instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I created a single page (with code behind .vb) and created Public intFileID As Integer in the Page load I check for the querystring and assign it if available or set intFileID = 0. Public intFileID As Integer = 0 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Pa...
To persist the `intFileID` value across postbacks without using HTML elements (which could be modified by the user), your approach using ViewState is a good choice. You've correctly updated your `Page_Load` method to utilize ViewState for this purpose. Here’s a concise version of your implementation, along with some ad...
21,980
[ { "from": "human", "value": "I created a single page (with code behind .vb) and created Public intFileID As Integer\nin the Page load I check for the querystring and assign it if available or set intFileID = 0.\nPublic intFileID As Integer = 0\n\nProtected Sub Page_Load(ByVal sender As Object, ByVal e As Sy...
I'm connecting to a web service hosted by a third-party provider. I've added a service reference in my project to the web service, VS has generated all the references and classes needed. I'm connecting with this piece of code (client name and methods anonymized): using (var client = new Client()) { try { ...
The error message you are encountering is related to a type conflict in the XML serialization when using Windows Communication Foundation (WCF) to consume a SOAP web service. Here’s a breakdown of what might be going wrong and how you can address it: ### Possible Causes: 1. **Return Type Conflict**: The exception ind...
20,191
[ { "from": "human", "value": "I'm connecting to a web service hosted by a third-party provider. I've added a service reference in my project to the web service, VS has generated all the references and classes needed.\nI'm connecting with this piece of code (client name and methods anonymized):\n using (var c...
This question is pretty much the same as this .Net question exept for java. How do you escape the %1$ characters in a java String.format? THe reason I need to do this is that I'm building up a string that will later have more info inserted into it. I've thought of having one of the args just be "%1$" but that doesn't s...
In Java, when using `String.format`, you need to escape special characters, including the `%` symbol, if you want it to be treated as a literal character rather than a format specifier. To do this, you can escape the `%` character by doubling it: `%%`. If you want to include the characters `%1$` in your format string...
24,231
[ { "from": "human", "value": "This question is pretty much the same as this .Net question exept for java.\nHow do you escape the %1$ characters in a java String.format?\nTHe reason I need to do this is that I'm building up a string that will later have more info inserted into it. I've thought of having one o...
I'm writing a config file and I need to define if the process expects a windows format file or a unix format file. I've got a copy of the expected file - is there a way I can check if it uses \n or \r\n without exiting emacs?
Yes, you can check the line endings of a file in Emacs without exiting. Here’s how you can do it: 1. **Open the file in Emacs**. 2. **Enable the `whitespace` mode**: You can enable whitespace mode by typing `M-x whitespace-mode`. This will highlight different types of whitespace, including line endings. 3. **Look for ...
23,653
[ { "from": "human", "value": "I'm writing a config file and I need to define if the process expects a windows format file or a unix format file. I've got a copy of the expected file - is there a way I can check if it uses \\n or \\r\\n without exiting emacs?\n" }, { "from": "gpt", "value": "Yes, ...
In many languages, assignments are legal in conditions. I never understood the reason behind this. Why would you write: if (var1 = var2) { ... } instead of: var1 = var2; if (var1) { ... } ?
The use of assignment within conditional statements (like `if (var1 = var2)`) is a feature found in several programming languages, such as C, C++, and Java. There are a few reasons and contexts where this can be useful, although it can also lead to bugs if not used carefully. ### Reasons for Allowing Assignment in Con...
19,841
[ { "from": "human", "value": "In many languages, assignments are legal in conditions. I never understood the reason behind this. Why would you write:\nif (var1 = var2) {\n ...\n}\n\ninstead of:\nvar1 = var2;\nif (var1) {\n ...\n}\n\n?\n" }, { "from": "gpt", "value": "The use of assignment withi...
How do you handle cookies and with webrequest/response as in a proxy? I'm not sure how to do this...or if I even can.
Handling cookies in a web proxy involves intercepting HTTP requests and responses and managing cookie headers appropriately. Below is a basic guide on how to achieve this, including the relevant steps and code snippets. ### Basic Steps to Handle Cookies in a Web Proxy 1. **Intercept Requests and Responses**: Your pro...
18,503
[ { "from": "human", "value": "How do you handle cookies and with webrequest/response as in a proxy?\nI'm not sure how to do this...or if I even can.\n" }, { "from": "gpt", "value": "Handling cookies in a web proxy involves intercepting HTTP requests and responses and managing cookie headers appro...
Since generics were introduced, Class is parametrized, so that List.class produces Class<List>. This is clear. What I am not able to figure out is how to get a instance of Class of type which is parametrized itself, i.e. Class<List<String>>. Like in this snippet: public class GenTest { static <T> T instantiate(Clas...
In Java, due to type erasure, it's not possible to create a `Class` object that directly represents a parameterized type (like `Class<List<String>>`) at runtime. When you compile your code, the generic type parameters (`<String>` in your case) are removed, leaving just the raw type (in this case, `ArrayList`). This mea...
18,712
[ { "from": "human", "value": "Since generics were introduced, Class is parametrized, so that List.class produces Class<List>. This is clear.\nWhat I am not able to figure out is how to get a instance of Class of type which is parametrized itself, i.e. Class<List<String>>. Like in this snippet:\npublic class ...
Sorry for the long question title. I guess I'm on to a loser on this one but on the off chance. Is it possible to make the calculation of a calculated field in a table the result of an aggregate function applied to a field in another table. i.e. You have a table called 'mug', this has a child called 'color' (which make...
In a relational database, you can achieve the desired behavior by using aggregate functions, but calculated fields that dynamically reflect such aggregates aren't directly supported in the way you've described—especially if you're looking for real-time updates without triggers or procedural logic. Here's a breakdown of...
19,802
[ { "from": "human", "value": "Sorry for the long question title.\nI guess I'm on to a loser on this one but on the off chance.\nIs it possible to make the calculation of a calculated field in a table the result of an aggregate function applied to a field in another table.\ni.e.\nYou have a table called 'mug'...
What is the best breakdown of responsibility when using a virtual grid and the MVP pattern in a winforms application. including: Getting callbacks from the grid on user changed cell updates Callback from the grid to set the style and value of a cell given a row and column
When using a virtual grid in a WinForms application along with the Model-View-Presenter (MVP) pattern, it's crucial to delineate responsibilities among the components clearly. Here's a breakdown of responsibilities that should facilitate effective interaction between the grid, the model, and the presenter while adherin...
18,021
[ { "from": "human", "value": "What is the best breakdown of responsibility when using a virtual grid and the MVP pattern in a winforms application.\nincluding:\n\nGetting callbacks from the grid on user changed cell updates\nCallback from the grid to set the style and value of a cell given a row and column\n...
Can anyone recommend a .NET winforms control that offers similar functionality to the address bar in Windows Explorer, auto-completing file paths? I'm not too bothered about Vista-style breadcrumbs - quite happy with a simple XP-style textbox-only appearance, but I'd like it to offer auto-complete suggestions based on ...
If you're looking for a .NET WinForms control that mimics the functionality of the address bar in Windows Explorer with auto-complete capabilities for file paths, you might want to consider the following options: 1. **TextBox with AutoCompleteSource**: - You can use a standard `TextBox` control and enable its `Auto...
23,688
[ { "from": "human", "value": "Can anyone recommend a .NET winforms control that offers similar functionality to the address bar in Windows Explorer, auto-completing file paths?\nI'm not too bothered about Vista-style breadcrumbs - quite happy with a simple XP-style textbox-only appearance, but I'd like it to...
Is there a way to get the key (or id) value of a db.ReferenceProperty, without dereferencing the actual entity it points to? I have been digging around - it looks like the key is stored as the property name preceeded with an _, but I have been unable to get any code working. Examples would be much appreciated. Thank...
In Google App Engine's datastore for Python (using the `db` module), when you are working with a `ReferenceProperty`, the actual value stored in the property is a `db.Key` object, which you can access without dereferencing the entity. You are correct that the key for the reference property is prefixed with an undersco...
22,952
[ { "from": "human", "value": "Is there a way to get the key (or id) value of a db.ReferenceProperty, without dereferencing the actual entity it points to? I have been digging around - it looks like the key is stored as the property name preceeded with an _, but I have been unable to get any code working. E...
I have a RDLC report which has a table, calling a subreport N times. This works perfectly in the control viewer and when I export to PDF. Yet when I export to Excel, I get the following error: Subreports within table/matrix cells are ignored. Does anyone know why this occurs only within the Excel export? And is t...
The error message "Subreports within table/matrix cells are ignored" occurs during Excel exports from RDLC reports due to Excel's limitations in handling subreports nested within a table or matrix. While subreports work in other formats (like PDF), Excel has restrictions because it expects a flat structure of data rath...
22,003
[ { "from": "human", "value": "I have a RDLC report which has a table, calling a subreport N times. This works perfectly in the control viewer and when I export to PDF. Yet when I export to Excel, I get the following error:\n\nSubreports within table/matrix cells\n are ignored.\n\nDoes anyone know why this...
In the STL library some containers have iterators and it is commonly held that they are a superior way of iterating through these containers rather than simple for loops e.g. for ( int i=0; i < vecVector.size(); i++ ) { .. } Can anyone tell me why and in what cases I should use iterators and in what cases the code s...
Using iterators in STL (Standard Template Library) provides several advantages over using simple for loops with indices, especially when iterating through containers like `std::vector`, `std::list`, `std::deque`, and others. Here are some reasons why iterators are often preferred, as well as cases when it may be approp...
18,321
[ { "from": "human", "value": "In the STL library some containers have iterators and it is commonly held that they are a superior way of iterating through these containers rather than simple for loops e.g.\nfor ( int i=0; i < vecVector.size(); i++ )\n{\n\n..\n\n}\n\nCan anyone tell me why and in what cases I ...
I'd like to package a C# windows service project so it can be easily installed by anyone without having to use installutil command prompt utility? Is there an easy way to configure a Visual Studio setup project to do that similar to how winforms applications are installed?
Yes, you can package a C# Windows Service project to be easily installed without requiring users to use the `installutil` command. One common approach is to create a Visual Studio Installer project that can create an MSI installer. This installer can automate the installation and uninstallation process of your Windows ...
16,780
[ { "from": "human", "value": "I'd like to package a C# windows service project so it can be easily installed by anyone without having to use installutil command prompt utility? Is there an easy way to configure a Visual Studio setup project to do that similar to how winforms applications are installed?\n" ...
I'm curious if there are any texts that can be recommended that actually discuss application architecture best practices with respect to the use of Silverlight in web applications. ASP.Net would be preferable, but I'm open to consideration of other technologies also.
Silverlight was a framework developed by Microsoft for building rich internet applications, allowing developers to create interactive user experiences on the web. However, it has been largely phased out, and support for it has diminished significantly. Despite that, there are still a few resources that discuss applicat...
20,566
[ { "from": "human", "value": "I'm curious if there are any texts that can be recommended that actually discuss application architecture best practices with respect to the use of Silverlight in web applications. ASP.Net would be preferable, but I'm open to consideration of other technologies also.\n" }, {...
in Config.groovy I see this: // set per-environment serverURL stem for creating absolute links environments { production { grails.serverURL = "http://www.changeme.com" } } what is the correct way to access that at runtime?
In a Grails application, you can access configuration values defined in `Config.groovy` at runtime using the `grailsApplication` or through the `grailsApplication.config` object. For example, if you want to access the `grails.serverURL` configuration property that you've defined for the production environment, you can ...
20,945
[ { "from": "human", "value": "in Config.groovy I see this:\n// set per-environment serverURL stem for creating absolute links\nenvironments {\n production {\n grails.serverURL = \"http://www.changeme.com\"\n }\n}\n\nwhat is the correct way to access that at runtime?\n" }, { "from": "gpt"...
I am a college student at a school that teaches mainly in Java. One of the strong points of Java, which I quite enjoy, is the large collection of libraries. What makes these libraries especially useful is the extensive documentation and organization presented via JavaDoc. Are there any library collections for Common Li...
Yes, Common Lisp does have a variety of libraries, and while it may not have the same extensive ecosystem as Java, there are definitely useful libraries and documentation tools available. ### Common Lisp Libraries 1. **Quicklisp**: This is a popular library manager for Common Lisp, which allows you to easily install,...
23,019
[ { "from": "human", "value": "I am a college student at a school that teaches mainly in Java. One of the strong points of Java, which I quite enjoy, is the large collection of libraries. What makes these libraries especially useful is the extensive documentation and organization presented via JavaDoc. Are th...
I've been getting some OutOfMemory errors lately in my application. Is it possible to detect ahead of time when the virtual machine is running low on memory? In other words to preemptively deal with OutOfMemory errors before they actually occur?
Yes, it is possible to detect low memory conditions in your application, which can help you to preemptively deal with `OutOfMemoryError` exceptions. Here are some strategies and techniques you can use to monitor memory usage and take action before running out of memory: 1. **Memory Monitoring**: You can use Java's `Me...
23,933
[ { "from": "human", "value": "I've been getting some OutOfMemory errors lately in my application. Is it possible to detect ahead of time when the virtual machine is running low on memory? In other words to preemptively deal with OutOfMemory errors before they actually occur?\n" }, { "from": "gpt", ...
Should I be using this method of throwing errors: if (isset($this->dbfields[$var])) { return $this->dbfields[$var]; } else { throw new FieldNotFoundException($var); } or this style: try { return $this->dbfields[$var]; } catch (Exception $e) { throw new FieldNotFoundException($var); } ...or something e...
In your scenario, where you want to check if a variable exists in an array and throw a custom exception if it doesn't, the first method is preferable: ```php if (isset($this->dbfields[$var])) { return $this->dbfields[$var]; } else { throw new FieldNotFoundException($var); } ``` ### Reasons to Prefer the First...
25,145
[ { "from": "human", "value": "Should I be using this method of throwing errors:\nif (isset($this->dbfields[$var])) {\n return $this->dbfields[$var];\n} else {\n throw new FieldNotFoundException($var);\n}\n\nor this style:\ntry {\n return $this->dbfields[$var];\n} catch (Exception $e) {\n throw ne...
I have problems opening a berkeley db in python using bdtables. As bdtables is used by the library I am using to access the database, I need it to work. The problem seems to be that the db environment I am trying to open (I got a copy of the database to open), is version 4.4 while libdb is version 4.6. I get the follow...
The error you're encountering is due to the version mismatch between the Berkeley DB library you're using (version 4.6) and the database files created with an older version (4.4). In general, Berkeley DB databases are not backwards compatible, which means that a database created with an older version cannot be accessed...
20,009
[ { "from": "human", "value": "I have problems opening a berkeley db in python using bdtables. As bdtables is used by the library I am using to access the database, I need it to work.\nThe problem seems to be that the db environment I am trying to open (I got a copy of the database to open), is version 4.4 wh...
I know that this is a simple question for PHP guys but I don't know the language and just need to do a simple "get" from another web page when my page is hit. i.e. signal the other page that this page has been hit. EDIT: curl is not available to me.
If you need to make an HTTP GET request from your PHP page without using cURL, you can use the built-in `file_get_contents` function. This function can fetch the contents of a web page as a string. Here's an example of how to use `file_get_contents` to perform a simple GET request when your page is accessed: ```php <...
21,816
[ { "from": "human", "value": "I know that this is a simple question for PHP guys but I don't know the language and just need to do a simple \"get\" from another web page when my page is hit. i.e. signal the other page that this page has been hit.\nEDIT: curl is not available to me.\n" }, { "from": "g...
Lets say on MySQL database (if it matters).
Sure! Please go ahead and ask your question about MySQL, and I'll do my best to assist you!
26,994
[ { "from": "human", "value": "Lets say on MySQL database (if it matters).\n" }, { "from": "gpt", "value": "Sure! Please go ahead and ask your question about MySQL, and I'll do my best to assist you!" } ]
I have the following code: MemoryStream foo(){ MemoryStream ms = new MemoryStream(); // write stuff to ms return ms; } void bar(){ MemoryStream ms2 = foo(); // do stuff with ms2 return; } Is there any chance that the MemoryStream that I've allocated will somehow fail to be disposed of later? ...
The concern raised by your peer is valid. In .NET, the `MemoryStream` class implements the `IDisposable` interface, which means that it holds onto unmanaged resources that need to be cleaned up. If you do not explicitly dispose of the `MemoryStream`, those resources may not be released immediately, leading to memory le...
23,440
[ { "from": "human", "value": "I have the following code:\nMemoryStream foo(){\n MemoryStream ms = new MemoryStream();\n // write stuff to ms\n return ms;\n}\n\nvoid bar(){\n MemoryStream ms2 = foo();\n // do stuff with ms2\n return;\n}\n\nIs there any chance that the MemoryStream that I've ...
I recently downloaded the source tarball for a GTK application that I'd like to improve. It uses the standard ./configure and make build sequence. The first time through, configure reported a bunch of unmet build dependencies, such as libgnomeui-2.0. As I usually do, I had to manually go through and find the Debian *...
Yes, there are tools that can help you automatically install the build dependencies for a source tarball in Debian-based systems. Here are a couple of options you can consider: ### 1. `apt-get build-dep` If you have access to a Debian or Ubuntu package repository for the application you are trying to build, you can u...
22,570
[ { "from": "human", "value": "I recently downloaded the source tarball for a GTK application that I'd like to improve. It uses the standard ./configure and make build sequence.\nThe first time through, configure reported a bunch of unmet build dependencies, such as libgnomeui-2.0. As I usually do, I had to...
I'm looking at creating a server in python that I can run, and will work as an SSH server. This will then let different users login, and act as if they'd logged in normally, but only had access to one command. I want to do this so that I can have a system where I can add users to without having to create a system wide ...
To create a lightweight SSH server in Python that restricts users to execute only a specific command (like `/bin/bzr`), you can use the `paramiko` library for handling SSH connections along with a simple authentication mechanism to allow user login without creating system-wide accounts. Below is a basic example of how...
20,400
[ { "from": "human", "value": "I'm looking at creating a server in python that I can run, and will work as an SSH server. This will then let different users login, and act as if they'd logged in normally, but only had access to one command.\nI want to do this so that I can have a system where I can add users ...
int l = strlen(s); warning C4244: '=' : conversion from '__w64 int' to 'int', possible loss of data I need to replace strlen with an inline function int l = new_strlen(s); But how do I portably get the result of the strlen into the int without a warning, and without using pragmas? I can guarantee there aren't more tha...
To replace `strlen` with an inline function and safely convert its return value to an `int` without triggering warnings about potential data loss, you can use a combination of inline functions and C-style casting, which you've noted does work. However, it's important to ensure that the inline function behaves in a way ...
24,566
[ { "from": "human", "value": "int l = strlen(s);\nwarning C4244: '=' : conversion from '__w64 int' to 'int', possible loss of data\nI need to replace strlen with an inline function\nint l = new_strlen(s);\nBut how do I portably get the result of the strlen into the int without a warning, and without using pr...
The TIBCO EMS .NET reference guide says (pg 134) To enable reconnection behavior and fault tolerance, the serverURL parameter must be a comma-separated list of two or more URLs. In a situation with only one server, you may supply two copies of that server’s URL to enable client reconnection (for example, tcp://loca...
In a TIBCO EMS reconnect scenario, the client has a role to play in handling the reconnection process. While the server provides the capability to handle client connections, the client must be configured properly to take advantage of that functionality. Here's how it works in practice: 1. **Connection Configuration**...
23,913
[ { "from": "human", "value": "The TIBCO EMS .NET reference guide says (pg 134)\n\nTo enable reconnection behavior and fault tolerance, the serverURL parameter must be a comma-separated list of two or more URLs. In a situation with only one server, you may supply two copies of that server’s URL to enable cl...
I have a list of States in an ItemsControl, the DataTemplate is a CheckBox. I would like to add a function to select(check) all states. However I need to loop through the CheckBoxs rather then the data items since the checked state is stored in a separate data structure then the list of states the ItemsControl's ItemS...
To implement a "Select All" functionality for an `ItemsControl` with `CheckBox` items while managing the checked states in a separate data structure, you can follow these steps: 1. **Define Your Data Structures:** You'll need a collection for the states and another for the checked states. For example, you might have a...
17,756
[ { "from": "human", "value": "I have a list of States in an ItemsControl, the DataTemplate is a CheckBox. I would like to add a function to select(check) all states. However I need to loop through the CheckBoxs rather then the data items since the checked state is stored in a separate data structure then th...
I have some ksh scripts which I'd like to convert to run with bash instead. Are there any useful on-line resources for this? I'm really looking for a list of differences between the two shells and any gotchas I might encounter, although all information is welcome :-)
Certainly! Converting scripts from KornShell (ksh) to Bash can be straightforward in many cases, but there are notable differences between the two shells. Here are some resources and a summary of key differences that you might find helpful: ### Online Resources 1. **Shell Compatibility Guide** - [Bash Compatibilit...
20,311
[ { "from": "human", "value": "I have some ksh scripts which I'd like to convert to run with bash instead.\nAre there any useful on-line resources for this?\nI'm really looking for a list of differences between the two shells and any gotchas I might encounter, although all information is welcome :-)\n" }, ...
Our graphics person uses Adobe Illustrator and we'd like to use her images inside our WPF application as paths. Is there a way to do this?
Yes, you can use images created in Adobe Illustrator in your WPF application by converting them into a format that WPF can understand. WPF supports vector graphics natively through XAML, and one way to incorporate vector images from Illustrator is to export them as XAML paths. Here’s how you can do this: ### Steps to ...
18,410
[ { "from": "human", "value": "Our graphics person uses Adobe Illustrator and we'd like to use her images inside our WPF application as paths. Is there a way to do this?\n" }, { "from": "gpt", "value": "Yes, you can use images created in Adobe Illustrator in your WPF application by converting the...
What is the best practice for setting up a LAMP server in terms of linux users and groups? If there are multiple sites hosted on the same server, is it best to have a single user that owns all site source files (and uploads) that is in the same group as apache - or to have a different user for each site (so that each ...
Setting up a LAMP server (Linux, Apache, MySQL, PHP) with proper user and group management is critical for security, maintainability, and organization. Here are some best practices to consider, especially if you're hosting multiple sites on the same server: ### 1. User and Group Setup - **Separate Users per Site**: I...
19,010
[ { "from": "human", "value": "What is the best practice for setting up a LAMP server in terms of linux users and groups? If there are multiple sites hosted on the same server, is it best to have a single user that owns all site source files (and uploads) that is in the same group as apache - or to have a di...
In the Java world, there are a few more choices for message queues, but in .Net, there are only a few. When evaluating which one to use, what are some characteristics one should look for? What are the fundamental concepts that make up a reliable message queueing system?
When evaluating message queues in .NET (or any environment), several characteristics are essential to consider for a reliable message queuing system. Here are the key factors to look for: ### 1. **Reliability** - **Durability:** Messages should be persisted to disk to ensure they are not lost in case of a failure. ...
20,136
[ { "from": "human", "value": "In the Java world, there are a few more choices for message queues, but in .Net, there are only a few. When evaluating which one to use, what are some characteristics one should look for? What are the fundamental concepts that make up a reliable message queueing system?\n" }, ...
I have a DataGrid, with an ItemTemplate that has an image and label. In the EditItemTemplate the label is replaced by a textbox. My problem is that the edit template only shows when I click the Edit button the second time. What gives?
The issue you're experiencing with the DataGrid's `EditItemTemplate` only showing when you click the Edit button for the second time might be related to how the binding and state management of the data is being handled in your code. Here are a few things to check to diagnose and fix this behavior: 1. **Binding Mode**:...
18,596
[ { "from": "human", "value": "I have a DataGrid, with an ItemTemplate that has an image and label. In the EditItemTemplate the label is replaced by a textbox. My problem is that the edit template only shows when I click the Edit button the second time. What gives?\n" }, { "from": "gpt", "value...
I have an xml file providing data for a datagrid in Flex 2 that includes an unformatted Price field (ie: it is just a number). Can anyone tell me how I take that datafield and format it - add a currency symbol, put in thousand separators etc. Thanks. S.
To format a Price field in Flex 2 for display in a DataGrid, you can use a combination of a custom formatter and a label function. Here's how to do it step by step: 1. **Create a Custom Formatter**: You can create a function that formats the price values, adding currency symbols and thousand separators. 2. **Use t...
15,326
[ { "from": "human", "value": "I have an xml file providing data for a datagrid in Flex 2 that includes an unformatted Price field (ie: it is just a number). \nCan anyone tell me how I take that datafield and format it - add a currency symbol, put in thousand separators etc.\nThanks.\nS.\n" }, { "from...
As a programmer I found it very hard to use my laptop and workstation with two different input devices, Can anyone suggest a good solution to use single mouse and keyboard to control my two machines I am not looking for a Virtual Machine or RDP solution to see my machines in a single monitor,
Certainly! To control two machines with a single keyboard and mouse, you have a few effective hardware and software solutions to consider. Here are some options: ### Hardware Solutions 1. **KVM Switch (Keyboard, Video, Mouse Switch)**: - A KVM switch allows you to connect multiple computers to a single set of keyb...
16,226
[ { "from": "human", "value": "As a programmer I found it very hard to use my laptop and workstation with two different input devices, Can anyone suggest a good solution to use single mouse and keyboard to control my two machines\nI am not looking for a Virtual Machine or RDP solution to see my machines in a ...
I'd like to zoom and unzoom in ways the base class doesn't support. For instance, upon receiving a double tap.
To implement zooming and unzooming functionality that responds to a double-tap gesture, you'll typically use a combination of gesture recognizers and custom zoom logic. Below is an example of how to achieve this in a Swift-based iOS app using `UIScrollView` for zooming and `UITapGestureRecognizer` for detecting double ...
15,567
[ { "from": "human", "value": "I'd like to zoom and unzoom in ways the base class doesn't support.\nFor instance, upon receiving a double tap.\n" }, { "from": "gpt", "value": "To implement zooming and unzooming functionality that responds to a double-tap gesture, you'll typically use a combination...
I'm using Chris Pederick's Firefox addon "Web Developer 1.1.6". I get this warning when hitting a certain web page on my site: Unknown property 'MozOpacity'. Declaration dropped. What does this mean and how can I fix this on my site?
The warning you're seeing, "Unknown property 'MozOpacity'. Declaration dropped," indicates that the CSS property `MozOpacity` is not recognized by the browser or the specific version of the web standards being validated against. This property was a proprietary CSS extension used primarily in early versions of Firefox t...
23,525
[ { "from": "human", "value": "I'm using Chris Pederick's Firefox addon \"Web Developer 1.1.6\". I get this warning when hitting a certain web page on my site: \n\nUnknown property 'MozOpacity'. Declaration dropped.\n\nWhat does this mean and how can I fix this on my site?\n" }, { "from": "gpt", "...
I have a webpage that redirects to another webpage like this: http://www.myOtherServer.com/Sponsor.php?RedirectPage=http://mylink.com/whereIwasgoingtogo.html Then the Sponsor.php page displays an ad with a link saying "Continue to your page" that links to the passed in RedirectPage. Are there security/spoofing issues...
Yes, the scenario you've described can indeed pose security risks and could be exploited through various forms of attack, particularly phishing or open redirect vulnerabilities. Here are the primary concerns and recommendations to mitigate these risks: ### Security Concerns 1. **Open Redirect Vulnerability**: If the ...
23,231
[ { "from": "human", "value": "I have a webpage that redirects to another webpage like this:\nhttp://www.myOtherServer.com/Sponsor.php?RedirectPage=http://mylink.com/whereIwasgoingtogo.html\n\nThen the Sponsor.php page displays an ad with a link saying \"Continue to your page\" that links to the passed in Red...
How effective is merging when folders and projects have been renamed in your solution?
The effectiveness of merging when folders and projects have been renamed in a solution can vary depending on several factors, including the version control system you are using, how the renaming has been handled, and the specific changes being merged. Here are some key points to consider: 1. **Version Control System (...
20,020
[ { "from": "human", "value": "How effective is merging when folders and projects have been renamed in your solution?\n" }, { "from": "gpt", "value": "The effectiveness of merging when folders and projects have been renamed in a solution can vary depending on several factors, including the version...
Is it possible to see the return value of a method after the line has been run and before the instruction pointer returns to the calling function? I am debugging code I can't modify (read: don't want to re-compile a third party library), and sometimes it jumps to code I don't have source to or the return expression has...
When debugging code where you want to inspect the return value of a method immediately after the line has been executed, but before returning to the calling function, there are a few strategies you could consider, especially in common debugging environments like GDB (GNU Debugger) for C/C++, or similar tools for other ...
22,127
[ { "from": "human", "value": "Is it possible to see the return value of a method after the line has been run and before the instruction pointer returns to the calling function?\nI am debugging code I can't modify (read: don't want to re-compile a third party library), and sometimes it jumps to code I don't h...
How do you get the max value of an enum?
In many programming languages, you can obtain the maximum value of an enum by using different approaches. Below are examples in some commonly used programming languages: ### C# In C#, you can get the maximum value of an enum using `Enum.GetValues` and then finding the maximum: ```csharp using System; public enum My...
19,867
[ { "from": "human", "value": "How do you get the max value of an enum?\n" }, { "from": "gpt", "value": "In many programming languages, you can obtain the maximum value of an enum by using different approaches. Below are examples in some commonly used programming languages:\n\n### C#\n\nIn C#, you...
Can a flash front end talk to a .net backend?
Yes, a Flash frontend can communicate with a .NET backend. Flash, which is often used for creating rich internet applications, can send and receive data to and from a backend server through several methods. The most common way to achieve this is by using HTTP requests, such as GET and POST, to interact with web service...
23,389
[ { "from": "human", "value": "Can a flash front end talk to a .net backend?\n" }, { "from": "gpt", "value": "Yes, a Flash frontend can communicate with a .NET backend. Flash, which is often used for creating rich internet applications, can send and receive data to and from a backend server throug...
I am working on a 2D scrolling game for iPhone. I have a large image background, say 480×6000 pixels, of only a part is visible (exactly one screen’s worth, 480×320 pixels). What is the best way to get such a background on the screen? Currently I have the background split into several textures (to get around the maximu...
To achieve better performance when rendering a large background image in a 2D scrolling game, there are several optimization techniques you can employ. Here are some suggestions: ### 1. Texture Atlases Instead of having your background split into several textures, consider using a texture atlas. This means combining m...
23,181
[ { "from": "human", "value": "I am working on a 2D scrolling game for iPhone. I have a large image background, say 480×6000 pixels, of only a part is visible (exactly one screen’s worth, 480×320 pixels). What is the best way to get such a background on the screen?\nCurrently I have the background split into ...
How can I get MSBuild to evaluate and print in a <Message /> task an absolute path given a relative path? Property Group <Source_Dir>..\..\..\Public\Server\</Source_Dir> <Program_Dir>c:\Program Files (x86)\Program\</Program_Dir> Task <Message Importance="low" Text="Copying '$(Source_Dir.FullPath)' to '$(Program_Dir)'"...
To evaluate and print an absolute path from a relative path in MSBuild, you'll need to use a combination of properties and MSBuild tasks. Unfortunately, the `<Message />` task does not evaluate relative paths into absolute paths directly; you'll need to use the built-in `MSBuild` properties and `Path` functions. Here'...
22,654
[ { "from": "human", "value": "How can I get MSBuild to evaluate and print in a <Message /> task an absolute path given a relative path?\nProperty Group\n<Source_Dir>..\\..\\..\\Public\\Server\\</Source_Dir>\n<Program_Dir>c:\\Program Files (x86)\\Program\\</Program_Dir>\n\nTask\n<Message Importance=\"low\" Te...
If you create a panel on a form and set it to Dock=Top and drop another panel and set its Dock=Fill, it may fill the entire form, ignoring the first panel. Changing the tab order does nothing.
In a Windows Forms application, if you create two panels and set the first panel’s `Dock` property to `Top`, and the second panel’s `Dock` property to `Fill`, the expected behavior is that the first panel will occupy the top of the form, and the second panel will occupy the remaining space below it, effectively filling...
21,992
[ { "from": "human", "value": "If you create a panel on a form and set it to Dock=Top and drop another panel and set its Dock=Fill, it may fill the entire form, ignoring the first panel. Changing the tab order does nothing.\n" }, { "from": "gpt", "value": "In a Windows Forms application, if you cr...
I'm hoping someone has seen this before because I can't for the life of me find the problem. I'm trying to do the old "fix the back button" thing in an application and I think i have a pretty decent approach, the problem is that it relies on the application not calling page_load when you hit back and instead loading t...
It sounds like you're dealing with a tricky caching issue in your ASP.NET application that behaves differently depending on how users navigate to certain pages. There are a few things you could investigate and try to resolve this inconsistency: 1. **Ensure Consistent Navigation**: - Make sure that all navigational ...
19,311
[ { "from": "human", "value": "I'm hoping someone has seen this before because I can't for the life of me find the problem. \nI'm trying to do the old \"fix the back button\" thing in an application and I think i have a pretty decent approach, the problem is that it relies on the application not calling page_...
Okay I'm still learning the ropes with the Entity Framework and I came across one more small issue. When I create my Entity Model from the SQL Server 2008 database it warns me about saving the login information in the connection string in the config file. Initially I wasn't concerned about that so I just left it in the...
When deploying an application that uses Entity Framework with a SQL Server database, it's important to handle your connection strings securely, especially if they contain sensitive information such as usernames and passwords. Here are some alternatives to including login information directly in your connection string: ...
18,822
[ { "from": "human", "value": "Okay I'm still learning the ropes with the Entity Framework and I came across one more small issue.\nWhen I create my Entity Model from the SQL Server 2008 database it warns me about saving the login information in the connection string in the config file. Initially I wasn't con...
When creating a new object that is mapped to one of my SQL Server tables, LINQ inserts a new record into the table when I call SubmitChanges. I want to prevent this, but still need my new object. I know about the custom methods, but is there anyway to disable this behaviour so that it just updates existing records and...
When working with LINQ to SQL, the default behavior when you create a new instance of an entity class (like `MyTableClass`) and call `SubmitChanges()` is to insert a new record in the corresponding database table. If you want to prevent any new records from being inserted while still being able to work with new instanc...
20,035
[ { "from": "human", "value": "When creating a new object that is mapped to one of my SQL Server tables, LINQ inserts a new record into the table when I call SubmitChanges. I want to prevent this, but still need my new object.\nI know about the custom methods, but is there anyway to disable this behaviour so...
Is it possible to read damaged media (cd, hdd, dvd,...) even if windows explorer bombs out? What I mean to ask is, whether there is a set of APIs or something that can access the disk at a very low level (below explorer?) and read whatever can be retrieved even if it is only partial, especially if you can still see the...
Yes, it is possible to access and attempt to read damaged media (like CDs, DVDs, and hard drives) at a lower level than Windows Explorer, using a variety of APIs and tools designed for data recovery. Here are some methods and tools you can consider: ### Low-Level Access Methods 1. **Raw Disk Access**: - You can us...
20,305
[ { "from": "human", "value": "Is it possible to read damaged media (cd, hdd, dvd,...) even if windows explorer bombs out?\nWhat I mean to ask is, whether there is a set of APIs or something that can access the disk at a very low level (below explorer?) and read whatever can be retrieved even if it is only pa...
How can I modify the NSDatePickerElementFlags for the NSDatePicker in row templates for NSDate properties returned by [NSPredicateRowEditorTemplate templatesWithAttributeKeyPaths:inEntityDescription:]? I would like the NSDatePicker to show hrs:minutes as well as the date. Update I've added an answer below, gleaned from...
To modify the `NSDatePickerElementFlags` for an `NSDatePicker` in a row template when using `NSPredicateRowEditorTemplate`, you can customize the attributes of the date picker to show both hours and minutes along with the date. This involves adjusting the flags associated with the date picker. Here’s a general approac...
23,187
[ { "from": "human", "value": "How can I modify the NSDatePickerElementFlags for the NSDatePicker in row templates for NSDate properties returned by [NSPredicateRowEditorTemplate templatesWithAttributeKeyPaths:inEntityDescription:]? I would like the NSDatePicker to show hrs:minutes as well as the date.\nUpdat...
I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service (I CreateService it myself) to supply the logon credentials, but while the function succeeds (returns TRUE), if I try to start the service, it fails with a 1069 (logon failed). If I go into the service manager and modify credenti...
The issue you're encountering with the `ChangeServiceConfig` function seems to be related to how the `strPassword` is being handled or passed in the function call. Although the function returns `TRUE`, it doesn't guarantee that the credentials are being properly set for the service. Here are some potential troubleshoot...
21,584
[ { "from": "human", "value": "I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service (I CreateService it myself) to supply the logon credentials, but while the function succeeds (returns TRUE), if I try to start the service, it fails with a 1069 (logon failed). If I go int...
Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing?
Unit testing PL/SQL can be a bit challenging, but there are several tools and frameworks available that can facilitate this process. Quest Code Tester is indeed one of the more popular options, especially for its user-friendly interface and robust features. Here are some considerations regarding Code Tester and alterna...
22,341
[ { "from": "human", "value": "Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing?\n" }, { "from": "gpt", "v...
I have the following component public class MyTimer : IMyTimer { public MyTimer(TimeSpan timespan){...} } Where timespan should be provided by the property ISettings.MyTimerFrequency. How do I wire this up in windsor container xml? I thought I could do something like this: <component id="settings" ...
You're on the right track, but you're facing a common issue when trying to resolve a property value within Windsor's XML configuration. Windsor doesn't support directly injecting properties through a factory method in the way you've attempted. However, you can use a combination of dependency resolution and custom types...
23,665
[ { "from": "human", "value": "I have the following component \npublic class MyTimer : IMyTimer {\n public MyTimer(TimeSpan timespan){...}\n}\n\nWhere timespan should be provided by the property ISettings.MyTimerFrequency.\nHow do I wire this up in windsor container xml?\nI thought I could do something like ...
Is there a better way to debug JavaScript than MS Script Editor? I am searching for something like Firebug. Firebug Lite doesn't offer this functionality, though. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
Yes, there are several powerful tools for debugging JavaScript beyond MS Script Editor and Firebug Lite. Here are some popular options: 1. **Browser Developer Tools**: Most modern web browsers come with built-in developer tools that provide robust debugging capabilities. Here are some popular ones: - **Google Chro...
19,619
[ { "from": "human", "value": "Is there a better way to debug JavaScript than MS Script Editor? I am searching for something like Firebug. Firebug Lite doesn't offer this functionality, though.\n­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­\n" }, { "from": "gpt", "value": "Yes, there are sever...
I've got a php page which handles requets for file downloads. I need to be able to detect when a file has been downloaded successfully. How can this be done? Perhaps there's some means of detecting this client-side then sending a confirmation down to the server. Thanks. Edit: By handle, I mean that the page is doing so...
Detecting a successful file download in PHP can be challenging because the PHP script essentially sends the file as a stream to the client's browser, and once the file is sent, the server has no inherent way of knowing if the client completed the download or not. However, you can implement a solution that involves a c...
18,379
[ { "from": "human", "value": "I've got a php page which handles requets for file downloads. I need to be able to detect when a file has been downloaded successfully. How can this be done? Perhaps there's some means of detecting this client-side then sending a confirmation down to the server.\nThanks.\nEdit:\...
I'm having an issue with a Flash/Flex erroring in Firefox but not IE. I need to see the error that the Flash/Flex app is getting from the ASP.NET app. Is there any way to debug the response that Flash/Flex is getting?
Yes, there are several ways to debug and view the response that a Flash/Flex application is receiving from an ASP.NET backend. Here are some approaches you can use: ### 1. Use a Proxy Tool One of the most effective methods for inspecting HTTP requests and responses is to use a proxy tool. Tools like Fiddler, Charles ...
17,506
[ { "from": "human", "value": "I'm having an issue with a Flash/Flex erroring in Firefox but not IE. I need to see the error that the Flash/Flex app is getting from the ASP.NET app. Is there any way to debug the response that Flash/Flex is getting?\n" }, { "from": "gpt", "value": "Yes, there are...
what sql query will i need to show the activated server roles in a specific user?
To display the activated server roles for a specific user in SQL Server, you can use the following SQL query: ```sql SELECT r.name AS RoleName FROM sys.server_role_members AS rm JOIN sys.server_principals AS r ON rm.role_principal_id = r.principal_id JOIN sys.server_principals AS p ON rm.member_pri...
25,355
[ { "from": "human", "value": "what sql query will i need to show the activated server roles in a specific user?\n" }, { "from": "gpt", "value": "To display the activated server roles for a specific user in SQL Server, you can use the following SQL query:\n\n```sql\nSELECT \n r.name AS RoleName...
I want to hold a bunch of const char pointers into an std::set container [1]. std::set template requires a comparator functor, and the standard C++ library offers std::less, but its implementation is based on comparing the two keys directly, which is not standard for pointers. I know I can define my own functor and im...
If you want to store `const char*` pointers in an `std::set` and need to use a comparator, the standard library provides a way to do this in a clean and standard-compliant manner. Since you're dealing with static strings and don't want to create `std::string` objects, you can create a comparator that compares the addre...
24,552
[ { "from": "human", "value": "I want to hold a bunch of const char pointers into an std::set container [1]. std::set template requires a comparator functor, and the standard C++ library offers std::less, but its implementation is based on comparing the two keys directly, which is not standard for pointers.\...
I'm developing an embedded system which currently boots linux with console output on serial port 1 (using the console boot param from the boot loader). However, eventually we will be using this serial port. What is the best solution for the kernel console output? /dev/null? Can it be put on a pty somehow so that we...
When developing an embedded system where the primary serial port is eventually needed for communication purposes, there are several options for redirecting the kernel console output without losing access to debugging and log information. Here are a few possible approaches: ### 1. Use /dev/null Redirecting console out...
19,692
[ { "from": "human", "value": "I'm developing an embedded system which currently boots linux with console output on serial port 1 (using the console boot param from the boot loader). However, eventually we will be using this serial port. What is the best solution for the kernel console output? /dev/null? ...
I am about to start on a journey writing a windows forms application that will open a txt file that is pipe delimited and about 230 mb in size. This app will then insert this data into a sql server 2005 database (obviously this needs to happen swiftly). I am using c# 3.0 and .net 3.5 for this project. I am not asking ...
Your project sounds like an interesting challenge! Here are some key considerations and potential pitfalls when writing a Windows Forms application for this task: ### 1. File Handling - **Reading the File**: Given the size of the file (230 MB), it's better to read the file in chunks rather than loading it all into mem...
19,769
[ { "from": "human", "value": "I am about to start on a journey writing a windows forms application that will open a txt file that is pipe delimited and about 230 mb in size. This app will then insert this data into a sql server 2005 database (obviously this needs to happen swiftly). I am using c# 3.0 and .ne...
If I do the following: import subprocess from cStringIO import StringIO subprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\ntwo\nthree\nfour\nfive\nsix\n')).communicate()[0] I get: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/build/toolchain/mac32/python-2.4.3/lib/py...
The issue you're encountering is due to the fact that `subprocess.Popen` expects file-like objects to support the `fileno()` method, which `StringIO` from `cStringIO` does not provide. Instead, you can use the `io` module's `StringIO`, which was introduced in Python 3 and behaves like a file object more closely. If yo...
22,986
[ { "from": "human", "value": "If I do the following:\nimport subprocess\nfrom cStringIO import StringIO\nsubprocess.Popen(['grep','f'],stdout=subprocess.PIPE,stdin=StringIO('one\\ntwo\\nthree\\nfour\\nfive\\nsix\\n')).communicate()[0]\n\nI get:\nTraceback (most recent call last):\n File \"<stdin>\", line 1,...
Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull the weight of an item from the database based on the item's name. I tried using the "?" parameter substitution suggested to prevent SQL injections but it doesn't work. For example, when I use: for item in self.inventory_names: self.cursor....
The issue you're facing is due to how you are passing the parameters to the `execute` method. When you use `?` in the SQL statement, the parameters need to be provided as a sequence (like a list or tuple). In your case, you are passing a single string (`item`), which results in SQLite trying to bind it as multiple para...
22,735
[ { "from": "human", "value": "Using SQLite3 with Python 2.5, I'm trying to iterate through a list and pull the weight of an item from the database based on the item's name.\nI tried using the \"?\" parameter substitution suggested to prevent SQL injections but it doesn't work. For example, when I use:\nfor i...
How do you save data from ExtJS form? Load data from the business layer into form or grid?
In ExtJS, saving data from a form and loading data into a form or grid involves a few key steps, typically interacting with a backend service or business layer through AJAX calls. Here’s how you can achieve both saving and loading data: ### Saving Data from an ExtJS Form 1. **Create the Form**: Set up the ExtJS form ...
20,618
[ { "from": "human", "value": "How do you save data from ExtJS form? Load data from the business layer into form or grid?\n" }, { "from": "gpt", "value": "In ExtJS, saving data from a form and loading data into a form or grid involves a few key steps, typically interacting with a backend service o...
The simple demo below captures what I am trying to do. In the real program, I have to use the object initialiser block since it is reading a list in a LINQ to SQL select expression, and there is a value that that I want to read off the database and store on the object, but the object doesn't have a simple property that...
The approach using fluent interface style extensions is indeed a valid workaround for your situation, particularly when you want to manipulate objects in a more concise way during initialization. To directly address your question about whether it will work in a LINQ query: It won't. LINQ to SQL queries need to be exec...
21,232
[ { "from": "human", "value": "The simple demo below captures what I am trying to do. In the real program, I have to use the object initialiser block since it is reading a list in a LINQ to SQL select expression, and there is a value that that I want to read off the database and store on the object, but the o...
I'm working on a simple 2D game engine in Java, and having no trouble with FSEM, buffer strategies, and so on; my issue is with the mouse cursor. In windowed mode, I can hide the mouse cursor, no problem, by using setCursor() from my JFrame to set a wholly-transparent cursor. However, after a call to device.setFullScre...
It seems like you've encountered a known issue with Java's fullscreen exclusive mode (FSEM) on macOS, particularly in older versions of the JVM. The behavior you're experiencing—where the mouse cursor reappears and cannot be hidden while in FSEM—is not uncommon and can be attributed to platform-specific handling of win...
22,378
[ { "from": "human", "value": "I'm working on a simple 2D game engine in Java, and having no trouble with FSEM, buffer strategies, and so on; my issue is with the mouse cursor. In windowed mode, I can hide the mouse cursor, no problem, by using setCursor() from my JFrame to set a wholly-transparent cursor. Ho...
I've built an installer for my application by hand (don't ask why). And I set up the registry keys for its entry in the add/remove control panel under HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall. And it works fine. I need it to be under HKCU so my installer will run on Vista without asking to be elevated....
When you create a registry entry for your application under `HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall`, it allows the application to show up in the "Add/Remove Programs" (or "Programs and Features") control panel for that particular user. However, since the `HKCU` registry is user-specific, this means t...
23,617
[ { "from": "human", "value": "I've built an installer for my application by hand (don't ask why). And I set up the registry keys for its entry in the add/remove control panel under HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall. And it works fine. I need it to be under HKCU so my installer wi...
I am currently creating an overnight job that calls a Unix script which in turn creates and transfers a file using ftp. I would like to check all possible return codes. The man page for ftp doesn't list return codes. Does anyone know where to find a list? Anyone with experience with this? We have other scripts tha...
When working with FTP in Unix or Linux, the behavior of the command and the return codes can vary depending on the specific implementation of FTP you are using (such as the traditional `ftp`, `lftp`, or other FTP clients). While the `ftp` man page typically does not provide a comprehensive list of exit codes, some comm...
17,090
[ { "from": "human", "value": "I am currently creating an overnight job that calls a Unix script which in turn creates and transfers a file using ftp. I would like to check all possible return codes. The man page for ftp doesn't list return codes. Does anyone know where to find a list? Anyone with experie...
I have an ASP.NET page with a gridview control on it with a CommandButton column with delete and select commands active. Pressing the enter key causes the first command button in the gridview to fire, which deletes a row. I don't want this to happen. Can I change the gridview control in a way that it does not react any...
To prevent the GridView from reacting to the Enter key press, which is causing the first command button (Delete) to fire, you can handle this in JavaScript by overriding the default behavior of the Enter key for the GridView control. Here is one approach to do this. You can add a `KeyPress` event handler on the GridV...
20,541
[ { "from": "human", "value": "I have an ASP.NET page with a gridview control on it with a CommandButton column with delete and select commands active.\nPressing the enter key causes the first command button in the gridview to fire, which deletes a row. I don't want this to happen. Can I change the gridview c...
I have an XML reader on this XML string: <?xml version="1.0" encoding="UTF-8" ?> <story id="1224488641nL21535800" date="20 Oct 2008" time="07:44"> <title>PRESS DIGEST - PORTUGAL - Oct 20</title> <text> <p> LISBON, Oct 20 (Reuters) - Following are some of the main stories in Portuguese newspapers on Monday. Reuters ...
The issue you're facing is due to the structure of the XML. In your XML, the `<text>` element contains child `<p>` elements, and your `story` class does not reflect this structure. Instead of directly mapping `text` to a `string`, you need to create a corresponding class to represent the content of the `<text>` element...
24,054
[ { "from": "human", "value": "I have an XML reader on this XML string:\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<story id=\"1224488641nL21535800\" date=\"20 Oct 2008\" time=\"07:44\">\n<title>PRESS DIGEST - PORTUGAL - Oct 20</title>\n<text>\n<p> LISBON, Oct 20 (Reuters) - Following are some of the ma...
I just had a conversation with my lead developer who disagreed that unit tests are all that necessary or important. In his view, functional tests with a high enough code coverage should be enough since any inner refactorings (interface changes, etc.) will not lead to the tests being needed to be rewritten or looked ove...
It's great that you're engaging in this discussion, as the debate between unit tests and functional tests is a common one in software development. Here are some key reasons why unit tests are essential and the dangers of relying solely on functional tests: ### Advantages of Unit Testing: 1. **Granularity of Testing:*...
21,605
[ { "from": "human", "value": "I just had a conversation with my lead developer who disagreed that unit tests are all that necessary or important. In his view, functional tests with a high enough code coverage should be enough since any inner refactorings (interface changes, etc.) will not lead to the tests b...
If A references assembly B 1.1 and C, and C references B 1.2, how do you avoid assembly conflicts? I naively assumed C's references would be encapsulated away and would not cause any problems, but it appears all the dll's are copied to the bin, which is where the problem occurs. I understand the two ways around this ar...
Assembly conflicts in .NET can be quite challenging, especially when dealing with multiple versions of the same assembly referenced by different projects. Here’s a breakdown of the approaches you mentioned, along with additional considerations and potential solutions. ### 1. GAC (Global Assembly Cache) - **Advantages...
22,199
[ { "from": "human", "value": "If A references assembly B 1.1 and C, and C references B 1.2, how do you avoid assembly conflicts?\nI naively assumed C's references would be encapsulated away and would not cause any problems, but it appears all the dll's are copied to the bin, which is where the problem occurs...
I am working on a web application, where I transfer data from the server to the browser in XML. Since I'm danish, I quickly run into problems with the characters æøå. I know that in html, I use the "&amp;aelig;&amp;oslash;&amp;aring;" for æøå. however, as soon as the chars pass through JavaScript, I get black boxes wit...
It sounds like you've encountered a common issue with character encoding when transferring and displaying special characters in a web application. When working with data that contains special characters, especially when it comes from a database like MySQL, it's important to ensure that all parts of the data handling pr...
15,629
[ { "from": "human", "value": "I am working on a web application, where I transfer data from the server to the browser in XML.\nSince I'm danish, I quickly run into problems with the characters æøå.\nI know that in html, I use the \"&amp;aelig;&amp;oslash;&amp;aring;\" for æøå.\nhowever, as soon as the chars ...
I learned Java in college, and then I was hired by a C# shop and have used that ever since. I spent my first week realizing that the two languages were almost identical, and the next two months figuring out the little differences. For the most part, was I noticing the things that Java had that C# doesn't, and thus was ...
Both Java and C# are powerful, modern programming languages that share many similarities, largely due to their common influences, but they also exhibit distinct features and paradigms. Here’s a breakdown of the relative merits and weaknesses of both languages across various dimensions: ### Language Structure **Java:*...
9,200
[ { "from": "human", "value": "I learned Java in college, and then I was hired by a C# shop and have used that ever since. I spent my first week realizing that the two languages were almost identical, and the next two months figuring out the little differences. For the most part, was I noticing the things tha...
Does anyone know how to set the code text editor font style to italics in Visual Studio 2005 or 2008? Note, I'm talking about the code editor not in code itself.
In Visual Studio 2005 or 2008, you can customize the font and styles used in the code editor, but setting the font style to italics for the entire code editor is not directly supported through the user interface. However, you can change the font for various types of text (like comments, keywords, etc.) to italics. Here...
24,887
[ { "from": "human", "value": "Does anyone know how to set the code text editor font style to italics in Visual Studio 2005 or 2008? Note, I'm talking about the code editor not in code itself. \n" }, { "from": "gpt", "value": "In Visual Studio 2005 or 2008, you can customize the font and styles us...
I am about to set up a subversion server to be accessed via svn+ssh. I was wondering, where the default repository location is (on a unix box). Do you put it in /opt/svn or /home/svn or /usr/subversion or even /svn or somewhere else? I am looking for the place, most people put it. Is there a convention? EDIT: It is...
When setting up a Subversion (SVN) server on a Unix-based system, there isn't a strict convention for where to place the repositories, but there are common practices that many users follow. Here are some typical locations and considerations: 1. **/var/svn**: This is a common directory for storing version-controlled re...
22,131
[ { "from": "human", "value": "I am about to set up a subversion server to be accessed via svn+ssh. I was wondering, where the default repository location is (on a unix box).\nDo you put it in\n/opt/svn\n\nor\n/home/svn\n\nor\n/usr/subversion\n\nor even\n/svn\n\nor somewhere else?\nI am looking for the place,...
We currently use a hand-rolled setup and configuration script and a hand-rolled continuous integration script to build and deploy our application. I am looking at formalizing this somewhat with a third party system designed for these purposes. I have looked into Phing before, and I get that it's basically like Ant. But...
To formalize your setup and configuration script as well as your continuous integration (CI) process, you're on the right track considering tools like Phing, CruiseControl, and phpUnderControl. Let’s clarify the relationship and usage of these tools to better address your needs. ### Tool Overview 1. **Phing**: - P...
17,747
[ { "from": "human", "value": "We currently use a hand-rolled setup and configuration script and a hand-rolled continuous integration script to build and deploy our application. I am looking at formalizing this somewhat with a third party system designed for these purposes.\nI have looked into Phing before, a...
I got a text file with a couple of lines and I am looking for a string in this file. I need to pass following command line parameters to the program: - file path - the string I am looking for - maximum number of processes the program is allowed to "fork" in order to complete this task. How to such a program should b...
You can create a simple Python script to search for a specified string in a text file while utilizing multiprocessing to fork processes, limited by a maximum number specified as a command-line argument. Below is a basic implementation that achieves this functionality. ### Python Program ```python import sys import mu...
18,320
[ { "from": "human", "value": "I got a text file with a couple of lines and I am looking for a string in this file. I need to pass following command line parameters to the program:\n- file path\n- the string I am looking for\n- maximum number of processes the program is allowed to \"fork\" in order to comple...
I have run across an XML Schema with the following definition: <xs:simpleType name="ClassRankType"> <xs:restriction base="xs:integer"> <xs:totalDigits value="4"/> <xs:minInclusive value="1"/> <xs:maxInclusive value="9999"/> </xs:restriction> </xs:simpleType> However, it seems to me that...
You are correct in your observations about the `totalDigits` facet in the XML Schema definition you provided. Let's break down your questions regarding the behavior of `totalDigits`, `minInclusive`, and `maxInclusive`. ### 1. Understanding `totalDigits` vs. `maxInclusive` - **`totalDigits`**: This facet specifies the ...
20,532
[ { "from": "human", "value": "I have run across an XML Schema with the following definition:\n<xs:simpleType name=\"ClassRankType\">\n <xs:restriction base=\"xs:integer\">\n <xs:totalDigits value=\"4\"/>\n <xs:minInclusive value=\"1\"/>\n <xs:maxInclusive value=\"9999\"/>\n </xs:re...
I have a document library with a custom column named "compound" which is just text. I want to put a filter (input text box) on that document library page so the view shows only the items where the compound column contains my typed-in text. Optimally, wildcards such as * or ? or full regular expressions could be suppor...
To implement a filter for your custom column "compound" in a document library that supports a "contains" functionality, you have several options. Here are some approaches, both out-of-the-box and with third-party solutions: ### Option 1: SharePoint Framework (SPFx) Web Part You can create a custom SharePoint Framework...
20,586
[ { "from": "human", "value": "I have a document library with a custom column named \"compound\" which is just text.\nI want to put a filter (input text box) on that document library page so the view shows only the items where the compound column contains my typed-in text. Optimally, wildcards such as * or ?...
When i use any of the other strongly typed HTML helpers after typing for example Html.Actionlink<HomeController>(x=>x. This pops up intellisense on the methods that the HomeController class has. However for the example above, this does not happen. Only after inserting the link text (second parameter) and going back t...
What you're experiencing with the `Html.ActionLink<HomeController>(x => x.)` syntax seems to be a quirk with Visual Studio's IntelliSense and how it processes lambda expressions in certain contexts. This is a known issue that developers have encountered, particularly when using strongly typed HTML helpers in ASP.NET MV...
21,527
[ { "from": "human", "value": "When i use any of the other strongly typed HTML helpers after typing for example \nHtml.Actionlink<HomeController>(x=>x.\n\nThis pops up intellisense on the methods that the HomeController class has. However for the example above, this does not happen. Only after inserting the l...
Why does this work: $(window).keydown(function(event){ alert(event.keyCode); }); but not this: $('#ajaxSearchText').keydown(function(event){ alert(event.keyCode); }); I'm testing with Firefox 3. Interestingly, neither of them work in IE7.
The difference in behavior between the two snippets you provided is likely due to how jQuery handles events and the timing of when those events are bound to the elements. 1. **Global Event Binding vs. Specific Element Binding**: - The first snippet `$(window).keydown(function(event){ ... })` binds the keydown event...
22,263
[ { "from": "human", "value": "Why does this work:\n$(window).keydown(function(event){\n alert(event.keyCode);\n});\n\nbut not this:\n$('#ajaxSearchText').keydown(function(event){\n alert(event.keyCode);\n});\n\nI'm testing with Firefox 3.\nInterestingly, neither of them work in IE7.\n" }, { "fr...
Is there and easy way to remove the IF/End If structured pairing. Being able to do this in one keystroke would be nice (I also use Refactor! Pro) Right now this is what I do: Delete the IF line Watch Visual Studio reformat the code to line up correctly taking into account that the IF is Missing. Navigate to the End I...
Removing an `If`/`End If` structure in Visual Studio can be done more efficiently with a few steps, although there isn't a built-in feature to perform this in a single keystroke. However, you can streamline the process. Here’s a more efficient approach to remove the `If` structure: 1. **Select the code block**: Instea...
20,782
[ { "from": "human", "value": "Is there and easy way to remove the IF/End If structured pairing.\nBeing able to do this in one keystroke would be nice (I also use Refactor! Pro)\nRight now this is what I do:\n\nDelete the IF line \nWatch Visual Studio reformat the code to line up correctly taking into account...
I have one of those "I swear I didn't touch the server" situations. I honestly didn't touch any of the php scripts. The problem I am having is that php data is not being saved across different pages or page refreshes. I know a new session is being created correctly because I can set a session variable (e.g. $_SESSION['...
It sounds like you're encountering issues with PHP sessions on your host's server. If the session variable you set isn't persisting across pages, here are some troubleshooting steps and considerations to help identify the problem: ### 1. Ensure Session Start Make sure that `session_start()` is called at the very begin...
21,915
[ { "from": "human", "value": "I have one of those \"I swear I didn't touch the server\" situations. I honestly didn't touch any of the php scripts. The problem I am having is that php data is not being saved across different pages or page refreshes. I know a new session is being created correctly because I c...
I have a servlet which is in the same web application as the JSF servlet. How do I replace (rather than redirect) the servlet response with the JSF response?
In a Java web application, if you want to replace the response generated by a servlet with a JSF response, you can use a combination of the `HttpServletRequest` and `HttpServletResponse` objects along with the JSF `ExternalContext` to render the JSF view within the servlet. Here's how you can achieve that: ### Step 1...
17,716
[ { "from": "human", "value": "I have a servlet which is in the same web application as the JSF servlet.\nHow do I replace (rather than redirect) the servlet response with the JSF response? \n" }, { "from": "gpt", "value": "In a Java web application, if you want to replace the response generated b...
Title is the entire question. Can someone give me a reason why this happens?
It seems like your message is missing the specific question or context you’re referring to. Could you please provide more details or clarify what issue or phenomenon you're asking about? This will help me give you a more accurate and helpful response.
26,936
[ { "from": "human", "value": "Title is the entire question. Can someone give me a reason why this happens?\n" }, { "from": "gpt", "value": "It seems like your message is missing the specific question or context you’re referring to. Could you please provide more details or clarify what issue or ph...
I'm looking for books or online resources that go in detail over programming techniques for high performance computing using C++.
There are several excellent resources available for learning about programming techniques for high-performance computing (HPC) using C++. Here are some recommended books and online resources that cover various aspects of HPC, including parallel programming, optimization, and performance tuning: ### Books 1. **"C++ Hi...
18,162
[ { "from": "human", "value": "I'm looking for books or online resources that go in detail over programming techniques for high performance computing using C++.\n" }, { "from": "gpt", "value": "There are several excellent resources available for learning about programming techniques for high-perfo...
IO.popen() and system() in Ruby is sorely lacking several useful features, such as: obtaining the return value of the function capturing both stdout and stderr (seperately and merged) running without spawning an extra cmd.exe or /bin/sh process Python has a module "subprocess" which I was thinking about using as insp...
In Ruby, while `IO.popen` and `system` have their limitations, there are several common approaches that developers use to address these issues: 1. **Obtaining the Return Value**: - To capture the exit status of a command executed with `system`, you can check the special variable `$?` right after the command executi...
22,101
[ { "from": "human", "value": "IO.popen() and system() in Ruby is sorely lacking several useful features, such as:\n\nobtaining the return value of the function\ncapturing both stdout and stderr (seperately and merged)\nrunning without spawning an extra cmd.exe or /bin/sh process\n\nPython has a module \"subp...
I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of my software development. Currently, NAnt handles just about everything, including replacing environment specific settings (e.g., database connection strings) based on an input target that I specify on the command line. CruiseControl.NE...
Yes, you can parameterize a CruiseControl.NET project configuration using a combination of parameters and the web interface, although it may not support checkboxes directly. You can create parameters in your configuration file that can be adjusted via the web interface, allowing you to dictate which builds to trigger f...
22,000
[ { "from": "human", "value": "I am currently trying to use NAnt and CruiseControl.NET to manage various aspects of my software development. Currently, NAnt handles just about everything, including replacing environment specific settings (e.g., database connection strings) based on an input target that I spec...
In some asp tutorials, like this, i observe the following pattern: Application.Lock 'do some things with the application object Application.Unlock However, since web pages can have multiple instances, there is an obvious concurrency problem. So my questions are the following: What if one page tries to lock while the ...
In ASP (Active Server Pages), the `Application` object is used to store information that is shared across all users of the web application. The locking mechanism with `Application.Lock` and `Application.Unlock` is intended to prevent concurrent access issues when multiple requests modify the `Application` object at the...
20,577
[ { "from": "human", "value": "In some asp tutorials, like this, i observe the following pattern:\n\nApplication.Lock\n'do some things with the application object\nApplication.Unlock\n\nHowever, since web pages can have multiple instances, there is an obvious concurrency problem. So my questions are the follo...
My customer is replacing MS Office with OpenOffice in some workstations. My program export a file to Excel using the .xml extension (using open format) and opens it using the current associated program (using ShellExecute) The problem is that OpenOffice does not register the .xml extension associated with it. Manually ...
The association of file types with specific applications in Windows is indeed stored in the registry, but it might not be as straightforward as associating the file extension directly with OpenOffice. Here’s a general outline of how to create a `.reg` file to associate the `.xml` file extension with OpenOffice, even if...
20,844
[ { "from": "human", "value": "My customer is replacing MS Office with OpenOffice in some workstations. My program export a file to Excel using the .xml extension (using open format) and opens it using the current associated program (using ShellExecute)\nThe problem is that OpenOffice does not register the .x...
This is a simple issue of me not knowing proper Xml syntax. In castle windsor I can duplicate this line of code: IoC.Container.AddComponent<IInputRequestedDialog<string>, SealsInputDialog>("seals"); With this Xml: <component id="seals" service="MyApp.InputRequestedDialog`1[[System.String]], MyApp" type="MyA...
To properly configure a generic type in XML for Castle Windsor, you need to make sure to specify the correct type arguments. When you're working with a generic type like `IInputRequestedDialog<string[]>`, you need to reflect the array type correctly in the XML. In .NET, an array type is represented with a "[]" suffix ...
23,760
[ { "from": "human", "value": "This is a simple issue of me not knowing proper Xml syntax. In castle windsor I can duplicate this line of code:\nIoC.Container.AddComponent<IInputRequestedDialog<string>, SealsInputDialog>(\"seals\");\n\nWith this Xml:\n<component id=\"seals\" \n service=\"MyApp.InputReques...
I have a self-hosted service that I want to add transport security to. I've set WSHttpBinding.SecurityMode to Transport and the ClientCredentialType to HttpClientCredentialType.None. I've created a certificate and set it to my host with ServiceHost.Credentials.ServiceCertificate.SetCertificate() I've also registered it...
The error message "Authentication failed because the remote party has closed the transport stream" indicates that there is a problem in establishing a secure connection between the client and server. Given your configuration, it sounds like the server is expecting a client certificate for authentication due to the way ...
19,615
[ { "from": "human", "value": "I have a self-hosted service that I want to add transport security to.\nI've set WSHttpBinding.SecurityMode to Transport and the ClientCredentialType to HttpClientCredentialType.None.\nI've created a certificate and set it to my host with\nServiceHost.Credentials.ServiceCertific...
At work I'm using Perl 5.8.0 on Windows. When I first put Perl on, I went to CPAN, downloaded all the sources, made a few changes (in the .MAK file(?) to support threads, or things like that), and did nmake / nmake test / nmake install. Then, bit by bit, I've downloaded individual modules from CPAN and done the nmake d...
Upgrading Perl while ensuring that your existing scripts and modules remain functional can be a bit of a challenge, especially on a Windows system where you've customized your setup. Here’s a step-by-step guide to help you with the upgrade process: ### Step 1: Backup Your Current Installation 1. **Backup Your Perl Di...
18,739
[ { "from": "human", "value": "At work I'm using Perl 5.8.0 on Windows.\nWhen I first put Perl on, I went to CPAN, downloaded all the sources, made a few changes (in the .MAK file(?) to support threads, or things like that), and did nmake / nmake test / nmake install. Then, bit by bit, I've downloaded individ...
I'm trying to write a faster user switching app for Windows. Win+L and selecting users is very cumbersome. If I start Task Manager as administrator, it shows active users and I can select one and "Connect" (if I enter their password). How do I get the list of all users (or all active users)? I'm using C# (Visual Studi...
To create a faster user switching app in C#, you can utilize the Windows Management Instrumentation (WMI) or System.DirectoryServices namespaces to get information about the users. However, to get a list of currently active users in a Windows session, a more straightforward approach is to use the Windows API via P/Invo...
18,301
[ { "from": "human", "value": "I'm trying to write a faster user switching app for Windows. Win+L and selecting users is very cumbersome. If I start Task Manager as administrator, it shows active users and I can select one and \"Connect\" (if I enter their password).\nHow do I get the list of all users (or al...
I've worked with MySQL and MSSQL for some time and have used a variety of CASE and UML tools when designing some of my more complex projects. I was recently asked by a colleague if I could provide an Access database for his department. The application itself isn't too complicated, and Access actually looks like the ide...
It's great to hear that you're expanding your database design skills into Microsoft Access! While Access is a powerful tool, it does have some limitations compared to more robust systems like MySQL or MSSQL, particularly when it comes to database design features. Unfortunately, Access does not natively support creatin...
23,265
[ { "from": "human", "value": "I've worked with MySQL and MSSQL for some time and have used a variety of CASE and UML tools when designing some of my more complex projects.\nI was recently asked by a colleague if I could provide an Access database for his department. The application itself isn't too complicat...
I have a PHP script that uses the system() call to execute other (potentially long-running) programs (for interest: NCBI BLAST, phrap, primer3 and other programs for doing DNA sequence analysis and assembly). I'm running under Windows XP, using the CLI version of PHP from a command prompt, or as a service. (In either c...
The behavior you're experiencing with child processes when using PHP 4 versus PHP 5 is indeed related to how signal handling is implemented in those versions. In PHP 5, when a script is terminated with a signal (like Ctrl+C), the default behavior is different, leading to child processes not being terminated alongside t...
17,572
[ { "from": "human", "value": "I have a PHP script that uses the system() call to execute other (potentially long-running) programs (for interest: NCBI BLAST, phrap, primer3 and other programs for doing DNA sequence analysis and assembly).\nI'm running under Windows XP, using the CLI version of PHP from a com...
I'm used to working in a Delphi and C# environment which seem to have a rich set of third party components available. I'm currently wanting to do cross-platform programming in C++ using either qt or wxwidgets. Is there a large market for third party components? I was looking at sourceforge and that doesn't seem to show...
When transitioning to cross-platform programming in C++ with frameworks like Qt or wxWidgets, it's understandable to seek out third-party components to enhance your development experience. Here's an overview of the current landscape regarding third-party components for both Qt and wxWidgets: ### Qt 1. **Qt Marketplace...
21,611
[ { "from": "human", "value": "I'm used to working in a Delphi and C# environment which seem to have a rich set of third party components available. I'm currently wanting to do cross-platform programming in C++ using either qt or wxwidgets. Is there a large market for third party components? I was looking at ...
What's the difference between absolute path & relative path when using any web server or Tomcat?
When working with web servers, including Tomcat, understanding the difference between absolute paths and relative paths is essential for managing resources (like files, images, stylesheets, etc.) effectively. Here’s a breakdown of both concepts: ### Absolute Path 1. **Definition**: An absolute path is a full path tha...
20,478
[ { "from": "human", "value": "What's the difference between absolute path & relative path when using any web server or Tomcat?\n" }, { "from": "gpt", "value": "When working with web servers, including Tomcat, understanding the difference between absolute paths and relative paths is essential for ...
I would like to drag and drop my data file onto a Python script and have it process the file and generate output. The Python script accepts the name of the data file as a command-line parameter, but Windows Explorer doesn't allow the script to be a drop target. Is there some kind of configuration that needs to be done ...
Yes, you can configure your Python script to accept drag-and-drop functionality in Windows. Here are the steps to ensure that your Python script works as a drop target: ### Steps to Set Up Drag-and-Drop for Python Script 1. **Create a Batch File**: To enable drag-and-drop functionality, you can create a batch file th...
22,794
[ { "from": "human", "value": "I would like to drag and drop my data file onto a Python script and have it process the file and generate output. The Python script accepts the name of the data file as a command-line parameter, but Windows Explorer doesn't allow the script to be a drop target.\nIs there some ki...
I have this script: select name,create_date,modify_date from sys.procedures order by modify_date desc I can see what procedures were modified lately. I will add a "where modify_date >= " And I'd like to use some system stored procedure, that will generate me : drop + create scripts for the (let's say 5 matching) stor...
It looks like you're trying to generate drop and create scripts for stored procedures based on their modification date. While there isn't a built-in system stored procedure that directly provides this functionality, you can achieve it using dynamic SQL in combination with the information from `sys.procedures`. Here's ...
20,321
[ { "from": "human", "value": "I have this script:\nselect name,create_date,modify_date from sys.procedures order by modify_date desc\n\nI can see what procedures were modified lately.\nI will add a \"where modify_date >= \"\nAnd I'd like to use some system stored procedure, that will generate me :\ndrop + c...