instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Can Ruby really be used as a functional language? What are some good tutorials to teach this facet of the language? Note: I really want to use and stick with Ruby as my primary language so I am not interested at this point in being converted to YAFL (yet another functional language). I am really interested in how ... | Yes, Ruby can indeed be used as a functional programming (FP) language, even though it is primarily an object-oriented programming (OOP) language. Ruby supports many functional programming concepts, including first-class functions, higher-order functions, closures, and immutability (to a certain extent). You can levera... | 21,216 | [
{
"from": "human",
"value": "Can Ruby really be used as a functional language? What are some good tutorials to teach this facet of the language? Note: I really want to use and stick with Ruby as my primary language so I am not interested at this point in being converted to YAFL (yet another functional la... |
When I want to validate my XML docuemnts against a schema in my server-side Java, I use the built-in JRE Xerces implementation and javax.xml.validation.Schema. It works fine, but when validation fails, Xerces gives error messages that are very close to useless, for example:
cvc-minLength-valid: Value '' with length = ... | When dealing with XML validation in server-side Java and looking for better error handling than what the default Xerces implementation offers, there are a few strategies and libraries you can explore. Here are some recommendations:
### 1. **Custom Error Handling with SAX Error Handler**
You can implement your own erro... | 18,754 | [
{
"from": "human",
"value": "When I want to validate my XML docuemnts against a schema in my server-side Java, I use the built-in JRE Xerces implementation and javax.xml.validation.Schema. It works fine, but when validation fails, Xerces gives error messages that are very close to useless, for example:\ncv... |
Suppose I have a drop-down list like:
<select id='list'>
<option value='1'>Option A</option>
<option value='2'>Option B</option>
<option value='3'>Option C</option>
</select>
Given the value '2' (i.e., using a specific value, not necessarily the selected one), what selector can I use to get "Option B"?
I t... | To select an option from a drop-down list based on its value, you should target the `<option>` elements directly. The selector you tried, `$("#list[value='2']")`, is incorrect because it attempts to select the `<select>` element based on its value, rather than the `<option>` elements inside it.
To get the text of the ... | 28,070 | [
{
"from": "human",
"value": "Suppose I have a drop-down list like:\n<select id='list'>\n <option value='1'>Option A</option>\n <option value='2'>Option B</option>\n <option value='3'>Option C</option>\n</select>\n\nGiven the value '2' (i.e., using a specific value, not necessarily the selected one)... |
In my cross-platform architecture, I would like to act on a context menu click (right button click) during a mouse click event. In Cocoa, can you detect that the user either Ctrl-Clicked or double-tapped on touchpad (right-click equivalent) DURING the mouseDown event? I am aware of NSView's menuForEvent but do not wi... | In Cocoa, you can detect a right-click (or control-click) during a mouse-down event by checking the event's modifier flags and button number in your mouse down handler. Here's how you can do it within an `NSView` subclass:
1. Override the `mouseDown:` method in your custom `NSView` subclass.
2. Use the `NSEvent` param... | 25,514 | [
{
"from": "human",
"value": "In my cross-platform architecture, I would like to act on a context menu click (right button click) during a mouse click event. In Cocoa, can you detect that the user either Ctrl-Clicked or double-tapped on touchpad (right-click equivalent) DURING the mouseDown event? I am awa... |
Is there a way to format a UTC time into any arbitrary string format I want in java? Basically I was thinking of having some class take the timestamp and I pass it is string telling it how I want it formated, and it returns the formatted string for me. Is there a way to do this?
| Yes, you can format a UTC time into any arbitrary string format you want in Java by using the `java.time` package, which provides a powerful and flexible API for date and time manipulation. Specifically, you can use the `DateTimeFormatter` class to format `ZonedDateTime`, `LocalDateTime`, or `OffsetDateTime`.
Here's h... | 21,788 | [
{
"from": "human",
"value": "Is there a way to format a UTC time into any arbitrary string format I want in java? Basically I was thinking of having some class take the timestamp and I pass it is string telling it how I want it formated, and it returns the formatted string for me. Is there a way to do thi... |
I'm trying to retrieve an XML stream from a URL. For most URLs my code below works fine. But, I have a couple URLs that timeout. The URLs in question do work from Internet Explorer.
$webclient=New-Object "System.Net.WebClient"
[xml]$data=$webclient.DownloadString($url)
So, I went searching for a way to increase the ti... | It seems you're on the right track by switching to `System.Net.WebRequest` for better control over the request parameters, including timeout settings. Since you mentioned that you could access the URLs via Internet Explorer, you might be dealing with authentication or proxy settings that WebClient doesn't handle the sa... | 21,425 | [
{
"from": "human",
"value": "I'm trying to retrieve an XML stream from a URL. For most URLs my code below works fine. But, I have a couple URLs that timeout. The URLs in question do work from Internet Explorer.\n$webclient=New-Object \"System.Net.WebClient\"\n[xml]$data=$webclient.DownloadString($url)\n\nSo... |
whats your rule of thumb for maximum size for xml files.
What if I ask maximum no of records, and one record have 10 values for instance? Another condition is we are loading it from web.
| When working with XML files, especially in a web context, there are several factors to consider that can affect performance and usability. While there's no strict maximum size for XML files, here are some general guidelines and rules of thumb to consider:
### General Guidelines for XML Size
1. **File Size**:
- **K... | 22,063 | [
{
"from": "human",
"value": "whats your rule of thumb for maximum size for xml files.\nWhat if I ask maximum no of records, and one record have 10 values for instance? Another condition is we are loading it from web.\n"
},
{
"from": "gpt",
"value": "When working with XML files, especially in a w... |
How should I format URLs with special/international characters?
Currently I try to make URLs "look good", so that:
www.myhost.com/this is a test, do you know how?
is converted to:
www.myhost.com/this_is_a_test_do_you_know_how
I know some international letters could be converted (ü = ue, æ = ae, å = aa), some charac... | Formatting URLs that include special or international characters can be a challenge, but it's important to strike a balance between readability, SEO, and technical correctness. Here are some guidelines you can follow:
### 1. **Use Percent-Encoding**
For characters that cannot be represented in ASCII, use percent-enc... | 21,207 | [
{
"from": "human",
"value": "How should I format URLs with special/international characters?\nCurrently I try to make URLs \"look good\", so that: \nwww.myhost.com/this is a test, do you know how?\n\nis converted to: \nwww.myhost.com/this_is_a_test_do_you_know_how\n\nI know some international letters could ... |
I am having trouble grabbing the values from the form once processed. I need your help.
function updateUser($table, $id) {
if($_POST) {
processUpdate($table, $id);
} else {
updateForm($table, $id);
}
}
function processUpdate($table, $id) {
print $table; //testing
print $id; //testi... | It looks like you're experiencing an issue with processing the form values in your PHP code. There are a few potential problems that could be causing the form data not to be posted correctly. Let's go through them:
1. **Use of `$HTTP_POST_VARS`**:
The variable `$HTTP_POST_VARS` is deprecated. Instead, you should us... | 17,264 | [
{
"from": "human",
"value": "I am having trouble grabbing the values from the form once processed. I need your help.\nfunction updateUser($table, $id) {\n if($_POST) {\n processUpdate($table, $id);\n } else {\n updateForm($table, $id);\n }\n}\n\nfunction processUpdate($table, $id) {\n... |
I would like to be able to write a Java class in one package which can access non-public methods of a class in another package without having to make it a subclass of the other class. Is this possible?
| In Java, the visibility of class members (methods and fields) is determined by access modifiers. There are four main access levels:
1. **Public**: Accessible from any other class.
2. **Protected**: Accessible within the same package and by subclasses.
3. **Default** (no modifier): Accessible only within classes in the... | 21,419 | [
{
"from": "human",
"value": "I would like to be able to write a Java class in one package which can access non-public methods of a class in another package without having to make it a subclass of the other class. Is this possible?\n"
},
{
"from": "gpt",
"value": "In Java, the visibility of class... |
I am using some nested layouts in Ruby on Rails, and in one of the layouts i have a need to read in a string from a div and set that as the title of the document. What is correct way (if any) to set the title of the document?
<script type="text/javascript">
$(document).ready(function() {
// ???
});
</script>
| In a Ruby on Rails application, if you want to dynamically set the title of the document based on a string from a `<div>`, you can easily achieve this using JavaScript or jQuery. Here's a step-by-step guide on how to do that:
1. **Ensure that your Rails layout is set up properly**: You should have a main layout file (... | 23,024 | [
{
"from": "human",
"value": "I am using some nested layouts in Ruby on Rails, and in one of the layouts i have a need to read in a string from a div and set that as the title of the document. What is correct way (if any) to set the title of the document?\n<script type=\"text/javascript\">\n$(document).ready... |
There is a UNIQUE database constraint on an index which doesn't allow more than one record having identical columns.
There is a piece of code, managed by Hibernate (v2.1.8), doing two DAO
getHibernateTemplate().save( theObject )
calls which results two records entered into the table mentioned above.
If this code is ex... | To address the unique constraint violation when using Hibernate and Spring transaction management across multiple database platforms, especially considering the behavior of MS SQL, you can consider the following workarounds:
1. **Batch Inserts**: Instead of performing two separate `save()` calls within a single transa... | 22,431 | [
{
"from": "human",
"value": "There is a UNIQUE database constraint on an index which doesn't allow more than one record having identical columns.\nThere is a piece of code, managed by Hibernate (v2.1.8), doing two DAO \ngetHibernateTemplate().save( theObject )\ncalls which results two records entered into t... |
In a web app that support more than 5000 users, postgres is becoming the bottle neck.
It takes more than 1 minute to add a new user.(even after optimizations and on Win 2k3)
So, as a design issue, which other DB's might be better?
| When facing performance issues with PostgreSQL, especially in a web app that supports over 5000 users and taking more than a minute to add a new user, it’s essential to consider both database options and architectural optimizations. Here are some alternative databases you might consider:
### Alternative Databases
1. ... | 23,962 | [
{
"from": "human",
"value": "In a web app that support more than 5000 users, postgres is becoming the bottle neck.\nIt takes more than 1 minute to add a new user.(even after optimizations and on Win 2k3)\nSo, as a design issue, which other DB's might be better?\n"
},
{
"from": "gpt",
"value": "W... |
I'm running into a problem setting up my development environment. I've been working on ColdFusion and .NET applications up until recently I haven't needed to touch IIS. Now, I have to set up a classic ASP application for some one-off work.
I added a virtual directory in IIS and pointed it at the actual codebase on my l... | It sounds like you’ve made good progress in setting up your classic ASP application in IIS. Here are some additional tips that might help you troubleshoot further issues, especially related to the missing includes that you're encountering:
1. **Check the Path of Includes**: Ensure that the paths for any included files... | 21,485 | [
{
"from": "human",
"value": "I'm running into a problem setting up my development environment. I've been working on ColdFusion and .NET applications up until recently I haven't needed to touch IIS. Now, I have to set up a classic ASP application for some one-off work.\nI added a virtual directory in IIS and... |
I am struggling with the route setup for a Rails application. I have installed restful_authentication and mostly followed the instructions. I have set up the routes this way:
map.login '/login', :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'
map.resourc... | It looks like you're on the right track with your routes setup, but there is a little confusion regarding how the route mapping works in your Rails application.
In Rails, routes are defined in such a way that they create URL patterns that map to controller actions. Your setup here is generally correct for defining cus... | 22,325 | [
{
"from": "human",
"value": "I am struggling with the route setup for a Rails application. I have installed restful_authentication and mostly followed the instructions. I have set up the routes this way:\nmap.login '/login', :controller => 'sessions', :action => 'new'\nmap.logout '/logout', :controller => '... |
With the release of Visual Studio 2008, Microsoft implemented code-completion and IntelliSense support for JavaScript.
Unfortunately the support for JavaScript is shady at best--one of the major hassles being that when referencing external JavaScript files, the developer has to open and close JavaScript files to force ... | Yes, there are a few strategies you can use to improve IntelliSense support for JavaScript in Visual Studio 2008, even with the limitations you mentioned regarding external JavaScript files. Here are some suggestions:
1. **Use Script Reference Comments**: If you're referencing external JavaScript files, you can someti... | 22,912 | [
{
"from": "human",
"value": "With the release of Visual Studio 2008, Microsoft implemented code-completion and IntelliSense support for JavaScript.\nUnfortunately the support for JavaScript is shady at best--one of the major hassles being that when referencing external JavaScript files, the developer has to... |
Is it possible to reference system environment variables (as opposed to Java system properties) in a log4j xml configuration file?
I'd like to be able to do something like:
<level value="${env.LOG_LEVEL}" />
and have it get that from the system environment variables, so I can avoid having to pass in so many things wit... | Yes, it is possible to reference system environment variables in a Log4j XML configuration file, but it requires a specific approach since Log4j does not directly support `${env.VARIABLE_NAME}` style placeholders for environment variables out of the box.
However, you can use the `PropertyConfigurator` in Log4j or impl... | 23,335 | [
{
"from": "human",
"value": "Is it possible to reference system environment variables (as opposed to Java system properties) in a log4j xml configuration file?\nI'd like to be able to do something like:\n<level value=\"${env.LOG_LEVEL}\" />\n\nand have it get that from the system environment variables, so I... |
We have a Java codebase that is currently one Web-based Netbeans project. As our organization and codebase grows it seems obvious that we should partition the various independent pieces of our system into individual jars. So one Jar library for the data access layer, one for a general lib, one for a specialized knowled... | Yes, your approach to modularizing your Java codebase into separate JAR libraries is a good practice, especially as your application grows. It enhances maintainability, reusability, and separation of concerns. Here’s an overview of how to manage this modularization effectively, along with recommendations regarding tool... | 22,998 | [
{
"from": "human",
"value": "We have a Java codebase that is currently one Web-based Netbeans project. As our organization and codebase grows it seems obvious that we should partition the various independent pieces of our system into individual jars. So one Jar library for the data access layer, one for a g... |
A little benchmark with ASP.NET MVC. Viewpage code:
public string Bechmark(Func<string> url)
{
var s = new Stopwatch();
var n = 1000;
s.Reset();
s.Start();
for (int i = 0; i < n; i++)
{
var u = url();
}
s.Stop();
return s.Elaps... | When working with ASP.NET MVC and performance concerns related to URL generation and link building, there are several strategies you can employ to mitigate overhead and improve performance. Here’s a breakdown of potential solutions and best practices:
### 1. **Caching**
Implement caching strategies for URLs that are ... | 20,175 | [
{
"from": "human",
"value": "A little benchmark with ASP.NET MVC. Viewpage code:\n public string Bechmark(Func<string> url)\n {\n var s = new Stopwatch();\n var n = 1000;\n\n s.Reset();\n s.Start();\n for (int i = 0; i < n; i++)\n {\n var u = url();... |
Are there any automatic, online or off, tools for testing xhtml/css for compliance with screen readers and other visual guidelines of the Americans with Disabilities Act (ADA)?
| Yes, there are several online and offline tools available for testing XHTML/CSS compliance with accessibility guidelines, including those related to the Americans with Disabilities Act (ADA) and the Web Content Accessibility Guidelines (WCAG). While these tools may not specifically focus on screen reader compatibility,... | 23,169 | [
{
"from": "human",
"value": "Are there any automatic, online or off, tools for testing xhtml/css for compliance with screen readers and other visual guidelines of the Americans with Disabilities Act (ADA)?\n"
},
{
"from": "gpt",
"value": "Yes, there are several online and offline tools available... |
Is there any free java library which I can use to convert string in one encoding to other encoding, something like iconv? I'm using Java version 1.3.
| In Java 1.3, character encoding support is somewhat limited compared to later versions. However, you can use the built-in `String` class methods and the `InputStreamReader` / `OutputStreamWriter` to achieve character encoding conversion.
Here's how you can convert a string from one encoding to another:
1. First, con... | 22,787 | [
{
"from": "human",
"value": "Is there any free java library which I can use to convert string in one encoding to other encoding, something like iconv? I'm using Java version 1.3.\n"
},
{
"from": "gpt",
"value": "In Java 1.3, character encoding support is somewhat limited compared to later versio... |
I'm looking for a script that will call a random image linked to its corresponding site on pageload. Anyone know a javascript or php way to do this?
| Certainly! You can achieve this by using either JavaScript or PHP. Below, I'll provide both options.
### JavaScript Option
You can use JavaScript to select a random image and link when the page loads. Here is a simple example:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name=... | 23,955 | [
{
"from": "human",
"value": "I'm looking for a script that will call a random image linked to its corresponding site on pageload. Anyone know a javascript or php way to do this? \n"
},
{
"from": "gpt",
"value": "Certainly! You can achieve this by using either JavaScript or PHP. Below, I'll pro... |
The AssemblyVersion and AssemblyFileVersion attributes are the built-in way of handling version numbers for .NET assemblies. While the framework provides the ability to have the least significant parts of a version number (build and revision, in Microsoft terms) automatically determined, I find the method for this pret... | Managing version numbers for .NET assemblies can indeed be challenging, especially as projects grow in complexity and the need for clear versioning practices becomes paramount. Below are several approaches and best practices for managing assembly and file versions effectively, taking into account the requirements of mo... | 22,526 | [
{
"from": "human",
"value": "The AssemblyVersion and AssemblyFileVersion attributes are the built-in way of handling version numbers for .NET assemblies. While the framework provides the ability to have the least significant parts of a version number (build and revision, in Microsoft terms) automatically de... |
I was put in a position today in which I needed to enumerate all possible combinations of jagged list. For instance, a naive approach would be:
for a in [1,2,3]:
for b in [4,5,6,7,8,9]:
for c in [1,2]:
yield (a,b,c)
This is functional, but not general in terms of the number of lists that can be... | Your implementation of generating combinations from a jagged list is quite interesting, but there are a few areas where it could be simplified or improved in terms of clarity, performance, and flexibility. Here are some recommendations and alternative approaches:
### 1. Use of Built-in Libraries
Python provides power... | 24,816 | [
{
"from": "human",
"value": "I was put in a position today in which I needed to enumerate all possible combinations of jagged list. For instance, a naive approach would be:\nfor a in [1,2,3]:\n for b in [4,5,6,7,8,9]:\n for c in [1,2]:\n yield (a,b,c)\n\nThis is functional, but not gene... |
I am working on an Actionscript 2 project - trying to use the XML object to find a url which is returned as a 302 redirect. Is there a way to do this in actionscript 2?
code:
var urlone:XML = new XML();
urlone.load("http://mydomain.com/file.py");
urlone.onLoad = function (success) {
trace("I want to print the 302 ... | In ActionScript 2, the `XML` object's `load` method does not directly provide a way to handle HTTP redirects, such as a 302 redirect. When you request a URL and the server responds with a redirect, the `XML` object follows the redirect automatically, but it doesn't expose the redirected URL directly.
To handle this an... | 23,740 | [
{
"from": "human",
"value": "I am working on an Actionscript 2 project - trying to use the XML object to find a url which is returned as a 302 redirect. Is there a way to do this in actionscript 2?\ncode:\nvar urlone:XML = new XML();\nurlone.load(\"http://mydomain.com/file.py\");\nurlone.onLoad = function ... |
What is the best way to take a given PHP object and serialize it as XML? I am looking at simple_xml and I have used it to parse XML into objects, but it isn't clear to me how it works the other way around.
| To serialize a PHP object as XML, you can use the `SimpleXMLElement` class, which provides a convenient way to create and manipulate XML structures in PHP. Below is a step-by-step guide on how to convert a PHP object into XML using `SimpleXMLElement`.
### Step 1: Create Your PHP Object
Here’s an example of a simple P... | 18,369 | [
{
"from": "human",
"value": "What is the best way to take a given PHP object and serialize it as XML? I am looking at simple_xml and I have used it to parse XML into objects, but it isn't clear to me how it works the other way around.\n"
},
{
"from": "gpt",
"value": "To serialize a PHP object as... |
How to create a table with a timestamp column that defaults to DATETIME('now')?
Like this:
CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT,
t TIMESTAMP DEFAULT DATETIME('now')
);
This gives an error.
| The error you're encountering is likely due to the way SQLite handles the default value for the `TIMESTAMP` type. In SQLite, you should use a text representation for the `DATETIME` function in a `DEFAULT` clause. Instead of using `DATETIME('now')` directly in the `DEFAULT` clause, you should use the `CURRENT_TIMESTAMP`... | 25,667 | [
{
"from": "human",
"value": "How to create a table with a timestamp column that defaults to DATETIME('now')?\nLike this:\nCREATE TABLE test (\n id INTEGER PRIMARY KEY AUTOINCREMENT, \n t TIMESTAMP DEFAULT DATETIME('now')\n);\n\nThis gives an error.\n"
},
{
"from": "gpt",
"value": "The erro... |
I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this:
var sign = Math.abs(n) / n;
But, there is any other way? Better than this?
| Your approach using `Math.abs(n) / n` effectively returns `1` for positive numbers and `-1` for negative numbers, but it will lead to `Infinity` for `0`. If you want to avoid this situation and handle zero explicitly, you could use a different method. Here are a few alternatives that you might find useful:
### Option ... | 25,658 | [
{
"from": "human",
"value": "I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this:\nvar sign = Math.abs(n) / n;\n\nBut, there is any other way? Better than this?\n"
},
{
"from": "gpt",
"value": "Your approach u... |
What type of authentication would you suggest for the service that is:
implemented as WCF and exposed via
varios enpoints (including XML-RPC)
has to be consumed easily by various cross-platform clients
Why?
Options that I'm aware of are:
Forms-based authentication for IIS-hosted WCF (easy to implement, but has horri... | When considering authentication for a WCF service that needs to support various endpoints (including XML-RPC) and be easily consumable by cross-platform clients, it's essential to find a balance between security, usability, and implementation complexity.
Among the options you mentioned, here are some recommendations:
... | 21,162 | [
{
"from": "human",
"value": "What type of authentication would you suggest for the service that is:\n\nimplemented as WCF and exposed via\nvarios enpoints (including XML-RPC)\nhas to be consumed easily by various cross-platform clients\n\nWhy?\nOptions that I'm aware of are:\n\nForms-based authentication fo... |
I am using Apache HttpClient and would like to communicate HTTP errors (400 Bad Request, 404 Not Found, 500 Server Error, etc.) via the Java exception mechanism to the calling code. Is there an exception in the Java standard library or in a widely used library that would be appropriate to use or to subclass for this pu... | When using Apache HttpClient to handle HTTP errors, you have a couple of options for communicating these errors through exceptions.
### Custom Exception Class
Given that standard Java exceptions do not directly encapsulate HTTP error scenarios, a common approach is to create a custom exception class. You can define a ... | 20,235 | [
{
"from": "human",
"value": "I am using Apache HttpClient and would like to communicate HTTP errors (400 Bad Request, 404 Not Found, 500 Server Error, etc.) via the Java exception mechanism to the calling code. Is there an exception in the Java standard library or in a widely used library that would be appr... |
If I have a property:
public list<String> names { get; set; }
How can I generate and handle a custom Event for arguments sake called 'onNamesChanged' whenever a name gets added to the list?
| To implement a custom event that triggers whenever a name is added to a `List<string>` in a C# property, you can encapsulate the list within a class and expose a custom event. This event can then be raised whenever an item is added to the list.
Here's how you can do it:
1. Create a class that holds the `List<string>`... | 24,687 | [
{
"from": "human",
"value": "If I have a property:\npublic list<String> names { get; set; }\n\nHow can I generate and handle a custom Event for arguments sake called 'onNamesChanged' whenever a name gets added to the list?\n"
},
{
"from": "gpt",
"value": "To implement a custom event that trigger... |
Working on a project that parses a log of events, and then updates a model based on properties of those events. I've been pretty lazy about "getting it done" and more concerned about upfront optimization, lean code, and proper design patterns. Mostly a self-teaching experiment. I am interested in what patterns more exp... | It sounds like you are dealing with a complex system, and finding the right architectural pattern can be challenging, especially with so many event types and properties. Given the requirements and the issues you've faced, I would recommend exploring the following patterns and approaches:
### 1. **Event Sourcing and Co... | 10,307 | [
{
"from": "human",
"value": "Working on a project that parses a log of events, and then updates a model based on properties of those events. I've been pretty lazy about \"getting it done\" and more concerned about upfront optimization, lean code, and proper design patterns. Mostly a self-teaching experiment... |
For example, I am trying to get a min date, a max date, and a sum in different instances. I am trying to avoid hard coding a SQL string or looping through an IList to get these values.
| To achieve the goal of obtaining a minimum date, maximum date, and a sum from a dataset without hard coding SQL strings or looping through a list, you can use LINQ (Language Integrated Query) in C#.
Here's how you can do that assuming you have a collection of objects that contain properties for date and a numeric val... | 24,769 | [
{
"from": "human",
"value": "For example, I am trying to get a min date, a max date, and a sum in different instances. I am trying to avoid hard coding a SQL string or looping through an IList to get these values.\n"
},
{
"from": "gpt",
"value": "To achieve the goal of obtaining a minimum date, ... |
I'm looking for an easy way to debug RESTful services. For example, most webapps can be debugged using your average web browser. Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.
I am not looking to automate tests. I'd like to run new services through a qui... | Debugging RESTful services can be accomplished easily using several tools and techniques that allow you to send various types of HTTP requests, including PUT, DELETE, and POST. Here are some popular options that can help you perform quick sanity checks on your services without writing your own client:
### 1. **Postman... | 21,709 | [
{
"from": "human",
"value": "I'm looking for an easy way to debug RESTful services. For example, most webapps can be debugged using your average web browser. Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.\nI am not looking to automate tests. ... |
I am trying to link to a file that has the '#' character in via a window.open() call. The file does exist and can be linked to just fine using a normal anchor tag.
I have tried escaping the '#' character with '%23' but when the window.open(myurl) gets processed, the '%23' becomes '%2523'. This tells me that my url st... | It seems like you're encountering an issue with the way URLs are being handled in JavaScript, particularly with the `#` character. When you call `window.open()`, the URL is being encoded twice, which causes the `#` to become `%2523` instead of the desired `%23`.
Here are a few methods you can try to work around this i... | 23,406 | [
{
"from": "human",
"value": "I am trying to link to a file that has the '#' character in via a window.open() call. The file does exist and can be linked to just fine using a normal anchor tag.\nI have tried escaping the '#' character with '%23' but when the window.open(myurl) gets processed, the '%23' beco... |
By default, copying from the command prompt will prompt you to overwrite files that already exist in the target location.
You can add "/Y" to say "Yes to all" replacements.
But how can you say "No to all" ?
In other words, I want to copy everything from one directory that does not already exist in the target.
The close... | To copy files from one directory to another without overwriting existing files in the target directory, you can use the `XCOPY` command with the `/D` option. However, since you want to avoid overwriting files entirely (including checking their modification dates), you'll need to use a combination of `ROBOCOPY` or `XCOP... | 21,115 | [
{
"from": "human",
"value": "By default, copying from the command prompt will prompt you to overwrite files that already exist in the target location.\nYou can add \"/Y\" to say \"Yes to all\" replacements.\nBut how can you say \"No to all\" ?\nIn other words, I want to copy everything from one directory th... |
Is is possible to write MS SQL Server add-in? I'm thinking of some application integrated with database server available form SQL Server Enterprise Manager.
| Yes, it is possible to create add-ins or extensions for Microsoft SQL Server, although the approach may vary depending on what exactly you want to achieve. Microsoft SQL Server Management Studio (SSMS) is the primary tool for managing SQL Server databases, and it supports extensibility through a couple of different mea... | 24,692 | [
{
"from": "human",
"value": "Is is possible to write MS SQL Server add-in? I'm thinking of some application integrated with database server available form SQL Server Enterprise Manager.\n"
},
{
"from": "gpt",
"value": "Yes, it is possible to create add-ins or extensions for Microsoft SQL Server,... |
It seems like each body section in an axapta report can only print columns from a single table(consistantly). For instance:
I have a report that has the following tables: SalesLine, InventTable and CustTable. Then I would like to print columns from each of this tables on the same row. It seems like I can do this whe... | In Microsoft Dynamics AX (often referred to as Axapta), reporting can indeed be tricky when it comes to printing data from multiple tables in a single body section. However, there are some strategies you can use to achieve this in a more efficient and cleaner way. Here are a few suggestions:
### 1. **Use a Data Source... | 23,976 | [
{
"from": "human",
"value": "It seems like each body section in an axapta report can only print columns from a single table(consistantly). For instance:\nI have a report that has the following tables: SalesLine, InventTable and CustTable. Then I would like to print columns from each of this tables on the ... |
I need to access some members marked internal that are declared in a third party assembly.
I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. However, these properties return types that are also internal and declared i... | Accessing internal members of a third-party assembly typically requires the use of reflection or the `InternalsVisibleTo` attribute if you have control over the assembly. If you do not have control over the third-party assembly and you are limited to reflection, you can retrieve internal properties and their values, ev... | 20,513 | [
{
"from": "human",
"value": "I need to access some members marked internal that are declared in a third party assembly.\nI would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. However, these properties return t... |
Instead of arranging controls on a winform form by specifying pixel locations, I'd like to lay it out similar to the way you'd layout a form in html. This would make it scale better (for larger fonts etc).
Does anyone know of a layout library that allows you to define the form in xml and lay it out similar to html?
| Yes, there are several ways to achieve a layout in Windows Forms that resembles HTML layout, allowing for more responsive design and scalability. Here are a couple of approaches you might consider:
### 1. **Use of TableLayoutPanel**
The built-in `TableLayoutPanel` control allows you to create a grid layout similar to ... | 13,794 | [
{
"from": "human",
"value": "Instead of arranging controls on a winform form by specifying pixel locations, I'd like to lay it out similar to the way you'd layout a form in html. This would make it scale better (for larger fonts etc).\nDoes anyone know of a layout library that allows you to define the form... |
I have a data warehouse containing typical star schemas, and a whole bunch of code which does stuff like this (obviously a lot bigger, but this is illustrative):
SELECT cdim.x
,SUM(fact.y) AS y
,dim.z
FROM fact
INNER JOIN conformed_dim AS cdim
ON cdim.cdim_dim_id = fact.cdim_dim_id
INNER JOIN nonconformed_d... | Your approach of creating a view like `MODEL_SYSTEM_1` to simplify queries that access your star schema does offer some advantages, but there are also some considerations to keep in mind. Let's break down your questions and observations:
### 1. Performance Considerations
- **View Performance:** While views can provid... | 17,629 | [
{
"from": "human",
"value": "I have a data warehouse containing typical star schemas, and a whole bunch of code which does stuff like this (obviously a lot bigger, but this is illustrative):\nSELECT cdim.x\n ,SUM(fact.y) AS y\n ,dim.z\nFROM fact\nINNER JOIN conformed_dim AS cdim\n ON cdim.cdim_dim_... |
I have currently an installed pgsql instance that is running on port 1486. I want to change this port to 5433, how should I proceed for this?
| To change the port on which your PostgreSQL instance is running, you'll need to modify the PostgreSQL configuration file. Here's how you can do this step-by-step:
1. **Locate the Configuration File**: The main configuration file for PostgreSQL is usually called `postgresql.conf`. The location of this file can vary bas... | 24,427 | [
{
"from": "human",
"value": "I have currently an installed pgsql instance that is running on port 1486. I want to change this port to 5433, how should I proceed for this?\n"
},
{
"from": "gpt",
"value": "To change the port on which your PostgreSQL instance is running, you'll need to modify the P... |
A team member has run into an issue with an old in-house system where a user double-clicking on a link on a web page can cause two requests to be sent from the browser resulting in two database inserts of the same record in a race condition; the last one to run fails with a primary key violation. Several solutions and... | The issue you've encountered with duplicate requests leading to primary key violations is a common problem in web applications. Let's consider the options already discussed and introduce some additional approaches that might help mitigate the problem.
### Existing Options Analysis:
1. **Disable the link on first clic... | 19,112 | [
{
"from": "human",
"value": "A team member has run into an issue with an old in-house system where a user double-clicking on a link on a web page can cause two requests to be sent from the browser resulting in two database inserts of the same record in a race condition; the last one to run fails with a prim... |
With the code, forms and data inside the same database I am wondering what are the best practices to design a suite of tests for a Microsoft Access application (say for Access 2007).
One of the main issues with testing forms is that only a few controls have a hwnd handle and other controls only get one they have focus,... | Testing a Microsoft Access application, especially one that involves forms and user interactions, can indeed pose unique challenges due to the way Access handles its UI components. Here are some best practices and strategies to design a comprehensive testing suite for an Access application:
### 1. **Unit Testing of Co... | 14,456 | [
{
"from": "human",
"value": "With the code, forms and data inside the same database I am wondering what are the best practices to design a suite of tests for a Microsoft Access application (say for Access 2007).\nOne of the main issues with testing forms is that only a few controls have a hwnd handle and ot... |
Can anyone recommend a lightweight JavaScript XML-RPC library?
After researching this a while ago, I couldn't find anything I was comfortable with, so I kinda ended up writing my own.
However, maybe that was stupid, as there must be something suitable out there!?
My own pseudo-library is mainly missing a way to turn an... | There are a few lightweight JavaScript libraries that can handle XML-RPC requests and responses. Here are some options that you might find useful:
1. **xmlrpc.js**:
- This is a simple and lightweight XML-RPC library for JavaScript. It supports both client-side and server-side usage.
- GitHub: [xmlrpc.js](https:/... | 22,468 | [
{
"from": "human",
"value": "Can anyone recommend a lightweight JavaScript XML-RPC library?\nAfter researching this a while ago, I couldn't find anything I was comfortable with, so I kinda ended up writing my own.\nHowever, maybe that was stupid, as there must be something suitable out there!?\nMy own pseud... |
I am trying to make this feature available, maybe in an apache .htaccess file.
| If you're looking to implement a feature in an Apache web server using the `.htaccess` file, you'll need to specify exactly what feature or functionality you want to enable. The `.htaccess` file is a powerful tool that allows you to configure various aspects of your web server, including URL rewriting, access control, ... | 18,911 | [
{
"from": "human",
"value": "I am trying to make this feature available, maybe in an apache .htaccess file.\n"
},
{
"from": "gpt",
"value": "If you're looking to implement a feature in an Apache web server using the `.htaccess` file, you'll need to specify exactly what feature or functionality y... |
How would I write a Perl CGI script that receives a file via a HTTP post and saves that to the file system?
| Writing a Perl CGI script to handle file uploads via HTTP POST and saving the file to the file system involves a few key steps. Below is a simple example that demonstrates how to do this.
### Prerequisites:
1. Ensure that the `CGI` module is installed (it comes by default with Perl).
2. Ensure that the web server is c... | 14,816 | [
{
"from": "human",
"value": "How would I write a Perl CGI script that receives a file via a HTTP post and saves that to the file system?\n"
},
{
"from": "gpt",
"value": "Writing a Perl CGI script to handle file uploads via HTTP POST and saving the file to the file system involves a few key steps... |
I am looking for a reliable technique for adding Ajax to a working ASP.NET MVC application. I want to use jQuery, and understand how to use the AJAX functionality from jQuery.
What I need to know is how I should write my controller so that I can run the site without JavaScript, but at the same time make AJAX calls pos... | To integrate jQuery AJAX functionality into your ASP.NET MVC application while ensuring that your application remains fully functional without JavaScript, you can follow a few straightforward principles. The key is to ensure your controllers can handle both standard requests and AJAX requests, rendering views when nece... | 17,378 | [
{
"from": "human",
"value": "I am looking for a reliable technique for adding Ajax to a working ASP.NET MVC application. I want to use jQuery, and understand how to use the AJAX functionality from jQuery. \nWhat I need to know is how I should write my controller so that I can run the site without JavaScript... |
ToolStripItems show Active highlighting when you mouse over them, even if the form they are in is not in focus. They do not, however, show their tooltips, unless the form is focused. I have seen the ToolStrip 'click-though' hack. Anyone know how to make a ToolStripButton show its tooltip when its parent form is n... | To achieve the behavior of showing tooltips for a `ToolStripButton` even when its parent form is not in focus, you can override the default tooltip behavior by handling the `MouseHover` event for the `ToolStripButton`. By default, tooltips are tied to the focus state of the form, but you can manually trigger the toolti... | 25,119 | [
{
"from": "human",
"value": "ToolStripItems show Active highlighting when you mouse over them, even if the form they are in is not in focus. They do not, however, show their tooltips, unless the form is focused. I have seen the ToolStrip 'click-though' hack. Anyone know how to make a ToolStripButton s... |
In a Visio ShapeSheet, one can add actions. I want to create an action that updates the value of another cell (the position of a control). How can one do that? Does it need a separate macro, or can it be specified directly? And how?
| In Visio, you can create actions in a ShapeSheet that can update the value of another cell, such as the position of a control, without the need for a separate macro. You can specify this directly using formulas in the ShapeSheet.
Here’s how you can set this up:
1. **Open the ShapeSheet**: Right-click on the shape you... | 25,376 | [
{
"from": "human",
"value": "In a Visio ShapeSheet, one can add actions. I want to create an action that updates the value of another cell (the position of a control). How can one do that? Does it need a separate macro, or can it be specified directly? And how?\n"
},
{
"from": "gpt",
"value": "I... |
How to add a click event listener to my custom control made with wxWidgets? The custom control uses wxWindow as the base. On the event list I see
wxEVT_LEFT_DOWN
wxEVT_LEFT_UP
wxEVT_LEFT_DCLICK
wxEVT_MIDDLE_DOWN
wxEVT_MIDDLE_UP
wxEVT_MIDDLE_DCLICK
wxEVT_RIGHT_DOWN
wxEVT_RIGHT_UP
wxEVT_RIGHT_DCLICK
wxEVT_MOTION
wxE... | In wxWidgets, you can respond to mouse click events by binding to the appropriate mouse button events such as `wxEVT_LEFT_DOWN`, `wxEVT_LEFT_UP`, and others. While there isn't a specific `wxEVT_LEFT_CLICK` event, you can emulate the behavior of a click by combining these events. The typical way to detect a mouse click ... | 13,383 | [
{
"from": "human",
"value": "How to add a click event listener to my custom control made with wxWidgets? The custom control uses wxWindow as the base. On the event list I see \nwxEVT_LEFT_DOWN \nwxEVT_LEFT_UP \nwxEVT_LEFT_DCLICK\nwxEVT_MIDDLE_DOWN\nwxEVT_MIDDLE_UP \nwxEVT_MIDDLE_DCLICK\nwxEVT_RIGHT_DOWN \nw... |
I'm running some JMeter tests against a Java process to determine how responsive a web application is under load (500+ users). JMeter will give the response time for each web request, and I've written a script to ping the Tomcat Manager every X seconds which will get me the current size of the JVM heap.
I'd like to col... | To collect CPU utilization as a percentage of CPU time used since the last sample, similar to what `top` shows, you can use a combination of the `ps` command and a bit of arithmetic to calculate the difference between the CPU time used in successive samples.
Here’s a shell script that does this:
```bash
#!/bin/bash
... | 19,039 | [
{
"from": "human",
"value": "I'm running some JMeter tests against a Java process to determine how responsive a web application is under load (500+ users). JMeter will give the response time for each web request, and I've written a script to ping the Tomcat Manager every X seconds which will get me the curr... |
Is there a way to step through a .bat script? The thing is, I have a build script , which calls a lot of other scripts, and I would like to see what is the order in which they are called, so that I may know where exactly I have to go about and add my modifications.
| Yes, you can step through a `.bat` script and observe the order in which the commands are executed. Here are a few methods you can use to achieve that:
### 1. **Use Echo Commands**
You can modify your batch script to include `echo` statements before each command. This will help you visualize the flow of execution in t... | 23,509 | [
{
"from": "human",
"value": "Is there a way to step through a .bat script? The thing is, I have a build script , which calls a lot of other scripts, and I would like to see what is the order in which they are called, so that I may know where exactly I have to go about and add my modifications.\n"
},
{
... |
I have a MenuBar setup with YUI's MenuBar widget, and I have a YAHOO.util.KeyListener attached to document to get quick keyboard access to the menus and sub-menu items (e.g. 's' to open the Setup menu). The problem is that the keylistener will still fire when a user is in an input element. For example, a user might b... | Disabling the key listener when an input element is focused and enabling it when the input loses focus is a common approach to solving this problem. Here’s how you can implement this using YUI’s `KeyListener` and a basic event listener for focus and blur events on input elements.
### Implementation Steps:
1. **Create... | 21,205 | [
{
"from": "human",
"value": "I have a MenuBar setup with YUI's MenuBar widget, and I have a YAHOO.util.KeyListener attached to document to get quick keyboard access to the menus and sub-menu items (e.g. 's' to open the Setup menu). The problem is that the keylistener will still fire when a user is in an in... |
I have a DataGridView control on a form in a manged c# project. (.net 2.0)
When I use the scroll button on my mouse and then click a cell and click the escape button or select another cell the grid will reposition it self. But if i use the scrollbar on the control, this behavior does not happen.
Have anyone seen behav... | The behavior you are experiencing with the `DataGridView` control in .NET 2.0, where it repositions itself when scrolling with the mouse wheel but does not do so when scrolling using the scrollbar, is not uncommon and can be attributed to how `DataGridView` handles focus and selection events in different scrolling scen... | 20,965 | [
{
"from": "human",
"value": "I have a DataGridView control on a form in a manged c# project. (.net 2.0) \nWhen I use the scroll button on my mouse and then click a cell and click the escape button or select another cell the grid will reposition it self. But if i use the scrollbar on the control, this behavi... |
I deploy a webapp on two different containers (Tomcat and Jetty), but their default servlets for serving the static content have a different way of handling the URL structure I want to use (details).
I am therefore looking to include a small servlet in the webapp to serve its own static content (images, CSS, etc.). The... | To create a simple servlet for serving static content while fulfilling your requirements, you can implement a custom `HttpServlet`. Below is a sample implementation that includes the handling for `If-Modified-Since`, as well as a basic structure for supporting Gzip encoding and ETags.
### Custom Static Content Servlet... | 19,371 | [
{
"from": "human",
"value": "I deploy a webapp on two different containers (Tomcat and Jetty), but their default servlets for serving the static content have a different way of handling the URL structure I want to use (details).\nI am therefore looking to include a small servlet in the webapp to serve its o... |
I'd like to be able to switch the sound output source in Mac OS X without any GUI interaction.
There are tools to do control the sound output, such as SoundSource and an applescript to open the preferences dialog.
What I am looking for is something that switches the preference instantly, like SoundSource but it has to ... | It sounds like you've already made great progress by creating a command-line application to switch audio outputs on macOS. If you're looking for a simple way to switch between audio output sources via a script or command-line tool without GUI interaction, here are a few options you can consider, including the one you'v... | 20,044 | [
{
"from": "human",
"value": "I'd like to be able to switch the sound output source in Mac OS X without any GUI interaction.\nThere are tools to do control the sound output, such as SoundSource and an applescript to open the preferences dialog.\nWhat I am looking for is something that switches the preference... |
I have two drop down menus that I want populated with identical data depending on what is selected on the parent drop down menu. Right now, I am using a javascript library that populates one child drop down menu based on a parent, but I need to have two drop down menus populated simultaneously.
This javascript library ... | To populate two drop-down menus based on a selection from a parent drop-down menu, you will need to modify your JavaScript code a bit. Since you're already using the `PrintOptions` function from the library you mentioned, it sounds like you might just need to call this function with the appropriate parameters for both ... | 18,709 | [
{
"from": "human",
"value": "I have two drop down menus that I want populated with identical data depending on what is selected on the parent drop down menu. Right now, I am using a javascript library that populates one child drop down menu based on a parent, but I need to have two drop down menus populated... |
When debugging an application in Visual Studio, there are 2 options for breaking on exceptions. Break as soon as an exception is thrown, and breaking only when an exception isn't caught. This works fine when developing desktop applications. However, when developing ASP.NET applications, all exceptions are eventually ca... | In Visual Studio, the behavior you’re experiencing with ASP.NET applications can indeed be affected by the way exceptions are handled in the IIS process. By default, unhandled exceptions in an ASP.NET application are caught by the ASP.NET runtime, and as a result, the debugger may not break as expected unless you confi... | 21,663 | [
{
"from": "human",
"value": "When debugging an application in Visual Studio, there are 2 options for breaking on exceptions. Break as soon as an exception is thrown, and breaking only when an exception isn't caught. This works fine when developing desktop applications. However, when developing ASP.NET appli... |
Has Object Prevalance mechanisms been used in an actual Production system? I'm referring to something like Prevayler or Madeleine
The only thing I've found is Instiki, a wiki engine. But since they started they've switched to SQLite. (The actual instiki page is down)
| Object prevalence mechanisms like Prevayler and Madeleine are indeed less common in production systems compared to more mainstream persistence solutions like relational databases. However, there have been some instances and projects that have explored or utilized these concepts.
1. **Prevayler**: Prevayler was designe... | 24,085 | [
{
"from": "human",
"value": "Has Object Prevalance mechanisms been used in an actual Production system? I'm referring to something like Prevayler or Madeleine\nThe only thing I've found is Instiki, a wiki engine. But since they started they've switched to SQLite. (The actual instiki page is down)\n"
},
... |
I am not the most experienced GUI programmer, so bear with me here. I have a custom list view. I would like to be able to drag a row from the ListView to another control on a form. I know how to catch events that are fired when an object is dragged to a control, but I am not sure how to make a row itself draggable. ... | To implement drag-and-drop functionality for a custom ListView row in a Windows Forms application, you can follow these steps to make a row draggable and allow it to be dropped onto another control. Here's a basic example using C#:
1. **Enable Drag-and-Drop**: First, ensure that the controls involved are set up to han... | 20,347 | [
{
"from": "human",
"value": "I am not the most experienced GUI programmer, so bear with me here. I have a custom list view. I would like to be able to drag a row from the ListView to another control on a form. I know how to catch events that are fired when an object is dragged to a control, but I am not ... |
A while ago I noticed I don't have a magnifying-glass next to my datatables. I used to have it, and somehow, sometime, it disappeared...
Has anyone seen this happen? Do you know how to help me view my datatables again?
Update: I'm still clueless about this. Could anyone point me in some direction, where should I even... | It sounds like you were experiencing an issue with the DataTable visualizers in Visual Studio 2005, which is not uncommon for older versions of the IDE. Since you've found the solution, it would be beneficial to share it for others who might face the same issue.
If you're still willing to provide insight into how you... | 27,277 | [
{
"from": "human",
"value": "A while ago I noticed I don't have a magnifying-glass next to my datatables. I used to have it, and somehow, sometime, it disappeared...\nHas anyone seen this happen? Do you know how to help me view my datatables again? \nUpdate: I'm still clueless about this. Could anyone poin... |
I'm matching identifiers, but now I have a problem: my identifiers are allowed to contain unicode characters. Therefore the old way to do things is not enough:
t_IDENTIFIER = r"[A-Za-z](\\.|[A-Za-z_0-9])*"
In my markup language parser I match unicode characters by allowing all the characters except those I explicitly ... | To create a regex that matches Unicode characters while excluding ASCII characters and specific numeric characters, you'll need to take advantage of Python's Unicode support. Given your requirement for identifiers that can include a wide range of Unicode characters, including various symbols but excluding numbers, you'... | 24,222 | [
{
"from": "human",
"value": "I'm matching identifiers, but now I have a problem: my identifiers are allowed to contain unicode characters. Therefore the old way to do things is not enough:\nt_IDENTIFIER = r\"[A-Za-z](\\\\.|[A-Za-z_0-9])*\"\n\nIn my markup language parser I match unicode characters by allowi... |
I'm just starting to wean myself from ASP.NET UpdatePanels. I'm using jQuery and jTemplates to bind the results of a web service to a grid, and everything works fine.
Here's the thing: I'm trying to show a spinner GIF while the table is being refreshed (à la UpdateProgress in ASP.NET) I've got it all working, except t... | It sounds like you're experiencing an issue where the animation of the spinner GIF is not rendering correctly while the AJAX call and data binding are taking place. This is a common problem, particularly in older browsers like IE7, where the UI may not be updated until JavaScript execution is complete.
Here are a few ... | 21,772 | [
{
"from": "human",
"value": "I'm just starting to wean myself from ASP.NET UpdatePanels. I'm using jQuery and jTemplates to bind the results of a web service to a grid, and everything works fine. \nHere's the thing: I'm trying to show a spinner GIF while the table is being refreshed (à la UpdateProgress in ... |
I am using the JQuery form plugin (http://malsup.com/jquery/form/) to handle the ajax submission of a form. I also have JQuery.Validate (http://docs.jquery.com/Plugins/Validation) plugged in for my client side validation.
What I am seeing is that the validation fails when I expect it to however it does not stop the for... | The issue you're experiencing is due to how jQuery Validate and jQuery Form Plugin work together. By default, the jQuery Form Plugin submits the form as soon as it is called, without checking if the form is valid. To achieve the desired behavior—preventing the form from submitting when validation fails—you need to ensu... | 11,216 | [
{
"from": "human",
"value": "I am using the JQuery form plugin (http://malsup.com/jquery/form/) to handle the ajax submission of a form. I also have JQuery.Validate (http://docs.jquery.com/Plugins/Validation) plugged in for my client side validation.\nWhat I am seeing is that the validation fails when I exp... |
I have a Dictionary where I hold data for movieclips, and I want the data to be garbage collected if I stop using the movieclips. I'm using the weak keys parameters, and it works perfectly with other data, however I've run into a problem.
This code works great:
var mc = new MovieClip();
var dic = new Dictionary(true);... | The behavior you are experiencing with the `Dictionary` using weak keys in ActionScript is influenced by how garbage collection works in combination with object references. Let's break down the problem.
### Explanation of the Behavior:
1. **Weak References**: A `Dictionary` with weak keys allows the keys (in your cas... | 21,239 | [
{
"from": "human",
"value": "I have a Dictionary where I hold data for movieclips, and I want the data to be garbage collected if I stop using the movieclips. I'm using the weak keys parameters, and it works perfectly with other data, however I've run into a problem. \nThis code works great:\nvar mc = new M... |
I am a newbie to WPF and have a couple of questions about WPF and Windows Forms integration.
I have an existing Visual C# Windows Forms application. I would like to integrate it with a WPF window, that can be shown on a button click. This was not possible as WPF expects the calling thread to be a STAThread and by de... | Integrating WPF with an existing Windows Forms application can be a bit tricky due to the threading model differences between the two frameworks. Let’s address your questions:
### 1) Can we make a call to a WPF window/control without marking the Main as an STAThread?
In order to create and show a WPF window, you must... | 21,719 | [
{
"from": "human",
"value": "I am a newbie to WPF and have a couple of questions about WPF and Windows Forms integration.\nI have an existing Visual C# Windows Forms application. I would like to integrate it with a WPF window, that can be shown on a button click. This was not possible as WPF expects the c... |
What is the best plugin for Rails that gzips my webpage output?
Edit:
The company I am hosting with has stated they will not install mod_deflate.
| If you're using Ruby on Rails and your hosting provider does not support `mod_deflate` for gzip compression, you can implement gzip compression directly in your Rails application. One of the most popular options for enabling gzip compression is using the built-in `Rack::Deflater` middleware, which is available by defau... | 25,363 | [
{
"from": "human",
"value": "What is the best plugin for Rails that gzips my webpage output?\nEdit:\nThe company I am hosting with has stated they will not install mod_deflate.\n"
},
{
"from": "gpt",
"value": "If you're using Ruby on Rails and your hosting provider does not support `mod_deflate`... |
What are the best practices for naming unit test classes and test methods?
This was discussed on SO before, at What are some popular naming conventions for Unit Tests?
I don't know if this is a very good approach, but currently in my testing projects, I have one-to-one mappings between each production class and a test ... | Naming conventions for unit test classes and methods are crucial for readability, maintainability, and ease of understanding. Your current approach of mapping production classes to test classes and naming test methods descriptively is a solid foundation. Here are some best practices to enhance your naming conventions:
... | 21,143 | [
{
"from": "human",
"value": "What are the best practices for naming unit test classes and test methods?\nThis was discussed on SO before, at What are some popular naming conventions for Unit Tests?\nI don't know if this is a very good approach, but currently in my testing projects, I have one-to-one mapping... |
I was reading this answer previously and it got me interested in purchasing a Nintendo DS Lite for learning to program embedded devices. Before I go out and splurge on a DS I had a few questions:
Are there any restrictions on what you can program? The post I indicated earlier seemed to say there weren't, but clarific... | It's great that you're interested in programming and considering the Nintendo DS Lite as a platform for learning embedded programming. Here's a breakdown of your questions:
1. **Are there any restrictions on what you can program?**
- When developing for the Nintendo DS, there are generally no official restrictions ... | 21,432 | [
{
"from": "human",
"value": "I was reading this answer previously and it got me interested in purchasing a Nintendo DS Lite for learning to program embedded devices. Before I go out and splurge on a DS I had a few questions:\n\nAre there any restrictions on what you can program? The post I indicated earlie... |
I basically want to run all JUnit unit tests in my IntelliJ IDEA project (excluding JUnit integration tests), using the static suite() method of JUnit. Why use the static suite() method? Because I can then use IntelliJ IDEA's JUnit test runner to run all unit tests in my application (and easily exclude all integration ... | To dynamically collect all unit test classes that extend `TestCase`, while excluding any classes with names ending in "IntegrationTest", you can use Java's reflection capabilities. Here's how you can modify the `getUnitTestClasses` method to achieve this:
1. You will need to scan your classpath to find all test classe... | 22,612 | [
{
"from": "human",
"value": "I basically want to run all JUnit unit tests in my IntelliJ IDEA project (excluding JUnit integration tests), using the static suite() method of JUnit. Why use the static suite() method? Because I can then use IntelliJ IDEA's JUnit test runner to run all unit tests in my applica... |
I want to create a simple box with a header bar containing a title and some tool buttons. I have the following markup:
<div style="float:left">
<div style="background-color:blue; padding: 1px; height: 20px;">
<div style="float: left; background-color:green;">title</div>
<div style="float: right; bac... | The issue you're experiencing with Internet Explorer 7 (IE7) is likely due to its handling of floats and the box model. To ensure compatibility across browsers, particularly with older versions like IE7, it's best to use a more structured and semantically correct approach. Here’s how you can modify your markup and styl... | 23,154 | [
{
"from": "human",
"value": "I want to create a simple box with a header bar containing a title and some tool buttons. I have the following markup:\n<div style=\"float:left\">\n <div style=\"background-color:blue; padding: 1px; height: 20px;\">\n <div style=\"float: left; background-color:green;\"... |
My InstallShield 2009 basic MSI project installs pretty slowly. We have a 65MB .msi and a 110MB .cab. The project was upgraded from IS12, using which it took about half as long to install.
Did the 2009 upgrade make some default modifications that I can reverse? Are there any general optimizations that can speed up ba... | Upgrading to a newer version of InstallShield can sometimes lead to changes in the default configuration or behavior that may affect installation speed. Here are several suggestions and optimizations you can apply to speed up your InstallShield 2009 Basic MSI project:
### 1. **Review Standard Actions**
Ensure that y... | 21,815 | [
{
"from": "human",
"value": "My InstallShield 2009 basic MSI project installs pretty slowly. We have a 65MB .msi and a 110MB .cab. The project was upgraded from IS12, using which it took about half as long to install.\nDid the 2009 upgrade make some default modifications that I can reverse? Are there any ... |
I have code to create another "row" (div with inputs) on a button click. I am creating new input elements and everything works fine, however, I can't find a way to access these new elements.
Example: I have input element (name_1 below). Then I create another input element (name_2 below), by using the javascript's cre... | Your code to create new elements dynamically looks mostly correct, but there are a few things to ensure that your new input elements are accessible after they are created. Let's go through your code and correct any issues.
### Key Points
1. **Ensure Unique IDs**: Make sure that each input has a unique ID. If `id` is ... | 20,642 | [
{
"from": "human",
"value": "I have code to create another \"row\" (div with inputs) on a button click. I am creating new input elements and everything works fine, however, I can't find a way to access these new elements.\nExample: I have input element (name_1 below). Then I create another input element (... |
I know that to change the index page for rails I need to do three things: delete the index.html, do something with routes.rb, and probably make an action that the route will point to. It's the details that I am a little fuzzy on :-)
| Certainly! Here’s a step-by-step guide to changing the index page in a Ruby on Rails application:
### Step 1: Delete the default `index.html`
If you have a `public/index.html` file that is generated by Rails, you can delete it to avoid it being served as the default page. You can do this by running:
```bash
rm publi... | 23,397 | [
{
"from": "human",
"value": "I know that to change the index page for rails I need to do three things: delete the index.html, do something with routes.rb, and probably make an action that the route will point to. It's the details that I am a little fuzzy on :-)\n"
},
{
"from": "gpt",
"value": "... |
What's the easiest way to remove last row from the text file using SQL Server Integration Services?
Thanks.
| Removing the last row from a text file using SQL Server Integration Services (SSIS) can be accomplished by following these general steps:
### 1. **Read the File**
- Use a **Flat File Source** to read the contents of the text file.
### 2. **Count Rows**
- Use a **Row Count** transformation to count the number of... | 22,594 | [
{
"from": "human",
"value": "What's the easiest way to remove last row from the text file using SQL Server Integration Services?\nThanks.\n"
},
{
"from": "gpt",
"value": "Removing the last row from a text file using SQL Server Integration Services (SSIS) can be accomplished by following these ge... |
Apart from just inserting and parsing text into a blank Word field, is there any way to programmatically build user-defined fields and field codes into my own templates with VBA? Furthermore, is there a way to make these fields show up in the list of available fields?
| Yes, you can programmatically build user-defined fields and field codes in your Word templates using VBA. Additionally, you can make these fields available in the list of available fields, but this typically involves using custom document properties or content controls rather than directly manipulating field codes.
He... | 23,180 | [
{
"from": "human",
"value": "Apart from just inserting and parsing text into a blank Word field, is there any way to programmatically build user-defined fields and field codes into my own templates with VBA? Furthermore, is there a way to make these fields show up in the list of available fields?\n"
},
... |
Any idea on how to unit test the views in ASP.NET MVC?
I am sick of encountering the yellow screen of death when I launch my MVC project just because I forget to update the views when one of the Action methods of my controller changes name.
| Unit testing views in ASP.NET MVC can be a bit tricky because views are tightly coupled with the Razor view engine and the MVC framework. However, you can still implement strategies to ensure your views are functioning as expected and reduce the chances of encountering issues like the "yellow screen of death". Here are... | 19,822 | [
{
"from": "human",
"value": "Any idea on how to unit test the views in ASP.NET MVC?\nI am sick of encountering the yellow screen of death when I launch my MVC project just because I forget to update the views when one of the Action methods of my controller changes name.\n"
},
{
"from": "gpt",
"v... |
Here's the deal. Is there a way to have strings tokenized in a line based on multiple regexes?
One example:
I have to get all href tags, their corresponding text and some other text based on a different regex.
So I have 3 expressions and would like to tokenize the line and extract tokens of text matching every expressi... | Yes, you can certainly tokenize strings based on multiple regex patterns in Python or Perl, and do it all within a single language. Below are a few methods to achieve this in Python:
### 1. Using `re` module
Python's built-in `re` module allows you to define multiple regex patterns and extract the required tokens. Yo... | 21,108 | [
{
"from": "human",
"value": "Here's the deal. Is there a way to have strings tokenized in a line based on multiple regexes?\nOne example:\nI have to get all href tags, their corresponding text and some other text based on a different regex.\nSo I have 3 expressions and would like to tokenize the line and ex... |
I'm pretty used to how to do CVS merges in Eclipse, and I'm otherwise happy with the way that both Subclipse and Subversive work with the SVN repository, but I'm not quite sure how to do merges properly.
When I do a merge, it seems to want to stick the merged files in a seperate directory in my project rather than ove... | Merging in SVN (Subversion) can differ significantly from CVS, especially regarding how conflicts and merges are handled. Here’s a step-by-step guide on how to perform merges properly in Eclipse using either Subclipse or Subversive:
### General Steps for Merging in SVN:
1. **Update Your Working Copy**:
- Before st... | 11,347 | [
{
"from": "human",
"value": "I'm pretty used to how to do CVS merges in Eclipse, and I'm otherwise happy with the way that both Subclipse and Subversive work with the SVN repository, but I'm not quite sure how to do merges properly. \nWhen I do a merge, it seems to want to stick the merged files in a sepera... |
I was loading an image resource with the following code and it works fine from my dev environment (netbeans) but threw an exception as soon as it ran from the desktop.
new ImageIcon(Images.class.getResource("images/highlighter24.gif"));
I traced it down to my file having different case than in the code.
Fine, my bad, ... | The inconsistency you're experiencing with the file loading in your code is due to the way file systems handle case sensitivity. Here's the breakdown:
1. **File System Differences**:
- Windows file systems (like NTFS) are case-insensitive by default. This means that `highlighter24.gif` and `Highlighter24.gif` are ... | 24,199 | [
{
"from": "human",
"value": "I was loading an image resource with the following code and it works fine from my dev environment (netbeans) but threw an exception as soon as it ran from the desktop.\nnew ImageIcon(Images.class.getResource(\"images/highlighter24.gif\"));\n\nI traced it down to my file having d... |
For personal projects I use Git for SCM, but at work we use TFS. One thing that I like about Git is that it allows a person to easily squash all the changes made in a branch when pulling the changes back into the master branch.
The benefit of this is that if their is anything wrong with the changes they can easily be ... | In TFS (Team Foundation Server), while the model of version control differs from Git, you can still achieve some equivalent functionality, but it won't be as straightforward as in Git.
### Squashing Commits in TFS
TFS does not have a built-in concept equivalent to Git's "squashing" commits. However, you can achieve a ... | 24,721 | [
{
"from": "human",
"value": "For personal projects I use Git for SCM, but at work we use TFS. One thing that I like about Git is that it allows a person to easily squash all the changes made in a branch when pulling the changes back into the master branch.\nThe benefit of this is that if their is anything ... |
I have a Person model that has a foreign key relationship to Book, which has a number of fields, but I'm most concerned about author (a standard CharField).
With that being said, in my PersonAdmin model, I'd like to display book.author using list_display:
class PersonAdmin(admin.ModelAdmin):
list_display = ['book.a... | In Django's `admin` site, the `list_display` attribute expects a list of field names or methods that belong to the model you're administering. Since `book` is a foreign key relationship on the `Person` model, you can display related fields using the double underscore (`__`) syntax.
To display the `author` field from t... | 24,731 | [
{
"from": "human",
"value": "I have a Person model that has a foreign key relationship to Book, which has a number of fields, but I'm most concerned about author (a standard CharField).\nWith that being said, in my PersonAdmin model, I'd like to display book.author using list_display:\nclass PersonAdmin(adm... |
If I have an Address class that implements IEditableObject, I might have EndEdit implementation like this:
public void EndEdit()
{
// BeginEdit would have set _editInProgress and save to *Editing fields
if (_editInProgress)
{
_line1 = _line1Editing;
_line2 = _line2Editing;
_city = _c... | To address the problem of managing state during the editing process, especially when exceptions can occur and could lead to a partial update of the object state, you need to implement a mechanism that allows for safe state management. The `IEditableObject` interface is commonly used in data binding scenarios, where you... | 18,598 | [
{
"from": "human",
"value": "If I have an Address class that implements IEditableObject, I might have EndEdit implementation like this:\npublic void EndEdit()\n{\n // BeginEdit would have set _editInProgress and save to *Editing fields\n if (_editInProgress)\n {\n _line1 = _line1Editing;\n ... |
Is there a acts as taggable solution out there for merb users already?
| As of my last update in October 2023, there wasn't a widely recognized or specifically maintained "taggable" solution for Merb, which is a Ruby web framework that has since evolved into the more popular Ruby on Rails. However, if you are looking to implement tagging functionality in a Merb application, you might consid... | 26,635 | [
{
"from": "human",
"value": "Is there a acts as taggable solution out there for merb users already?\n"
},
{
"from": "gpt",
"value": "As of my last update in October 2023, there wasn't a widely recognized or specifically maintained \"taggable\" solution for Merb, which is a Ruby web framework tha... |
Is there a way of programmatically determining a rough geographical position of a mobile phone using J2ME application, for example determining the current cell? This question especially applies to non-GPS enabled devices.
I am not looking for a set of geographical coordinates, but an ability for a user to define locat... | Determining the geographical position of a mobile phone using J2ME (Java 2 Micro Edition) applications, especially for non-GPS enabled devices, can be challenging. J2ME itself does not provide a standard way to access cellular network information that could be used to estimate location. However, there are a few approac... | 23,118 | [
{
"from": "human",
"value": "Is there a way of programmatically determining a rough geographical position of a mobile phone using J2ME application, for example determining the current cell? This question especially applies to non-GPS enabled devices. \nI am not looking for a set of geographical coordinates,... |
Greetings.
I'm trying to implement some multithreaded code in an application. The purpose of this code is to validate items that the database gives it. Validation can take quite a while (a few hundred ms to a few seconds), so this process needs to be forked off into its own thread for each item.
The database may give i... | Your implementation of the `ItemValidationService` class has some fundamental concepts right, but there are several areas where improvements can be made, especially regarding thread safety, performance, and code maintainability. Let's go through some potential issues and enhancements.
### Issues and Recommendations
1... | 21,392 | [
{
"from": "human",
"value": "Greetings.\nI'm trying to implement some multithreaded code in an application. The purpose of this code is to validate items that the database gives it. Validation can take quite a while (a few hundred ms to a few seconds), so this process needs to be forked off into its own thr... |
I'm setting up a new project using CruiseControl.net 1.4.
I see from ccnet contributions
that there are two options for a subversion repository number labeller - a
feature that I would really like to make use of.
1) SVNLabeller available from jcxsoftware
and
2) Svnrevisionlabeller available from google code
My problem ... | Setting up a subversion repository number labeller in CruiseControl.NET (CCNet) can indeed enhance your project management capabilities. Here are some options to consider for both SVNLabeller and Svnrevisionlabeller:
### 1. SVNLabeller from JCX Software
Although you mentioned having trouble finding documentation for ... | 23,719 | [
{
"from": "human",
"value": "I'm setting up a new project using CruiseControl.net 1.4.\nI see from ccnet contributions\nthat there are two options for a subversion repository number labeller - a\nfeature that I would really like to make use of.\n1) SVNLabeller available from jcxsoftware\nand\n2) Svnrevision... |
What won't plugins wont work with vb c# studio express?
| Visual Studio Express editions, including Visual Studio Express for Windows Desktop (which supports VB and C#), have certain limitations compared to the full versions of Visual Studio. As such, some plugins and extensions may not be compatible with these Express editions. Here are a few general points about what won't ... | 25,914 | [
{
"from": "human",
"value": "What won't plugins wont work with vb c# studio express?\n"
},
{
"from": "gpt",
"value": "Visual Studio Express editions, including Visual Studio Express for Windows Desktop (which supports VB and C#), have certain limitations compared to the full versions of Visual S... |
How do I easily undo a git rebase? A lengthy manual method is:
checkout the commit parent to both of the branches
create and checkout a temporary branch
cherry-pick all commits by hand
reset the faulty rebased branch to point to the temporary branch
In my current situation, this works because I can easily spot commit... | If you've performed a rebase in Git and want to undo it, there’s a much simpler and safer way to do so, especially if you haven't yet pushed the rebased branch to a remote repository. Here are a couple of methods you can use:
### Method 1: Using `git reflog`
1. **Check Git Reflog**: The reflog keeps a history of all ... | 20,382 | [
{
"from": "human",
"value": "How do I easily undo a git rebase? A lengthy manual method is:\n\ncheckout the commit parent to both of the branches\ncreate and checkout a temporary branch\ncherry-pick all commits by hand\nreset the faulty rebased branch to point to the temporary branch\n\nIn my current situat... |
I am looking hard at the basic principles of storing the state of an executing program to disk, and bringing it back in again. In the current design that we have, each object (which is a C-level thingy with function pointer lists, kind of low-level home-made object-orientation -- and there are very good reasons for do... | The challenge you're facing revolves around saving and restoring the state of a running program, particularly one that employs a thread model. You have a clear, structured approach for object state serialization, but including active thread state adds significant complexity.
### Key Considerations
1. **Active vs. Rea... | 21,299 | [
{
"from": "human",
"value": "I am looking hard at the basic principles of storing the state of an executing program to disk, and bringing it back in again. In the current design that we have, each object (which is a C-level thingy with function pointer lists, kind of low-level home-made object-orientation ... |
I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text box). However that's not always the case... | The issue you're experiencing with text boxes not allowing you to exit after modifying their values could be related to a few different factors, especially since the behavior seems to vary depending on the objects being edited. Here are some suggestions to help troubleshoot and potentially resolve the issue:
### 1. Ch... | 23,713 | [
{
"from": "human",
"value": "I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text... |
I'd like to create a basic "Hello World" style application for the IPhone using Java - can anyone tell me how?
| Creating an iPhone application using Java is not the standard approach, as iOS applications are primarily developed using Swift or Objective-C in Xcode. However, if you want to use Java, you can utilize frameworks or tools that allow Java code to be compiled or converted to native iOS code. One popular option is **Code... | 23,278 | [
{
"from": "human",
"value": "I'd like to create a basic \"Hello World\" style application for the IPhone using Java - can anyone tell me how?\n"
},
{
"from": "gpt",
"value": "Creating an iPhone application using Java is not the standard approach, as iOS applications are primarily developed using... |
i was just about to finish up my project and install it as a windows service. I have the installer, etc. - everything i need. When i went to choose Application Type, Windows service does not appear as an option.
Here is the kicker. When I dev in VB.NET, i have that option. The project mentioned above is in c#.
Also... | It sounds like you're experiencing an issue with project types in Visual Studio for C#. Here are a few steps and checks you can perform to resolve the issue:
1. **Check Visual Studio Version**: Ensure you are using a version of Visual Studio that supports Windows Service projects for C#. Most recent versions do, but i... | 25,167 | [
{
"from": "human",
"value": "i was just about to finish up my project and install it as a windows service. I have the installer, etc. - everything i need. When i went to choose Application Type, Windows service does not appear as an option.\nHere is the kicker. When I dev in VB.NET, i have that option. ... |
In win32, are thread input queues global to all applications?
So Application A can attach itself to application B's thread input queue?
| In the Win32 API, thread input queues are not global to all applications. Each thread has its own input queue that is private to that thread. This means that an application cannot directly attach itself to another application's thread input queue.
When a thread processes input, it has its own queue where input events ... | 26,889 | [
{
"from": "human",
"value": "In win32, are thread input queues global to all applications? \nSo Application A can attach itself to application B's thread input queue?\n"
},
{
"from": "gpt",
"value": "In the Win32 API, thread input queues are not global to all applications. Each thread has its ow... |
I'm trying to change the background color of single cell be based on a string value and wanted to see this expression code.
I was reading a similar question here, but this is not the exact same issue I'm trying to solve.
| To change the background color of a single cell in Excel based on a string value, you can use Conditional Formatting. Here are the steps to achieve this:
### Steps to Change Cell Background Color Based on String Value:
1. **Select the Cell:**
Click on the cell you want to format. If you want to format multiple cel... | 25,294 | [
{
"from": "human",
"value": "I'm trying to change the background color of single cell be based on a string value and wanted to see this expression code.\nI was reading a similar question here, but this is not the exact same issue I'm trying to solve.\n"
},
{
"from": "gpt",
"value": "To change th... |
I would like to write some scripts in python that do some automated changes to source code. If the script determines it needs to change the file I would like to first check it out of perforce. I don't care about checking in because I will always want to build and test first.
| To automate changes to source code in Python and check out files from Perforce, you can use the `P4Python` library, which is an interface for the Perforce version control system. Below is a step-by-step guide to get you started.
### Step 1: Install P4Python
You need to have Perforce and P4Python installed on your sys... | 22,334 | [
{
"from": "human",
"value": "I would like to write some scripts in python that do some automated changes to source code. If the script determines it needs to change the file I would like to first check it out of perforce. I don't care about checking in because I will always want to build and test first. \n"... |
If I have the following:
Public Class Product
Public Id As Integer
Public Name As String
Public AvailableColours As List(Of Colour)
Public AvailableSizes As List(Of Size)
End Class
and I want to get a list of products from the database and display them on a page along with their available sizes and col... | The decision between using a single method to retrieve all product information in one go or having multiple methods to retrieve data can depend on various factors, including performance, code maintainability, and the expected frequency of database access patterns.
### Option A: Single Method with a Single View
This ap... | 18,626 | [
{
"from": "human",
"value": "If I have the following:\nPublic Class Product\n Public Id As Integer\n Public Name As String\n Public AvailableColours As List(Of Colour)\n Public AvailableSizes As List(Of Size)\nEnd Class\n\nand I want to get a list of products from the database and display them o... |
I am parsing an RSS feed from the following URL:
http://rss.sciam.com/ScientificAmerican-Global?format=xml
// $xml_text is filled with the contents read from the URL
$xml_parser = xml_parser_create();
$res = xml_parse($xml_parser, $xml_text);
if (!$res) {
$error =
xml_error_string(xml_get_error_code($xml_parser)... | It seems that the issue you're encountering is related to how the server responds based on the user-agent of the request. When you make a request to the RSS feed using PHP's built-in functions, the server may not recognize it as a valid request, causing it to return an incomplete or incorrect response.
To work around ... | 21,002 | [
{
"from": "human",
"value": "I am parsing an RSS feed from the following URL:\nhttp://rss.sciam.com/ScientificAmerican-Global?format=xml\n// $xml_text is filled with the contents read from the URL\n$xml_parser = xml_parser_create();\n$res = xml_parse($xml_parser, $xml_text);\n\nif (!$res) {\n $error =\n ... |
Is it legal to more or less "copy" (or euphemistically, be very "inspired by") the idea and UI of a copyrighted program? This question popped in my mind when looking at "Things" which is a Mac-only program.
How legal would it be for someone to make a Windows version of this program with a basically identical UI design ... | The question of whether it is legal to create a program that is "inspired by" an existing copyrighted program, such as Things, is a complex issue that involves several areas of intellectual property law, including copyright and trade dress.
### Copyright
1. **Copyright Protection**: Copyright protects the expression ... | 25,726 | [
{
"from": "human",
"value": "Is it legal to more or less \"copy\" (or euphemistically, be very \"inspired by\") the idea and UI of a copyrighted program? This question popped in my mind when looking at \"Things\" which is a Mac-only program.\nHow legal would it be for someone to make a Windows version of th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.