instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I have a nested function to show/hide paragraphs news-ticker-style.
The problem is that when the loop starts over (line 4), the opacity effects stop working correctly so the paragraphs appear abruptly.
Any jquery masters know about this? Am I making this too hard?
$('#special-ticker p').hide();
var a=0;
function outer... | The issue you're encountering with your nested function can be resolved by ensuring that the animation sequence is completed before the next one starts. The problem arises because you are calling the `outer()` function again immediately after incrementing `a`, which leads to overlapping animations.
To fix this, you ca... | 42,859 | [
{
"from": "human",
"value": "I have a nested function to show/hide paragraphs news-ticker-style.\nThe problem is that when the loop starts over (line 4), the opacity effects stop working correctly so the paragraphs appear abruptly. \nAny jquery masters know about this? Am I making this too hard?\n$('#specia... |
I appreciate that there are now many mechanisms in dotnet to deal with XML in a myriad of ways...
Suppose I have a string containing the XML....
<?xml version="1.0" encoding="utf-8" ?>
<root>
<Element1>
<Element1_1>
SomeData
</Element1_1>
</Element1>
<Element2>
Some More... | In .NET 3.5, one of the simplest and most readable ways to manipulate XML is by using the `System.Xml.Linq` namespace, which provides a LINQ to XML API. This makes it easy to query and modify XML documents.
Here's how you can remove the `Element1_1` from your XML string using `XDocument`:
```csharp
using System;
usin... | 43,125 | [
{
"from": "human",
"value": "I appreciate that there are now many mechanisms in dotnet to deal with XML in a myriad of ways... \nSuppose I have a string containing the XML....\n<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<root>\n <Element1>\n <Element1_1>\n SomeData\n </Element1... |
I want to develop a windows application. If I use native C++ and MFC for user interface then the application will be very fast and tiny. But using MFC is very complicated. Also If I use C# then the application will be slower than the native code and It reqiures .NET framework to run. But developing GUI is very easy by ... | The choice between C++ with MFC and C# with WinForms for developing a Windows application depends on several factors, including your specific needs, target audience, performance requirements, and your familiarity with the languages and frameworks. Here are some points to consider for both options:
### C++ with MFC:
**... | 40,699 | [
{
"from": "human",
"value": "I want to develop a windows application. If I use native C++ and MFC for user interface then the application will be very fast and tiny. But using MFC is very complicated. Also If I use C# then the application will be slower than the native code and It reqiures .NET framework to... |
I have a T4 template that generates classes from an xml file.
How can I add a dependency between the xml file and the template file so that when the xml file is modified the template is rerun automatically without choosing "Run custom tool" from the context menu?
| To ensure that your T4 template automatically runs whenever the XML file is modified, you can use a combination of T4 template directives and a custom file watcher. Here's how you can set this up in Visual Studio:
1. **Add a Dependency Directive**: First, ensure your T4 template includes a reference to the XML file us... | 34,259 | [
{
"from": "human",
"value": "I have a T4 template that generates classes from an xml file. \nHow can I add a dependency between the xml file and the template file so that when the xml file is modified the template is rerun automatically without choosing \"Run custom tool\" from the context menu?\n"
},
{... |
If there a way to protect against concurrent modifications of the same data base entry by two or more users?
It would be acceptable to show an error message to the user performing the second commit/save operation, but data should not be silently overwritten.
I think locking the entry is not an option, as a user might u... | Yes, there are several strategies to protect against concurrent modifications of the same database entry by multiple users while ensuring data integrity and providing appropriate feedback when conflicts occur. Here are some common approaches:
### 1. **Optimistic Concurrency Control**
- **Versioning**: Add a version... | 38,198 | [
{
"from": "human",
"value": "If there a way to protect against concurrent modifications of the same data base entry by two or more users?\nIt would be acceptable to show an error message to the user performing the second commit/save operation, but data should not be silently overwritten.\nI think locking th... |
I'm generating compiled getter methods at runtime for a given member. Right now, my code just assumes that the result of the getter method is a string (worked good for testing). However, I'd like to make this work with a custom converter class I've written, see below, "ConverterBase" reference that I've added.
I can'... | To achieve what you want, you will need to construct an expression tree that calls the `FieldToString` method of the `ConverterBase` instance with the value obtained from the member access. Here’s how you can do that step-by-step:
1. Create an instance of `ConverterBase`.
2. Use `Expression.Call` to create a call expr... | 38,604 | [
{
"from": "human",
"value": "I'm generating compiled getter methods at runtime for a given member. Right now, my code just assumes that the result of the getter method is a string (worked good for testing). However, I'd like to make this work with a custom converter class I've written, see below, \"Conver... |
I'm trying to convert a character code to a character with chr(), but VBScript isn't giving me the value I expect. According to VBScript, character code 199 is:
�
However, when using something like Javascript's String.fromCharCode, 199 is:
Ç
The second result is what I need to get out of VBScript's chr() function. ... | The behavior you're experiencing with the `Chr()` function in VBScript is likely due to a difference in character encoding and the context in which you're operating.
VBScript is based on the ANSI character set for the default Windows code page, and character codes may vary between different systems and environments. ... | 40,851 | [
{
"from": "human",
"value": "I'm trying to convert a character code to a character with chr(), but VBScript isn't giving me the value I expect. According to VBScript, character code 199 is:\n�\n\nHowever, when using something like Javascript's String.fromCharCode, 199 is:\nÇ\n\nThe second result is what I... |
I have a few text boxes and buttons on my form.
Lets say txtBox1 is next to btnSubmit1,
txtBox2 is next to btnSubmit2,
txtBox3 is next to btnSubmit3.
How can I set the focus on btnSubmit3 when the user starts to type something in txtBox3.
Meaning..... if a user type in a text box the program will know what button to fi... | To set the focus on `btnSubmit3` when the user starts typing in `txtBox3`, you can use the `KeyPress` or `KeyDown` event of `txtBox3` to detect when the user starts typing. Once the event is triggered, you can set the focus to `btnSubmit3`. Additionally, you can handle the `KeyDown` event to check for the Enter key and... | 41,435 | [
{
"from": "human",
"value": "I have a few text boxes and buttons on my form.\nLets say txtBox1 is next to btnSubmit1,\ntxtBox2 is next to btnSubmit2,\ntxtBox3 is next to btnSubmit3.\nHow can I set the focus on btnSubmit3 when the user starts to type something in txtBox3.\nMeaning..... if a user type in a te... |
We are using shared hosting and the follow features are disabled.
file_uploads = Off
allow_url_fopen = Off
allow_url_include = Off
We are unable to change hosting and need to figure out some workarounds. The hosting co is also not able/willing to enable these features.
For example:
We are calling 1 server from anot... | Given the constraints of your shared hosting environment, you can explore the following workarounds to fetch content from your dedicated server and cache it on your shared hosting server. Since `file_uploads`, `allow_url_fopen`, and `allow_url_include` are disabled, we will look for alternatives.
### 1. Use cURL to Fe... | 36,197 | [
{
"from": "human",
"value": "We are using shared hosting and the follow features are disabled.\nfile_uploads = Off\nallow_url_fopen = Off\nallow_url_include = Off\n\nWe are unable to change hosting and need to figure out some workarounds. The hosting co is also not able/willing to enable these features. \... |
I want a workflow that, when an entry is created in List A, will generate one entry in List B for each entry in List C. Is this possible? If so, how?
| Yes, it is possible to create a workflow that generates an entry in List B for each entry in List C whenever a new entry is created in List A. The exact implementation will depend on the tools or platform you are using (for example, Microsoft Power Automate, SharePoint, or a custom solution). Below, I'll provide a gene... | 36,898 | [
{
"from": "human",
"value": "I want a workflow that, when an entry is created in List A, will generate one entry in List B for each entry in List C. Is this possible? If so, how?\n"
},
{
"from": "gpt",
"value": "Yes, it is possible to create a workflow that generates an entry in List B for each ... |
I'm using the AsyncOperation class to avoid having to write tons of "if (control.InvokeRequired) then/else" methods (as opposed to its traditional role in the Event-Based Asynchronous Pattern). In some cases, I don't really care about getting a notification when the worker thread is complete. Because of this, I'd lik... | Omitting the call to `PostOperationCompleted` when using the `AsyncOperation` class can lead to potential issues, and it's generally considered bad practice. While the documentation may not explicitly state all the implications, there are a few reasons why it's recommended to always call `PostOperationCompleted`:
1. *... | 42,585 | [
{
"from": "human",
"value": "I'm using the AsyncOperation class to avoid having to write tons of \"if (control.InvokeRequired) then/else\" methods (as opposed to its traditional role in the Event-Based Asynchronous Pattern). In some cases, I don't really care about getting a notification when the worker th... |
Someone posted a great little function here the other day that separated the full path of a file into several parts that looked like this:
Function BreakDown(Full As String, FName As String, PName As String, Ext As String) As Integer
If Full = "" Then
BreakDown = False
Exit Function
End If
If InStr(Full, "\") Then... | You can modify the function to only consider the last three characters after the last period (.) as the file extension. This can be achieved by finding the last occurrence of the period in the string and then checking the substring that follows it. Here’s how you can implement this:
```vb
Function BreakDown(Full As St... | 41,931 | [
{
"from": "human",
"value": "Someone posted a great little function here the other day that separated the full path of a file into several parts that looked like this:\nFunction BreakDown(Full As String, FName As String, PName As String, Ext As String) As Integer\n If Full = \"\" Then\n BreakDown = False\n ... |
I have an object created in a host application and can access it remotely using remoting, is there any way I can test the connection to ensure it is still "alive"? Maybe an event I can use that fires if the remoting connection gets disconnected, or some property that can tell me the state of the remoting connection. I... | In .NET Remoting, there isn't a built-in, straightforward mechanism specifically designed for checking if a remote object is alive or for catching disconnections through events. However, there are a few approaches you can take to monitor the health of your remoting connection:
### 1. **Ping Method**
You can implement ... | 40,870 | [
{
"from": "human",
"value": "I have an object created in a host application and can access it remotely using remoting, is there any way I can test the connection to ensure it is still \"alive\"? Maybe an event I can use that fires if the remoting connection gets disconnected, or some property that can tell ... |
We're trying to show 4 trend graphs and will be adding data to them them at a rate of about 1 point every second. In the end each trend needs to show around 600 points.
Currently we are using the graphing tools from Syncfusion but they are unable to redraw the graphs at the speed we require. I believe the issue is d... | For high-speed trending control in a WPF application, where you need to efficiently render a large amount of data (600 points) and update it frequently (about 1 point per second), you'll want to consider alternatives that are optimized for real-time data visualization. Here are several options:
1. **LiveCharts**:
-... | 38,597 | [
{
"from": "human",
"value": "We're trying to show 4 trend graphs and will be adding data to them them at a rate of about 1 point every second. In the end each trend needs to show around 600 points. \nCurrently we are using the graphing tools from Syncfusion but they are unable to redraw the graphs at the s... |
I need to upload a file using C# from a windows mobile app to a website. It's running PHP as the webservice on the other side, though I guess it really doesn't have to if there's another way to be able to get the file up there. There is no server-side ASP support, however. My problem really isn't the PHP, it's the mobi... | If you're working on a Windows Mobile application and need to upload a file to a server using C#, you can use the `HttpWebRequest` class, which is available in the Compact Framework. Below is a basic example of how you can perform a file upload to a PHP endpoint using this class.
### Sample Code to Upload a File
```c... | 37,324 | [
{
"from": "human",
"value": "I need to upload a file using C# from a windows mobile app to a website. It's running PHP as the webservice on the other side, though I guess it really doesn't have to if there's another way to be able to get the file up there. There is no server-side ASP support, however. My pr... |
I have a Delphi application similar to Taskbar Shuffle that includes a hook dll.
EDIT: This hook DLL communicates with the main app by sending windows messages.
I want to add support to XP and Vista x64 and my initial idea was to convert the dll to 64-bit (compiling it with FreePascal) but keep the application 32-bit f... | You are correct that a 32-bit application cannot load a 64-bit DLL. This is due to the differences in the architecture and memory models between 32-bit and 64-bit processes. When you try to load a DLL using `LoadLibrary`, the process must match the architecture of the DLL. Therefore, a 32-bit process can only load 32-b... | 42,895 | [
{
"from": "human",
"value": "I have a Delphi application similar to Taskbar Shuffle that includes a hook dll.\nEDIT: This hook DLL communicates with the main app by sending windows messages.\nI want to add support to XP and Vista x64 and my initial idea was to convert the dll to 64-bit (compiling it with Fr... |
I have an incoming soap message wich form is TStream (Delphi7), server that send this soap is in development mode and adds a html header to the message for debugging purposes. Now i need to cut out the html header part from it before i can pass it to soap converter. It starts from the beginning with 'pre' tag and ends ... | Sure! In Delphi 7, you can manipulate the `TStream` to extract the SOAP message, ignoring the HTML headers. Since you're dealing with a stream, you'll want to read the stream into a string, locate the HTML tags, and then cut them out. Below is a simple approach you can use.
Here's a code snippet that demonstrates how ... | 33,711 | [
{
"from": "human",
"value": "I have an incoming soap message wich form is TStream (Delphi7), server that send this soap is in development mode and adds a html header to the message for debugging purposes. Now i need to cut out the html header part from it before i can pass it to soap converter. It starts fr... |
I'm currently trying to create a kernel module that will produce data based on kernel events and push them to a file. After reading that this is bad (and I agree), I decided it would make more sense to have the data in a /proc file that a user program could pull from when necessary. However, this idea led to all sort... | Creating a kernel module to produce data based on kernel events and provide that data to user space can indeed be complex, especially if you want to ensure data is available in a timely and efficient manner. Using `/proc` files or named pipes (also known as FIFOs) in `/proc` has its own set of challenges.
### Kernel t... | 36,064 | [
{
"from": "human",
"value": "I'm currently trying to create a kernel module that will produce data based on kernel events and push them to a file. After reading that this is bad (and I agree), I decided it would make more sense to have the data in a /proc file that a user program could pull from when neces... |
I am evaluating several Javascript UI toolkits for building web applications that have a desktop-like feel, mainly because of dialogs and window management.
I looked at several options - here are my evaluations so far:
ExtJS - Great widget library, great docs! Not so great license.
jQuery UI - Lack of ready-made windo... | Your evaluations are fairly accurate, and you've captured some of the key strengths and weaknesses of each of these JavaScript UI toolkits. Here’s a bit more detail on each of them, along with some additional toolkits you might want to consider for building web applications with a desktop-like feel:
1. **ExtJS**:
-... | 34,829 | [
{
"from": "human",
"value": "I am evaluating several Javascript UI toolkits for building web applications that have a desktop-like feel, mainly because of dialogs and window management.\nI looked at several options - here are my evaluations so far:\n\nExtJS - Great widget library, great docs! Not so great l... |
I've been putting together a small web form for our technicians to use from their phones out in the field. However I'm having a lot of trouble getting things working using ASP.NET Mobile, and there seems to be few resources out there to help learn this stuff. I'm also having trouble getting help.
So the thing is, d... | You are correct that with modern mobile browsers, you don’t necessarily need to use ASP.NET Mobile controls to create a functional and user-friendly web form for your technicians. In fact, using standard HTML, CSS, and JavaScript may give you greater flexibility and control over the design and functionality of your web... | 42,481 | [
{
"from": "human",
"value": "I've been putting together a small web form for our technicians to use from their phones out in the field. However I'm having a lot of trouble getting things working using ASP.NET Mobile, and there seems to be few resources out there to help learn this stuff. I'm also having t... |
Should you always check parameters and throw exceptions in .NET when the parameters are not what you expected? E.g. null objects or empty strings?
I started doing this, but then thought that this will bloat my code a lot if it’s done on every single method. Should I check parameters for both private and public methods?... | When it comes to handling method parameters in .NET, especially regarding null values and other invalid inputs, best practices can vary depending on the context of your application, but there are some general guidelines you can follow.
### Public vs Private Methods
1. **Public Methods**:
- **Always Validate**: Fo... | 38,377 | [
{
"from": "human",
"value": "Should you always check parameters and throw exceptions in .NET when the parameters are not what you expected? E.g. null objects or empty strings?\nI started doing this, but then thought that this will bloat my code a lot if it’s done on every single method. Should I check param... |
Environment:
C# projects, Visual studio 2008, C#, .Net 3.5, MSBuild
Objective:
Run my own custom build task for my C# projects, and based on the platform (Soln configuration platform), I do some manipulations to the Project object itself before build. Like setting BuildAction to EmbeddedResource etc.
Once that's done I... | To achieve the desired outcome of capturing the build output and errors generated during the build process while avoiding marking the Project object dirty, you can implement a custom build logging mechanism within your custom task. Since you already have access to the `Engine` and `Project` classes, you can create a cu... | 35,126 | [
{
"from": "human",
"value": "Environment:\nC# projects, Visual studio 2008, C#, .Net 3.5, MSBuild\nObjective:\nRun my own custom build task for my C# projects, and based on the platform (Soln configuration platform), I do some manipulations to the Project object itself before build. Like setting BuildAction... |
I have a problem with formatting the data when doing an query to an Oracle database.
What I want to do is to export some data into the formatbelow into a textfile;
1IN20071001 40005601054910101200 1 65
First number (1 above) = Company number (position 1-5, blanks infront)
IN or UT = IN for clock... | To achieve the desired format in your output, you'll need to adjust your SQL query to properly format the fields according to the specifications you provided. The primary goal is to ensure that each field is aligned correctly within its designated space and filled with spaces where necessary.
Here’s a revised version ... | 40,612 | [
{
"from": "human",
"value": "I have a problem with formatting the data when doing an query to an Oracle database.\nWhat I want to do is to export some data into the formatbelow into a textfile;\n 1IN20071001 40005601054910101200 1 65\n\n\nFirst number (1 above) = Company number (positio... |
Kind of a basic question but I'm having troubles thinking of a solution so I need a push in the right direction.
I have an input file that I'm pulling in, and I have to put it into one string variable. The problem is I need to split this string up into different things. There will be 3 strings and 1 int. They are se... | You're on the right track! You can achieve this by using the `find` method to locate the colons (`:`) and the `substr` method to extract the parts of the string between the colons. Then, you can convert the relevant substring to an integer. Below is a step-by-step guide along with sample C++ code to help you through th... | 40,672 | [
{
"from": "human",
"value": "Kind of a basic question but I'm having troubles thinking of a solution so I need a push in the right direction.\nI have an input file that I'm pulling in, and I have to put it into one string variable. The problem is I need to split this string up into different things. There... |
How do you escape the forward slash character (/) in VBScript? For example, in the following string:
bob = "VU administration/front desk"
| In VBScript, the forward slash character (`/`) does not require any special escaping, as it is treated as a regular character within a string. You can simply include it as is. Here is how you can define the string in your example:
```vbscript
bob = "VU administration/front desk"
```
If you need to concatenate or mani... | 44,229 | [
{
"from": "human",
"value": "How do you escape the forward slash character (/) in VBScript? For example, in the following string:\nbob = \"VU administration/front desk\"\n\n"
},
{
"from": "gpt",
"value": "In VBScript, the forward slash character (`/`) does not require any special escaping, as it... |
For desktop application that is. This is just a general question that maybe only need general answers.
| Of course! Feel free to ask your general question about desktop applications, and I'll do my best to provide you with a helpful answer. | 45,378 | [
{
"from": "human",
"value": "For desktop application that is. This is just a general question that maybe only need general answers.\n"
},
{
"from": "gpt",
"value": "Of course! Feel free to ask your general question about desktop applications, and I'll do my best to provide you with a helpful ans... |
When I write to the beginning of the file,it always leaves the first line empty,and start writing from the second one.
How can I make it write from the first line,including the first one and on?
Thanks.
| When writing to a file in many programming environments, if you're seeing that writing starts from the second line and leaves the first line empty, it is likely due to the way you are opening the file or the way you are handling the writing process.
Here are a few common scenarios and their solutions based on differen... | 40,586 | [
{
"from": "human",
"value": "When I write to the beginning of the file,it always leaves the first line empty,and start writing from the second one.\nHow can I make it write from the first line,including the first one and on?\nThanks.\n"
},
{
"from": "gpt",
"value": "When writing to a file in man... |
im trying to kick off a Runnable classes run method however i keep getting a NullPointerException, Im using WebSpheres commonj.workmanager to get an instance of executorService.this is the code im using.
executorService.execute(new Runnable() {
public void run() {
System.out.println("Inside run ()method.."... | A `NullPointerException` usually indicates that you're trying to use an object reference that hasn't been initialized (i.e., it's `null`). In your case, the likely culprit is the `executorService` variable. If `executorService` is `null` when you call the `execute()` method, you'll get a `NullPointerException`.
Here a... | 39,004 | [
{
"from": "human",
"value": "im trying to kick off a Runnable classes run method however i keep getting a NullPointerException, Im using WebSpheres commonj.workmanager to get an instance of executorService.this is the code im using.\nexecutorService.execute(new Runnable() {\n public void run() {\n ... |
In Visual Studio, when you compile foo.idl, MIDL generates the proxy information in foo_p.c.
Unfortunately, for Win32 and x64 files, it uses the same filename. For Win32, the file starts with:
#if !defined(_M_IA64) && !defined(_M_AMD64)
For x64, the file starts with:
#if defined(_M_AMD64)
When you build for Win32 and... | When you encounter the issue with MIDL generating the same `foo_p.c` file for both Win32 and x64 builds, and the file is not being replaced properly, there are a few strategies you can use to resolve this:
### 1. Use Post-Build Events
Instead of a pre-build event, consider using post-build events to clean up the gener... | 42,860 | [
{
"from": "human",
"value": "In Visual Studio, when you compile foo.idl, MIDL generates the proxy information in foo_p.c.\nUnfortunately, for Win32 and x64 files, it uses the same filename. For Win32, the file starts with:\n#if !defined(_M_IA64) && !defined(_M_AMD64)\n\nFor x64, the file starts with:\n#if d... |
I need to modify the following MySQL statement to include information from a third table... but I suck at joins.
select
ss.*,
se.name as engine,
ss.last_run_at + interval ss.refresh_frequency day as next_run_at,
se.logo_name
from
searches ss join search_engines se on ss.engine_id = se.id
where
... | To include information from the `projects` table in your SQL statement, you'll need to add another JOIN clause to connect the `searches` table (aliased as `ss`) with the `projects` table. Assuming that the table `projects` has a column named `id` that matches with the `project_id` in the `searches` table, the modified ... | 42,588 | [
{
"from": "human",
"value": "I need to modify the following MySQL statement to include information from a third table... but I suck at joins.\nselect\n ss.*,\n se.name as engine,\n ss.last_run_at + interval ss.refresh_frequency day as next_run_at,\n se.logo_name \nfrom \n searches ss join ... |
We've been using jbossmq and csil. The implementation has been successful in production for 6 years, but I'm wondering if something better is available.
One issue is jbossmq's thread per client model, and scheduled end of life. Another is csil's lack of support for JBossMessaging, which is the latest JMS implementation... | It's great to hear that you've had success with JBossMQ and CSIL in production for six years. However, it's understandable that you're looking for improvements and better options, especially given the limitations you've mentioned. Here are some alternatives and considerations you might want to explore:
### Alternative... | 39,646 | [
{
"from": "human",
"value": "We've been using jbossmq and csil. The implementation has been successful in production for 6 years, but I'm wondering if something better is available.\nOne issue is jbossmq's thread per client model, and scheduled end of life. Another is csil's lack of support for JBossMessagi... |
This question is about a Java JTree or a Window .Net Tree (Winforms) or an Adobe Flex Tree.
In a client-server application (for Flex it's Web, really), I have a tree with hierarchical data (in a Windows Explorer type interface). Right now I lazily load up the tree as the user requests more data from the server. This is... | In a client-server application handling a massive hierarchical dataset (like 20 million nodes), you will indeed need a solid strategy to manage memory and performance effectively. Here are several approaches to consider:
### 1. **Lazy Loading with Caching**
You are already implementing lazy loading, which is good. To ... | 37,402 | [
{
"from": "human",
"value": "This question is about a Java JTree or a Window .Net Tree (Winforms) or an Adobe Flex Tree.\nIn a client-server application (for Flex it's Web, really), I have a tree with hierarchical data (in a Windows Explorer type interface). Right now I lazily load up the tree as the user r... |
New to silverlight. Traditionally if I were to design a wizard-like process where a user had to go through 3 or 4 steps, I'd have each step as a separate aspx page. Using silverlight, would you do it all in one component, or would you have 3 separate pages each with a different silverlight component? What kind of a... | When designing a wizard-like process in Silverlight, you typically have two primary approaches: using a single Silverlight component that manages the entire wizard process or creating separate Silverlight components for each step of the wizard. Each approach has its advantages and disadvantages.
### Single Silverlight... | 40,445 | [
{
"from": "human",
"value": "New to silverlight. Traditionally if I were to design a wizard-like process where a user had to go through 3 or 4 steps, I'd have each step as a separate aspx page. Using silverlight, would you do it all in one component, or would you have 3 separate pages each with a differe... |
I've created a small python script to toggle between two files I'm using for testing.
My question is, what is a good Python format style for the following code:
import filecmp
import shutil
local = "local.txt"
remote = "remote.txt"
config_file = "C:\some\path\file.txt"
shutil.copyfile( remote if( filecmp.cmp(local, c... | When it comes to formatting your Python code, readability is key. The choice among the options you've provided largely depends on your team's style guide or personal preference, but there are some general recommendations based on PEP 8, which is the style guide for Python code.
### Recommended Code Format
The third op... | 38,942 | [
{
"from": "human",
"value": "I've created a small python script to toggle between two files I'm using for testing.\nMy question is, what is a good Python format style for the following code:\nimport filecmp\nimport shutil\n\nlocal = \"local.txt\"\nremote = \"remote.txt\"\nconfig_file = \"C:\\some\\path\\fil... |
Does anyone know of a simple way of getting the raw xml that is returned from querying a webservice?
I have seen a way of doing this via Web Services Enhancements, but I don't want an added dependency.
| Yes, you can retrieve raw XML from a web service without adding dependencies like Web Services Enhancements (WSE). Here are a few straightforward methods to do this, depending on the technology you are using:
### 1. Using `HttpClient` in .NET
If you're using .NET, you can easily make HTTP requests using the `HttpClie... | 37,257 | [
{
"from": "human",
"value": "Does anyone know of a simple way of getting the raw xml that is returned from querying a webservice?\nI have seen a way of doing this via Web Services Enhancements, but I don't want an added dependency.\n"
},
{
"from": "gpt",
"value": "Yes, you can retrieve raw XML f... |
How do you manipulate text inside of a textarea as the user types in it?
| To manipulate text inside a `<textarea>` as the user types, you can use JavaScript event listeners. The most common approach is to listen for the `input` event, which is triggered every time the content of the `<textarea>` changes.
Here's a simple example of how to set this up:
### HTML
```html
<textarea id="myTexta... | 40,904 | [
{
"from": "human",
"value": "How do you manipulate text inside of a textarea as the user types in it?\n"
},
{
"from": "gpt",
"value": "To manipulate text inside a `<textarea>` as the user types, you can use JavaScript event listeners. The most common approach is to listen for the `input` event, ... |
Is there an easy way in either language to generate a large set of random data quickly so far all the functions I've tried haven't worked too well when I need to generate a group of say 500,000 characters :( Any ideas?
| Generating a large set of random data can be done easily in various programming languages. Here are a few examples in Python and JavaScript that can generate 500,000 random characters efficiently.
### Python
You can use Python's `random` module along with string constants. Here's how you can generate 500,000 random c... | 39,657 | [
{
"from": "human",
"value": "Is there an easy way in either language to generate a large set of random data quickly so far all the functions I've tried haven't worked too well when I need to generate a group of say 500,000 characters :( Any ideas?\n"
},
{
"from": "gpt",
"value": "Generating a l... |
The recently announced managed extensibility framework (MEF) of .NET 4.0 - is it a dependency injection framework? Will Microsoft Unity from Patterns and Practices be obsolete in 4.0 ? How does MEF compare to a framework like Unity?
| The Managed Extensibility Framework (MEF) introduced in .NET 4.0 is not a dependency injection (DI) framework in the same way that Unity or other traditional DI containers are. Instead, MEF is designed for creating extensible applications, allowing developers to easily compose applications from reusable components (or ... | 42,336 | [
{
"from": "human",
"value": "The recently announced managed extensibility framework (MEF) of .NET 4.0 - is it a dependency injection framework? Will Microsoft Unity from Patterns and Practices be obsolete in 4.0 ? How does MEF compare to a framework like Unity?\n"
},
{
"from": "gpt",
"value": "T... |
What is the best way to tokenize/split a NSString in Objective-C?
| In Objective-C, there are several ways to tokenize or split a `NSString`. One common method is to use the `componentsSeparatedByString:` or `componentsSeparatedByCharactersInSet:` methods. Here’s how you can use both of these methods:
### Method 1: Using `componentsSeparatedByString:`
If you want to split a string by ... | 41,585 | [
{
"from": "human",
"value": "What is the best way to tokenize/split a NSString in Objective-C?\n"
},
{
"from": "gpt",
"value": "In Objective-C, there are several ways to tokenize or split a `NSString`. One common method is to use the `componentsSeparatedByString:` or `componentsSeparatedByCharac... |
How can I make a local drive visible to a Windows XP VMWare image?
Preferably, I'd like to make local drives available as Drive Letters within the VM Ware Image.
| To make a local drive visible to a Windows XP VMware virtual machine (VM) and have it appear as drive letters within the VM, you can follow these steps:
### Step 1: Install VMware Tools
Before attempting to share drives, ensure that VMware Tools is installed on your Windows XP VM. VMware Tools enhances the performance... | 37,662 | [
{
"from": "human",
"value": "How can I make a local drive visible to a Windows XP VMWare image?\nPreferably, I'd like to make local drives available as Drive Letters within the VM Ware Image.\n"
},
{
"from": "gpt",
"value": "To make a local drive visible to a Windows XP VMware virtual machine (V... |
I found several controlsets for that nice looking ribbons (DotNetBar, DivElements, ...), but all require a license for at least 100 USD. Is there a free controlset that looks quite as nice as the commericial ones?
| Yes, there are several free UI control libraries that can provide attractive ribbon-like interfaces without requiring a paid license. Here are a few options you might want to consider:
1. **FluentRibbon**: An open-source library for WPF that allows you to create a ribbon UI similar to the one found in Microsoft Office... | 42,759 | [
{
"from": "human",
"value": "I found several controlsets for that nice looking ribbons (DotNetBar, DivElements, ...), but all require a license for at least 100 USD. Is there a free controlset that looks quite as nice as the commericial ones?\n"
},
{
"from": "gpt",
"value": "Yes, there are sever... |
Are there any robust and mature HTML parsers available for PHP? A quick skimming of PEAR didn't turn anything up (lots of classes for generating HTML, not so much for consuming), and Google taught me a lot of people have started and then abandoned a variety of parser projects.
Not interested in XML parsers (unless then... | Yes, there are several robust and mature HTML parsers available for PHP that can handle non-well-formed HTML and are suitable for extracting information from HTML documents. Here are a few popular ones:
1. **DOMDocument**:
- The built-in `DOMDocument` class in PHP is capable of parsing HTML and can handle non-well-... | 40,983 | [
{
"from": "human",
"value": "Are there any robust and mature HTML parsers available for PHP? A quick skimming of PEAR didn't turn anything up (lots of classes for generating HTML, not so much for consuming), and Google taught me a lot of people have started and then abandoned a variety of parser projects.\n... |
I use the app.config file to store some values (path to a mapping database, data connection selections). These settings differ on the user machines and I would like the installer to set them right. Is there an installer that can work with .NET config files during setup and allow me to create some dialogs that would hel... | If you are looking for a simpler solution than using WiX to modify your .NET application's `app.config` during installation, there are a few other options you can consider. Here are some suggestions:
### 1. **Visual Studio Installer Projects**
If you are using Visual Studio, you can use the Visual Studio Installer Pr... | 40,415 | [
{
"from": "human",
"value": "I use the app.config file to store some values (path to a mapping database, data connection selections). These settings differ on the user machines and I would like the installer to set them right. Is there an installer that can work with .NET config files during setup and allow... |
I'm trying to start a service that has a argument that specifies a port number. For example, using the DOS net I would do the following:
net start "SERVICENAME" /"ARGUMENT"
How would I do the same in C# using Service.Controller.Start()?
| To start a Windows service with arguments in C#, you cannot directly pass arguments to the service using the `ServiceController.Start()` method. The `Start()` method does not have an overload that takes arguments. Instead, you can configure the service to read arguments from a configuration file or the registry, or you... | 40,114 | [
{
"from": "human",
"value": "I'm trying to start a service that has a argument that specifies a port number. For example, using the DOS net I would do the following:\nnet start \"SERVICENAME\" /\"ARGUMENT\"\n\nHow would I do the same in C# using Service.Controller.Start()?\n"
},
{
"from": "gpt",
... |
I'm trying to implement (what I think is) a pretty simple data model for a counter:
class VisitorDayTypeCounter(models.Model):
visitType = models.CharField(max_length=60)
visitDate = models.DateField('Visit Date')
counter = models.IntegerField()
When someone comes through, it will look for a row that match... | To safely manage concurrent increments of a counter in your `VisitorDayTypeCounter` model, you can employ database transactions and the `get_or_create` method provided by Django. This will help you avoid race conditions when multiple requests are trying to access and update the same counter.
Here’s a step-by-step appr... | 40,443 | [
{
"from": "human",
"value": "I'm trying to implement (what I think is) a pretty simple data model for a counter:\nclass VisitorDayTypeCounter(models.Model):\n visitType = models.CharField(max_length=60)\n visitDate = models.DateField('Visit Date')\n counter = models.IntegerField()\n\nWhen someone c... |
Please let me know how can I remove default banner of web server from response - Apache http1.1 coyote
| To remove the default banner (also known as the "server signature") from the response headers in an Apache HTTP server, you can follow these steps:
### For Apache HTTP Server
1. **Edit the Apache Configuration File:**
Open your Apache configuration file, typically located at `/etc/httpd/conf/httpd.conf` or `/etc/a... | 37,903 | [
{
"from": "human",
"value": "Please let me know how can I remove default banner of web server from response - Apache http1.1 coyote\n"
},
{
"from": "gpt",
"value": "To remove the default banner (also known as the \"server signature\") from the response headers in an Apache HTTP server, you can f... |
just now the dba let me connect to the database using Sql Server Management Studio, this is how i noticed that the default database for the tfs setup and service users is master, is this ok?, is this why I'm having this error?, Let me post part of the log and the properties of the Setup user to confirm that the users ... | Based on the information you've provided, it looks like the issue you're facing is due to permissions and the default database setting of the TFS setup user.
### Key Points:
1. **Default Database**: The default database for the user is set to `master`. This is not ideal because your Team Foundation Server (TFS) databa... | 41,194 | [
{
"from": "human",
"value": "just now the dba let me connect to the database using Sql Server Management Studio, this is how i noticed that the default database for the tfs setup and service users is master, is this ok?, is this why I'm having this error?, Let me post part of the log and the properties of ... |
I wonder if there is something like a standalone version of Visual Studio's "Immediate Window"? Sometimes I just want to test some simple stuff, like DateTime.Parse("blah") to see if that works. But everytime I have to create a new console application, put in my code and test it.
The Immediate Window sadly only works w... | Yes, you can definitely use PowerShell to execute C# code snippets without the need to create a full console application every time. PowerShell provides a way to run C# code directly within its environment using the `Add-Type` cmdlet. This allows you to define classes and execute methods as needed.
Here’s how you can ... | 42,055 | [
{
"from": "human",
"value": "I wonder if there is something like a standalone version of Visual Studio's \"Immediate Window\"? Sometimes I just want to test some simple stuff, like DateTime.Parse(\"blah\") to see if that works. But everytime I have to create a new console application, put in my code and tes... |
On several of my usercontrols, I change the cursor by using
this.Cursor = Cursors.Wait;
when I click on something.
Now I want to do the same thing on a WPF page on a button click. When I hover over my button, the cursor changes to a hand, but when I click it, it doesn't change to the wait cursor. I wonder if this ha... | In WPF, the behavior of the cursor when interacting with UI elements like buttons can indeed differ from traditional WinForms applications. However, it's not due to the fact that you are using a button or a page instead of a user control. It’s more related to the event handling and how WPF manages the UI thread and its... | 42,542 | [
{
"from": "human",
"value": "On several of my usercontrols, I change the cursor by using\nthis.Cursor = Cursors.Wait;\n\nwhen I click on something.\nNow I want to do the same thing on a WPF page on a button click. When I hover over my button, the cursor changes to a hand, but when I click it, it doesn't ch... |
We have an advanced webpage (ASP.NET, C#), and a application which needs to be installed on the client computer in order to utilize the webpage to its fullest. The application is a tray app, and has primarily two tasks. Detect when certain events happen on the webserver (for instance invited to a meeting, or notify of ... | Detecting if a specific application is installed on a user's local machine can be challenging and is generally limited due to browser security restrictions. However, there are some approaches you can consider:
### 1. Custom Protocol Handler
If your tray application has registered a custom protocol (like `trayapp://`),... | 41,930 | [
{
"from": "human",
"value": "We have an advanced webpage (ASP.NET, C#), and a application which needs to be installed on the client computer in order to utilize the webpage to its fullest. The application is a tray app, and has primarily two tasks. Detect when certain events happen on the webserver (for ins... |
My clients home page is https://www.quakereadykit.com/store/home.php
This was given to me by a previous designer, and I cannot figure out how to do the simple task of changing the small photo next to the "Welcome" text. I have used Firebug in FF to try and dissect the page but I cannot find the source. Seems to be an i... | To change the small photo next to the "Welcome" text on the given webpage, you will need to inspect the HTML structure and find the source of the image. Here’s how to approach the task:
1. **Inspect the Element**: Use your browser's developer tools (like Firebug for Firefox or the built-in Inspector in Chrome) to insp... | 42,459 | [
{
"from": "human",
"value": "My clients home page is https://www.quakereadykit.com/store/home.php\nThis was given to me by a previous designer, and I cannot figure out how to do the simple task of changing the small photo next to the \"Welcome\" text. I have used Firebug in FF to try and dissect the page bu... |
What is the safe width in pixels to print a web page?
My page includes large images and I want to make sure they will not be cut of when printed.
I know about different browser margins and US Letter / DIN A4 paper sizes. So we got standard letter sized and some default DPI values. But can I convert these into pixel va... | When preparing a web page for printing, it’s important to account for several factors including browser margins, paper size, and DPI (dots per inch). To ensure that your images don’t get cut off when printed, you'll need to consider the following steps:
### 1. **Understand Paper Sizes**
- **US Letter Size**: 8.5 x 11 ... | 38,445 | [
{
"from": "human",
"value": "What is the safe width in pixels to print a web page? \nMy page includes large images and I want to make sure they will not be cut of when printed.\nI know about different browser margins and US Letter / DIN A4 paper sizes. So we got standard letter sized and some default DPI va... |
I would like to dynamically hide a button in one of my views depending on a certain condition.
I tried adding some code to the view controller's -viewWillAppear method, to make the button hidden before displaying the actual view, but I still don't know how to do that.
I have a reference to the button through an IBOutle... | To dynamically hide a `UIBarButtonItem` based on a condition in your view controller, you can modify the `navigationItem` of your view controller in the `viewWillAppear` method. A `UIBarButtonItem` cannot be hidden directly; instead, you will set its `tintColor` to `clearColor` or remove it from the navigation item ent... | 41,044 | [
{
"from": "human",
"value": "I would like to dynamically hide a button in one of my views depending on a certain condition.\nI tried adding some code to the view controller's -viewWillAppear method, to make the button hidden before displaying the actual view, but I still don't know how to do that.\nI have a... |
Here is the problem: we have lots of Javascripts and lots of CSS files, which we'd rather be serving minified. Minification is easy: set up the YUI Compressor, run an Ant task, and it spits out minified files, which we save beside the originals.
So we end up with the following directory structure somewhere inside our D... | To achieve the desired behavior of serving minified JavaScript and CSS files from a specific subdirectory while falling back to the original files when the minified versions do not exist, you can use Apache's `mod_rewrite` module. This allows you to define rules for how requests should be handled based on the existence... | 39,519 | [
{
"from": "human",
"value": "Here is the problem: we have lots of Javascripts and lots of CSS files, which we'd rather be serving minified. Minification is easy: set up the YUI Compressor, run an Ant task, and it spits out minified files, which we save beside the originals.\nSo we end up with the following ... |
Hey all, I need some advice on this...
We have certain permissions setup in the database for certain levels of control a user can have over the application. Disabled, ReadOnly and Edit.
My question is: Are there more generic/better ways to handle permissions applied to a form element on the page than writing a securit... | Your thought process about managing permissions in a more centralized manner is definitely on the right track. Here are some strategies and best practices that can help you simplify permission handling across your forms:
1. **Centralized Permission Management:**
- As you mentioned, using a constants-based approach ... | 41,760 | [
{
"from": "human",
"value": "Hey all, I need some advice on this...\nWe have certain permissions setup in the database for certain levels of control a user can have over the application. Disabled, ReadOnly and Edit. \nMy question is: Are there more generic/better ways to handle permissions applied to a form... |
I am trying something very simple, but for some reason it does not work. Basically, I need to rename some nodes in an XML document. Thus, I created an XSLT file to do the transformation.
Here is an example of the XML:
EDIT: Addresses and Address elements occur at many levels. This is what caused me to have to try and a... | To accomplish your goal of renaming specific `Addresses` and `Address` elements within your XML structure while dealing with namespaces and ensuring that the output doesn't become cluttered with unnecessary namespace references, we need to use XSLT with a few clear strategies.
### Your Requirements Recap
1. **Rename ... | 33,507 | [
{
"from": "human",
"value": "I am trying something very simple, but for some reason it does not work. Basically, I need to rename some nodes in an XML document. Thus, I created an XSLT file to do the transformation.\nHere is an example of the XML:\nEDIT: Addresses and Address elements occur at many levels. ... |
I am trying to use the ASP.NET Dynamic Data features to generate CRUD scaffolding for my data model. My model contains supertype/subtype relationships, so some logical entities are split between two tables: one for the generic data and one for the subtype-specific data.
In the LINQ context I expose these entities as a ... | In ASP.NET Dynamic Data, if you're seeing only a read-only view of your data when scaffolding is enabled, it is likely due to one or more of the following reasons related to the way Dynamic Data detects and configures your data model:
1. **LINQ to Entities Mapping**: Dynamic Data needs to recognize your data model as ... | 41,364 | [
{
"from": "human",
"value": "I am trying to use the ASP.NET Dynamic Data features to generate CRUD scaffolding for my data model. My model contains supertype/subtype relationships, so some logical entities are split between two tables: one for the generic data and one for the subtype-specific data.\nIn the ... |
I keep seeing the phrase "duck typing" bandied about, and even ran across a code example or two. I am way too lazy busy to do my own research, can someone tell me, briefly:
the difference between a 'duck type' and an old-skool 'variant type', and
provide an example of where I might prefer duck typing over variant typ... | Great questions! Let's break this down and clarify the concepts you're interested in regarding duck typing and variant typing.
### Duck Typing vs. Variant Typing
**Duck Typing**:
- Duck typing is a concept primarily found in dynamic languages (like Python, Ruby, and JavaScript). The idea is that an object's suitabili... | 38,975 | [
{
"from": "human",
"value": "I keep seeing the phrase \"duck typing\" bandied about, and even ran across a code example or two. I am way too lazy busy to do my own research, can someone tell me, briefly:\n\nthe difference between a 'duck type' and an old-skool 'variant type', and \nprovide an example of whe... |
I need a distinct sound to play when a error occurs. The error is the result of a problem with one of perhaps two hundred barcodes that are being inputted in rapid fire. The event queue seems to handle keyboard input (which the barcode scanner emulates) first, and playing of my sound second. So if the barcodes are s... | In most programming environments, the event queue handles events like keyboard input and playback of sounds based on a single thread of execution. This often leads to the issue you're facing, where quick successive inputs can crowd out sound playback. However, here are a few strategies you could consider to address thi... | 40,962 | [
{
"from": "human",
"value": "I need a distinct sound to play when a error occurs. The error is the result of a problem with one of perhaps two hundred barcodes that are being inputted in rapid fire. The event queue seems to handle keyboard input (which the barcode scanner emulates) first, and playing of m... |
I'm writing a HTML form that's divided in fieldsets, and I need to get the form fields from a specific fiedset in a function.
Currently it's like this:
function conta(Fieldset){
var Inputs = Fieldset.getElementsByTagName("input");
var Selects = Fieldset.getElementsByTagName("select");
/* Doing the s... | To achieve your goal of retrieving all form fields from a specific `<fieldset>` while keeping your code maintainable and adaptable to future form field types, you can indeed utilize the `elements` property of the `<form>` element. However, since you're working within a specific `<fieldset>`, you'll need to filter the f... | 36,187 | [
{
"from": "human",
"value": "I'm writing a HTML form that's divided in fieldsets, and I need to get the form fields from a specific fiedset in a function.\nCurrently it's like this: \nfunction conta(Fieldset){ \n var Inputs = Fieldset.getElementsByTagName(\"input\"); \n var Selects = Fieldset.getEl... |
I've been trying to create a parser using simpleparse. I've defined the grammar like this:
<w> := [ \n]*
statement_list := statement,(w,statement)?
statement := "MOVE",w,word,w,"TO",w,(word,w)+
word := [A-Za-z],[A-Za-z0-9]*,([-]+,[A-Za-z0-9]+)*
Now if I try to parse a string
MOVE ABC-DEF TO ABC
MOVE DDD TO XXX
The se... | It looks like you're trying to create a parser in SimpleParse that can handle multi-line statements with optional additional parameters for the "MOVE" command. The challenge arises from needing to structure the grammar correctly to ensure that separate statements are recognized properly and that you can have optional p... | 38,759 | [
{
"from": "human",
"value": "I've been trying to create a parser using simpleparse. I've defined the grammar like this:\n<w> := [ \\n]*\nstatement_list := statement,(w,statement)?\nstatement := \"MOVE\",w,word,w,\"TO\",w,(word,w)+\nword := [A-Za-z],[A-Za-z0-9]*,([-]+,[A-Za-z0-9]+)*\n\nNow if I try to parse ... |
I am building a PHP application in CodeIgniter. CodeIgniter sends all requests to the main controller: index.php. However, I don't like to see index.php in the URI. For example, http://www.example.com/faq/whatever will route to http://www.example.com/index.php/faq/whatever. I need a reliable way for a script to know wh... | Certainly! Let’s break down the differences between `PHP_SELF`, `PATH_INFO`, `SCRIPT_NAME`, and `REQUEST_URI` to understand how you can reliably determine the current address of your PHP script within a CodeIgniter application.
### 1. `PHP_SELF`
- **Definition**: This variable returns the filename of the currently exe... | 39,377 | [
{
"from": "human",
"value": "I am building a PHP application in CodeIgniter. CodeIgniter sends all requests to the main controller: index.php. However, I don't like to see index.php in the URI. For example, http://www.example.com/faq/whatever will route to http://www.example.com/index.php/faq/whatever. I ne... |
I want to set the background of an NSBox to be a gradient. In Interface Builder it is possible to set the background color of an NSBox to selectedMenuColor which is a gradient.
NSBox only has a setFillColor method so how is Interface Builder filling it with a gradient?
How do I programmatically fill an NSBox without ... | While it's true that `NSBox` only has a `setFillColor` method that allows you to set a solid fill color, you can achieve a gradient fill in an `NSBox` without subclassing it by using a custom drawing approach in the `drawRect:` method. However, since you're looking for a way to do this programmatically without subclass... | 40,384 | [
{
"from": "human",
"value": "I want to set the background of an NSBox to be a gradient. In Interface Builder it is possible to set the background color of an NSBox to selectedMenuColor which is a gradient. \nNSBox only has a setFillColor method so how is Interface Builder filling it with a gradient? \nHow d... |
I have a GridView that I would like to bind to an ObjectDataSource. I have a ReadOnlyCollection of business objects that have many properties. I only to need to display four of these properties in the GridView. I haven't used the ObjectDataSource control before, so how can I use it to display 4 properties of all of ... | To bind a `GridView` to an `ObjectDataSource` in order to display a subset of properties from a ReadOnlyCollection of business objects, you need to follow these steps:
1. **Set Up Your Business Object and Collection:**
Make sure you have a business object with the properties you want to display. For example:
``... | 37,748 | [
{
"from": "human",
"value": "I have a GridView that I would like to bind to an ObjectDataSource. I have a ReadOnlyCollection of business objects that have many properties. I only to need to display four of these properties in the GridView. I haven't used the ObjectDataSource control before, so how can I ... |
I'm relatively new to programming and I have to write a function that reads in input from the user and to fill two arrays then compare them. I guess what I'm confused on is how to read in both arrays.
This is what I'm supposed to do,
Write a table_diff function that compares two arrays of integers and returns the subsc... | It seems like you're trying to read two arrays of integers from the user, fill them, and then compare them. I can help clarify how to read the input correctly for both arrays and provide the function for comparing them.
Here's a complete example that demonstrates how to read two arrays of integers, compare them, and i... | 38,285 | [
{
"from": "human",
"value": "I'm relatively new to programming and I have to write a function that reads in input from the user and to fill two arrays then compare them. I guess what I'm confused on is how to read in both arrays.\nThis is what I'm supposed to do,\nWrite a table_diff function that compares t... |
Is there a better, more elegant (and/or possibly faster) way than
boolean isNumber = false;
try{
Double.valueOf(myNumber);
isNumber = true;
} catch (NumberFormatException e) {
}
...?
Edit:
Since I can't pick two answers I'm going with the regex one because a) it's elegant and b) saying "Jon Skeet solved the pr... | Yes, there is a more elegant and efficient way to check if a string can be converted to a number using regular expressions. Instead of trying to parse the number and catching exceptions, you can use a regex pattern to match valid numeric formats. Here’s an example using Java:
```java
public static boolean isNumber(Str... | 44,245 | [
{
"from": "human",
"value": "Is there a better, more elegant (and/or possibly faster) way than\nboolean isNumber = false;\ntry{\n Double.valueOf(myNumber);\n isNumber = true;\n} catch (NumberFormatException e) {\n}\n\n...?\n\nEdit:\nSince I can't pick two answers I'm going with the regex one because a) ... |
I am calling a .txt file from a jquery ajax call. It has some special characters like ±. This ± is a delimiter for a set of array; data I want to split out and push into a JavaScript array.
It is not treated as ± symbol when interpreted like this.
How do I get that data as just like browser content?
| When dealing with special characters in a text file that you're fetching via AJAX, you need to ensure that your server is serving the file with the correct character encoding. The most common encoding is UTF-8, which supports a wide range of characters including special symbols like `±`.
Here’s how you can achieve thi... | 42,784 | [
{
"from": "human",
"value": "I am calling a .txt file from a jquery ajax call. It has some special characters like ±. This ± is a delimiter for a set of array; data I want to split out and push into a JavaScript array.\nIt is not treated as ± symbol when interpreted like this.\nHow do I get that data as jus... |
I have a simple WPF application with a menu. I need to add menu items dynamically at runtime. When I simply create a new menu item, and add it onto its parent MenuItem, it does not display in the menu, regardless of if UpdateLayout is called.
What must happen to allow a menu to have additional items dynamically added... | In WPF, adding menu items dynamically to a `Menu` or `MenuItem` should work as expected. The code snippet you've provided looks correct at first glance, but there are some important things you might want to check to ensure that your dynamic addition of menu items works properly.
Here are some suggestions and correctio... | 40,526 | [
{
"from": "human",
"value": "I have a simple WPF application with a menu. I need to add menu items dynamically at runtime. When I simply create a new menu item, and add it onto its parent MenuItem, it does not display in the menu, regardless of if UpdateLayout is called.\nWhat must happen to allow a menu ... |
I wrote a PHP code like this
$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
But when I remove "http://" from $site I get the following warning:
Warning:
file_get_contents(www.google.com)
[function.file-get-contents]: failed
to open stream:
I tried try and catch but it didn't ... | The issue you're facing is due to the fact that `file_get_contents` requires a valid URL format, including the scheme (like `http://` or `https://`). When you remove `http://`, the URL becomes invalid, and PHP throws a warning that it cannot open the stream.
To handle this situation more gracefully, you can check if t... | 42,109 | [
{
"from": "human",
"value": "I wrote a PHP code like this\n$site=\"http://www.google.com\";\n$content = file_get_content($site);\necho $content;\n\nBut when I remove \"http://\" from $site I get the following warning:\n\nWarning:\n file_get_contents(www.google.com)\n [function.file-get-contents]: failed\n... |
I have a .net 1.1 project in VS.Net 2003 (using C#) in which I can set a breakpoint in one method, and step through code just fine, but when I hit one specific method (which we also wrote), the breakpoints and code pointers go "whacky", for lack of a better term. If the breakpoint is on line 100, the execution pointer... | The issue you're experiencing during debugging in Visual Studio .NET 2003 is often related to mismatches between the source code and the compiled assembly (the executable). Here are some potential reasons and solutions to help you resolve this problem:
### Potential Causes:
1. **Outdated Build**: If you've made chang... | 40,356 | [
{
"from": "human",
"value": "I have a .net 1.1 project in VS.Net 2003 (using C#) in which I can set a breakpoint in one method, and step through code just fine, but when I hit one specific method (which we also wrote), the breakpoints and code pointers go \"whacky\", for lack of a better term. If the break... |
I want to create an array with a message.
$myArray = array('my message');
But using this code, myArray will get overwritten if it already existed.
If I use array_push, it has to already exist.
$myArray = array(); // <-- has to be declared first.
array_push($myArray, 'my message');
Otherwise, it will bink.
Is there ... | Yes, you can achieve the behavior you want without explicitly clearing the array first by checking if the array already exists. If it doesn't, you can initialize it, and then use `array_push` to add your message. Here's how you can do it:
```php
if (!isset($myArray) || !is_array($myArray)) {
$myArray = array(); //... | 43,979 | [
{
"from": "human",
"value": "I want to create an array with a message.\n$myArray = array('my message');\n\nBut using this code, myArray will get overwritten if it already existed. \nIf I use array_push, it has to already exist.\n$myArray = array(); // <-- has to be declared first.\narray_push($myArray, 'my ... |
Perl seems to be killing my array whenever I read a file:
my @files = ("foo", "bar", "baz");
print "Files: " . join(" ", @files) . "\n";
foreach(@files) {
print "The file is $_\n";
func();
}
sub func {
open(READ, "< test.txt");
while(<READ>) {
}
close READ;
}
print "Files: " . join(" ", @files) . "... | The issue you're encountering in your Perl script relates to how the `while(<READ>)` loop interacts with the input file and the `@files` array.
When you open a file for reading in Perl with the diamond operator (`<...>`), the file handle will read lines from the file until it reaches the end. In your `func` subroutine... | 40,464 | [
{
"from": "human",
"value": "Perl seems to be killing my array whenever I read a file:\nmy @files = (\"foo\", \"bar\", \"baz\");\nprint \"Files: \" . join(\" \", @files) . \"\\n\";\n\nforeach(@files) {\n print \"The file is $_\\n\";\n func();\n}\n\nsub func {\n open(READ, \"< test.txt\");\n while(<R... |
I have an XML document with several <person> elements, each of which contains the <name> of the person, and several <preferred-number> elements inside a grouping <preferred-numbers> element.
I already found that to obtain the greatest <preferred-number> I have to do an <xsl:apply-template> with a <xsl:sort> inside it ... | To extract each person's `<name>` along with their greatest `<preferred-number>` using XSLT 1.0, you can use `<xsl:for-each>` along with `<xsl:sort>` and `<xsl:if>` to find the maximum `<preferred-number>` for each `<person>`. You will need to process each `<person>` element separately and sort their `<preferred-number... | 39,359 | [
{
"from": "human",
"value": "I have an XML document with several <person> elements, each of which contains the <name> of the person, and several <preferred-number> elements inside a grouping <preferred-numbers> element. \nI already found that to obtain the greatest <preferred-number> I have to do an <xsl:ap... |
I am new to OpenGL.
Wondering if there is any good Scenegraph API/framework for OpenGL.
At the moment I am using glut with a custom node based solution: I am setting children and siblings for each node the calling a traverse function.
I'd like a more flexible solution when it comes to managing dynamic elements in th... | Welcome to the world of OpenGL! When it comes to scene graphs, there are several libraries and frameworks you can consider that provide more structure and functionality compared to a custom node-based solution. Here are some notable options:
1. **Assimp**: While primarily an import library for 3D models, Assimp can he... | 41,815 | [
{
"from": "human",
"value": "I am new to OpenGL. \nWondering if there is any good Scenegraph API/framework for OpenGL. \nAt the moment I am using glut with a custom node based solution: I am setting children and siblings for each node the calling a traverse function. \nI'd like a more flexible solution when... |
We have a custom project management tool built in ASP,net 3.5 and we use VisualSVN for our version management. However, we are looking a way to report the version changes through the project management tool by integrating VisualSVN with our project management tool, i.e. pretty much similar to what Trac [python based S... | To integrate VisualSVN with your ASP.NET 3.5 project management tool, you can use the Subversion (SVN) client API provided by `SharpSvn`, which is a .NET client library for Subversion. Although VisualSVN does not provide a dedicated API, it does use Subversion, so SharpSvn can be a suitable choice for accessing SVN rep... | 39,320 | [
{
"from": "human",
"value": "We have a custom project management tool built in ASP,net 3.5 and we use VisualSVN for our version management. However, we are looking a way to report the version changes through the project management tool by integrating VisualSVN with our project management tool, i.e. pretty ... |
In VB.NET, I have a Combobox on a WinForm form. The form allows the user to type in a query to be searched. When the user hits the Enter key, a query is performed against the database and the results are returned as a DataTable. The DataTable is then bound to the Combobox and the user can select the option that they... | The behavior you are experiencing, where the code executes multiple times when you hit the Enter key, may be due to the way the `KeyDown` event is being handled. It is possible that other events, such as `KeyPress` or `KeyUp`, are also firing in response to the key press, leading to multiple invocations of your `Perfor... | 43,521 | [
{
"from": "human",
"value": "In VB.NET, I have a Combobox on a WinForm form. The form allows the user to type in a query to be searched. When the user hits the Enter key, a query is performed against the database and the results are returned as a DataTable. The DataTable is then bound to the Combobox and... |
We are working on a service that will have website access for stats and other tasks, but the majority of use will be through a client gem and rake tasks. What is the best way to handle authentication for both pieces.
It looks like fiveruns_tuneup, getexceptional, New Relic and others have websites with username and pas... | When designing an authentication strategy for a service that includes both a web interface and client access (through a gem and Rake tasks), you have several considerations regarding user experience, security, and maintainability. Here are some thoughts on best practices for authentication in your case:
### 1. API Key... | 40,276 | [
{
"from": "human",
"value": "We are working on a service that will have website access for stats and other tasks, but the majority of use will be through a client gem and rake tasks. What is the best way to handle authentication for both pieces.\nIt looks like fiveruns_tuneup, getexceptional, New Relic and ... |
I am trying to use Ganymede CDT to index our large codebase. It is painfully slow, can take a whole night to index the C++ files. Same project takes only 5 seconds to index with exuberant ctags 5.7.
Is there some way to find what the root of the problem is and to speed it up?
Maybe turn on logging in CDT, or some obscu... | Indexing a large codebase with Ganymede CDT (C/C++ Development Tooling) can indeed be slow, especially when compared to lighter tools like Exuberant Ctags. Here are some suggestions to diagnose and potentially speed up the indexing process:
### 1. **Enable CDT Logging**:
You can enable logging to see what's happeni... | 40,249 | [
{
"from": "human",
"value": "I am trying to use Ganymede CDT to index our large codebase. It is painfully slow, can take a whole night to index the C++ files. Same project takes only 5 seconds to index with exuberant ctags 5.7.\nIs there some way to find what the root of the problem is and to speed it up?\n... |
Is there a good test suite or tool set that can automate website navigation -- with Javascript support -- and collect the HTML from the pages?
Of course I can scrape straight HTML with BeautifulSoup. But this does me no good for sites that require Javascript. :)
| Yes, there are several tools and frameworks that can automate website navigation, handle JavaScript, and collect HTML from the pages. Here are some popular ones:
### 1. **Selenium**
- **Description**: Selenium is one of the most widely used tools for browser automation. It supports multiple programming languages, incl... | 24,060 | [
{
"from": "human",
"value": "Is there a good test suite or tool set that can automate website navigation -- with Javascript support -- and collect the HTML from the pages?\nOf course I can scrape straight HTML with BeautifulSoup. But this does me no good for sites that require Javascript. :)\n"
},
{
... |
Suppose you have output like this:
Word1 Word2 Word3 Word4
Where the number of spaces between words is arbitrary. I want to break it into an array of words.
I used the following code:
string[] tokens =
new List<String>(input.Split(' '))
.FindAll
(
de... | You can achieve the same goal more efficiently by using the `String.Split` method with an overload that allows you to specify an array of delimiters and a `StringSplitOptions` parameter. This way, you can directly ignore empty entries created by consecutive delimiters (in this case, spaces).
Here’s a more efficient ap... | 43,943 | [
{
"from": "human",
"value": "Suppose you have output like this:\nWord1 Word2 Word3 Word4\n\nWhere the number of spaces between words is arbitrary. I want to break it into an array of words.\nI used the following code:\nstring[] tokens =\n new List<String>(input.Split(' '))\n ... |
The Free MS Windows replacement operating system ReactOS has just released a new version. They have a large and active development team.
Have you tried your software with it yet?
if so what is your recommendation?
Is it time to start investigating it as a serious Windows replacement?
| As of my last knowledge update in October 2023, ReactOS is an open-source operating system designed to be binary-compatible with Windows, which means it aims to run Windows applications and drivers without modification. Since I don't have the capability to test software directly or track developments after that date, I... | 39,986 | [
{
"from": "human",
"value": "The Free MS Windows replacement operating system ReactOS has just released a new version. They have a large and active development team.\n\nHave you tried your software with it yet? \nif so what is your recommendation? \nIs it time to start investigating it as a serious Windows ... |
I have an odd edge case right now in that a response code from an NSURLConnection delegate method:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
Is triggered before the subsequent delegate method:
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *... | You're correct in observing that the `didReceiveResponse` and `didReceiveData` methods in the `NSURLConnection` delegate pattern can be invoked in a sequence that might not align perfectly with your desired flow of logic. This is a common scenario, and there are a few elegant ways to handle it while keeping your code c... | 39,431 | [
{
"from": "human",
"value": "I have an odd edge case right now in that a response code from an NSURLConnection delegate method:\n- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;\n\nIs triggered before the subsequent delegate method:\n- (void)connection:(NSURLCon... |
I want to use this pure HTML/CSS template for my ASP.NET website:
http://sub3.tanguay.de
I copy it inside my Default.aspx page, inside the FORM element, but the form messes up the layout:
http://sub2.tanguay.de
UPDATE: this now displays correctly, thanks to Devio.
I tried altering the style of the form tag but can't g... | When integrating a pure HTML/CSS template into an ASP.NET application, you might encounter layout issues due to how the HTML elements interact with the ASP.NET controls and the default styles applied by the ASP.NET framework. Here are some common strategies to troubleshoot and fix these issues:
### 1. Reset or Normali... | 40,909 | [
{
"from": "human",
"value": "I want to use this pure HTML/CSS template for my ASP.NET website:\nhttp://sub3.tanguay.de\nI copy it inside my Default.aspx page, inside the FORM element, but the form messes up the layout:\nhttp://sub2.tanguay.de\n\nUPDATE: this now displays correctly, thanks to Devio.\nI tried... |
I have a website which uses themes. Depending on the url (if it is A.something.com or B.something.com, where A and B represent clients), I will load a different theme. The intention is to use one codebase for different clients. I have an app_themes folder, several themes inside, for different clients, and different CSS... | It looks like you're trying to implement a theme selection mechanism based on the URL of the site. However, there are a couple of reasons why your CSS may not be loading correctly. Here are some steps and suggestions to help troubleshoot and potentially fix the issue:
1. **Ensure Themes Are Configured Correctly**:
... | 39,121 | [
{
"from": "human",
"value": "I have a website which uses themes. Depending on the url (if it is A.something.com or B.something.com, where A and B represent clients), I will load a different theme. The intention is to use one codebase for different clients. I have an app_themes folder, several themes inside,... |
How can I put up a "File Open" dialog from some VBA running in Excel?
I'm using Excel 2003.
| In Excel 2003, you can use the `Application.GetOpenFilename` method to display a "File Open" dialog. This method allows users to select a file, and it will return the path of the selected file as a string. Here's a simple example of how to use it in your VBA code:
```vba
Sub OpenFileDialogExample()
Dim filePath As... | 43,361 | [
{
"from": "human",
"value": "How can I put up a \"File Open\" dialog from some VBA running in Excel? \nI'm using Excel 2003. \n"
},
{
"from": "gpt",
"value": "In Excel 2003, you can use the `Application.GetOpenFilename` method to display a \"File Open\" dialog. This method allows users to sele... |
I've created a custom search page with some defined options in my search scope.
I have a metadata mapped jobtitle, and added the search option to my custom search.
<Property name="JobTitle"
ManagedName="title"
ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Title"/>
I want to chan... | When working with managed metadata and search properties in SharePoint, if you've updated the `ManagedName` but do not see the changes reflected in your search options, here are several steps and considerations to troubleshoot the issue:
1. **Verify Managed Metadata**: Ensure that you have correctly updated the manage... | 42,986 | [
{
"from": "human",
"value": "I've created a custom search page with some defined options in my search scope.\nI have a metadata mapped jobtitle, and added the search option to my custom search.\n<Property name=\"JobTitle\" \n ManagedName=\"title\" \n ProfileURI=\"urn:schemas-microsoft-com:... |
I'm trying to do the following in python:
In a file called foo.py:
# simple function that does something:
def myFunction(a,b,c):
print "call to myFunction:",a,b,c
# class used to store some data:
class data:
fn = None
# assign function to the class for storage.
data.fn = myFunction
And then in a file called bar.... | The behavior you're encountering is due to how methods in classes are handled in Python. When you assign a function as an attribute of a class (like you're doing with `data.fn`), it becomes a bound method. This means it expects to be called on an instance of the class, which is why you're seeing the error.
If you want... | 43,833 | [
{
"from": "human",
"value": "I'm trying to do the following in python:\nIn a file called foo.py:\n# simple function that does something:\ndef myFunction(a,b,c):\n print \"call to myFunction:\",a,b,c\n\n# class used to store some data:\nclass data:\n fn = None\n\n# assign function to the class for storage.... |
Why is garbage collection required for tail call optimization? Is it because if you allocate memory in a function which you then want to do a tail call on, there'd be no way to do the tail call and regain that memory? (So the stack would have to be saved so that, after the tail call, the memory could be reclaimed.)
| Tail call optimization (TCO) is a compiler technique that can improve performance by allowing certain function calls (specifically tail calls) to reuse the stack frame of the calling function, effectively preventing stack overflow and allowing for recursion to be used more safely. However, garbage collection is not inh... | 41,431 | [
{
"from": "human",
"value": "Why is garbage collection required for tail call optimization? Is it because if you allocate memory in a function which you then want to do a tail call on, there'd be no way to do the tail call and regain that memory? (So the stack would have to be saved so that, after the tail ... |
I need to retrieve the list of contacts (and only them) from any Outlook application except Outlook Express. I've seen many different libraries that can solve my problem but any of them is opensource. I was wondering if it is worth to solve this problem from scratch using JNI. I have never developed using this framewor... | Retrieving contacts from Outlook can indeed be approached in various ways, and using Java Native Interface (JNI) is one of them, but it might not be the most practical or efficient solution. JNI can be quite complex to work with, especially if you're not familiar with it, as it involves bridging Java with native code, ... | 41,923 | [
{
"from": "human",
"value": "I need to retrieve the list of contacts (and only them) from any Outlook application except Outlook Express. I've seen many different libraries that can solve my problem but any of them is opensource. I was wondering if it is worth to solve this problem from scratch using JNI. I... |
Could anyone tell me how to debug a custom installer class in an installer project.My custom installer class & the installer are present in same solution.
Regards,
Harsh Suman
| Debugging a custom installer class in a Visual Studio installer project can be a bit tricky, but it's certainly possible. Here’s how you can do it step-by-step:
### Steps to Debug a Custom Installer Class
1. **Set Up Your Project**:
Make sure your custom installer class is part of your setup project and that it is... | 28,678 | [
{
"from": "human",
"value": "Could anyone tell me how to debug a custom installer class in an installer project.My custom installer class & the installer are present in same solution.\nRegards,\nHarsh Suman\n"
},
{
"from": "gpt",
"value": "Debugging a custom installer class in a Visual Studio in... |
When I'm writing some tight loop that needs to work fast I am often bothered by thoughts about how the processor branch prediction is going to behave. For instance I try my best to avoid having an if statement in the most inner loop, especially one with a result which is not somewhat uniform (say evaluates to true or f... | Branch prediction is indeed a critical factor in the performance of modern processors, particularly in tight loops where execution speed is crucial. Modern processors employ sophisticated branch prediction algorithms that help mitigate the performance costs of mispredicted branches, but it's still important to understa... | 39,307 | [
{
"from": "human",
"value": "When I'm writing some tight loop that needs to work fast I am often bothered by thoughts about how the processor branch prediction is going to behave. For instance I try my best to avoid having an if statement in the most inner loop, especially one with a result which is not som... |
I'm struggling to understand Dependency Properties in Silverlight 2. Does anybody have a good explanation or link that clearly explains the DependencyObject and/or DependencyProperty?
| Certainly! Dependency Properties are a key feature in Silverlight (and WPF) that enable a more flexible and powerful way to manage properties of UI elements.
### What are Dependency Properties?
**Dependency Properties** are a special type of property that are part of the `DependencyObject` class. They allow propertie... | 41,393 | [
{
"from": "human",
"value": "I'm struggling to understand Dependency Properties in Silverlight 2. Does anybody have a good explanation or link that clearly explains the DependencyObject and/or DependencyProperty?\n"
},
{
"from": "gpt",
"value": "Certainly! Dependency Properties are a key feature... |
I would like to reset my globalization provider for an inner section of my web site.
The site root uses a custom sql provider, I would like to use resx in my subfolder.
what should I set in resourceProviderFactoryType="???"
Thanks
| To reset the globalization provider for a specific section of your website and use resource files (`.resx`) instead of a custom SQL provider in your subfolder, you'll need to set the `resourceProviderFactoryType` in your configuration.
Assuming you are using ASP.NET, you can specify the resource provider factory for y... | 42,901 | [
{
"from": "human",
"value": "I would like to reset my globalization provider for an inner section of my web site.\nThe site root uses a custom sql provider, I would like to use resx in my subfolder.\nwhat should I set in resourceProviderFactoryType=\"???\"\nThanks\n"
},
{
"from": "gpt",
"value":... |
After moving to .NET 2.0+ is there ever a reason to still use the systems.Collections namespace (besides maintaining legacy code)? Should the generics namespace always be used instead?
| When working with .NET 2.0 and later, it's generally recommended to use the `System.Collections.Generic` namespace over the non-generic `System.Collections` namespace for most scenarios, but there are still some cases where you might encounter the non-generic collections.
### Reasons to Prefer `System.Collections.Gene... | 40,952 | [
{
"from": "human",
"value": "After moving to .NET 2.0+ is there ever a reason to still use the systems.Collections namespace (besides maintaining legacy code)? Should the generics namespace always be used instead?\n"
},
{
"from": "gpt",
"value": "When working with .NET 2.0 and later, it's gener... |
Does anyone have a recommendation about web service security architecture in Java (preferably under JBoss)? Any recommended reading?
I want to expose a fairly rich web service to the world but the data are sensitive and it requires authentication from the current client (Flex), accessed via RPC. I definitely do not w... | When designing a secure web service architecture in Java, especially under JBoss (now known as WildFly), there are several key considerations and best practices to keep in mind. Since you're looking to expose a rich web service while ensuring the security of sensitive data, here are some recommendations along with reso... | 38,464 | [
{
"from": "human",
"value": "Does anyone have a recommendation about web service security architecture in Java (preferably under JBoss)? Any recommended reading?\nI want to expose a fairly rich web service to the world but the data are sensitive and it requires authentication from the current client (Flex)... |
I'm doing a basic homework assignment which looks like this:
While input <> -1
input = CDbl(InputBox("Enter numbers to add, enter -1 to stop"))
values = values + input
End While
It works fine until I press 'cancel' on the input box. Then the string input is "", and I get the following error:
S... | You're correct that the error occurs when you attempt to convert an empty string to a `Double`. The best way to handle this is indeed through error handling and input validation. You can modify your code to check for the empty string (as well as the specific value of `-1`) before attempting to convert the input to a `D... | 40,921 | [
{
"from": "human",
"value": "I'm doing a basic homework assignment which looks like this:\n While input <> -1\n input = CDbl(InputBox(\"Enter numbers to add, enter -1 to stop\"))\n values = values + input\n End While\n\nIt works fine until I press 'cancel' on the input box. Then the str... |
Recently our team was facing the task to build the 2D slice between a plane and some set of 3D geometry (set of triangles). Google hasn't been as helpful as we have wanted it to be, so we turn our attention here to see if anyone has encountered this problem with a possible solution. Links are also wanted.
Finding the i... | The problem you're describing—intersecting a plane with a set of 3D triangles and obtaining a 2D representation of the intersection—is a common task in computational geometry and computer graphics. This process generally involves a few steps: detecting the intersection points, determining the edges of the triangles tha... | 38,140 | [
{
"from": "human",
"value": "Recently our team was facing the task to build the 2D slice between a plane and some set of 3D geometry (set of triangles). Google hasn't been as helpful as we have wanted it to be, so we turn our attention here to see if anyone has encountered this problem with a possible solut... |
Suppose I have one html page with frames. The left frame is simply a list of links, which will be displayed in the right frame. Is it possible, using javascript, to generate the contents of the left frame when the page loads?
| Yes, you can dynamically generate the contents of the left frame using JavaScript. However, you'll need to ensure that the JavaScript executes in the context of the frame where you want the links to appear.
Here’s a basic example of how you can achieve this. This assumes you have an HTML page structured with frames (... | 37,279 | [
{
"from": "human",
"value": "Suppose I have one html page with frames. The left frame is simply a list of links, which will be displayed in the right frame. Is it possible, using javascript, to generate the contents of the left frame when the page loads?\n"
},
{
"from": "gpt",
"value": "Yes, you... |
In Visual C# 2008, I have a solution with two projects.
First project contains Form1 that displays one Label with Text set to a string from Properties.Resources, like this:
label1.Text = Properties.Resources.MY_TEXT;
In the second project, I "Add as link" this Form1 from the first project. I want to show this form, so... | Yes, your approach is correct. When working with multiple projects in Visual C#, especially when you want to share resources between them, there are a few key points to consider:
1. **Adding a Project Reference**: By adding Project1 as a reference to Project2, you're allowing Project2 to access the types, methods, and... | 41,077 | [
{
"from": "human",
"value": "In Visual C# 2008, I have a solution with two projects.\nFirst project contains Form1 that displays one Label with Text set to a string from Properties.Resources, like this:\nlabel1.Text = Properties.Resources.MY_TEXT;\n\nIn the second project, I \"Add as link\" this Form1 from ... |
I have a ToggleButtonBar with a DataProvider setup like this:
<mx:ToggleButtonBar itemClick="clickHandler(event);" selectedIndex="0">
<mx:dataProvider>
<mx:String>{resourceManager.getString('dashboard','daily')}</mx:String>
<mx:String>{resourceManager.getString('dashboard','monthly')}</mx:String>... | To ensure that the labels in your `ToggleButtonBar` update dynamically when the locale changes, you can use data binding to bind the data provider to a property that reflects the current locale. This way, when the locale changes, the data provider will automatically update.
Here’s one way to implement this:
1. **Crea... | 43,539 | [
{
"from": "human",
"value": "I have a ToggleButtonBar with a DataProvider setup like this:\n <mx:ToggleButtonBar itemClick=\"clickHandler(event);\" selectedIndex=\"0\">\n <mx:dataProvider>\n <mx:String>{resourceManager.getString('dashboard','daily')}</mx:String>\n <mx:String>{resourceMana... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.