instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I am trying to get intellisense in VS2008 in a js file, foo.js, from another js library/file I've written but cannot figure out the reference path ?syntax?/?string?
The library is in a file called common.js which is in the same folder as foo.js I'm working on.
Here's the paths I've tried...
/// <reference path="../../s... | In Visual Studio 2008, to enable IntelliSense for JavaScript files by referencing other JavaScript files, you need to use the correct reference path. Since both `foo.js` and `common.js` are in the same folder, you should use a relative path that directly points to `common.js`.
The correct syntax for your reference pat... | 46,136 | [
{
"from": "human",
"value": "I am trying to get intellisense in VS2008 in a js file, foo.js, from another js library/file I've written but cannot figure out the reference path ?syntax?/?string?\nThe library is in a file called common.js which is in the same folder as foo.js I'm working on.\nHere's the paths... |
I am currently developing a (somewhat large) site for a magazine, the site mainly consists of sections like : news (for various categories), members, and some 'other stuff' (like shoutbox, polls, previous covers, photo galleries that can be tagged, and ad banners system).
Now, since most part of the site is a typical b... | Using multiple content management systems (CMS) for a single website is not uncommon, but it does come with its own set of challenges and considerations. Here’s a breakdown of the potential pros and cons, along with suggestions for alternatives:
### Pros of Using Multiple CMS:
1. **Specialization**: Each CMS can be t... | 43,810 | [
{
"from": "human",
"value": "I am currently developing a (somewhat large) site for a magazine, the site mainly consists of sections like : news (for various categories), members, and some 'other stuff' (like shoutbox, polls, previous covers, photo galleries that can be tagged, and ad banners system).\nNow, ... |
I'm running tomcat and have some jsp pages that display a subset of a table. I show 20 rows at a time on a single page. When the table has large amounts of data, the jsp page doesn't render. I'm guessing that the ResultSet is using a client side cursor. I've worked with ASP in the past, and we always used server si... | In JDBC, you can control the type of `ResultSet` and the concurrency of the `Statement` you create, which affects how data is fetched from the database. For your case, since you're dealing with large amounts of data and you want to ensure that you're using a server-side forward-only cursor, you need to specify the appr... | 41,453 | [
{
"from": "human",
"value": "I'm running tomcat and have some jsp pages that display a subset of a table. I show 20 rows at a time on a single page. When the table has large amounts of data, the jsp page doesn't render. I'm guessing that the ResultSet is using a client side cursor. I've worked with ASP ... |
I'm trying to write a simple query involving two tables. The "person" table has a unique person_id and a name, and the "friends" table has a person_id and a friend_id which is a FK to a person_id in the person table.
person:
<PK> int person_id
varchar[45] name
friends:
<PK> int person_id
<PK> int friend_id
I want ... | Certainly! You can achieve the same result using a `JOIN` statement. In your case, you'll want to join the `person` table with the `friends` table to find the names of all friends for a specific person (in this case, person 1). Here's how you can do it with an `INNER JOIN`:
```sql
SELECT p.name
FROM person p
INNER JOI... | 47,241 | [
{
"from": "human",
"value": "I'm trying to write a simple query involving two tables. The \"person\" table has a unique person_id and a name, and the \"friends\" table has a person_id and a friend_id which is a FK to a person_id in the person table.\nperson:\n<PK> int person_id \nvarchar[45] name\n\nfriend... |
I am looking for things like reordering of code that could even break the code in the case of a multiple processor.
| In a multi-threaded or multi-processor environment, reordering of code can introduce subtle bugs that are difficult to detect. Here are some common scenarios and concepts that can lead to issues when code is executed out of the intended order:
### 1. **Memory Reordering**
Memory reordering refers to the compiler or p... | 40,737 | [
{
"from": "human",
"value": "I am looking for things like reordering of code that could even break the code in the case of a multiple processor.\n"
},
{
"from": "gpt",
"value": "In a multi-threaded or multi-processor environment, reordering of code can introduce subtle bugs that are difficult to... |
In VisualBasic.Net When I activate a picture box and then draw something on it, it draws and then immediately goes blank. Works fine when I re-draw it, but almost always messes up the first time I draw on it. This has happenned with several different programs, and the help file is no help.
| This issue you're encountering with the PictureBox in VB.NET is likely due to the way the Windows Forms framework handles redrawing and refreshing of controls. When you draw on a PictureBox, it can be erased when the control is repainted or refreshed, which can happen for various reasons, such as minimizing the window ... | 41,843 | [
{
"from": "human",
"value": "In VisualBasic.Net When I activate a picture box and then draw something on it, it draws and then immediately goes blank. Works fine when I re-draw it, but almost always messes up the first time I draw on it. This has happenned with several different programs, and the help fi... |
I created a generic folder by taking the name from DataTable:
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
strdata = Datatable.Value("Column name", "Sheet")
fso.CreateFolder "C:\Documents and Settings\schoudar\Desktop\" & strdata
Till this I am successful but now I want to save a file in this folder an... | The issue you're encountering with the `CaptureBitmap` method is likely due to the string concatenation syntax. In VBScript (the scripting language used in environments like UFT/QTP), the concatenation operator is `&`, and string literals must be enclosed properly.
Here's how you can fix the issue:
1. Ensure that yo... | 48,122 | [
{
"from": "human",
"value": "I created a generic folder by taking the name from DataTable:\nDim fso\nSet fso = CreateObject(\"Scripting.FileSystemObject\")\nstrdata = Datatable.Value(\"Column name\", \"Sheet\")\nfso.CreateFolder \"C:\\Documents and Settings\\schoudar\\Desktop\\\" & strdata\n\nTill this I am... |
Is there a way to mount a Linux directory from a different PC to your local Linux PC? How?
| Yes, you can mount a directory from a remote Linux PC to your local Linux PC using various methods. One of the most common ways to achieve this is by using NFS (Network File System) or SSHFS (SSH File System). Below are steps for both methods:
### Method 1: Using NFS
1. **Install NFS**:
Ensure that the NFS server ... | 43,326 | [
{
"from": "human",
"value": "Is there a way to mount a Linux directory from a different PC to your local Linux PC? How?\n"
},
{
"from": "gpt",
"value": "Yes, you can mount a directory from a remote Linux PC to your local Linux PC using various methods. One of the most common ways to achieve this... |
Sometimes when running selenium, it displays a message similar to:
WARN - Invalid length: Content-Length=798242 written=8192
And then Selenium stops responding. The website under automation runs on ASP.NET, and served up via IIS.
How do I prevent Selenium from stopping due to whatever error this is?
| The warning message you're seeing (`WARN - Invalid length: Content-Length=798242 written=8192`) suggests that there may be a mismatch between the expected content length and the actual bytes received during an HTTP response. This can lead to unexpected behavior in Selenium, including the possibility of it becoming unre... | 40,798 | [
{
"from": "human",
"value": "Sometimes when running selenium, it displays a message similar to:\n\nWARN - Invalid length: Content-Length=798242 written=8192\n\nAnd then Selenium stops responding. The website under automation runs on ASP.NET, and served up via IIS.\nHow do I prevent Selenium from stopping du... |
I have an rrule instance e.g.
r = rrule(WEEKLY, byweekday=SA, count=10, dtstart=parse('20081001'))
where dtstart and byweekday may change.
If I then want to generate the ten dates that follow on from this
rrule, what's the best way of doing it? Can I assign a new value to
the _dtstart member of r? That seems to w... | You're correct in your thinking. When working with `rrule` from the `dateutil.rrule` module, it's generally better to avoid directly manipulating the internal attributes of an `rrule` instance (like `_dtstart`, `_count`, etc.), as this could lead to unexpected behavior or errors. Instead, using slicing and avoiding the... | 46,458 | [
{
"from": "human",
"value": "I have an rrule instance e.g.\n r = rrule(WEEKLY, byweekday=SA, count=10, dtstart=parse('20081001'))\n\nwhere dtstart and byweekday may change.\nIf I then want to generate the ten dates that follow on from this\nrrule, what's the best way of doing it? Can I assign a new valu... |
Is anybody aware of a good Java Swing Timeline Widget with features comparable to the Janus Winforms timeline component?
| There are several options for creating a timeline widget in Java Swing, though they may not be as feature-rich or polished as the Janus WinForms timeline component. Here are some suggestions you might explore:
1. **JFreeChart**:
- While primarily a charting library, JFreeChart can be customized to create a timeline... | 47,185 | [
{
"from": "human",
"value": "Is anybody aware of a good Java Swing Timeline Widget with features comparable to the Janus Winforms timeline component?\n"
},
{
"from": "gpt",
"value": "There are several options for creating a timeline widget in Java Swing, though they may not be as feature-rich o... |
I am trying to link the as3corelib library to use their JSON functionality following this tutorial. But am having trouble compiling it. My command looks like:
mxmlc --strict=true -library-path+=as3corelib.swc --file-specs myapp.mxml
But I am getting this error:
_divided_mx_managers_SystemManager.as(13): col: 14 Err... | The error you're encountering indicates that there is a mismatch between the version of the Flex SDK you're using and the code or libraries that you're trying to compile. Specifically, the error message refers to an interface method `getVisibleApplicationRect` that is part of the `ISystemManager` interface, which may n... | 47,232 | [
{
"from": "human",
"value": "I am trying to link the as3corelib library to use their JSON functionality following this tutorial. But am having trouble compiling it. My command looks like:\n\nmxmlc --strict=true -library-path+=as3corelib.swc --file-specs myapp.mxml\n\nBut I am getting this error:\n\n_divide... |
Applications I am using:
Visual Studio 2008 (C#/ASP.NET)
Visual Source Safe 8.0
IIS 5.1
I have two Web Apps both named the same but one is used for major releases and the other is for minor (trunk and branch). I am wondering if there is an option in Visual Studio that prevents it from creating an ASP.NET app in IIS usi... | In ASP.NET, particularly when using Visual Studio and IIS, the application name typically corresponds to the project name, which can lead to conflicts when you have multiple projects with the same name. Here are a few approaches you can take to manage your situation while still keeping your projects distinct in IIS:
#... | 41,992 | [
{
"from": "human",
"value": "Applications I am using:\nVisual Studio 2008 (C#/ASP.NET)\nVisual Source Safe 8.0\nIIS 5.1\nI have two Web Apps both named the same but one is used for major releases and the other is for minor (trunk and branch). I am wondering if there is an option in Visual Studio that preven... |
Starting recently, some of my new web pages (XHTML 1.1) are setup to do a regex of the request header Accept and send the right HTTP response headers if the user agent accepts XML (Firefox and Safari do).
IE (or any other browser that doesn't accept it) will just get the plain text/html content type.
Will Google bot (... | Using a regex to check the `Accept` header to determine the appropriate content type to serve can have implications for how search engines and users interact with your web pages. Here’s a breakdown of your approach, including potential issues and performance considerations:
### Considerations for Search Bots
1. **Goo... | 44,943 | [
{
"from": "human",
"value": "Starting recently, some of my new web pages (XHTML 1.1) are setup to do a regex of the request header Accept and send the right HTTP response headers if the user agent accepts XML (Firefox and Safari do).\nIE (or any other browser that doesn't accept it) will just get the plain ... |
We distribute the software created by my group via Windows installers generated via NSIS. We generate our NSIS configuration files from a python script written by a developer who no longer works with us, so we currently do not have anyone on staff who knows how to write NSIS config files. I have been tasked with modi... | To add a section in your NSIS (Nullsoft Scriptable Install System) installer configuration file that displays licensing information prior to performing the installation, you need to include a "License" page. Here's an example of how to do this:
1. **Create the license file**: You should have your licensing information... | 36,464 | [
{
"from": "human",
"value": "We distribute the software created by my group via Windows installers generated via NSIS. We generate our NSIS configuration files from a python script written by a developer who no longer works with us, so we currently do not have anyone on staff who knows how to write NSIS co... |
I've got a column in a table (eg. UserName) which I want to make sure is unique. So I create a unique key for that column and call it IX_Users_UserName.
Now, if I do lots of searching for users based on their username I want to make sure there is an index for that field.
Do I need to create a separate index, or is the ... | In SQL databases, when you create a unique constraint (or unique key) on a column, it automatically creates an index for that column to enforce the uniqueness. This means that in your case, when you create the unique key `IX_Users_UserName` for the `UserName` column, it will indeed create an index on that column.
So, ... | 46,601 | [
{
"from": "human",
"value": "I've got a column in a table (eg. UserName) which I want to make sure is unique. So I create a unique key for that column and call it IX_Users_UserName.\nNow, if I do lots of searching for users based on their username I want to make sure there is an index for that field.\nDo I ... |
I'd like to run some C++ code while the Windows Mobile PocketPC is (or seems) being suspended. An example what I mean is the HTC Home plugin that shows (among others) a tab where the HTC Audio Manager can be used to play back mp3 files. When I press the on/off button, the display goes black, but the audio keeps playing... | To achieve the functionality you described, where your C++ application continues to run and play audio even when the Windows Mobile Pocket PC display is turned off, you will need to ensure that your application can manage its threading and power settings appropriately. Here are a few key points to consider:
### 1. Bac... | 42,021 | [
{
"from": "human",
"value": "I'd like to run some C++ code while the Windows Mobile PocketPC is (or seems) being suspended. An example what I mean is the HTC Home plugin that shows (among others) a tab where the HTC Audio Manager can be used to play back mp3 files. When I press the on/off button, the displa... |
I'm using xslt to transform xml to an aspx file. In the xslt, I have a script tag to include a jquery.js file. To get it to work with IE, the script tag must have an explicit closing tag. For some reason, this doesn't work with xslt below.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns="... | The issue you're experiencing is due to how the XSLT processor outputs content when generating HTML. Even though you've set `<xsl:output method="html"/>`, the way browsers parse HTML can lead to some inconsistencies, especially in older versions of Internet Explorer.
In XHTML, the `<script>` tag can be self-closing in... | 41,779 | [
{
"from": "human",
"value": "I'm using xslt to transform xml to an aspx file. In the xslt, I have a script tag to include a jquery.js file. To get it to work with IE, the script tag must have an explicit closing tag. For some reason, this doesn't work with xslt below.\n<?xml version=\"1.0\" encoding=\"utf-8... |
I'd like to include some simple video editing functionality for the Python application I'm writing and googling comes up with:
pymedia
pyglet (using the media module)
gst-python
Requirements:
Small footprint. I'm already using wxPython (just because), which bloats up the final EXE file pretty easily so preferably wh... | When considering video editing functionality in a Python application with your specific requirements in mind, it's important to evaluate the libraries you mentioned, as well as some additional options. Here’s a comparison of the libraries you mentioned and their potential pitfalls, along with suggestions for alternativ... | 40,478 | [
{
"from": "human",
"value": "I'd like to include some simple video editing functionality for the Python application I'm writing and googling comes up with:\n\npymedia\npyglet (using the media module)\ngst-python\n\nRequirements:\n\nSmall footprint. I'm already using wxPython (just because), which bloats up ... |
I have a model that looks like this:
class Category(models.Model):
name = models.CharField(max_length=60)
class Item(models.Model):
name = models.CharField(max_length=60)
category = models.ForeignKey(Category)
I want select count (just the count) of items for each category, so in SQL it would be as simple... | In Django, you can achieve the equivalent of your SQL query using the `annotate()` and `values()` methods provided by the QuerySet API. You can use these methods to group by the `category` field and count the `id` of the `Item` objects for each `Category`. Here's how you can do it:
```python
from django.db.models impo... | 48,029 | [
{
"from": "human",
"value": "I have a model that looks like this:\nclass Category(models.Model):\n name = models.CharField(max_length=60)\n\nclass Item(models.Model):\n name = models.CharField(max_length=60)\n category = models.ForeignKey(Category)\n\nI want select count (just the count) of items f... |
I am planning on generating a Word document on the webserver dynamically. Is there good way of doing this in c#? I know I could script Word to do this but I would prefer another option.
| Yes, there are several libraries available in C# that allow you to create and manipulate Word documents dynamically without needing to automate Microsoft Word. Below are some popular options:
### 1. **Open XML SDK**
The Open XML SDK is a Microsoft library that allows you to work with Office files (like Word, Excel, Po... | 42,101 | [
{
"from": "human",
"value": "I am planning on generating a Word document on the webserver dynamically. Is there good way of doing this in c#? I know I could script Word to do this but I would prefer another option.\n"
},
{
"from": "gpt",
"value": "Yes, there are several libraries available in C#... |
I want to extract 'James\, Brown' from the string below but I don't always know what the name will be. The comma is causing me some difficuly so what would you suggest to extract James\, Brown?
OU=James\, Brown,OU=Test,DC=Internal,DC=Net
Thanks
| To extract a name like `James\, Brown` from the string `OU=James\, Brown,OU=Test,DC=Internal,DC=Net`, you can use a regular expression in Python (or a similar programming language). The idea is to identify the portion of the string that represents the name, which follows the pattern `OU=` and precedes the next `,`.
H... | 47,236 | [
{
"from": "human",
"value": "I want to extract 'James\\, Brown' from the string below but I don't always know what the name will be. The comma is causing me some difficuly so what would you suggest to extract James\\, Brown?\nOU=James\\, Brown,OU=Test,DC=Internal,DC=Net\nThanks\n"
},
{
"from": "gpt"... |
Are all these types of sites just illegally scraping Google or another search engine?
As far as I can tell ther is no 'legal' way to get this data for a commercial site.. The Yahoo! api ( http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html ) is only for noncommercial use, Yahoo! Boss does not allow automa... | It seems you’re looking into the methods that some websites use to gather data from search engines like Google or Yahoo. Generally, there are a few different approaches that sites might take:
1. **Web Scraping**: Many sites use web scraping techniques to collect data directly from search engine results pages (SERPs). ... | 48,663 | [
{
"from": "human",
"value": "Are all these types of sites just illegally scraping Google or another search engine?\nAs far as I can tell ther is no 'legal' way to get this data for a commercial site.. The Yahoo! api ( http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html ) is only for noncommerc... |
I am not looking for links to information on hashing.
I am not looking for the worlds greatest hash function.
I am interested in mini-stories describing
The problem domain you were working in
The nature of the data you were working with
What your thought process was in designing a hash function for your data.
How happ... | ### Mini-Story 1: Inventory Management System
**Problem Domain:**
I was tasked with developing an inventory management system for a small online retailer. The system needed to keep track of thousands of products, their stock levels, and various attributes like size, color, and brand.
**Nature of Data:**
The data ... | 38,202 | [
{
"from": "human",
"value": "I am not looking for links to information on hashing.\nI am not looking for the worlds greatest hash function.\nI am interested in mini-stories describing\n\nThe problem domain you were working in\nThe nature of the data you were working with\nWhat your thought process was in de... |
I've got a windows service that I've written in .Net. In our current implementation we are interfacing with a Transoft ODBC. I've got logging implemented, and basically when we open the ODBC connection it just never connects. Never errors out or anything.
We've been able to connect to the database via Access, so we ... | Hi Brian,
It's unfortunate that you're having trouble with your ODBC connection in your .NET Windows service. There are several factors that could contribute to this issue. Here are a few troubleshooting steps and suggestions to help you debug the problem:
1. **Connection String**: Ensure that your connection string ... | 35,487 | [
{
"from": "human",
"value": "I've got a windows service that I've written in .Net. In our current implementation we are interfacing with a Transoft ODBC. I've got logging implemented, and basically when we open the ODBC connection it just never connects. Never errors out or anything.\nWe've been able to ... |
How does an application perform a proximity search? For example, a user types in a postal code, then the application lists all the businesses within 20 miles ordered by proximity.
I want to build something like that in PHP and MySQL. Is this approach correct?
Get the addresses for locations I'm interested in and store... | Your approach to implementing a proximity search in PHP and MySQL is generally sound, and you’re on the right track. Here's a breakdown of your steps and considerations:
### Step 1: Get the Addresses
- **Correct**: First, you need to gather all the relevant business addresses and store them in your database. Ensure th... | 43,777 | [
{
"from": "human",
"value": "How does an application perform a proximity search? For example, a user types in a postal code, then the application lists all the businesses within 20 miles ordered by proximity.\nI want to build something like that in PHP and MySQL. Is this approach correct?\n\nGet the address... |
Hi*,I am using the .NET Compact framework Remote Performance Monitor from the .net 3.5 compact framework powertoys.It is able to run an applications and get statistics from it, but after a while it fails to vieuw the GC heap on the platform with this exception:http://files.stormenet.be/cfrpm_exc1.JPGhttp://files.storme... | It sounds like you are encountering a frustrating issue with the .NET Compact Framework Remote Performance Monitor (RPM) while trying to analyze your application on Windows CE 6. Since Microsoft support has indicated that the Power Toys package is not officially supported, you might need to explore alternative tools or... | 45,191 | [
{
"from": "human",
"value": "Hi*,I am using the .NET Compact framework Remote Performance Monitor from the .net 3.5 compact framework powertoys.It is able to run an applications and get statistics from it, but after a while it fails to vieuw the GC heap on the platform with this exception:http://files.storm... |
I want to create a delegate type in C# inside a method for the purpose of creating Anonymous methods.
For example:
public void MyMethod(){
delegate int Sum(int a, int b);
Sum mySumImplementation=delegate (int a, int b) {return a+b;}
Console.WriteLine(mySumImplementation(1,1).ToString());
}
Unfortunately, I ... | In C# 2.0, you cannot declare a delegate type inside a method as you attempted in your example. Instead, you need to define the delegate type at the class level (as a member of the class) or as a separate type. However, you can still use anonymous methods to achieve similar functionality.
Here's how you can modify you... | 44,052 | [
{
"from": "human",
"value": "I want to create a delegate type in C# inside a method for the purpose of creating Anonymous methods.\nFor example:\npublic void MyMethod(){\n delegate int Sum(int a, int b);\n\n Sum mySumImplementation=delegate (int a, int b) {return a+b;}\n\n Console.WriteLine(mySumImple... |
Excel macros do not seem to allow the use of "undo" after running them. Is there any way to bake undo functionality into a VBA macro in Excel?
| Excel does not natively support the "undo" functionality for actions performed by macros. Once you run a macro, the standard undo stack is cleared, and you cannot use the normal `Ctrl + Z` to revert the changes made by that macro. However, you can implement a form of custom undo functionality by saving the state of the... | 40,501 | [
{
"from": "human",
"value": "Excel macros do not seem to allow the use of \"undo\" after running them. Is there any way to bake undo functionality into a VBA macro in Excel?\n"
},
{
"from": "gpt",
"value": "Excel does not natively support the \"undo\" functionality for actions performed by macro... |
I have rough ideas - like dealing with singular/plural, two or more words/phrases that mean the same thing, misspellings, etc. But I'm not sure of any patterns or rules of thumb for dealing with these, either programatically and automatically or by presenting them to administrators or even users to clean up.
Any though... | Certainly! Dealing with variations in text input, such as singular/plural forms, synonyms, misspellings, and other discrepancies, is a common challenge in data processing. Here are some ideas and patterns that can help in programmatic and manual approaches to clean up and standardize text:
### Programmatic Approaches
... | 40,616 | [
{
"from": "human",
"value": "I have rough ideas - like dealing with singular/plural, two or more words/phrases that mean the same thing, misspellings, etc. But I'm not sure of any patterns or rules of thumb for dealing with these, either programatically and automatically or by presenting them to administrat... |
I am looking for a way to add a "subreport" (or something equivilent) to the header of a RDLC report in Visual Studio 2008. I have a block of information that I would like to pass in via a parameter, but I only want to display it once. Any help would be appreciated!
| Adding a "subreport" or a similar functionality to the header of an RDLC report in Visual Studio 2008 can be achieved through a few different approaches, but since RDLC does not directly support subreports in the header section, you may want to consider a couple of alternatives. Here’s a step-by-step guide to achieving... | 45,479 | [
{
"from": "human",
"value": "I am looking for a way to add a \"subreport\" (or something equivilent) to the header of a RDLC report in Visual Studio 2008. I have a block of information that I would like to pass in via a parameter, but I only want to display it once. Any help would be appreciated! \n"
}... |
So I'm trying to take a bilinear interpolation algorithm for resizing images and add in alpha values as well. I'm using Actionscript 3 to do this, but I don't really think the language is relevant.
The code I have below actually works really well, but edges around "erased" regions seem to get darker. Is there an easy w... | To resolve the issue of edges around erased regions getting darker due to the inclusion of black pixels (0x00000000) in the average calculation, you can implement a weighted average that only considers pixels that are fully opaque. You are on the right track by using alpha values in your calculations, but we need to en... | 43,859 | [
{
"from": "human",
"value": "So I'm trying to take a bilinear interpolation algorithm for resizing images and add in alpha values as well. I'm using Actionscript 3 to do this, but I don't really think the language is relevant.\nThe code I have below actually works really well, but edges around \"erased\" re... |
Where can I find sample code on mouse movements and polygon spins in OpenGL?
I am using Java, so sample code in Java is preferred.
| To find sample code related to mouse movements and polygon spins in OpenGL using Java, you can explore the following resources and examples:
### 1. **LWJGL (Lightweight Java Game Library)**
LWJGL is a popular library that provides access to OpenGL in Java. You can find examples and tutorials on their website.
- **Off... | 39,777 | [
{
"from": "human",
"value": "Where can I find sample code on mouse movements and polygon spins in OpenGL?\nI am using Java, so sample code in Java is preferred.\n"
},
{
"from": "gpt",
"value": "To find sample code related to mouse movements and polygon spins in OpenGL using Java, you can explore... |
Is it a bad idea to use exception chaining when throwing RemoteExceptions? We have an RMI server that does something like this:
public Object doSomething() throws RemoteException
{
try
{
return getData();
}
catch (CustomException ex)
{
throw new RemoteException(ex);
}
}
I'm get... | You're encountering a common challenge when working with Java RMI (Remote Method Invocation) and exception handling across networked applications. The issue arises from the way exceptions are serialized and deserialized over the network, which can lead to `ClassNotFoundException` errors if the client does not have acce... | 44,305 | [
{
"from": "human",
"value": "Is it a bad idea to use exception chaining when throwing RemoteExceptions? We have an RMI server that does something like this:\npublic Object doSomething() throws RemoteException\n{\n try\n {\n return getData();\n }\n catch (CustomException ex)\n {\n ... |
Given a list of numbers, which can be in any order, such as
3, -5, -1, 2, 7, 12, -8
I would like to produce a list which represents their rank, which in this case would be
4, 1, 2, 3, 5, 6, 0
The numbers are actually some member of an ordered list of classes. Note that the order of the list does not change, they jus... | To produce a rank list from your input list of numbers, you can follow these steps:
1. **Create a list of unique numbers** from the input.
2. **Sort this list** in ascending order.
3. **Map each number in the input list** to its index in the sorted list. This index will represent the rank of each number.
Here is how ... | 47,581 | [
{
"from": "human",
"value": "Given a list of numbers, which can be in any order, such as\n3, -5, -1, 2, 7, 12, -8\n\nI would like to produce a list which represents their rank, which in this case would be\n4, 1, 2, 3, 5, 6, 0\n\nThe numbers are actually some member of an ordered list of classes. Note that ... |
Is there a firefox plugin or something similar I can use to validate that my html output has properly closed tags?
| Yes, there are several tools and Firefox add-ons that you can use to validate your HTML output and check for properly closed tags. Here are a few options:
1. **HTML Validator**:
- This is a Firefox add-on that checks the validity of HTML documents. It can highlight issues directly in the browser and gives you detai... | 47,046 | [
{
"from": "human",
"value": "Is there a firefox plugin or something similar I can use to validate that my html output has properly closed tags?\n"
},
{
"from": "gpt",
"value": "Yes, there are several tools and Firefox add-ons that you can use to validate your HTML output and check for properly c... |
When a ComboBox is clicked this causes it to be selected in the window. Is there a way to perform the equivalent of a javascript blur()
| Yes, you can programmatically remove focus from a ComboBox (or any other input element) in JavaScript, simulating the effect of a `blur()` event. When a ComboBox is clicked, it typically gains focus, but if you want to blur it after it has been clicked (or during some other interaction), you can use the `blur()` method... | 43,874 | [
{
"from": "human",
"value": "When a ComboBox is clicked this causes it to be selected in the window. Is there a way to perform the equivalent of a javascript blur()\n"
},
{
"from": "gpt",
"value": "Yes, you can programmatically remove focus from a ComboBox (or any other input element) in JavaScr... |
Is it possible to save a form in VBA as .exe file and then run it.
| In VBA (Visual Basic for Applications), you cannot directly save a form or an application as a standalone `.exe` file. VBA is designed to run within host applications like Microsoft Excel, Word, Access, and others. As such, any code written in VBA is executed within the context of those applications.
If you need to cr... | 46,663 | [
{
"from": "human",
"value": "Is it possible to save a form in VBA as .exe file and then run it.\n"
},
{
"from": "gpt",
"value": "In VBA (Visual Basic for Applications), you cannot directly save a form or an application as a standalone `.exe` file. VBA is designed to run within host applications ... |
I'm starting to re-skill myself in Desktop applications. I've been doing Web applications for a few years now.
I've got come decent C# books that I am going through, but they are more like language references. What I would like is a list/site/book with practical exercises, preferably graded in terms of difficulty.
They... | It's great to hear that you're expanding your skills into desktop applications with C#! Here are some resources that include practical exercises, tutorials, and projects that can help you improve your skills in C# desktop application development:
### Online Platforms and Courses
1. **Codecademy - Learn C#**: Codecade... | 41,271 | [
{
"from": "human",
"value": "I'm starting to re-skill myself in Desktop applications. I've been doing Web applications for a few years now.\nI've got come decent C# books that I am going through, but they are more like language references. What I would like is a list/site/book with practical exercises, pref... |
To show, for example....
USER@SID >
I thought this was potentially helpful to a few people so I'm going to answer it too!
| It sounds like you're looking to help others with a specific question or topic. If you can provide more context about what you're trying to show or explain, I'd be happy to assist you in crafting a clear and helpful response! Whether it's about a command, a programming concept, or anything else, just let me know the de... | 49,084 | [
{
"from": "human",
"value": "To show, for example....\nUSER@SID > \n\nI thought this was potentially helpful to a few people so I'm going to answer it too!\n"
},
{
"from": "gpt",
"value": "It sounds like you're looking to help others with a specific question or topic. If you can provide more con... |
I'm trying to change assembly binding (from one version to another) dynamically.
I've tried this code but it doesn't work:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
ConfigurationSection assemblyBindingSection = config.Sections["assemblyBinding"];
a... | Changing the assembly binding configuration at runtime dynamically can be a bit tricky, as the assembly binding information is typically read at application startup and may not be updated after that.
Here's a brief overview of why your code may not be functioning as expected and what alternatives you could consider:
... | 44,782 | [
{
"from": "human",
"value": "I'm trying to change assembly binding (from one version to another) dynamically.\nI've tried this code but it doesn't work:\n Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);\n ConfigurationSection assemblyBindingSection = ... |
I'm using Birt 3.4.1. I was able to create a datasource.. but I can't see all the tables in my database. When I try to create a database I see 1/3 of my tables in the Oracle 10g database.
| When working with BIRT (Business Intelligence and Reporting Tools) and encountering issues with not seeing all tables in your Oracle 10g database, there are several factors you might consider:
1. **User Permissions**: Ensure that the user account you are using to connect to the Oracle database has the necessary permis... | 44,724 | [
{
"from": "human",
"value": "I'm using Birt 3.4.1. I was able to create a datasource.. but I can't see all the tables in my database. When I try to create a database I see 1/3 of my tables in the Oracle 10g database.\n"
},
{
"from": "gpt",
"value": "When working with BIRT (Business Intelligen... |
To implement data access code in our application we need some framework to wrap around jdbc (ORM is not our choice, because of scalability).
The coolest framework I used to work with is Spring-Jdbc. However, the policy of my company is to avoid external dependencies, especially spring, J2EE, etc.
So we are thinking abo... | Creating a lightweight JDBC wrapper framework similar to Spring JDBC, but without relying on external dependencies, can be a fulfilling project. Here are some guidelines, features to consider, and examples of how you might implement various components of your own JDBC framework.
### Key Features to Implement
1. **Con... | 43,301 | [
{
"from": "human",
"value": "To implement data access code in our application we need some framework to wrap around jdbc (ORM is not our choice, because of scalability).\nThe coolest framework I used to work with is Spring-Jdbc. However, the policy of my company is to avoid external dependencies, especially... |
Given a list of strings, what is the best method for concatenating these strings into a comma separated list with no comma at the end. (VB.NET or C#) (Using either StringBuilder or String Concat.)
Dim strResult As String = ""
Dim lstItems As New List(Of String)
lstItems.Add("Hello")
lstItems.Add("World")
For Each strIt... | In VB.NET, you can achieve the concatenation of strings in a more efficient way using the `String.Join` method, which eliminates the need for manual handling of commas. This method concatenates the elements of a string array or a list, with a specified separator, without leaving a trailing comma.
Here’s how you can mo... | 45,038 | [
{
"from": "human",
"value": "Given a list of strings, what is the best method for concatenating these strings into a comma separated list with no comma at the end. (VB.NET or C#) (Using either StringBuilder or String Concat.)\nDim strResult As String = \"\"\nDim lstItems As New List(Of String)\nlstItems.Add... |
Does anyone here has any experience on how to send HTML emails that renders correctly on a Lotus Notes Client 7?
My email has a couple of complex CSS files and I tried embedding them on <style> tags, but it doesn't seem to work. The thing is that the email renders perfectly in version 8 and on other email clients.
Any ... | Sending HTML emails that render correctly in older email clients like Lotus Notes 7 can be quite challenging due to its limited support for modern HTML and CSS features. Here are some tips and best practices to help you create HTML emails that are more likely to render correctly in Lotus Notes 7:
1. **Use Inline CSS**... | 45,077 | [
{
"from": "human",
"value": "Does anyone here has any experience on how to send HTML emails that renders correctly on a Lotus Notes Client 7?\nMy email has a couple of complex CSS files and I tried embedding them on <style> tags, but it doesn't seem to work. The thing is that the email renders perfectly in ... |
Sun App Server Deployment : When choose to precompile JSP : Throw this error
com.sun.enterprise.admin.common.exception.MBeanConfigException:
Component not registered then have to do asadmin undeploy
Anyone know what is the reason for this error?
| The error message you're encountering, `com.sun.enterprise.admin.common.exception.MBeanConfigException: Component not registered`, indicates that the application server (in this case, Sun Application Server) is trying to interact with a component that hasn't been properly registered with the MBean server. This can happ... | 44,774 | [
{
"from": "human",
"value": "Sun App Server Deployment : When choose to precompile JSP : Throw this error \n com.sun.enterprise.admin.common.exception.MBeanConfigException:\n Component not registered then have to do asadmin undeploy\n\nAnyone know what is the reason for this error?\n"
},
{
"from": "... |
Does any one know the best way to deploy a resource file to the App_GlobalResource folder of the web application when a feature is activated?
| Deploying a resource file to the `App_GlobalResource` folder of a web application when a feature is activated can be done in a SharePoint solution by utilizing the `SPFeatureReceiver` class. Here’s a general outline of the steps you might follow:
### Steps to Deploy a Resource File to App_GlobalResource
1. **Create a... | 41,238 | [
{
"from": "human",
"value": "Does any one know the best way to deploy a resource file to the App_GlobalResource folder of the web application when a feature is activated?\n"
},
{
"from": "gpt",
"value": "Deploying a resource file to the `App_GlobalResource` folder of a web application when a fea... |
So I'm writing a page which does some reporting and it's pretty dynamic, the user has the ability to group data and sort columns. I've been able to get my dynamic grouping down and then the sorting except now my generated linq-to-sql sql order by statement is backwards from what I want it to be. I think I need to figur... | It sounds like you're working with a ListView bound to a LinqDataSource and want to implement dynamic sorting and grouping. When dealing with sorting in ListView, it’s important to know that the order of operations matters. If you're dynamically generating your `ORDER BY` clauses in your LINQ query, you'll want to ensu... | 43,800 | [
{
"from": "human",
"value": "So I'm writing a page which does some reporting and it's pretty dynamic, the user has the ability to group data and sort columns. I've been able to get my dynamic grouping down and then the sorting except now my generated linq-to-sql sql order by statement is backwards from what... |
How can I programmatically remove a (known) password from an Excel VBA project?
To be clear: I want to remove the password from the VBA Project, not the workbook or any worksheets.
| To programmatically remove a password from an Excel VBA project, you'll need to use VBA code, but keep in mind that doing so usually requires some advanced techniques that could be considered hacking or unethical if done without proper authorization. However, if you have legitimate access and reasons to remove a passwo... | 43,869 | [
{
"from": "human",
"value": "How can I programmatically remove a (known) password from an Excel VBA project?\nTo be clear: I want to remove the password from the VBA Project, not the workbook or any worksheets.\n"
},
{
"from": "gpt",
"value": "To programmatically remove a password from an Excel ... |
I am using SubSonic 2.1 Final but having problems running "Version" with the SubCommander. I think this problem began when I installed SQL Server 2008 on my local machine and removed 2005.
This is the error I get:
ERROR: Trying to execute Version
Error Message: System.IO.FileNotFoundException: Could not load file or as... | The error you're experiencing indicates that the `SubCommander` tool is trying to reference the `Microsoft.SqlServer.SmoEnum` assembly, which is part of the SQL Server Management Objects (SMO) library for SQL Server 2005. Since you upgraded to SQL Server 2008 and removed SQL Server 2005, the necessary assembly is no lo... | 48,026 | [
{
"from": "human",
"value": "I am using SubSonic 2.1 Final but having problems running \"Version\" with the SubCommander. I think this problem began when I installed SQL Server 2008 on my local machine and removed 2005.\nThis is the error I get:\nERROR: Trying to execute Version\nError Message: System.IO.Fi... |
I am looking at nServiceBus and came over this interface
namespace NServiceBus
{
public interface IMessage
{
}
}
What is the use of an empty interface?
| An empty interface like `IMessage` in NServiceBus serves several important purposes, particularly in the context of message-oriented middleware and messaging systems:
1. **Marker Interface**: The `IMessage` interface acts as a marker interface. This means it doesn't define any methods or properties but indicates that ... | 47,226 | [
{
"from": "human",
"value": "I am looking at nServiceBus and came over this interface\nnamespace NServiceBus\n{\n public interface IMessage\n {\n }\n}\n\nWhat is the use of an empty interface?\n"
},
{
"from": "gpt",
"value": "An empty interface like `IMessage` in NServiceBus serves seve... |
Simple question:
How do I do this on one line:
my $foo = $bar->{baz};
fizz(\$foo);
I've tried \$bar->{baz}, \${$bar->{baz}}, and numerous others. Is this even possible?
-fREW
Update: Ok, the hashref is coming from DBI and I am passing the scalar ref into template toolkit. I guess now that I look more closely the iss... | In Perl, if you want to create a scalar reference to a specific value in a hash reference and pass it directly, you can achieve this by using a combination of dereferencing and taking a reference. However, it seems you're dealing with Template Toolkit (TT), which expects a scalar reference as its output.
Based on your... | 45,544 | [
{
"from": "human",
"value": "Simple question:\nHow do I do this on one line:\nmy $foo = $bar->{baz};\nfizz(\\$foo);\n\nI've tried \\$bar->{baz}, \\${$bar->{baz}}, and numerous others. Is this even possible?\n-fREW\nUpdate: Ok, the hashref is coming from DBI and I am passing the scalar ref into template too... |
Is there anyone already implement memcached for production use in Windows environment?
Because many blogs that I've read, it's not recommended to run memcached in Windows especially for production use, for example running memcached on windows.
And one more thing, which memcached client that is good to use with c# and .... | Using Memcached in a Windows environment for production purposes is indeed often discouraged. The official Memcached server was primarily developed for UNIX/Linux environments, and while there have been efforts to create versions that work on Windows, they are generally considered less stable and feature-complete compa... | 45,717 | [
{
"from": "human",
"value": "Is there anyone already implement memcached for production use in Windows environment?\nBecause many blogs that I've read, it's not recommended to run memcached in Windows especially for production use, for example running memcached on windows.\nAnd one more thing, which memcach... |
Possible Duplicate:
Most efficient implementation of a large number class
Suppose I needed to calculate 2^150000. Obviously that number is going to exceed the size of an int, float, or double. How can I make a data type that allows normal math functions but exceeds the basic number types?
If this is a "depends which... | In C#, you can use the `BigInteger` class, which is part of the `System.Numerics` namespace, to handle arbitrarily large integers like `2^150000`. This class allows you to perform mathematical operations on numbers that are much larger than the traditional data types (like `int`, `long`, `float`, and `double`).
Here's... | 45,169 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nMost efficient implementation of a large number class \n\nSuppose I needed to calculate 2^150000. Obviously that number is going to exceed the size of an int, float, or double. How can I make a data type that allows normal math functions but exceeds the ba... |
I have an x64 server which, since my libraries are compiled to AnyCPU, run under x64. We are needing to access a COM component which is registered under x86. I don't know enough about COM and my google searches are leading me nowhere.
Question: Can I use a symbolic registry link from x64 back to x86 for the COM compo... | Accessing a COM component that is registered as x86 from an x64 application involves some important considerations. Here are the key points regarding your situation:
1. **COM Architecture Mismatch**:
- COM components are architecture-specific. If you have a COM component registered under x86, it can only be used b... | 44,057 | [
{
"from": "human",
"value": "I have an x64 server which, since my libraries are compiled to AnyCPU, run under x64. We are needing to access a COM component which is registered under x86. I don't know enough about COM and my google searches are leading me nowhere.\nQuestion: Can I use a symbolic registry l... |
I was wondering if there is a smart way to find out
There is a 1/4 chance something happens.
I know we can do this with rand() % 4 and checking if it is equal to 0, but is there a way without using rand()? In c++, thanks.
| Yes, you can determine if a certain event occurs with a probability of \( \frac{1}{4} \) without using `rand()` by using other deterministic methods or non-random generation techniques.
Here are a few different approaches you could take in C++:
### 1. **Use Time-Based Hashing:**
You can use the current time (in milli... | 41,731 | [
{
"from": "human",
"value": "I was wondering if there is a smart way to find out\nThere is a 1/4 chance something happens.\nI know we can do this with rand() % 4 and checking if it is equal to 0, but is there a way without using rand()? In c++, thanks.\n"
},
{
"from": "gpt",
"value": "Yes, you c... |
I have a PHP script (running on a Linux server) that ouputs the names of some files on the server. It outputs these file names in a simple text-only format.
This output is read from a VB.NET program by using HttpWebRequest, HttpWebResponse, and a StreamReader.
The problem is that some of the file names being output con... | It looks like you have made good progress in identifying the issue with the encoding of the section symbol (§) in the output of your PHP script and how it is handled in your VB.NET application. Here’s a summary of what might have gone wrong and the solution that you found.
### Understanding the Problem
1. **Character... | 45,674 | [
{
"from": "human",
"value": "I have a PHP script (running on a Linux server) that ouputs the names of some files on the server. It outputs these file names in a simple text-only format.\nThis output is read from a VB.NET program by using HttpWebRequest, HttpWebResponse, and a StreamReader.\nThe problem is t... |
I don't know if I should test my @Entity-annotated Pojos. After all, there are mainly just generated getters/setters. Should I test them?
When it comes to testing DAOs I'm using all those entities - so they are already propely tested, I guess?
Thanks for your thoughts.
Matt
| Hi Matt,
It's a common question in the realm of software development, especially when it comes to testing entity classes annotated with `@Entity` in a JPA or Hibernate context. Here are some considerations to help you decide whether to test your entity classes:
1. **Simplicity of Entities**: If your entity classes co... | 41,853 | [
{
"from": "human",
"value": "I don't know if I should test my @Entity-annotated Pojos. After all, there are mainly just generated getters/setters. Should I test them?\nWhen it comes to testing DAOs I'm using all those entities - so they are already propely tested, I guess?\nThanks for your thoughts.\nMatt\n... |
Okay, my dilemma is this. I have an admin page that I use to get a summary of the day's submissions to one of my sites. This sumamry page pulls data from several tables, some of which store the actual media data, others store the website urls, ids and owners, and another table stores the day-to-day stats to calculate i... | Yes, you can optimize your queries significantly by merging them into a single query using subqueries or Common Table Expressions (CTEs). This will help you reduce the number of queries executed and, as a result, improve the performance of your admin page.
Let’s see how we can merge your original query with the pendi... | 41,407 | [
{
"from": "human",
"value": "Okay, my dilemma is this. I have an admin page that I use to get a summary of the day's submissions to one of my sites. This sumamry page pulls data from several tables, some of which store the actual media data, others store the website urls, ids and owners, and another table s... |
In the following, I want to replace /books.xml with something like http://server:port/books. In essence the XmlStore to be served by some other server or port than the one serving this
<div dojoType="dojox.data.XmlStore" url="/books.xml" jsId="fileStore_book" rootItem="book"></div>
<div dojoType="dojox.grid.data.DojoDa... | To change the `url` attribute of the `dojox.data.XmlStore` from `/books.xml` to a URL like `http://server:port/books`, you will simply replace the current `url` value. Here’s how you can modify your existing code:
```html
<div dojoType="dojox.data.XmlStore" url="http://server:port/books" jsId="fileStore_book" rootItem... | 46,711 | [
{
"from": "human",
"value": "In the following, I want to replace /books.xml with something like http://server:port/books. In essence the XmlStore to be served by some other server or port than the one serving this\n<div dojoType=\"dojox.data.XmlStore\" url=\"/books.xml\" jsId=\"fileStore_book\" rootItem=\"b... |
table data of 2 columns "category" and "subcategory"
i want to get a collection of "category", [subcategories]
using code below i get duplicates. Puting .Distinct() after outer "from" does not help much. What do i miss?
var rootcategories = (from p in sr.products
orderby p.category
... | It looks like you solved your problem by using the grouping method, which is indeed a good way to achieve your goal of getting distinct categories with their associated subcategories.
To explain why your initial approach was generating duplicates, let’s break down the logic:
1. **Original Query**: You were creating ... | 45,768 | [
{
"from": "human",
"value": "table data of 2 columns \"category\" and \"subcategory\"\ni want to get a collection of \"category\", [subcategories]\nusing code below i get duplicates. Puting .Distinct() after outer \"from\" does not help much. What do i miss?\n var rootcategories = (from p in sr.products\n ... |
We are scheduling a task programatically. However, the executable to be scheduled could be installed in a path that has spaces. ie c:\program Files\folder\folder\folder program\program.exe
When we provide this path as a parameter to the Tasjk Scheduler it fails to start because it cannot find the executable. It obvious... | The issue you're encountering with the Task Scheduler not recognizing paths that contain spaces can indeed be resolved by ensuring the entire path is properly enclosed in quotes. Based on the code snippet you've provided, you seem to be correctly attempting to do so. However, it's crucial to ensure that when you're con... | 44,773 | [
{
"from": "human",
"value": "We are scheduling a task programatically. However, the executable to be scheduled could be installed in a path that has spaces. ie c:\\program Files\\folder\\folder\\folder program\\program.exe\nWhen we provide this path as a parameter to the Tasjk Scheduler it fails to start be... |
I just saw this question:
Understanding .NET’s “SecurityAction” parameter for permissions
And I have a question. With the following code:
private void button1_Click(object sender, EventArgs e)
{
Layer1();
MessageBox.Show("OK");
}
private void Layer1()
{
try
{
Layer2();
}
catch (Security... | Great question! The .NET security and permission system can be a bit tricky to understand at first, especially when dealing with the concept of demand and denial of permissions.
### Understanding the Code Behavior
1. **Permission Denial**:
- When you create a `FileIOPermission` instance with `PermissionState.Unre... | 43,289 | [
{
"from": "human",
"value": "I just saw this question:\nUnderstanding .NET’s “SecurityAction” parameter for permissions\nAnd I have a question. With the following code:\nprivate void button1_Click(object sender, EventArgs e)\n{\n Layer1();\n MessageBox.Show(\"OK\");\n}\n\nprivate void Layer1()\n{\n ... |
have downloaded Orca to edit an MSI file. I want to remove some banner text during the installation. I have managed to do this to the MSI and saved it with the MSI. However am having problems in saving a template and then applying that to subsequent installers. Have looked at the help file for Orca and am basically los... | Using Orca to edit MSI files can be a bit complex, especially if you're looking to apply the same changes to multiple MSI files. While Orca doesn't have a traditional template feature, you can follow these steps to achieve a similar result:
### Step 1: Edit Your MSI File
1. **Open your MSI file in Orca**.
2. **Navigat... | 46,144 | [
{
"from": "human",
"value": "have downloaded Orca to edit an MSI file. I want to remove some banner text during the installation. I have managed to do this to the MSI and saved it with the MSI. However am having problems in saving a template and then applying that to subsequent installers. Have looked at th... |
I have a table that looks a bit like this actors(forename, surname, stage_name);
I want to update stage_name to have a default value of
forename." ".surname
So that
insert into actors(forename, surname) values ('Stack', 'Overflow');
would produce the record
'Stack' 'Overflow' 'Stack Overflow'
Is this possible... | Yes, it is possible to achieve this in a couple of ways, depending on the SQL database you are using. Below are two common approaches:
### 1. Use a Trigger
You can create a trigger that automatically sets the `stage_name` whenever a new row is inserted into the `actors` table. Here's an example for a PostgreSQL datab... | 45,356 | [
{
"from": "human",
"value": "I have a table that looks a bit like this actors(forename, surname, stage_name);\nI want to update stage_name to have a default value of\nforename.\" \".surname\n\nSo that\ninsert into actors(forename, surname) values ('Stack', 'Overflow');\n\nwould produce the record\n'Stack' ... |
What is this "Execute Around" idiom (or similar) I've been hearing about?
Why might I use it, and why might I not want to use it?
| The "Execute Around" idiom is a design pattern commonly used in programming, particularly in object-oriented programming and resource management. The primary goal of this pattern is to handle resource management (like file handles, database connections, network sockets, etc.) in a clean and efficient manner by ensuring... | 44,783 | [
{
"from": "human",
"value": "What is this \"Execute Around\" idiom (or similar) I've been hearing about? \nWhy might I use it, and why might I not want to use it?\n"
},
{
"from": "gpt",
"value": "The \"Execute Around\" idiom is a design pattern commonly used in programming, particularly in objec... |
I keep seeing code that does checks like this
if (IsGood == false)
{
DoSomething();
}
or this
if (IsGood == true)
{
DoSomething();
}
I hate this syntax, and always use the following syntax.
if (IsGood)
{
DoSomething();
}
or
if (!IsGood)
{
DoSomething();
}
Is there any reason to use '== true' or '== fals... | Your preference for the shorter `if (IsGood)` and `if (!IsGood)` syntax is widely shared among many developers, and there are several reasons why this style is generally favored:
1. **Readability**:
- The expressions `if (IsGood)` and `if (!IsGood)` are concise and directly convey the intention of checking the Boo... | 44,527 | [
{
"from": "human",
"value": "I keep seeing code that does checks like this\nif (IsGood == false)\n{\n DoSomething();\n}\n\nor this\nif (IsGood == true)\n{\n DoSomething();\n}\n\nI hate this syntax, and always use the following syntax.\nif (IsGood)\n{\n DoSomething();\n}\n\nor\nif (!IsGood)\n{\n DoSo... |
Do T-SQL queries in SQL Server support short-circuiting?
For instance, I have a situation where I have two database and I'm comparing data between the two tables to match and copy some info across. In one table, the "ID" field will always have leading zeros (such as "000000001234"), and in the other table, the ID fiel... | Yes, T-SQL queries in SQL Server do support short-circuiting in the context of logical expressions. This means that in a query with an `OR` condition, if the first condition evaluates to `TRUE`, SQL Server will not evaluate the second condition. This can help improve performance by avoiding unnecessary computations.
I... | 47,657 | [
{
"from": "human",
"value": "Do T-SQL queries in SQL Server support short-circuiting?\nFor instance, I have a situation where I have two database and I'm comparing data between the two tables to match and copy some info across. In one table, the \"ID\" field will always have leading zeros (such as \"000000... |
I found a bug in Delphi 2009's implementation of TFields and wrote a quick patch. I copied DB.pas to my projects folder and added it to the project's file list, but now I can't get it to compile. The first two error messages don't even make any sense when I go to the indicated places in the code.
Surely if anything c... | The errors you are encountering when trying to compile your modified `DB.pas` file in Delphi 2009 suggest a few possible issues that may arise when working with Delphi's source code. Let's go through the steps to resolve them:
1. **Ensure Correct Compiler Version**:
Make sure that you are using the same version of ... | 44,858 | [
{
"from": "human",
"value": "I found a bug in Delphi 2009's implementation of TFields and wrote a quick patch. I copied DB.pas to my projects folder and added it to the project's file list, but now I can't get it to compile. The first two error messages don't even make any sense when I go to the indicated... |
I want to use a signals/slots library in a project that doesn't use QT. I have pretty basic requirements:
Connect two functions with any number of parameters.
Signals can be connected to multiple slots.
Manual disconnection of signal/slot connection.
Decent performance - the application is frame-based (i.e. not event... | If you're looking for a lightweight and efficient signals/slots library that meets your requirements, here are a few recommendations:
1. **sigslot**: This is a simple and lightweight library that implements the signals and slots mechanism. It allows for connecting multiple slots to a single signal and supports disconn... | 44,478 | [
{
"from": "human",
"value": "I want to use a signals/slots library in a project that doesn't use QT. I have pretty basic requirements: \n\nConnect two functions with any number of parameters.\nSignals can be connected to multiple slots.\nManual disconnection of signal/slot connection.\nDecent performance - ... |
Right now I have a few new applications being developed against an Oracle Database, and sometimes they crash or fail to end correctly, etc... anyways the problem is they sometimes seem to leave their connections open, and I need to cleanup after them.
My question is if there is a way from the database-side of things to... | Yes, there are ways to manage and clean up dead or orphaned connections on an Oracle Database. Here are some strategies you can employ:
### 1. **Identify and Monitor Sessions:**
You can use SQL queries to identify sessions that may be idle or have been left open. The `V$SESSION` view is useful for this purpose.
Here’... | 37,267 | [
{
"from": "human",
"value": "Right now I have a few new applications being developed against an Oracle Database, and sometimes they crash or fail to end correctly, etc... anyways the problem is they sometimes seem to leave their connections open, and I need to cleanup after them.\nMy question is if there is... |
I ran aspnet_regsql.exe to setup .net membership tables etc.
What do I run to create my application so I can add users etc?
| Once you have set up the ASP.NET membership tables using `aspnet_regsql.exe`, you can create your application and configure it to use the membership system. Here are the steps you typically follow to add users and manage memberships in your application:
### Step 1: Create a New ASP.NET Application
1. **Create a New P... | 42,383 | [
{
"from": "human",
"value": "I ran aspnet_regsql.exe to setup .net membership tables etc.\nWhat do I run to create my application so I can add users etc?\n"
},
{
"from": "gpt",
"value": "Once you have set up the ASP.NET membership tables using `aspnet_regsql.exe`, you can create your application... |
How do I create a batch file to delete files older than a specified date?
This does not seem to work;
:: --------DELOLD.BAT----------
@echo off
SET OLDERTHAN=%1
IF NOT DEFINED OLDERTHAN GOTO SYNTAX
for /f "tokens=2" %%i in ('date /t') do set thedate=%%i
type %1
pause
set mm=%thedate:~0,2%
set dd=%thedate:~3,2%
set yyy... | Your batch file is an interesting attempt to create a script for deleting files older than a specified number of days. However, it contains a few logical issues and could benefit from simplifications. Below is a revised version of your script that should work more effectively.
### Revised Batch File (DELOLD.BAT)
```b... | 39,178 | [
{
"from": "human",
"value": "How do I create a batch file to delete files older than a specified date?\nThis does not seem to work;\n:: --------DELOLD.BAT----------\n@echo off\nSET OLDERTHAN=%1\nIF NOT DEFINED OLDERTHAN GOTO SYNTAX\n\nfor /f \"tokens=2\" %%i in ('date /t') do set thedate=%%i\ntype %1\npause... |
Is there a way, in Axapta/Dynamics Ax, to create an Extended Data Type of type integer which only allows enering values in a specified range (i.e., if the extended data type is meant for storing years, I should be able to set a range like 1900-2100), or do I have to manage the range using X++ code?
And if I need to use... | In Microsoft Dynamics AX (also known as Axapta), Extended Data Types (EDTs) serve as a way to create a type that encapsulates certain properties and constraints for fields in the application. However, EDTs themselves do not provide built-in functionality to impose a range constraint directly on the data type, such as l... | 45,281 | [
{
"from": "human",
"value": "Is there a way, in Axapta/Dynamics Ax, to create an Extended Data Type of type integer which only allows enering values in a specified range (i.e., if the extended data type is meant for storing years, I should be able to set a range like 1900-2100), or do I have to manage the r... |
I want to programmatically verify the status of an application to see if it has crashed or stopped. I know how to see if the process exists in C# but can I also see if it is "Not responding"?
| Yes, you can check if an application is "Not responding" in C# by querying the state of the process and checking its responsiveness. To do this, you can use the `Process` class provided in the `System.Diagnostics` namespace. The `Process` class has a `Responding` property that you can use to determine whether the proce... | 45,371 | [
{
"from": "human",
"value": "I want to programmatically verify the status of an application to see if it has crashed or stopped. I know how to see if the process exists in C# but can I also see if it is \"Not responding\"?\n"
},
{
"from": "gpt",
"value": "Yes, you can check if an application is ... |
I need to retrieve the Build Status from TeamCity in the form of XML, RSS format would be ideal.
I am familiar with the RSS feed within Teamcity but that is of no use as it is more of a history view. I am looking for something more like the page generated by the Status Widget but in XML form. (FYI, the status widget pa... | Hi David,
If you're looking to retrieve the build status from TeamCity in XML format, you have a couple of options to consider. Unfortunately, TeamCity does not provide a direct RSS feed for the current build status, but you can access build status information via the REST API, which returns data in JSON or XML format... | 43,782 | [
{
"from": "human",
"value": "I need to retrieve the Build Status from TeamCity in the form of XML, RSS format would be ideal.\nI am familiar with the RSS feed within Teamcity but that is of no use as it is more of a history view. I am looking for something more like the page generated by the Status Widget b... |
I run a social networking / blogging website ( http://www.obsidianportal.com ), and currently the users are identified by their unique (and unchangeable) username everywhere. Many have requested the ability to have a display name as well that they can choose. I'd like to support this, but I'm worried about spoofing a... | Your concerns about impersonation and identity theft are valid, especially in a social networking environment where trust and authenticity are essential for user interactions. Here are some considerations and options to help you navigate this situation:
### Strategies to Consider
1. **Restricting Display Name Selecti... | 46,440 | [
{
"from": "human",
"value": "I run a social networking / blogging website ( http://www.obsidianportal.com ), and currently the users are identified by their unique (and unchangeable) username everywhere. Many have requested the ability to have a display name as well that they can choose. I'd like to suppo... |
I love scaffolding and it extremely helpful for prototyping. But Should we use scaffolding for developing application as such?
| Scaffolding is a powerful tool often used in software development, especially in frameworks like Ruby on Rails, Django, and others, to quickly generate boilerplate code for applications. It can greatly accelerate the prototyping process, allowing developers to focus on the core functionalities of an application. Howeve... | 45,130 | [
{
"from": "human",
"value": "I love scaffolding and it extremely helpful for prototyping. But Should we use scaffolding for developing application as such?\n"
},
{
"from": "gpt",
"value": "Scaffolding is a powerful tool often used in software development, especially in frameworks like Ruby on Ra... |
Moments ago Jeff Atwood said the following on twitter:
Look, I love rapid new software releases, but the frequency of WordPress releases is just ridiculous.
Which makes me think, how often should you release software updates?
Daily?
Weekly?
Monthly?
Yearly?
Whats the best release strategy?
| The optimal release strategy for software updates can vary depending on several factors, including the type of software, the target audience, and the goals of the development team. Here are some common strategies and considerations for software releases:
### 1. **Continuous Deployment (Daily or Weekly Releases)**
-... | 44,584 | [
{
"from": "human",
"value": "Moments ago Jeff Atwood said the following on twitter:\n\nLook, I love rapid new software releases, but the frequency of WordPress releases is just ridiculous.\n\nWhich makes me think, how often should you release software updates?\n\nDaily?\nWeekly?\nMonthly?\nYearly?\n\nWhats ... |
I have a class Agent with a property Id
Given a collection of Agents I need to check if any of them have duplicate Ids.
I am currently doing this with a hash table but am trying to get Linq-ified, what's a good way of doing this?
| You can use LINQ to efficiently check for duplicate `Id` values in a collection of `Agent` objects. You can use the `GroupBy` method to group agents by their `Id`, and then check if any group contains more than one agent. Here’s how you can do it:
Assuming your `Agent` class is defined like this:
```csharp
public cla... | 48,165 | [
{
"from": "human",
"value": "I have a class Agent with a property Id\nGiven a collection of Agents I need to check if any of them have duplicate Ids.\nI am currently doing this with a hash table but am trying to get Linq-ified, what's a good way of doing this?\n"
},
{
"from": "gpt",
"value": "Yo... |
I need to store an array in a custom content type in MOSS. This will always be hidden, only used programmatically. Throughout the lifecycle of the list item, I will be adding values to the array. My array may look like this after a while:
value1,1 | value1,2 | value1,3 | value1,4
value2,1 | value2,2 | value2,3 |
va... | In Microsoft Office SharePoint Server (MOSS), there is no built-in field type that directly supports storing multi-dimensional arrays or multi-row data in a structured way. The options you mentioned, such as using `SPFieldMultiColumn` or creating a text field for serialization, are common approaches.
Since you are loo... | 45,841 | [
{
"from": "human",
"value": "I need to store an array in a custom content type in MOSS. This will always be hidden, only used programmatically. Throughout the lifecycle of the list item, I will be adding values to the array. My array may look like this after a while:\n\nvalue1,1 | value1,2 | value1,3 | v... |
How do you create a 1 bit per pixel mask from an image using GDI in C#? The image I am trying to create the mask from is held in a System.Drawing.Graphics object.
I have seen examples that use Get/SetPixel in a loop, which are too slow. The method that interests me is one that uses only BitBlits, like this. I just can... | Creating a 1-bit per pixel mask from an image using GDI+ in C# can be efficiently achieved by leveraging `Graphics` and `Bitmap` classes without the need to use `GetPixel` and `SetPixel`, which are indeed slow.
Here's how you can create a 1-bit mask from an image using only BitBlits. The idea is to create a `Bitmap` w... | 43,199 | [
{
"from": "human",
"value": "How do you create a 1 bit per pixel mask from an image using GDI in C#? The image I am trying to create the mask from is held in a System.Drawing.Graphics object.\nI have seen examples that use Get/SetPixel in a loop, which are too slow. The method that interests me is one that... |
Is there a built-in IsLowerCase() in .NET?
| In .NET, there isn't a built-in method specifically called `IsLowerCase()`, but you can easily check if a character or a string is in lowercase using existing methods from the `char` and `string` classes.
For a single character, you can use the `char.IsLower()` method:
```csharp
char character = 'a';
bool isLower = c... | 49,626 | [
{
"from": "human",
"value": "Is there a built-in IsLowerCase() in .NET? \n"
},
{
"from": "gpt",
"value": "In .NET, there isn't a built-in method specifically called `IsLowerCase()`, but you can easily check if a character or a string is in lowercase using existing methods from the `char` and `st... |
Does anyone know of a short cut to place my name and the date where the cursor is i.e.
//021208 DarkAxi0m
so i don't keep check what the date is when i'm adding comments.
Im using Delphi7, with CnPack And GExperts Installed.
I think it should be able to be done with one of those experts.
| Yes, you can create a shortcut to insert your name and the date in the format you specified while using Delphi 7, CnPack, and GExperts. Both of these tools have features that can help automate this process.
### Using CnPack
CnPack has a built-in feature called **Code Templates** that allows you to create custom snippe... | 40,500 | [
{
"from": "human",
"value": "Does anyone know of a short cut to place my name and the date where the cursor is i.e.\n //021208 DarkAxi0m\n\nso i don't keep check what the date is when i'm adding comments. \nIm using Delphi7, with CnPack And GExperts Installed.\nI think it should be able to be done with one ... |
Given an array like {"one two", "three four five"}, how'd you calculate the total number of words contained in it using LINQ?
| You can calculate the total number of words in an array using LINQ in C#. Here's how you can do it:
1. Use the `Select` method to split each string in the array into words.
2. Use the `Sum` method to count the total number of words across all strings.
Here's a complete example:
```csharp
using System;
using System.L... | 46,568 | [
{
"from": "human",
"value": "Given an array like {\"one two\", \"three four five\"}, how'd you calculate the total number of words contained in it using LINQ?\n"
},
{
"from": "gpt",
"value": "You can calculate the total number of words in an array using LINQ in C#. Here's how you can do it:\n\n1... |
I have a C# application which will open a word document and then replace some of the predefined bookmarks with the data which i have like Name,Class etc..
It is all are just string values .Now I want to render a Table with dynamic number of rows to the word document.I want the table in a particular place in the docum... | Yes, you can use bookmarks in a Word document to define a specific location where you want to insert a table. Here's how you can do this with C# by using the `Microsoft.Office.Interop.Word` namespace. First, make sure that you have added a reference to the Microsoft Word Interop assembly in your project.
### Steps to ... | 37,141 | [
{
"from": "human",
"value": "I have a C# application which will open a word document and then replace some of the predefined bookmarks with the data which i have like Name,Class etc..\nIt is all are just string values .Now I want to render a Table with dynamic number of rows to the word document.I want th... |
Suppose we have n elements, a1, a2, ..., an, arranged in a circle. That is, a2 is between a1 and a3, a3 is between a2 and a4, an is between an-1 and a1, and so forth.
Each element can take the value of either 1 or 0. Two arrangements are different if there are corresponding ai's whose values differ. For instance, when ... | To solve the problem of counting arrangements of n elements (1s and 0s) in a circular formation such that no two adjacent elements both have the value 1, we can use combinatorial techniques.
First, let's denote \( a_n \) as the number of valid arrangements for \( n \) elements arranged in a circle. For linear arrangem... | 43,423 | [
{
"from": "human",
"value": "Suppose we have n elements, a1, a2, ..., an, arranged in a circle. That is, a2 is between a1 and a3, a3 is between a2 and a4, an is between an-1 and a1, and so forth.\nEach element can take the value of either 1 or 0. Two arrangements are different if there are corresponding ai'... |
I'm new to iPhone and Apple development and working on my first application. It simple with only a TableView and a "detail view" when an item in a table is selected.
What I want to do is change the background color of the cell in the TableView based on some action taken in my "detail view".
When the application initial... | To update your `UITableView` after returning from the detail view, you can certainly call `reloadData` on your table view in the `viewWillAppear:` or `viewDidAppear:` method of your table view controller. This ensures that the table is refreshed every time the view appears, and it retrieves any new data or updated sele... | 44,413 | [
{
"from": "human",
"value": "I'm new to iPhone and Apple development and working on my first application. It simple with only a TableView and a \"detail view\" when an item in a table is selected.\nWhat I want to do is change the background color of the cell in the TableView based on some action taken in my... |
I have a file upload form that is being posted back to a servlet (using multipart/form-data encoding). In the servlet, I am trying to use Apache Commons to handle the upload. However, I also have some other fields in the form that are just plain fields. How can I read those parameters from the request?
For example,... | To read both uploaded files and regular form fields using Apache Commons FileUpload in a servlet, you can continue with the logic you started but add additional checks to differentiate between file items and regular form fields. Here's how you can do this:
1. Iterate through the `FileItem` objects returned by the `par... | 43,432 | [
{
"from": "human",
"value": "I have a file upload form that is being posted back to a servlet (using multipart/form-data encoding). In the servlet, I am trying to use Apache Commons to handle the upload. However, I also have some other fields in the form that are just plain fields. How can I read those ... |
I need to validate a certain property to one of my classes. When I set the property, the class should validate the input and if incorrect, set the object to an invalid state.
Question : The property value must be in a certain mask/format eg. &&&&-&&&&-&&&&. I cannot use regular expressions. Is it possible to validate t... | Yes, it is possible to validate text against a specified mask format without using regular expressions. You can implement a method that checks whether the input string matches the desired mask format character by character.
Here’s a simple approach you can use in a class to validate the input against the mask `&&&&-&&... | 42,508 | [
{
"from": "human",
"value": "I need to validate a certain property to one of my classes. When I set the property, the class should validate the input and if incorrect, set the object to an invalid state.\nQuestion : The property value must be in a certain mask/format eg. &&&&-&&&&-&&&&. I cannot use regular... |
I am opening a new window from a button using var myWindow = window.open(...). I then want to move that window to the correct location on the screen. I use myWindow.moveTo(10,10) to do this but I get an Access Denied error.
The window I open contains information from another server to the one I am executing on. When it... | The issue you're encountering is due to the Same Origin Policy (SOP) enforced by browsers, including Internet Explorer. When you open a window with content from a different origin (domain, protocol, or port), the browser restricts certain operations, including `moveTo()`, due to security concerns. This is why you are r... | 43,797 | [
{
"from": "human",
"value": "I am opening a new window from a button using var myWindow = window.open(...). I then want to move that window to the correct location on the screen. I use myWindow.moveTo(10,10) to do this but I get an Access Denied error.\nThe window I open contains information from another se... |
What's the best way to output the public contents of an object to a human-readable file? I'm looking for a way to do this that would not require me to know of all the members of the class, but rather use the compiler to tell me what members exist, and what their names are. There have to be macros or something like that... | In C++, there isn't a direct way to output the public members of a class automatically without knowing their names, because C++ does not provide reflection or introspection capabilities natively like some other languages (e.g., Python or Java). However, there are some strategies you can use to achieve similar functiona... | 40,369 | [
{
"from": "human",
"value": "What's the best way to output the public contents of an object to a human-readable file? I'm looking for a way to do this that would not require me to know of all the members of the class, but rather use the compiler to tell me what members exist, and what their names are. There... |
I've been developing a few JSF applications lately and am disturbed with the inconsistency in the web component APIs.
I've noticed that there is extremely unpredictable behavior when calling .getValue() or .getSubmittedValue() on a JSF component object in server side code. Sometimes when I call .getValue() on a drop d... | What you're experiencing with JSF (JavaServer Faces) is indeed rooted in how the JSF lifecycle works, and it can certainly be confusing if you're not familiar with it. Let's break down what's happening with `.getValue()` and `.getSubmittedValue()`.
### Understanding the JSF Lifecycle
JSF operates on a request-respons... | 42,532 | [
{
"from": "human",
"value": "I've been developing a few JSF applications lately and am disturbed with the inconsistency in the web component APIs. \nI've noticed that there is extremely unpredictable behavior when calling .getValue() or .getSubmittedValue() on a JSF component object in server side code. Som... |
I need a tool to automatically convert simple HTML into an image. I will be controlling the HTML input which will consist of simple text formatting tags and possibly image links--I don't need to be able to render arbitrary HTML. Is there a simple way to do this?
I've looked at the HTML layout engines like Gecko and We... | To convert simple HTML into an image on a Linux server, you have a few options that are lightweight and more straightforward than using full-fledged browsers like Gecko or WebKit. Here are some suggestions:
### 1. **Headless Chrome (Puppeteer)**
Puppeteer is a Node.js library that provides a high-level API to control... | 44,009 | [
{
"from": "human",
"value": "I need a tool to automatically convert simple HTML into an image. I will be controlling the HTML input which will consist of simple text formatting tags and possibly image links--I don't need to be able to render arbitrary HTML. Is there a simple way to do this? \nI've looked at... |
I have CLI/MFC application and I would like to begin to learn how to unit test with it. I have VS2008 Pro. If possible, I would like to use the built in unit testing. Thanks for your input!
| Unit testing in Visual Studio 2008 (VS2008) can be a bit tricky, especially for a CLI/MFC application, since the built-in unit testing features are more aligned with managed code (like C# or VB.NET) rather than native C++ code. However, you can still implement unit tests for your native C++ MFC application. Here’s a st... | 41,296 | [
{
"from": "human",
"value": "I have CLI/MFC application and I would like to begin to learn how to unit test with it. I have VS2008 Pro. If possible, I would like to use the built in unit testing. Thanks for your input!\n"
},
{
"from": "gpt",
"value": "Unit testing in Visual Studio 2008 (VS200... |
I've searched around a bit for similar questions, but other than running one command or perhaps a few command with items such as:
ssh user@host -t sudo su -
However, what if I essentially need to run a script on (let's say) 15 servers at once. Is this doable in bash? In a perfect world I need to avoid installing appli... | You can indeed achieve your goal using bash by leveraging SSH to run your deployment commands concurrently on multiple servers. While you mentioned you prefer not to install additional applications, if you already have SSH access configured for all your servers, then you can use bash's built-in capabilities without any... | 43,508 | [
{
"from": "human",
"value": "I've searched around a bit for similar questions, but other than running one command or perhaps a few command with items such as:\nssh user@host -t sudo su -\n\nHowever, what if I essentially need to run a script on (let's say) 15 servers at once. Is this doable in bash? In a pe... |
You are doing contract first development of web services in a SOA world.
After editing an XSD file, what is the best way to automatically (re)generate .net classes from the XSD files?
| To automatically (re)generate .NET classes from an edited XSD file in a service-oriented architecture (SOA) environment, you can use the `xsd.exe` tool provided by the .NET SDK. This tool converts XML Schema (XSD) files into .NET classes that can be used for serialization and deserialization of XML data.
Here’s how to... | 41,794 | [
{
"from": "human",
"value": "You are doing contract first development of web services in a SOA world.\nAfter editing an XSD file, what is the best way to automatically (re)generate .net classes from the XSD files?\n"
},
{
"from": "gpt",
"value": "To automatically (re)generate .NET classes from a... |
I have a problem creating a regular expression for the following task:
Suppose we have HTML-like text of the kind:
<x>...<y>a</y>...<y>b</y>...</x>
I want to get a collection of values inside <y></y> tags located inside a given <x> tag, so the result of the above example would be a collection of two elements ["a","b"]... | To achieve the extraction of values inside `<y>` tags that are located within a specific `<x>` tag using regular expressions, you can use the following pattern:
```regex
<x[^>]*>(.*?)<\/x>
```
This pattern captures everything within the `<x>` tag. Within that, we will focus on extracting the `<y>` tags:
```regex
<y>... | 46,740 | [
{
"from": "human",
"value": "I have a problem creating a regular expression for the following task:\nSuppose we have HTML-like text of the kind:\n<x>...<y>a</y>...<y>b</y>...</x>\n\nI want to get a collection of values inside <y></y> tags located inside a given <x> tag, so the result of the above example wo... |
Here are two chunks of code that accomplish (what I think is) the same thing.
I basically am trying to learn how to use Java 1.5's concurrency to get away from Thread.sleep(long). The first example uses ReentrantLock, and the second example uses CountDownLatch. The jist of what I am trying to do is put one thread to ... | Your exploration of Java's concurrency mechanisms is commendable. Both `ReentrantLock` and `CountDownLatch` serve their purposes effectively, but their design intent and optimal use cases differ significantly. Let's address your specific questions and provide additional insights.
### Question 1: Are you using locks fo... | 37,779 | [
{
"from": "human",
"value": "Here are two chunks of code that accomplish (what I think is) the same thing.\nI basically am trying to learn how to use Java 1.5's concurrency to get away from Thread.sleep(long). The first example uses ReentrantLock, and the second example uses CountDownLatch. The jist of wh... |
How do I get a DateFormat of some sort to throw an exception if I try to parse an illegal date? If I parse a date like "99.99.9999" with a SimpleDateFormat with the pattern "dd.MM.yyyy", no exception is thrown, but this is clearly not a valid date.
| When using `SimpleDateFormat` in Java, parsing a date string that doesn't match the expected date values (like "99.99.9999" for the pattern "dd.MM.yyyy") does not throw an exception; instead, it may produce a valid date (like December 31, 9999). This behavior occurs because `SimpleDateFormat` is lenient by default.
To... | 48,542 | [
{
"from": "human",
"value": "How do I get a DateFormat of some sort to throw an exception if I try to parse an illegal date? If I parse a date like \"99.99.9999\" with a SimpleDateFormat with the pattern \"dd.MM.yyyy\", no exception is thrown, but this is clearly not a valid date.\n"
},
{
"from": "g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.