instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I have a table with a TEXT column where the contents is just strings of CSV numbers. Example ",1,76,77,115," Each string can have an arbitrary number of numbers.
I am trying to set up Full Text Indexing so that I can search this column rapidly. This works great. Instead of running queries with
where MY_COL LIKE '%,77,%... | When working with Full Text Indexing in databases (like SQL Server or others), the behavior you're encountering is not uncommon. Full Text Search systems often ignore short words, including single characters, based on their internal noise word lists or stemming algorithms.
### Steps to Address the Issue
1. **Check No... | 36,244 | [
{
"from": "human",
"value": "I have a table with a TEXT column where the contents is just strings of CSV numbers. Example \",1,76,77,115,\" Each string can have an arbitrary number of numbers.\nI am trying to set up Full Text Indexing so that I can search this column rapidly. This works great. Instead of ru... |
I need to migrate a large project from StarTeam 5 to Subversion, and I'd like to keep snapshots of (at least) 5-10 of the major releases. I've considered the following:
Manual or scripted export/import of each snapshot. Advantages: straightforward, easy to select labeled/dated versions. Disadvantages: time-consumin... | Migrating a large project from StarTeam 5 to Subversion (SVN) while retaining snapshots of significant releases can indeed be challenging, especially considering the limitations and issues you've outlined. Here are some additional considerations, experiences, and suggestions that could help you in your migration:
### ... | 36,081 | [
{
"from": "human",
"value": "I need to migrate a large project from StarTeam 5 to Subversion, and I'd like to keep snapshots of (at least) 5-10 of the major releases. I've considered the following:\n\nManual or scripted export/import of each snapshot. Advantages: straightforward, easy to select labeled/da... |
I am trying to use log4net in an ASP.NET application with Visual Studio 2005. I have declared an instance of the logger like so:
Private Shared ReadOnly log As ILog = LogManager.GetLogger("")
I am trying to use it in the following manner:
If log.IsDebugEnabled Then
log.Debug("Integration Services Constructed")
End ... | It looks like you have the basic setup for log4net in your ASP.NET application, but you're encountering an issue where `log.IsDebugEnabled` is always returning `false`. This typically suggests that your logging configuration may not be properly initialized or that the log level isn't set correctly.
Here are some step... | 33,020 | [
{
"from": "human",
"value": "I am trying to use log4net in an ASP.NET application with Visual Studio 2005. I have declared an instance of the logger like so:\nPrivate Shared ReadOnly log As ILog = LogManager.GetLogger(\"\")\n\nI am trying to use it in the following manner:\nIf log.IsDebugEnabled Then\n lo... |
I have been using code similar to this
MessageDlg('', mtWarning, [mbOK], 0);
throughout my project, (thanks to the GExperts Message Dialog tool :) ) and i was wondering if anyone knows of a way do override the call and show my own custom Form.
The only way i can think to do it its make a New Form with something like
f... | Overriding built-in functions like `MessageDlg` in Delphi can be challenging due to their widespread use and the way they are implemented. However, there are a few strategies you can consider to achieve your goal without having to replace all instances of `MessageDlg` throughout your code:
### Option 1: Create a Custo... | 34,035 | [
{
"from": "human",
"value": "I have been using code similar to this\nMessageDlg('', mtWarning, [mbOK], 0);\n\nthroughout my project, (thanks to the GExperts Message Dialog tool :) ) and i was wondering if anyone knows of a way do override the call and show my own custom Form.\nThe only way i can think to do... |
I am trying to improve the performance of the threaded application with real-time deadlines. It is running on Windows Mobile and written in C / C++. I have a suspicion that high frequency of thread switching might be causing tangible overhead, but can neither prove it or disprove it. As everybody knows, lack of proof i... | Improving the performance of a threaded application, especially one with real-time deadlines, can indeed be challenging. Addressing your questions about context switching and how to measure or estimate its overhead:
### 1. Measurements of the Cost of Switching Thread Context
The cost of a context switch can vary sign... | 36,141 | [
{
"from": "human",
"value": "I am trying to improve the performance of the threaded application with real-time deadlines. It is running on Windows Mobile and written in C / C++. I have a suspicion that high frequency of thread switching might be causing tangible overhead, but can neither prove it or disprov... |
I'm using XPCOM, and I want to get the URI of the portion of a page the user clicks (e.g., a user right-clicks on a frame, and I want to display the URL of that frame). So I've set up a mouse listener (nsIDOMEventListener) and then when a click occurs, the handleEvent callback gives me access to the nsIDOMEvent.
My qu... | To retrieve the URI of the frame or the element that was clicked using XPCOM and the `nsIDOMEvent`, you'll need to perform a couple of steps in your event handler. The `nsIDOMEvent` will not directly give you the URI, but you can access the target of the event and then get the corresponding URI from that target.
Here’... | 35,425 | [
{
"from": "human",
"value": "I'm using XPCOM, and I want to get the URI of the portion of a page the user clicks (e.g., a user right-clicks on a frame, and I want to display the URL of that frame). So I've set up a mouse listener (nsIDOMEventListener) and then when a click occurs, the handleEvent callback ... |
Here is my problem. I am hitting a web service (hosted on a Java based server) that will only accept text encoded Requests, but it returns MTOM Responses. What I've found is that if I set the web service to RequireMtom, it sends an Mtom request! Unfortunately, the server chokes on an Mtom request and returns a 500 erro... | You're in a tricky situation when dealing with web services that have inconsistent expectations regarding message encoding. The primary issue you're facing is that the .NET framework expects a specific content type for the responses, and that type needs to match the request encoding. Here are a few potential strategies... | 35,264 | [
{
"from": "human",
"value": "Here is my problem. I am hitting a web service (hosted on a Java based server) that will only accept text encoded Requests, but it returns MTOM Responses. What I've found is that if I set the web service to RequireMtom, it sends an Mtom request! Unfortunately, the server chokes ... |
In simulator mode, my app has an icon with round corners, but on a real iPhone, the corners aren't rounded.
| If you're experiencing an issue where your app's icon appears with rounded corners in the simulator but not on a real iPhone, it could be due to a few different reasons. Here are some steps you can take to troubleshoot and resolve the issue:
1. **Check the Icon File Format**: Ensure that your app icon is in the correc... | 34,787 | [
{
"from": "human",
"value": "In simulator mode, my app has an icon with round corners, but on a real iPhone, the corners aren't rounded.\n"
},
{
"from": "gpt",
"value": "If you're experiencing an issue where your app's icon appears with rounded corners in the simulator but not on a real iPhone, ... |
Any GOOD libraries available to access SVN from .net application (using C#). The only 3 I found so far that I will be trying out is:
SVN#
SharpSVN
NSvn
I want to create a very simple SVN client!
| If you're looking to work with Subversion (SVN) in a .NET application using C#, the libraries you mentioned are a great starting point. Here's a brief overview of each of them, along with a couple of additional options you may find useful:
### 1. **SVN#**
- **Description**: SVN# is a wrapper around the SVN client libr... | 32,225 | [
{
"from": "human",
"value": "Any GOOD libraries available to access SVN from .net application (using C#). The only 3 I found so far that I will be trying out is:\n\nSVN#\nSharpSVN\nNSvn\n\nI want to create a very simple SVN client!\n"
},
{
"from": "gpt",
"value": "If you're looking to work with ... |
Today I stumpled upon the shadowCopyBinAssemblies option in the hostingEnvironment tag.
Appearently this attribute it is a web.config (system.web) configuration Boolean option indicating whether the assemblies of an application in the Bin directory are shadow copied to the application's ASP.NET Temporary Files director... | The `shadowCopyBinAssemblies` option in the `<hostingEnvironment>` tag of the `web.config` file allows you to control whether or not assemblies in the `Bin` directory are shadow copied. Shadow copying is a feature that allows an assembly to be loaded into memory while still allowing the original assembly file to be mod... | 36,807 | [
{
"from": "human",
"value": "Today I stumpled upon the shadowCopyBinAssemblies option in the hostingEnvironment tag.\nAppearently this attribute it is a web.config (system.web) configuration Boolean option indicating whether the assemblies of an application in the Bin directory are shadow copied to the appl... |
Is there any way to run ASDoc on your project via the Flex Builder UI? Or, is there a good (preferably free) plugin that will do so?
If there is no UI for it, does someone have a link to a tutorial on how to set it up to be automatic when I build my project, maybe via Ant (which I've never used, but am more than happy... | ASDoc is a documentation generator for ActionScript code and is typically used in Flex projects. In Flex Builder (now Adobe Flash Builder), there isn't a built-in user interface option to run ASDoc directly through the UI, but you can configure it to generate documentation during your build process or utilize a command... | 32,223 | [
{
"from": "human",
"value": "Is there any way to run ASDoc on your project via the Flex Builder UI? Or, is there a good (preferably free) plugin that will do so?\nIf there is no UI for it, does someone have a link to a tutorial on how to set it up to be automatic when I build my project, maybe via Ant (whi... |
I need to know how to return a default row if no rows exist in a table. What would be the best way to do this? I'm only returning a single column from this particular table to get its value.
Edit: This would be SQL Server.
| In SQL Server, if you want to return a default row when no rows exist in a table, you can use a combination of `UNION` and a `WHERE` clause to check for the existence of rows. Here’s a common approach to achieve that:
1. First, attempt to select the desired rows from your table.
2. Use `UNION ALL` to add a default row... | 38,236 | [
{
"from": "human",
"value": "I need to know how to return a default row if no rows exist in a table. What would be the best way to do this? I'm only returning a single column from this particular table to get its value. \nEdit: This would be SQL Server. \n"
},
{
"from": "gpt",
"value": "In SQL S... |
The following code
public class GenericsTest2 {
public static void main(String[] args) throws Exception {
Integer i = readObject(args[0]);
System.out.println(i);
}
public static <T> T readObject(String file) throws Exception {
return readObject(new ObjectInputStream(new FileInputSt... | The situation you're encountering relates to how Java handles generics and type inference. Let's break down the key points regarding your two versions of the `readObject` method.
### Original Version
```java
public static <T> T readObject(String file) throws Exception {
return readObject(new ObjectInputStream(new ... | 37,068 | [
{
"from": "human",
"value": "The following code\npublic class GenericsTest2 {\n\n public static void main(String[] args) throws Exception {\n Integer i = readObject(args[0]);\n System.out.println(i);\n }\n\n public static <T> T readObject(String file) throws Exception {\n retur... |
Is there any way to use AppleScript (or something else) to query currently running applications for the filename and path of the current file that they have open? I know some applications show the filename in the window title which is script accessible, but this isn't a solution as not all do, and hardly any show the ... | Querying the currently opened files and their paths in running Mac applications can indeed be complex, especially since not all applications follow the same standards for exposing their documents. While AppleScript can interact with many applications, the level of detail you can retrieve varies significantly based on h... | 35,288 | [
{
"from": "human",
"value": "Is there any way to use AppleScript (or something else) to query currently running applications for the filename and path of the current file that they have open? I know some applications show the filename in the window title which is script accessible, but this isn't a solutio... |
I want to create a Silverlight 2 control that has two content areas. A Title and a MainContent. So the control would be:
<StackPanel>
<TextBlock Text=" CONTENT1 "/>
<Content with CONTENT2 "/>
</StackPanel>
When I use the control I should just be able to use:
<MyControl Text="somecontent">main content </MyControl>
H... | To create a custom control in Silverlight 2 with two content areas (one for the title and one for the main content), you will need to define a new control that can take a property for the title text and use a content property for the main content. Here’s a step-by-step guide on how to implement this.
### Step 1: Creat... | 36,866 | [
{
"from": "human",
"value": "I want to create a Silverlight 2 control that has two content areas. A Title and a MainContent. So the control would be:\n<StackPanel>\n<TextBlock Text=\" CONTENT1 \"/>\n<Content with CONTENT2 \"/>\n</StackPanel>\n\nWhen I use the control I should just be able to use:\n<MyCont... |
I managed to create a class using CodeDom and add a single method to that class. Now, is there a way to, having constructed the CodeCompileUnit instance, compile the code and invoke the generated method? The method invocation has to be done in the same context as the code generation.
| Yes, you can compile the generated code from a `CodeCompileUnit` using the `CodeDomProvider` class in .NET, and then invoke the method you've added to the generated class. Below are the steps you'll need to follow:
1. Create your `CodeCompileUnit` and add your class and method to it.
2. Compile the generated code into... | 33,855 | [
{
"from": "human",
"value": "I managed to create a class using CodeDom and add a single method to that class. Now, is there a way to, having constructed the CodeCompileUnit instance, compile the code and invoke the generated method? The method invocation has to be done in the same context as the code genera... |
Is it possible to use the __unused attribute macro on Objective-C object method parameters? I've tried placing it in various positions around the parameter declaration but it either causes a compilation error or seems to be ignored (i.e., the compiler still generates unused parameter warnings when compiling with -Wall ... | In Objective-C, the `__unused` attribute is typically used in C and C++ code to suppress warnings about unused parameters, but its use in Objective-C method parameter declarations can be tricky due to how the Objective-C runtime handles method declarations and their arguments.
The `__unused` attribute is not officiall... | 37,789 | [
{
"from": "human",
"value": "Is it possible to use the __unused attribute macro on Objective-C object method parameters? I've tried placing it in various positions around the parameter declaration but it either causes a compilation error or seems to be ignored (i.e., the compiler still generates unused para... |
How can I restart(recycle) IIS Application Pool from C# (.net 2)?
Appreciate if you post sample code?
| You can restart or recycle an IIS Application Pool from a C# application using the `Microsoft.Web.Administration` namespace, which is available in .NET Framework 3.5 and later. However, since you specified .NET 2.0, the approach will be slightly different because `Microsoft.Web.Administration` is not available in .NET ... | 32,817 | [
{
"from": "human",
"value": "How can I restart(recycle) IIS Application Pool from C# (.net 2)?\nAppreciate if you post sample code?\n"
},
{
"from": "gpt",
"value": "You can restart or recycle an IIS Application Pool from a C# application using the `Microsoft.Web.Administration` namespace, which ... |
My web application is relying on container-managed security and I'm wondering if it's possible to use salted passwords at all. As far as I can tell it's easy enough to store digested passwords in a database by just configuring a JDBC or DataSource Realm, but there's no way to add a salt to those digest.
Any suggestion... | You're correct that the use of salted passwords can be effectively managed by deciding where the hashing and salting takes place—whether on the client-side or server-side. Here are a few considerations and suggestions to help you implement salted passwords in your web application while still using container-managed sec... | 35,773 | [
{
"from": "human",
"value": "My web application is relying on container-managed security and I'm wondering if it's possible to use salted passwords at all. As far as I can tell it's easy enough to store digested passwords in a database by just configuring a JDBC or DataSource Realm, but there's no way to ad... |
I'm trying to create a custom JSP tag that would take an array object and display the elements of the tag in an HTML table. Does anyone have suggestions on how to do this?
| Creating a custom JSP tag to display an array object in an HTML table involves a few key steps. Below, I'll guide you through the process, including creating the tag handler, defining the tag in a JSP file, and using it in a JSP page.
### Step 1: Create the Tag Handler
You need to create a Java class that extends `Si... | 32,328 | [
{
"from": "human",
"value": "I'm trying to create a custom JSP tag that would take an array object and display the elements of the tag in an HTML table. Does anyone have suggestions on how to do this?\n"
},
{
"from": "gpt",
"value": "Creating a custom JSP tag to display an array object in an HTM... |
Right now a project I'm working on has reached a level of complexity that requires more than a few steps (actually its become arcane!) to produce a complete/usable product. And unfortunately we didn't start out with a Continuos Integration mindset, so as you can imagine its kind of painful at times, and at others I can... | Migrating an existing project to a Continuous Integration (CI) pipeline can indeed be challenging, especially when dealing with a complex codebase and multiple components in various languages. Here are some steps and resources that can help you navigate this transition more smoothly:
### Steps to Migrate to Continuous... | 35,452 | [
{
"from": "human",
"value": "Right now a project I'm working on has reached a level of complexity that requires more than a few steps (actually its become arcane!) to produce a complete/usable product. And unfortunately we didn't start out with a Continuos Integration mindset, so as you can imagine its kind... |
Which download I need to use to use TinyMCE in JSP(Struts application)
I see Main Package, Development Package and also different Compression packages.
I am trying to implement Rich text editor for a text area in our application.
| To integrate TinyMCE into a JSP/Struts application for a rich text editor, you will typically need the core files of TinyMCE. Here’s a straightforward guide on how to proceed:
### Step 1: Choose the Right Package
1. **Main Package**: This is the essential package for TinyMCE. It contains the core files necessary to r... | 33,806 | [
{
"from": "human",
"value": "Which download I need to use to use TinyMCE in JSP(Struts application)\nI see Main Package, Development Package and also different Compression packages.\nI am trying to implement Rich text editor for a text area in our application.\n"
},
{
"from": "gpt",
"value": "To... |
Do we really need a server side architecture to create a RIA application?
My idea is the following:
Create a complete RIA application using only Html pages, JQuery and a full client side UI set of components (choose your poison between the large number of different components available open source and not)
Server side... | Ciao Massimo,
Your idea of creating a Rich Internet Application (RIA) primarily using client-side technologies with a minimal server-side architecture is indeed feasible and aligns with modern web development trends. Many successful applications today leverage this architecture. However, there are several consideratio... | 35,683 | [
{
"from": "human",
"value": "Do we really need a server side architecture to create a RIA application?\nMy idea is the following:\n\nCreate a complete RIA application using only Html pages, JQuery and a full client side UI set of components (choose your poison between the large number of different component... |
the WPF Popup control is nice, but somewhat limited in my opinion. is there a way to "drag" a popup around when it is opened (like with the DragMove() method of windows)?
can this be done without big problems or do i have to write a substitute for the popup class myself?
thanks
| In WPF, the `Popup` control does not support dragging out of the box like a standard window does with the `DragMove()` method. However, you can implement a draggable `Popup` by using mouse events to manually control its position. While this might not require rewriting the `Popup` class itself, it does involve handling ... | 31,651 | [
{
"from": "human",
"value": "the WPF Popup control is nice, but somewhat limited in my opinion. is there a way to \"drag\" a popup around when it is opened (like with the DragMove() method of windows)?\ncan this be done without big problems or do i have to write a substitute for the popup class myself?\ntha... |
Are there, in the canonical Gang of Four list, any design patterns that you often find misused, misunderstood or overused (other than the highly debated Singleton)? In other words, is there a design pattern you would advise to think twice before using? (And why?)
| Yes, there are several design patterns from the Gang of Four (GoF) catalog that are often misused, misunderstood, or overused. Here are a few notable examples, along with reasons to think twice before using them:
1. **Decorator Pattern**:
- **Misuse**: The Decorator pattern can lead to a complex system of classes w... | 34,210 | [
{
"from": "human",
"value": "Are there, in the canonical Gang of Four list, any design patterns that you often find misused, misunderstood or overused (other than the highly debated Singleton)? In other words, is there a design pattern you would advise to think twice before using? (And why?)\n"
},
{
... |
I am writing an application using the Microsoft Enterprise Library. I wrote a wrapper DLL for that Enterprise Library DLL file. I want to use my wrapper in some Windows Forms application. The problem is that every time I want to use my wrapper I get an error in the compilation that says that a reference to the Enterpr... | When you create a wrapper around a DLL (in this case, the Microsoft Enterprise Library), the wrapper DLL does not automatically propagate its references to any project that uses it. This behavior is by design, and there are a few reasons for it:
1. **Reference Management in .NET**: Each project in .NET manages its own... | 35,540 | [
{
"from": "human",
"value": "I am writing an application using the Microsoft Enterprise Library. I wrote a wrapper DLL for that Enterprise Library DLL file. I want to use my wrapper in some Windows Forms application. The problem is that every time I want to use my wrapper I get an error in the compilation ... |
We have a few XML based interfaces that is quite well documented in XSD schemas. The interfaces are now going to be publicly available and we would like to create reference documentation for them.
Is there a tool that can automatically convert XSD files into some more readable format?
| Yes, there are several tools that can help you convert XSD files into more readable documentation formats. Here are a few options you might consider:
1. **XMLSpy**: Altova's XMLSpy is a powerful XML editor that can generate documentation from XSD files. It can produce documentation in formats like HTML or RTF, making ... | 37,114 | [
{
"from": "human",
"value": "We have a few XML based interfaces that is quite well documented in XSD schemas. The interfaces are now going to be publicly available and we would like to create reference documentation for them.\nIs there a tool that can automatically convert XSD files into some more readable ... |
Does anyone know if there is an implementation of javax.jms.QueueConnectionFactory for WebSphere MQ and where to get it? I Googled it and searched IBM website but couldn't find anything. I don't want to retrieve the connection or factory from Websphere MQ via JNDI, I need my own connection factory.
| To implement a `javax.jms.QueueConnectionFactory` for WebSphere MQ without using JNDI, you can make use of the IBM MQ classes for JMS. IBM provides a JMS implementation that includes the necessary classes to create and manage your own connection factories programmatically. Here’s how you can do it:
### Steps to Implem... | 35,058 | [
{
"from": "human",
"value": "Does anyone know if there is an implementation of javax.jms.QueueConnectionFactory for WebSphere MQ and where to get it? I Googled it and searched IBM website but couldn't find anything. I don't want to retrieve the connection or factory from Websphere MQ via JNDI, I need my own... |
I've looked into and considered many JavaScript unit tests and testing tools, but have been unable to find a suitable option to remain fully TDD compliant. So, is there a JavaScript unit test tool that is fully TDD compliant?
| Test-Driven Development (TDD) emphasizes writing tests before writing the code that needs to pass those tests. While there isn't a single "TDD-compliant" tool per se, there are several JavaScript testing frameworks and tools that facilitate a TDD workflow. Here are some popular options:
1. **Jest**:
- Jest is a wid... | 36,205 | [
{
"from": "human",
"value": "I've looked into and considered many JavaScript unit tests and testing tools, but have been unable to find a suitable option to remain fully TDD compliant. So, is there a JavaScript unit test tool that is fully TDD compliant?\n"
},
{
"from": "gpt",
"value": "Test-Dri... |
pretty much what the title says.
I am using an Ajax Drop Down as illustrated here:
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/DropDown/DropDown.aspx
using linkbuttons ... is there a way to limit to list?
Thank you.
Edit: I think it was VB 6 maybe that you could select "LimitToList" in a drop down. Meaning the... | In the context of using an Ajax DropDown from the Ajax Control Toolkit, you can achieve a similar effect to the "LimitToList" functionality by handling the input in your application. This would typically involve ensuring that the user can only select values from the dropdown list and cannot enter arbitrary values. Here... | 31,438 | [
{
"from": "human",
"value": "pretty much what the title says. \nI am using an Ajax Drop Down as illustrated here:\nhttp://www.asp.net/AJAX/AjaxControlToolkit/Samples/DropDown/DropDown.aspx\nusing linkbuttons ... is there a way to limit to list?\nThank you. \nEdit: I think it was VB 6 maybe that you could se... |
I am running a java program that sets up a database connection to an SQL database. It works fine on Mac OS X, but when I try to run the same code on Linux, I get a Exception in thread "main" java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException.
I am using jdk-1.6.0_02 - if I unzip src.zip, it turns out that ... | The issue you're encountering, `java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException`, indicates that the class `SQLClientInfoException` is not found in your current Java environment. This class was introduced in Java SE 6, but it’s possible that your specific installation of JDK 6 (version 1.6.0_02) on Linu... | 36,802 | [
{
"from": "human",
"value": "I am running a java program that sets up a database connection to an SQL database. It works fine on Mac OS X, but when I try to run the same code on Linux, I get a Exception in thread \"main\" java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException.\nI am using jdk-1.6.0... |
Photoshop has a lot of cool artistic filters, and I'd love to understand the underlying algorithms.
One algorithm that's particularly interesting is the Cutout filter (number 2 at the link above).
It has three tunable parameters, Number of Levels, Edge Simplicity, and Edge Fidelity. Number of levels appears to drive a... | Photoshop's Cutout filter is designed to create a stylized effect by simplifying the image's color and emphasizing its edges. While Adobe does not officially provide the exact algorithm or implementation details for their filters, we can infer some of the underlying techniques based on common image processing methods a... | 35,556 | [
{
"from": "human",
"value": "Photoshop has a lot of cool artistic filters, and I'd love to understand the underlying algorithms.\nOne algorithm that's particularly interesting is the Cutout filter (number 2 at the link above).\nIt has three tunable parameters, Number of Levels, Edge Simplicity, and Edge Fid... |
I've seen comments that there are some missing features in the VC++ 2008 Express debugger, particularly related to multi-threaded debugging. I've tried debugging a multi-threaded program in Visual C++ 2008 Express and it seemed to work fine. What is really missing?
Looking here (as mentioned in one answer), I found:
"M... | Visual C++ 2008 Express Edition does support multi-threaded debugging to some extent, but it lacks several features and enhancements that are available in the full versions of Visual Studio, making the debugging experience less intuitive and less powerful for complex multi-threaded applications.
Here are some specific... | 36,249 | [
{
"from": "human",
"value": "I've seen comments that there are some missing features in the VC++ 2008 Express debugger, particularly related to multi-threaded debugging. I've tried debugging a multi-threaded program in Visual C++ 2008 Express and it seemed to work fine. What is really missing?\nLooking here... |
I have a column with a "DEFAULT" constraint. I'd like to create a script that drops that column.
The problem is that it returns this error:
Msg 5074, Level 16, State 1, Line 1
The object 'DF__PeriodSce__IsClo__4BCC3ABA' is dependent on column 'IsClosed'.
Msg 4922, Level 16, State 9, Line 1
ALTER TABLE DROP COLUMN I... | In SQL Server, when you want to drop a column that has a default constraint, you must first drop the default constraint explicitly. Unlike some other database systems, SQL Server does not provide an automatic way to drop a column and its associated constraints in a single command. You need to handle this in two steps:
... | 37,567 | [
{
"from": "human",
"value": "I have a column with a \"DEFAULT\" constraint. I'd like to create a script that drops that column.\nThe problem is that it returns this error:\nMsg 5074, Level 16, State 1, Line 1 \nThe object 'DF__PeriodSce__IsClo__4BCC3ABA' is dependent on column 'IsClosed'. \nMsg 4922, Level... |
With reference to Problem with date day/month reversing on save
I have further noted that even setting the Session.LCID on the page itself is making no difference what so ever.
How could the environments be such that between test and live the asp site on live is reversing dates entered via SQL but not on test.
Both hav... | It sounds like you're facing a frustrating issue with date formats being interpreted differently between your test and live environments in an ASP application. Here are several areas to investigate that could help you troubleshoot this problem further:
### 1. Database Settings
- **Date Format Settings**: Check the SQ... | 35,051 | [
{
"from": "human",
"value": "With reference to Problem with date day/month reversing on save\nI have further noted that even setting the Session.LCID on the page itself is making no difference what so ever.\nHow could the environments be such that between test and live the asp site on live is reversing date... |
I need to read account number from Maestro/Mastercard with smart card reader. I am using Java 1.6 and its javax.smartcardio package. I need to send APDU command which will ask EMV application stored on card's chip for PAN number. Problem is, I cannot find regular byte array to construct APDU command which will return n... | To read the Primary Account Number (PAN) from a Maestro/Mastercard using a smart card reader with Java, you will need to send specific APDU (Application Protocol Data Unit) commands to the EMV (Europay MasterCard and Visa) application on the card. The PAN is usually stored in the EMV card and can be retrieved via the S... | 34,674 | [
{
"from": "human",
"value": "I need to read account number from Maestro/Mastercard with smart card reader. I am using Java 1.6 and its javax.smartcardio package. I need to send APDU command which will ask EMV application stored on card's chip for PAN number. Problem is, I cannot find regular byte array to c... |
From googling around it looks like Xcode (3.1 in my case) should be at least trying to give me a sane debug view of STL containers - or at least vectors.
However, whenever I go to look at a vector in the debugger I just see M_impl, with M_start and M_finish members (and a couple of others) - but nothing in-between! (it... | When working with STL containers like `std::vector` and `std::wstring` in Xcode (especially older versions like 3.1), it can sometimes be challenging to view their contents in the debugger. Here are some steps and considerations that might help you enhance your debugging experience:
### Debugging STL Containers in Xco... | 36,928 | [
{
"from": "human",
"value": "From googling around it looks like Xcode (3.1 in my case) should be at least trying to give me a sane debug view of STL containers - or at least vectors.\nHowever, whenever I go to look at a vector in the debugger I just see M_impl, with M_start and M_finish members (and a coupl... |
How can I return the result of a different action or move the user to a different action if there is an error in my ModelState without losing my ModelState information?
The scenario is; Delete action accepts a POST from a DELETE form rendered by my Index Action/View. If there is an error in the Delete I want to move t... | In ASP.NET MVC, when you want to return to a previous action while retaining the ModelState information, you'll want to use a `RedirectToAction` method after adding the errors to the ModelState. However, you cannot directly pass the ModelState to a different action using `RedirectToAction`. Instead, you'll need to save... | 36,646 | [
{
"from": "human",
"value": "How can I return the result of a different action or move the user to a different action if there is an error in my ModelState without losing my ModelState information?\nThe scenario is; Delete action accepts a POST from a DELETE form rendered by my Index Action/View. If there ... |
There's a lot to C# & ASP.net. Where should I start? What should I not bother focusing on?
Should I learn Winforms then WPF? Ditto for webforms / Silverlight?
Should I learn ASP.MVC or classic ASP.NET? If both, which first?
In the either/or cases - which will make more sense having known the other first?
What major .NE... | Given your goals of building a modular intranet application with a web interface, it's essential to focus on modern technologies and frameworks within the C# and ASP.NET ecosystem. Here’s a guide on where to start, what to focus on, and what to avoid:
### What to Start Learning
1. **C# Language Basics**:
- Since ... | 33,203 | [
{
"from": "human",
"value": "There's a lot to C# & ASP.net. Where should I start? What should I not bother focusing on?\nShould I learn Winforms then WPF? Ditto for webforms / Silverlight?\nShould I learn ASP.MVC or classic ASP.NET? If both, which first?\nIn the either/or cases - which will make more sense ... |
I'm using JScrollPane to allow scrolling in a JFrame that has a text component that's serving as a text editor. What I want to do, after setting the text in this editor, is have it scroll back up to the top, so you can see what's at the beginning of the file.
Does anyone know how to do this?
| To scroll to the top of a `JScrollPane` that contains a text component (such as `JTextArea`) in a Java Swing application, you can use the `JScrollPane`'s viewport and call the `setViewPosition` method to set the scroll position to the top.
Here's an example of how you can achieve this. In this example, we create a `JF... | 35,348 | [
{
"from": "human",
"value": "I'm using JScrollPane to allow scrolling in a JFrame that has a text component that's serving as a text editor. What I want to do, after setting the text in this editor, is have it scroll back up to the top, so you can see what's at the beginning of the file.\nDoes anyone know... |
I'm trying to create an algorithm in C# which produces the following output strings:
AAAA
AAAB
AAAC
...and so on...
ZZZX
ZZZY
ZZZZ
What is the best way to accomplish this?
public static IEnumerable<string> GetWords()
{
//Perform algorithm
yield return word;
}
| To generate the required output strings from "AAAA" to "ZZZZ" in C#, you can use a simple nested loop approach. Since you want to create all combinations of 4 characters where each character can range from 'A' to 'Z', a total of 26 characters, you can incrementally build the string by changing the last character first,... | 35,685 | [
{
"from": "human",
"value": "I'm trying to create an algorithm in C# which produces the following output strings:\nAAAA\nAAAB\nAAAC\n...and so on...\nZZZX\nZZZY\nZZZZ\n\nWhat is the best way to accomplish this?\npublic static IEnumerable<string> GetWords()\n{\n //Perform algorithm\n yield return word;... |
I am trying to use set.insert (key) as a conditional, where if the key is inserted correctly (meaning that the key does NOT already exist in the set ) then it should go on and perform some kind of code. For example, something like:
if (set.insert( key )) {
// some kind of code
}
Is this allowed? Because the compil... | In C++, the `insert` function of a `std::set` returns an iterator pointing to the inserted element (or to the element that prevented the insertion). To check if the insertion was successful (i.e., whether the key was already in the set), you can compare the returned iterator with the end iterator of the set.
Here is h... | 37,597 | [
{
"from": "human",
"value": "I am trying to use set.insert (key) as a conditional, where if the key is inserted correctly (meaning that the key does NOT already exist in the set ) then it should go on and perform some kind of code. For example, something like:\nif (set.insert( key )) {\n // some kind of ... |
What is the most elegant way of bubble-sorting in F#?
UPDATE
As pointed out in one of the answers, bubble sorting isn't efficient in a functional language to begin with. A humourously-cynical commenter also pointed out that bubble sorting is only appropriate when the list is small and it's almost sorted anyway.
Howeve... | Certainly! While bubble sort isn't the most efficient sorting algorithm, especially in a functional programming context like F#, it's a good exercise to implement it in a more elegant way. Below is a simple and elegant implementation of bubble sort in F#.
```fsharp
let rec bubbleSort lst =
let rec bubbleOnce lst s... | 34,448 | [
{
"from": "human",
"value": "What is the most elegant way of bubble-sorting in F#?\nUPDATE\nAs pointed out in one of the answers, bubble sorting isn't efficient in a functional language to begin with. A humourously-cynical commenter also pointed out that bubble sorting is only appropriate when the list is s... |
VB.net web system with a SQL Server 2005 backend. I've got a stored procedure that returns a varchar, and we're finally getting values that won't fit in a varchar(8000).
I've changed the return parameter to a varchar(max), but how do I tell the OleDbParameter.Size Property to accept any amount of text?
As a concrete e... | To handle a `varchar(max)` return type in an `OleDbCommand` when dealing with a SQL Server 2005 backend, you can make use of the `Size` property of the `OleDbParameter` as follows:
### Key Points
1. For `varchar(max)`, you do not need to set the size explicitly to any specific maximum value like `8000`.
2. Instead, se... | 36,517 | [
{
"from": "human",
"value": "VB.net web system with a SQL Server 2005 backend. I've got a stored procedure that returns a varchar, and we're finally getting values that won't fit in a varchar(8000).\nI've changed the return parameter to a varchar(max), but how do I tell the OleDbParameter.Size Property to ... |
When I create a new Date object, it is initialized to the current time but in the local timezone. How can I get the current date and time in GMT?
| To get the current date and time in GMT (UTC) in JavaScript, you can create a new `Date` object and then use the appropriate methods to extract the date and time components in UTC format. Here's how you can do it:
```javascript
// Create a new Date object
const now = new Date();
// Get the current date and time in GM... | 35,498 | [
{
"from": "human",
"value": "When I create a new Date object, it is initialized to the current time but in the local timezone. How can I get the current date and time in GMT?\n"
},
{
"from": "gpt",
"value": "To get the current date and time in GMT (UTC) in JavaScript, you can create a new `Date`... |
In a detailsview, how can I prepopulate one of the textboxes on the insertcommand (When the user clicks insert and the view is insert).
I think this would work for codebehind:
Dim txtBox As TextBox = FormView1.FindControl("txtbox")
txtbox.Text = "Whatever I want"
Is this right? What do I need in the aspx (not as sure)?... | You can achieve the goal of prepopulating a textbox in a `DetailsView` control during the insert process in ASP.NET. Given your use case of generating a random GUID and setting it in a textbox on the `InsertCommand`, you can do this using the `ItemCreated` or `ItemInserting` event of the `DetailsView`.
### Here's how... | 34,422 | [
{
"from": "human",
"value": "In a detailsview, how can I prepopulate one of the textboxes on the insertcommand (When the user clicks insert and the view is insert).\nI think this would work for codebehind:\nDim txtBox As TextBox = FormView1.FindControl(\"txtbox\")\ntxtbox.Text = \"Whatever I want\"\nIs this... |
I'm using asp.net/c# and have a number of Collapsible Panel Extenders that have been dynamically created when the page loads. The controls are within an update panel that updates every 5 seconds. The problem I have is whenever the update panel updates the state of the controls is reset. For example the Collapsible Pane... | In ASP.NET Web Forms, when you're dynamically generating controls and using an `UpdatePanel`, the controls' states are reset on every partial postback (which happens every 5 seconds in your case). This is because the dynamically created controls need to be recreated on every postback for their state to be preserved.
... | 35,115 | [
{
"from": "human",
"value": "I'm using asp.net/c# and have a number of Collapsible Panel Extenders that have been dynamically created when the page loads. The controls are within an update panel that updates every 5 seconds. The problem I have is whenever the update panel updates the state of the controls i... |
Let's say I checked in a changelist (in Perforce) with lots of files and I'd like to revert the entire changelist. Is there an easy way to "revert" the entire changelist in one fell swoop?
Currently I do something like this for each file in the changelist:
p4 sync //path/to/file#n (where "n" is the previous version o... | Yes, there is a more efficient way to revert an entire changelist in Perforce without having to manually revert each file individually. You can use the `p4 revert` command, which allows you to revert all changes in a specific changelist at once.
Here are the steps to revert a changelist:
1. First, identify the change... | 38,940 | [
{
"from": "human",
"value": "Let's say I checked in a changelist (in Perforce) with lots of files and I'd like to revert the entire changelist. Is there an easy way to \"revert\" the entire changelist in one fell swoop?\nCurrently I do something like this for each file in the changelist:\n\np4 sync //path/... |
I have been researching and playing with functional programming lately, solely to broaden my thinking about programming, because I find thinking "functionally" difficult.
I have downloaded Glasgow Haskell and experimented with that.
What I am wondering is, what is the best platform for Windows to experiment with FP? I... | It's great to hear that you're exploring functional programming (FP)! Each language offers unique advantages and experiences, and it's understandable to seek a JVM-based approach given your background in C and Java. Let's delve into your questions.
### 1. **JVM and Tail Recursion**
While it's true that the JVM has so... | 34,156 | [
{
"from": "human",
"value": "I have been researching and playing with functional programming lately, solely to broaden my thinking about programming, because I find thinking \"functionally\" difficult.\nI have downloaded Glasgow Haskell and experimented with that.\nWhat I am wondering is, what is the best p... |
What's the best way to get a regular anchor (<a href="...">) to submit the form it is embedded in when clicked?
<form>
<ul>
<li>
<p>
The link could be <span>embedded <a href="" onclick="?">at any level</a></span>
in the form, so "this.parentNode.parentNode..." is ... | You can achieve the desired functionality using plain JavaScript without relying on jQuery or any external library. The key is to use the `closest` method to find the nearest parent form element and then call the `submit()` method on it. Here's how you can implement it:
```html
<form>
<ul>
<li>
... | 36,166 | [
{
"from": "human",
"value": "What's the best way to get a regular anchor (<a href=\"...\">) to submit the form it is embedded in when clicked?\n<form>\n <ul>\n <li>\n <p>\n The link could be <span>embedded <a href=\"\" onclick=\"?\">at any level</a></span>\n ... |
Without using a WebBrowser control, how could I execute a JavaScript function, that is decoupled from any browser DOM dependencies, in a C# application? I am investigating implementing validation rules only once, for both server and client validation. See this question for reference if you like. Are there any JS int... | To achieve your goal of executing JavaScript in a C# application without relying on a WebBrowser control or similar browser dependencies, you can use a JavaScript engine library that allows you to run JavaScript code in a .NET environment. This approach allows you to maintain a single set of validation rules in JavaScr... | 33,967 | [
{
"from": "human",
"value": "Without using a WebBrowser control, how could I execute a JavaScript function, that is decoupled from any browser DOM dependencies, in a C# application? I am investigating implementing validation rules only once, for both server and client validation. See this question for ref... |
So i'm not really sure why this is happening but I'm running through some DataRows where I have the control name, property, and value that I want to set. Everything works fine except when I set the TEXT property of a button. For some reason, the click event is called...
Here's some of the code I've got:
string controlN... | It seems that you're encountering an unexpected behavior when setting the `Text` property of a button. In Windows Forms (WinForms) applications, setting the `Text` property of a button should not trigger its click event handler directly. However, there are a few scenarios and potential issues that could lead to this be... | 36,201 | [
{
"from": "human",
"value": "So i'm not really sure why this is happening but I'm running through some DataRows where I have the control name, property, and value that I want to set. Everything works fine except when I set the TEXT property of a button. For some reason, the click event is called...\nHere's ... |
I'm working on an application developed by another mob and am confounded by the use of a char field instead of bit for all the boolean columns in the database. It uses "Y" for true and "N" for false (these have to be uppercase). The type name itself is then aliased with some obscure name like ybln.
This is very annoyin... | Using a `CHAR` or `VARCHAR` field to represent boolean values, as in the case you described with "Y" for true and "N" for false, is not a common practice in modern database design where many databases provide a dedicated `BOOLEAN` type. However, there are several reasons why a developer or team might choose this approa... | 35,827 | [
{
"from": "human",
"value": "I'm working on an application developed by another mob and am confounded by the use of a char field instead of bit for all the boolean columns in the database. It uses \"Y\" for true and \"N\" for false (these have to be uppercase). The type name itself is then aliased with some... |
I am working on a new version of a firefox extension, but after releasing it, and incrementing the em:version in install.rdf and update.rdf, when I click "Find updates" Firefox reports that "No updates were found." When I run it with debugging on, the output in the console is actually identical to what I see when I do... | When you're experiencing issues with your Firefox extension updates, there are several things to check to troubleshoot the problem. Below are some steps and checks that you might find helpful:
1. **Check the Update URL**: Ensure that the update URL specified in the `install.rdf` and `update.rdf` files is correct. The ... | 32,489 | [
{
"from": "human",
"value": "I am working on a new version of a firefox extension, but after releasing it, and incrementing the em:version in install.rdf and update.rdf, when I click \"Find updates\" Firefox reports that \"No updates were found.\" When I run it with debugging on, the output in the console ... |
I'm tring to build a library for simplifing late binding calls in C#, and I'm getting trouble tring with reference parameteres. I have the following method to add a parameter used in a method call
public IInvoker AddParameter(ref object value)
{
//List<object> _parameters = new List<object>();
_... | The issue you're encountering arises from the fact that when you pass a value type (like `int`) to a method that takes a `ref` parameter, the value type gets boxed when you assign it to an `object`. This boxing process creates a new instance on the heap, so any modifications to that instance won't reflect back on the o... | 34,887 | [
{
"from": "human",
"value": "I'm tring to build a library for simplifing late binding calls in C#, and I'm getting trouble tring with reference parameteres. I have the following method to add a parameter used in a method call\n public IInvoker AddParameter(ref object value)\n {\n //List<object>... |
I have a class which constructor takes a Jakarta enums. I'm trying to find how I can easily inject it via an Spring XML aplicationContext.
For example :
The enum :
public class MyEnum extends org.apache.commons.lang.enums.Enum {
public static final MyEnum MY_FIRST_VALUE = new MyEnum("MyFirstValue");
public stat... | To inject your custom `MyEnum` type using Spring's XML configuration, you'll need to utilize a `PropertyEditor` because Spring doesn't inherently know how to convert strings to your custom enum type.
Here are the steps to create a custom `PropertyEditor` for your `MyEnum` class and configure it in your Spring XML appl... | 37,239 | [
{
"from": "human",
"value": "I have a class which constructor takes a Jakarta enums. I'm trying to find how I can easily inject it via an Spring XML aplicationContext.\nFor example :\nThe enum :\npublic class MyEnum extends org.apache.commons.lang.enums.Enum {\n public static final MyEnum MY_FIRST_VALUE ... |
On an ASP.NET page, I have a GridView populated with the results of a LINQ query. I'm setting the DataSource in code, then calling DataBind on it. In the GridView's RowDataBound event, I'm selectively hiding links in some GridView fields based on the query results. (For instance, I hide the "Show Parent" link of the... | To achieve your goal of hiding specific links in the GridView based on conditions even after a postback, you can handle the logic in the `RowDataBound` event during the initial data binding and also ensure you have a mechanism to determine the same conditions during postback. Since the `RowDataBound` event won't fire o... | 34,017 | [
{
"from": "human",
"value": "On an ASP.NET page, I have a GridView populated with the results of a LINQ query. I'm setting the DataSource in code, then calling DataBind on it. In the GridView's RowDataBound event, I'm selectively hiding links in some GridView fields based on the query results. (For insta... |
What is the best way to print the cells of a String[][] array as a right-justified table? For example, the input
{ { "x", "xxx" }, { "yyy", "y" }, { "zz", "zz" } }
should yield the output
x xxx
yyy y
zz zz
This seems like something that one should be able to accomplish using java.util.Formatter, but it doesn't ... | To print a `String[][]` array as a right-justified table in Java, we can determine the maximum width for each column and then use `String.format()` to format each element accordingly. Here's a complete example of how to achieve this:
```java
import java.util.Arrays;
public class RightJustifiedTable {
public stat... | 36,622 | [
{
"from": "human",
"value": "What is the best way to print the cells of a String[][] array as a right-justified table? For example, the input\n{ { \"x\", \"xxx\" }, { \"yyy\", \"y\" }, { \"zz\", \"zz\" } }\n\nshould yield the output\n x xxx\nyyy y\n zz zz\n\nThis seems like something that one should be ... |
Are there limits or performance penalties on the amount of code inside of my home.cs form?
I am writing a database application front-end in C# in Visual Studio 2008. The way things are lining up, I am using a tab-page way of changing the info shown to the end users, instead of using new forms.
Coming from VBA/MS Acces... | In C#, particularly when using Visual Studio 2008, there are no strict limits on the number of lines of code you can have in a single file (like your `home.cs`). Unlike VBA in Access, C# does not impose a maximum line limit that would cause a compilation error. However, there are several considerations you should keep ... | 35,010 | [
{
"from": "human",
"value": "Are there limits or performance penalties on the amount of code inside of my home.cs form?\nI am writing a database application front-end in C# in Visual Studio 2008. The way things are lining up, I am using a tab-page way of changing the info shown to the end users, instead of ... |
I have a client application that calls a function1 on webservice1 on server1 in the local network. The webservice1 then calls another webservice2 on an remote server2.
If open Internet Explorer on server1 and point it to the function1 on webservice1 and run the function, everything goes fine.
But if I run it from the c... | The issue you’re facing may be related to several factors, especially since you’ve highlighted that the function works when accessed directly from the server but fails when called from the client. Here are some potential reasons for the “bad request” or “protocol error” you are encountering:
1. **Network Configuration... | 36,492 | [
{
"from": "human",
"value": "I have a client application that calls a function1 on webservice1 on server1 in the local network. The webservice1 then calls another webservice2 on an remote server2.\nIf open Internet Explorer on server1 and point it to the function1 on webservice1 and run the function, everyt... |
I have a problem with an ASP.NET application that is driving me nuts.
When a user leaves a page inactive for a period of time the session was timing out and error were being thrown due to session variables not being resolvable (I will error trap this anyway but this is not the problem).
I coded a 'defribulator' which w... | It sounds like you're experiencing a classic challenge with ASP.NET session state and Forms Authentication timeouts. Here are some considerations and suggestions that may help clarify the situation and potentially resolve the issue:
1. **Session Timeout vs. Forms Authentication Timeout**:
- The session timeout and ... | 35,710 | [
{
"from": "human",
"value": "I have a problem with an ASP.NET application that is driving me nuts.\nWhen a user leaves a page inactive for a period of time the session was timing out and error were being thrown due to session variables not being resolvable (I will error trap this anyway but this is not the ... |
I'm using flex builder to compile my SWF. Im using mp3's on my local machine and computeSpectrum() to analyze the mp3.
After playing for 20secs, my computeSpectrum stops returning values, instead, it starts returning this error:
SecurityError: Error #2121: Security sandbox violation: SoundMixer.computeSpectrum: file:/... | The `SecurityError: Error #2121` indicates that there is a security sandbox violation in your Flex application when it tries to access the sound data using `SoundMixer.computeSpectrum()`. This issue typically occurs when trying to access local files, especially when your SWF is not being served from a web server.
### ... | 35,624 | [
{
"from": "human",
"value": "I'm using flex builder to compile my SWF. Im using mp3's on my local machine and computeSpectrum() to analyze the mp3. \nAfter playing for 20secs, my computeSpectrum stops returning values, instead, it starts returning this error:\nSecurityError: Error #2121: Security sandbox vi... |
Good morning. I have an XML file which contains lists of warning and errors from a build output. I have successfully been able to write XSL to iterate over the separate lists of warnings and errors to have them display in my browser. What I'd like to do next would be to add a bit of javascript in order to add a link... | The issue you're encountering is due to how you're structuring your HTML and JavaScript for toggling the visibility of the warning messages. You're generating a separate `<td>` for each warning, but all of them share the same `id` ("warnings"). In HTML, `id` attributes must be unique within a document, so when you retr... | 31,010 | [
{
"from": "human",
"value": "Good morning. I have an XML file which contains lists of warning and errors from a build output. I have successfully been able to write XSL to iterate over the separate lists of warnings and errors to have them display in my browser. What I'd like to do next would be to add a... |
I've previously encountered the suggestion to call System.Threading.Thread.Sleep(0); in tights loops in C# to prevent CPU hogging and used it to good effect.
I have a PowerShell script that has a tight loop and I'm wondering whether I should be calling [Thread]::Sleep(0) or Start-Sleep 0 or whether the PS engine will y... | In PowerShell, if you have a tight loop, the engine itself does not yield control in a manner that would prevent CPU hogging. Therefore, if you want to ensure that your script doesn't consume excessive CPU resources while running in a tight loop, it's a good practice to introduce a slight delay.
In PowerShell, you hav... | 37,639 | [
{
"from": "human",
"value": "I've previously encountered the suggestion to call System.Threading.Thread.Sleep(0); in tights loops in C# to prevent CPU hogging and used it to good effect.\nI have a PowerShell script that has a tight loop and I'm wondering whether I should be calling [Thread]::Sleep(0) or Sta... |
Our app (already deployed) is using an Access/Jet database. The upcoming version of our software requires some additional columns in one of the tables. I need to first check if these columns exist, and then add them if they don't.
Can someone provide a quick code sample, link, or nudge in the right direction?
(I'm usin... | To check if specific columns exist in an Access/Jet database table and then add them if they don't, you can use ADO.NET with the OleDb provider in C#. Below is a sample code snippet that demonstrates how to do this:
### C# Code Sample:
```csharp
using System;
using System.Data;
using System.Data.OleDb;
namespace Acc... | 32,790 | [
{
"from": "human",
"value": "Our app (already deployed) is using an Access/Jet database. The upcoming version of our software requires some additional columns in one of the tables. I need to first check if these columns exist, and then add them if they don't.\nCan someone provide a quick code sample, link, ... |
I'm currently the Teaching Assistant for an Introduction to C class. The class is being taught using Visual Studio, but when grading I just use a simple Windows batch script to process all the assignment submissions, compile them, run them on a test file, and redirect the output to a series of text files I can print ou... | The issue you're encountering is due to the way input and output are handled in console applications when you redirect stdin and stdout. When you redirect the input from a file, the program does not flush the output buffer when it prints the prompt, which results in the prompt not being visible in the redirected output... | 38,831 | [
{
"from": "human",
"value": "I'm currently the Teaching Assistant for an Introduction to C class. The class is being taught using Visual Studio, but when grading I just use a simple Windows batch script to process all the assignment submissions, compile them, run them on a test file, and redirect the output... |
I am working with LINQ to SQL and my image fields are treated as Binary. It's no big issue to convert the Binary type to byte[] (you can just use the ToArray() method of the Binary object) when I need to render the images, but can someone tell me how to turn either a byte[] or Stream object into the Binary object so I... | In LINQ to SQL, if you need to convert a `byte[]` or `Stream` object back into a `Binary` object for saving into the database, you can achieve this easily. Below are the steps for both conversions:
### Converting `byte[]` to `Binary`
If you have a `byte[]` and you need to convert it into a `Binary` object, you can do... | 36,756 | [
{
"from": "human",
"value": "I am working with LINQ to SQL and my image fields are treated as Binary. It's no big issue to convert the Binary type to byte[] (you can just use the ToArray() method of the Binary object) when I need to render the images, but can someone tell me how to turn either a byte[] or ... |
What are the best practices to do transactions in C# .Net 2.0. What are the classes that should be used? What are the pitfalls to look out for etc. All that commit and rollback stuff. I'm just starting a project where I might need to do some transactions while inserting data into the DB. Any responses or links for even... | When working with transactions in C# .NET 2.0, it's important to follow best practices to ensure data integrity, maintain consistency, and handle any exceptions that may arise. Below are some best practices, classes to use, common pitfalls to watch for, and a brief explanation of how to commit and rollback transactions... | 31,827 | [
{
"from": "human",
"value": "What are the best practices to do transactions in C# .Net 2.0. What are the classes that should be used? What are the pitfalls to look out for etc. All that commit and rollback stuff. I'm just starting a project where I might need to do some transactions while inserting data int... |
I want to implement forms authentication on an ASP.NET website, the site should seek the user on the database to get some data and then authenticate against LDAP (Active Directory) to validate the user/password combo.
After that I need to keep a instance of class that represents the user to use it in various forms.
I t... | Implementing forms authentication in an ASP.NET website while synchronizing session timeout with the authentication cookie lifespan can be a bit tricky, but it is achievable with careful management of both the session and authentication state. Here’s a guideline on how to implement this properly:
### Step-by-Step Appr... | 28,280 | [
{
"from": "human",
"value": "I want to implement forms authentication on an ASP.NET website, the site should seek the user on the database to get some data and then authenticate against LDAP (Active Directory) to validate the user/password combo.\nAfter that I need to keep a instance of class that represent... |
(If anything here needs clarification/ more detail please let me know.)
I have an application (C#, 2.* framework) that interfaces with a third-party webservice using SOAP. I used thinktecture's WSCF add-in against a supplied WSDL to create the client-side implementation. For reasons beyond my control the SOAP message ... | To capture the raw SOAP response in a C# application that is using a WSE (Web Services Enhancements) client, you can employ message logging to intercept the messages that are sent and received. Here's how you can do it:
### 1. Create a Custom SoapExtension
You can create a custom `SoapExtension` to log the raw SOAP r... | 34,139 | [
{
"from": "human",
"value": "(If anything here needs clarification/ more detail please let me know.)\nI have an application (C#, 2.* framework) that interfaces with a third-party webservice using SOAP. I used thinktecture's WSCF add-in against a supplied WSDL to create the client-side implementation. For r... |
I have a form that sits behind ASP.NET forms authentication. So far, the implementation follows a typical "out of the box" type configuration.
One page allows users to post messages. If the user sits on that page for a long time to compose the message, it may run past the auth session expiration. In that case, the p... | To address the issue of users potentially losing their messages due to session expiration while composing a long message, you can consider a couple of strategies that don't involve extending the authentication session duration for the entire application. Here are some recommended approaches:
### 1. Use AJAX for Messag... | 35,039 | [
{
"from": "human",
"value": "I have a form that sits behind ASP.NET forms authentication. So far, the implementation follows a typical \"out of the box\" type configuration.\nOne page allows users to post messages. If the user sits on that page for a long time to compose the message, it may run past the a... |
I am writing a program that will draw a solid along the curve of a spline. I am using visual studio 2005, and writing in C++ for OpenGL. I'm using FLTK to open my windows (fast and light toolkit).
I currently have an algorithm that will draw a Cardinal Cubic Spline, given a set of control points, by breaking the interv... | It sounds like you're working on an interesting project! Extruding a solid along a spline can indeed be a bit tricky, especially when it comes to correctly orienting the cylinder segments.
Here’s a systematic approach to achieve your goal, particularly focusing on the orientation issue for drawing the cylinders along ... | 33,288 | [
{
"from": "human",
"value": "I am writing a program that will draw a solid along the curve of a spline. I am using visual studio 2005, and writing in C++ for OpenGL. I'm using FLTK to open my windows (fast and light toolkit).\nI currently have an algorithm that will draw a Cardinal Cubic Spline, given a set... |
I am saving some small images to Xml as a Byte[] via the following XElement construct..
XElement xe = new XElement("Images",
from c in qry
select new XElement("Image", new XAttribute("Date", c.Date),
new XElement("Data", c.Bytes)));
the Bytes property is a Byte[], looking at the r... | When working with XML in C#, storing and retrieving binary data like a `byte[]` can be a bit tricky, as XML is primarily text-based. When you save a `byte[]` as XML, the data is typically represented in a textual format, such as Base64 encoding.
To retrieve the byte array from your XML, you should first read the cont... | 37,708 | [
{
"from": "human",
"value": "I am saving some small images to Xml as a Byte[] via the following XElement construct..\nXElement xe = new XElement(\"Images\",\n from c in qry\n select new XElement(\"Image\", new XAttribute(\"Date\", c.Date),\n new XElement(\"Data\", c.Bytes)... |
I am developing a website using SQL Server Express on my development machine. My web hosting company is providing me with SQL Server 2005.
At the moment all I have is a database that I develop with and a database that is on the live server. I do not have the original scripts to generate the schema but I can auto genera... | Managing your database schema effectively is crucial for the long-term success of your development project, especially when working with different environments (development, testing, production). Here are some tips and best practices to help you manage your database schema using source control.
### What to Include in ... | 34,232 | [
{
"from": "human",
"value": "I am developing a website using SQL Server Express on my development machine. My web hosting company is providing me with SQL Server 2005.\nAt the moment all I have is a database that I develop with and a database that is on the live server. I do not have the original scripts to... |
I have a snippet looking something like the below.
string bodyTypeAssemblyQualifiedName = "XXX.XX.XI.CustomerPayment.Schemas.r1.CustomerPayments_v01, XXX.XX.XI.CustomerPaym" +
"ent.Schemas.r1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ac564f277cd4488" +
"e";
I'd like use regular ... | To match the entire string assignment including newlines in your C# snippet using a regular expression, you need to use the `RegexOptions.Singleline` option, which allows the `.` character to match newline characters as well.
Here's how you can achieve that in C#:
```csharp
using System;
using System.Text.RegularExpr... | 35,769 | [
{
"from": "human",
"value": "I have a snippet looking something like the below.\nstring bodyTypeAssemblyQualifiedName = \"XXX.XX.XI.CustomerPayment.Schemas.r1.CustomerPayments_v01, XXX.XX.XI.CustomerPaym\" +\n \"ent.Schemas.r1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ac564f277cd4488\... |
I have an ASP.Net MVC Ajax.BeginForm that submits and updates my page properly when I click the submit button.
The problem is I need additional events to do the same thing, like when they change the text of an input. The additonal events do properly submit the form but they circumvent the onsubmit javascript generat... | To ensure that your additional events trigger the `onsubmit` JavaScript function generated by `Ajax.BeginForm`, you can modify your jQuery to manually call the `handleSubmit` method from the `Sys.Mvc.AsyncForm` instead of just submitting the form normally. This way, you can ensure that the same Ajax behavior is retaine... | 36,813 | [
{
"from": "human",
"value": "I have an ASP.Net MVC Ajax.BeginForm that submits and updates my page properly when I click the submit button. \nThe problem is I need additional events to do the same thing, like when they change the text of an input. The additonal events do properly submit the form but they ... |
Something that confuses me, but has never caused any problems... the recommended way to dispatch an event is as follows:
public event EventHandler SomeEvent;
...
{
....
if(SomeEvent!=null)SomeEvent();
}
In a multi-threaded environment, how does this code guarantee that another thread will not alter the invocat... | The concern you've raised regarding the invocation of events in a multi-threaded environment is a valid one. The code you've provided does indeed have a potential race condition. Between checking if `SomeEvent` is not null and invoking it, another thread could potentially unsubscribe from the event, which would lead to... | 38,191 | [
{
"from": "human",
"value": "Something that confuses me, but has never caused any problems... the recommended way to dispatch an event is as follows:\npublic event EventHandler SomeEvent;\n...\n{\n ....\n if(SomeEvent!=null)SomeEvent();\n}\n\nIn a multi-threaded environment, how does this code guarant... |
I'd like to warn users when they try to close a browser window if they didn't save the changes they made in the web form.
I'm using ASP.NET 3.5 (with ASP.NET Ajax).
Is there a common solution which I could easily implement?
EDIT: maybe my question wasn't clear: I am specifically looking for a way which integrates grace... | To warn users when they attempt to close a browser window or navigate away from the page without saving changes in a web form using ASP.NET, you can utilize JavaScript along with ASP.NET Server Controls. The goal is to prompt the user with a confirmation dialog when they try to leave the page, especially if they have u... | 33,683 | [
{
"from": "human",
"value": "I'd like to warn users when they try to close a browser window if they didn't save the changes they made in the web form.\nI'm using ASP.NET 3.5 (with ASP.NET Ajax).\nIs there a common solution which I could easily implement?\nEDIT: maybe my question wasn't clear: I am specifica... |
I used an application recently that was awe-inspiring. All the forms inherited from their own classes and a 'form' came with an amazing amount of functionality and looked the nuts.
What I'm interested in is this 'feature' of the form. This was a C# WinForms project and blew me away.
The forms were bound to objects that... | Creating a C# WinForms application that features advanced data binding with two-way data validation and real-time updates involves several components working together seamlessly. The design you described suggests that the developers implemented a sophisticated pattern for data binding, validation, and change notificati... | 28,844 | [
{
"from": "human",
"value": "I used an application recently that was awe-inspiring. All the forms inherited from their own classes and a 'form' came with an amazing amount of functionality and looked the nuts.\nWhat I'm interested in is this 'feature' of the form. This was a C# WinForms project and blew me ... |
What are all the problem that you foresee in doing that.
| To provide a more accurate response, I would need to know specifically what "that" refers to. However, I can outline common issues that might arise in various contexts or projects:
1. **Technical Challenges**: Insufficient technical skills, inadequate technology, or software bugs can hinder progress.
2. **Resource Li... | 38,687 | [
{
"from": "human",
"value": "What are all the problem that you foresee in doing that.\n"
},
{
"from": "gpt",
"value": "To provide a more accurate response, I would need to know specifically what \"that\" refers to. However, I can outline common issues that might arise in various contexts or proj... |
Is there an easy way to verify that a given private key matches a given public key? I have a few *.puband a few *.key files, and I need to check which go with which.
Again, these are pub/key files, DSA.
I would really prefer a one-liner of some sort...
| Yes, you can verify if a DSA private key matches a public key using the `ssh-keygen` command. The following one-liner will help you do that:
```bash
ssh-keygen -y -f your_private_key.key | diff - your_public_key.pub
```
Replace `your_private_key.key` with the filename of your private key file and `your_public_key.pub... | 31,574 | [
{
"from": "human",
"value": "Is there an easy way to verify that a given private key matches a given public key? I have a few *.puband a few *.key files, and I need to check which go with which.\nAgain, these are pub/key files, DSA.\nI would really prefer a one-liner of some sort...\n"
},
{
"from":... |
I have a VB6 picture box that gets an image from a video capture device.
I'm trying to figure out how to then convert the picture box to a byte array.
| In Visual Basic 6 (VB6), you can convert the content of a PictureBox (which holds an image) into a byte array by using the `GetDIBits` API function to retrieve the bits from the device context of the PictureBox. Here's a basic outline of how to do this:
1. **Get the device context (DC) of the PictureBox.**
2. **Retrie... | 32,859 | [
{
"from": "human",
"value": "I have a VB6 picture box that gets an image from a video capture device.\nI'm trying to figure out how to then convert the picture box to a byte array.\n"
},
{
"from": "gpt",
"value": "In Visual Basic 6 (VB6), you can convert the content of a PictureBox (which holds ... |
I am writing a pretty simple 2D game in JavaFX, and although its only in preview release at the moment, I am looking to try to implement (even basically) some sort of Cel-Shading onto my game objects.
Does anyone know if there are reference implementations of cel-shading out there that I could use, or perhaps, some adv... | Cel-shading is a technique used in graphics to give objects a cartoon-like appearance by creating distinct bands of color, rather than smooth gradients. Implementing cel-shading in JavaFX can be a bit challenging since JavaFX is primarily designed for 2D applications and may not provide direct support for complex shadi... | 27,549 | [
{
"from": "human",
"value": "I am writing a pretty simple 2D game in JavaFX, and although its only in preview release at the moment, I am looking to try to implement (even basically) some sort of Cel-Shading onto my game objects.\nDoes anyone know if there are reference implementations of cel-shading out th... |
I am building an Entity Framework model for a subset of the Pubs database from microsoft. I am only interested and publishers and books, not publishers and employees, but there is a foreign key constraint between the publishers and emoloyees tables. When I remove the employees entity from my model, the model won't vali... | When working with a subset of a database that includes foreign key constraints to tables that you do not want to include in your Entity Framework model, there are a few strategies you can use without altering the actual database structure. Here’s how you can approach this situation:
### 1. **Using a Database View**
O... | 35,719 | [
{
"from": "human",
"value": "I am building an Entity Framework model for a subset of the Pubs database from microsoft. I am only interested and publishers and books, not publishers and employees, but there is a foreign key constraint between the publishers and emoloyees tables. When I remove the employees e... |
I have a large query in a PostgreSQL database.
The Query is something like this:
SELECT * FROM table1, table2, ... WHERE table1.id = table2.id...
When I run this query as a sql query, the it returns the wanted row.
But when I tries to use the same query to create a view, it returns an error:
error: column "id" specif... | Yes, the error you're encountering is due to the fact that when you use a `SELECT *` from multiple tables that share column names (like `id`), the resulting view will have duplicate column names, which PostgreSQL does not allow.
To resolve this issue without explicitly listing all the column names, you can use the `U... | 37,966 | [
{
"from": "human",
"value": "I have a large query in a PostgreSQL database.\nThe Query is something like this:\nSELECT * FROM table1, table2, ... WHERE table1.id = table2.id...\n\nWhen I run this query as a sql query, the it returns the wanted row.\nBut when I tries to use the same query to create a view, i... |
What is the actual use of TempData collection in asp.net MVC, I need pros and cons of that collection, and when do I need to use it, which views it is shared upon, or any useful information about it, finally if someone can tell me when to use it rather than ViewData?
Thanks in advance
CLOSED as exact duplicate of Diffe... | `TempData` is a specialized data storage mechanism in ASP.NET MVC that is used to store data temporarily for a single request. Here’s a deeper look into its use, pros and cons, and when to use it compared to `ViewData`.
### Use of TempData
1. **Data Persistence Across Redirects**: `TempData` is primarily used for sto... | 36,260 | [
{
"from": "human",
"value": "What is the actual use of TempData collection in asp.net MVC, I need pros and cons of that collection, and when do I need to use it, which views it is shared upon, or any useful information about it, finally if someone can tell me when to use it rather than ViewData?\nThanks in ... |
I am a newbie at Flex, and I don't like the way you have to write the namespace mx: for every control declaration you write. It makes the code cluttery. I would like to write:
<Panel ...
rather than
<mx:Panel ...
I tried writing
xmlns="http://www.adobe.com/2006/mxml"
for the top level element instead of
xmlns:mx="h... | It's great to hear that you've found a way to clean up your code by avoiding the repetitive namespace prefix in your Flex applications. Your approach, although unconventional, works for your specific use case and demonstrates your willingness to experiment with the technology. However, it’s worth highlighting the impli... | 35,494 | [
{
"from": "human",
"value": "I am a newbie at Flex, and I don't like the way you have to write the namespace mx: for every control declaration you write. It makes the code cluttery. I would like to write:\n<Panel ...\n\nrather than\n<mx:Panel ...\n\nI tried writing\nxmlns=\"http://www.adobe.com/2006/mxml\"\... |
Consider the following code:
client.Send(data, data.Length, endpoint);
byte[] response = client.Receive(ref endpoint);
While, according to WireShark (network sniffer), the remote host does reply with data,
the application here just waits for data forever... it does not receive the answer from the remote host for some ... | Based on your description of the code and the issue you're facing, there are a few potential reasons why the application is not receiving the response from the remote host. Here are some common issues and suggestions for troubleshooting:
1. **Blocking Call**: The `client.Receive()` method is a blocking call and may wa... | 30,666 | [
{
"from": "human",
"value": "Consider the following code:\nclient.Send(data, data.Length, endpoint);\nbyte[] response = client.Receive(ref endpoint);\n\nWhile, according to WireShark (network sniffer), the remote host does reply with data,\nthe application here just waits for data forever... it does not rec... |
I'm considering migrating my c# application from using custom GDI+ drawn controls to a WPF application with custom controls etc. I would like to know what's involved and what to expect.
Are there any resources people can recommend that might help? Or indeed any personal experiences that might be beneficial?
| Migrating a C# application from GDI+ to WPF can be a significant undertaking, but it can also provide many benefits, including improved performance, a more modern user interface, and better data binding capabilities. Here are some key points to consider, resources to check out, and personal experiences that can guide y... | 33,479 | [
{
"from": "human",
"value": "I'm considering migrating my c# application from using custom GDI+ drawn controls to a WPF application with custom controls etc. I would like to know what's involved and what to expect.\nAre there any resources people can recommend that might help? Or indeed any personal experie... |
I'm trying to safely update the home directory as specified in /etc/passwd,
but the standard Linux utils - usermod and vipw - for doing so aren't provided
by Cygwin.
Could anyone tell me how they changed this in Cygwin?
| In Cygwin, managing user accounts and their home directories can be a bit different from traditional Linux systems since Cygwin aims to provide a Unix-like environment on Windows. Since `usermod` and `vipw` aren't available, you'll need to manually edit the user database.
Here's how you can change a user's home direct... | 31,014 | [
{
"from": "human",
"value": "I'm trying to safely update the home directory as specified in /etc/passwd,\nbut the standard Linux utils - usermod and vipw - for doing so aren't provided\nby Cygwin.\nCould anyone tell me how they changed this in Cygwin?\n"
},
{
"from": "gpt",
"value": "In Cygwin, ... |
I'm trying to install a site under an alternative port on a server, but the port may be closed by a firewall. Is there a way to ping out or in, on a specific port, to see if it is open?
| Yes, you can test if a specific port is open on a server or if it can be reached through a firewall using several methods. Here are a few options:
### 1. Using Telnet
You can use the Telnet command to check if a port is open:
```bash
telnet [hostname or IP] [port]
```
If the connection is successful, the port is ope... | 37,167 | [
{
"from": "human",
"value": "I'm trying to install a site under an alternative port on a server, but the port may be closed by a firewall. Is there a way to ping out or in, on a specific port, to see if it is open?\n"
},
{
"from": "gpt",
"value": "Yes, you can test if a specific port is open on ... |
Does anyone know how much memory MyISAM and innoDB use? How does their memory usages compare when dealing with small tables vs. when dealing with bigger tables (up to 32 GB)?
I know innoDB is heavier than MyISAM, but just how much more?
Any help would be appreciated.
Thanks,
jb
| When comparing MyISAM and InnoDB in terms of memory usage, there are several factors to consider. Both storage engines have different architectures, optimizations, and features, which influence their memory consumption.
### MyISAM
1. **Memory Usage**:
- MyISAM is generally lighter in terms of memory usage because... | 34,937 | [
{
"from": "human",
"value": "Does anyone know how much memory MyISAM and innoDB use? How does their memory usages compare when dealing with small tables vs. when dealing with bigger tables (up to 32 GB)?\nI know innoDB is heavier than MyISAM, but just how much more? \nAny help would be appreciated.\nThank... |
There appears to be some debate about "the divide is between wanting an SDK and wanting to know the underlying protocol" (see http://www.tbray.org/ongoing/When/199x/1999/08/18/BitsOnTheWire).
I don't really understand what this is referring to, or why they are mutually exclusive.
What is the philosophy of each approach... | The debate between wanting an SDK (Software Development Kit) and wanting to understand the underlying protocol revolves around two different philosophies or approaches to software development and integration.
### Wanting an SDK
1. **Abstraction**: An SDK provides an abstraction layer that simplifies the interaction w... | 36,052 | [
{
"from": "human",
"value": "There appears to be some debate about \"the divide is between wanting an SDK and wanting to know the underlying protocol\" (see http://www.tbray.org/ongoing/When/199x/1999/08/18/BitsOnTheWire).\nI don't really understand what this is referring to, or why they are mutually exclus... |
When I set trust connection = yes in my web.config, what user account does it use?
Is it the 'NT AUTHORITY\NETWORK SERVICE'?
Because I under security in Sql management, I see: NtAuthority/System only??
| When you set `trusting connection` (or `Trusted_Connection=True`) in your `web.config` for a .NET application using SQL Server, the application will attempt to authenticate the user based on the Windows identity of the process running the application. This typically means that the application will use the identity of t... | 37,213 | [
{
"from": "human",
"value": "When I set trust connection = yes in my web.config, what user account does it use?\nIs it the 'NT AUTHORITY\\NETWORK SERVICE'?\nBecause I under security in Sql management, I see: NtAuthority/System only??\n"
},
{
"from": "gpt",
"value": "When you set `trusting connec... |
What is the most appropriate media type (formally MIME type) to use when sending data structured with YAML over HTTP and why?
There is no registered application type or text type that I can see.
Example:
> GET /example.yaml
< Content-Type: ????
<
< --- # Favorite movies
< - Casablanca
< - North by Northwest
< - Notori... | When sending YAML data over HTTP, the most appropriate media type (MIME type) to use is `application/yaml`.
Here's a breakdown of the options you provided:
- `text/x-yaml` and `text/yaml`: While these could be interpreted as suitable for text-based formats, they are not standard and there is no wide consensus on the... | 39,213 | [
{
"from": "human",
"value": "What is the most appropriate media type (formally MIME type) to use when sending data structured with YAML over HTTP and why?\nThere is no registered application type or text type that I can see.\nExample:\n> GET /example.yaml\n\n< Content-Type: ????\n<\n< --- # Favorite movies\... |
I know how to find out the current domain name in PHP already, the problem is when I put this code into a file and then include it from another server it shows the domain name of where the file is located. Is there any way for it to find out the domain or the site containing the include() code?
| When you include a PHP file from another server using the `include()` or `require()` functions, the included file is executed in the context of the server where the code is included. Therefore, if you are including a file from Server A while executing on Server B, any code that tries to get the current domain using `$_... | 33,455 | [
{
"from": "human",
"value": "I know how to find out the current domain name in PHP already, the problem is when I put this code into a file and then include it from another server it shows the domain name of where the file is located. Is there any way for it to find out the domain or the site containing the... |
I am using JSF frontend for a page where an image is uploaded or deleted. Clicking on the upload or delete button causes a postback and the page to reload with the updated status. This however, resets the scroll position of the page. How should I go about retaining the scrollback of this page on the postback actions.
| In JSF (JavaServer Faces), when a postback occurs due to an upload or delete action, the page reloads and any scroll position is lost. To retain the scroll position after the page refresh, you can use a combination of JavaScript and JSF to achieve this. Here's a step-by-step approach:
1. **Save Scroll Position on Post... | 31,475 | [
{
"from": "human",
"value": "I am using JSF frontend for a page where an image is uploaded or deleted. Clicking on the upload or delete button causes a postback and the page to reload with the updated status. This however, resets the scroll position of the page. How should I go about retaining the scrollbac... |
I have an SQL database with multiple tables, and I am working on creating a searching feature. Other than having multiple queries for the different tables, is there a different way to go about said searching function?
I should probably add that a lot of my content is database driven to make upkeep easier. Lucene wil... | When implementing a search feature across multiple tables in an SQL database, there are several approaches you can consider that can be more efficient than executing multiple separate queries for each table. Here are a few strategies:
### 1. **Unified Query with JOINs:**
If your tables are related (e.g., they have for... | 34,428 | [
{
"from": "human",
"value": "I have an SQL database with multiple tables, and I am working on creating a searching feature. Other than having multiple queries for the different tables, is there a different way to go about said searching function?\n\nI should probably add that a lot of my content is databas... |
DWR handles lists of primitives quite straight forward. I could not find whether array of objects returned by a DWR method call represent a JSON object. Any clues? Or do I have to return a JSON string representing the array of objects back to the browser?
| DWR (Direct Web Remoting) is a Java library that facilitates communication between Java servers and web browsers using JavaScript. When using DWR to return arrays of objects, the behavior regarding the serialization of those objects can vary based on the configuration and the types of objects being returned.
1. **Retu... | 36,532 | [
{
"from": "human",
"value": "DWR handles lists of primitives quite straight forward. I could not find whether array of objects returned by a DWR method call represent a JSON object. Any clues? Or do I have to return a JSON string representing the array of objects back to the browser?\n"
},
{
"from":... |
I don't find the oft-used "*" to be very nice looking - can anyone suggest a nicer-looking method or point me to an example?
I tried making the field highlighted in red as one person suggested but I did not like the look.
Bold labels might do the trick.
But I really like the idea of "Required" being shown in grey in th... | If you're looking for a visually appealing way to indicate required fields in a form, you have a few options. One popular method is to use placeholder text that disappears when the user starts typing, combined with CSS styles to enhance the appearance. Here's an example of how you can achieve this using HTML and CSS.
... | 36,131 | [
{
"from": "human",
"value": "I don't find the oft-used \"*\" to be very nice looking - can anyone suggest a nicer-looking method or point me to an example?\nI tried making the field highlighted in red as one person suggested but I did not like the look.\nBold labels might do the trick.\nBut I really like th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.