instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I want to prevent my script running more than once at a time.
My current approach is
create a semaphore file containing the pid of the running process
read the file, if my process-id is not in it exit (you never know...)
at the end of the processing, delete the file
In order to prevent the process from hanging, I se... | Your current approach has some limitations and potential risks. Here’s an analysis of your method, including the potential for killing the wrong process and some alternative solutions.
### Risks with Your Current Approach:
1. **Race Conditions**: There is a possibility of a race condition occurring between the time y... | 18,597 | [
{
"from": "human",
"value": "I want to prevent my script running more than once at a time. \nMy current approach is\n\ncreate a semaphore file containing the pid of the running process\nread the file, if my process-id is not in it exit (you never know...)\nat the end of the processing, delete the file\n\nIn... |
I have a Ruby DateTime which gets filled from a form. Additionally I have n hours from the form as well. I'd like to subtract those n hours from the previous DateTime. (To get a time range).
DateTime has two methods "-" and "<<" to subtract day and month, but not hour. (API). Any suggestions how I can do that?
| In Ruby, you can subtract hours from a `DateTime` object using the `-` operator in combination with `Rational` to convert hours into days. Since `DateTime` works with days, you'll need to convert the hours to a fraction of a day. Here's how you can do it:
```ruby
require 'date'
# Assuming you have a DateTime object a... | 25,083 | [
{
"from": "human",
"value": "I have a Ruby DateTime which gets filled from a form. Additionally I have n hours from the form as well. I'd like to subtract those n hours from the previous DateTime. (To get a time range).\nDateTime has two methods \"-\" and \"<<\" to subtract day and month, but not hour. (API... |
How do I uninstall a .NET Windows Service if the service files do not exist anymore?
I installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run
InstallUtil /u
first, so the service is still listed in the Services MMC.
Do I have to go into the registry? Or is there a better ... | If you've deleted the files of a .NET Windows Service but the service entry still exists in the Services management console (MMC), you can indeed remove the service from the registry without needing the original service files. Here's how to do it:
### Method 1: Using the Registry Editor
1. **Open the Registry Editor*... | 20,809 | [
{
"from": "human",
"value": "How do I uninstall a .NET Windows Service if the service files do not exist anymore?\nI installed a .NET Windows Service using InstallUtil. I have since deleted the files but forgot to run\n InstallUtil /u\n\nfirst, so the service is still listed in the Services MMC.\nDo I have ... |
I have a mixed UI (Win App, WPF App, and soon an ASP.NET MVC App) setup, so far I'm using Client Application Services for security. I know how to programmatically get a user authenticated and doing so is working beautifully. However...
I want to implement some cross cutting that basically checks to see if the user is... | Implementing a cross-cutting concern like user authentication in a mixed UI environment can indeed benefit from using the right techniques and tools. Here’s a breakdown of your questions regarding the Policy Injection Application Block (PIAB) and alternatives for achieving your goal.
### 1. Will the PIAB cover that ne... | 21,951 | [
{
"from": "human",
"value": "I have a mixed UI (Win App, WPF App, and soon an ASP.NET MVC App) setup, so far I'm using Client Application Services for security. I know how to programmatically get a user authenticated and doing so is working beautifully. However...\nI want to implement some cross cutting t... |
By that I mean, what do I need to do to have useful assertions in my code?
MFC is quite easy, i just use ASSERT(something).
What's the non-MFC way?
Edit: Is it possible to stop assert breaking in assert.c rather than than my file which called assert()?
Edit: What's the difference between <assert.h> & <cassert>?
Accepte... | To have useful assertions in your C or C++ code without using MFC, you can utilize the `<assert.h>` header (in C) or `<cassert>` (in C++) for assertion purposes. Here are some key points about using assertions and the differences between the two headers:
### Using Assertions
1. **Basic Usage**: You can use the `assert... | 21,578 | [
{
"from": "human",
"value": "By that I mean, what do I need to do to have useful assertions in my code?\nMFC is quite easy, i just use ASSERT(something).\nWhat's the non-MFC way?\nEdit: Is it possible to stop assert breaking in assert.c rather than than my file which called assert()?\nEdit: What's the diffe... |
I'm running my site through the W3C's validator trying to get it to validate as XHTML 1.0 Strict and I've gotten down to a particularly sticky (at least in my experience) validation error. I'm including certain badges from various services in the site that provide their own API and code for inclusion on an external si... | When dealing with third-party scripts or badges that insert HTML dynamically, it can indeed lead to validation issues, especially when you're striving to maintain XHTML 1.0 Strict compliance. The validator will flag these because the child elements that are supposed to be populated by JavaScript are absent during the v... | 21,920 | [
{
"from": "human",
"value": "I'm running my site through the W3C's validator trying to get it to validate as XHTML 1.0 Strict and I've gotten down to a particularly sticky (at least in my experience) validation error. I'm including certain badges from various services in the site that provide their own API... |
I am trying to create a custom control that a "gridview" like control but specifcally for business objects that implement certain custom interfaces.
In doing this I have come across the following problem.
I have a control that I have disabled viewstate on (and I don't want to re-enable it) and it has a child control t... | When you disable ViewState at the parent control level in ASP.NET, it indeed affects all child controls, preventing them from maintaining their state across postbacks. To enable ViewState on a child control while keeping it disabled for the parent control is a common scenario, but unfortunately, ASP.NET does not allow ... | 22,515 | [
{
"from": "human",
"value": "I am trying to create a custom control that a \"gridview\" like control but specifcally for business objects that implement certain custom interfaces. \nIn doing this I have come across the following problem.\nI have a control that I have disabled viewstate on (and I don't want ... |
My LCD rotates. The software that comes with my ATI card to rotate the desktop just crashes (I've uninstalled, reinstalled and rolled them back, still crashes). Is there any other way to rotate a Windows XP Desktop by 90 degree increments? I am looking for either software or code (any language is fine.) I know I ha... | Rotating the desktop on Windows XP can be done in a few different ways, especially if the software provided by your ATI card is crashing. While using third-party software is one option, you can also utilize Windows' built-in capabilities if your graphics card supports it. Here’s how you can achieve rotation and also wr... | 14,381 | [
{
"from": "human",
"value": "My LCD rotates. The software that comes with my ATI card to rotate the desktop just crashes (I've uninstalled, reinstalled and rolled them back, still crashes). Is there any other way to rotate a Windows XP Desktop by 90 degree increments? I am looking for either software or ... |
I have a large solution containing many C# projects. When I open the solution and hit F5 for the first time, I get compile errors like the following:
Error 3 Metadata file 'C:\Users\david\Documents\VS.Projects\CeoTrunk\Ceoimage\bin\x86\Release\Ceoimage.dll' could not be found.
I'm compiling the solution and the pr... | The issue you're encountering seems to stem from the fact that your Visual Studio solution is trying to build using a configuration (Release x86) that hasn't been actively set or configured in a while. Here are some steps to troubleshoot and resolve this issue:
### 1. Check Solution Configuration
1. **Open Configurat... | 17,000 | [
{
"from": "human",
"value": "I have a large solution containing many C# projects. When I open the solution and hit F5 for the first time, I get compile errors like the following:\n\nError 3 Metadata file 'C:\\Users\\david\\Documents\\VS.Projects\\CeoTrunk\\Ceoimage\\bin\\x86\\Release\\Ceoimage.dll' could... |
How to find out size of session in ASP.NET from web application?
| In ASP.NET, you can find the size of the session in a web application by calculating the size of the data stored in the session object. However, there's no built-in method to directly get the size of the session. Instead, you can create a method to serialize the session data and then calculate the size based on the ser... | 18,776 | [
{
"from": "human",
"value": "How to find out size of session in ASP.NET from web application?\n"
},
{
"from": "gpt",
"value": "In ASP.NET, you can find the size of the session in a web application by calculating the size of the data stored in the session object. However, there's no built-in meth... |
I have a variable that is built in loop. Something like:
$str = "";
for($i = 0; $i < 10; $i++) $str .= "something";
If $str = "" is ommitted, I get undefined variable notice, but I thought php auto-declare a variable the first time it sees undeclared one?
How do I do this right?
| In PHP, variables are indeed automatically declared when they are first assigned a value. However, if you try to use a variable without initializing it first, you'll get an "undefined variable" notice. In your case, the `undefined variable` notice occurs because you are using the concatenation operator (`.`) on an unin... | 24,826 | [
{
"from": "human",
"value": "I have a variable that is built in loop. Something like:\n$str = \"\";\nfor($i = 0; $i < 10; $i++) $str .= \"something\";\n\nIf $str = \"\" is ommitted, I get undefined variable notice, but I thought php auto-declare a variable the first time it sees undeclared one?\nHow do I do... |
What is the most efficient way to read the last row with SQL Server?
The table is indexed on a unique key -- the "bottom" key values represent the last row.
| To efficiently read the last row from a SQL Server table where the table is indexed on a unique key (and assuming the unique key values represent the "bottom" key values), you can leverage the ordering of the unique key to retrieve the last row.
Here's a straightforward way to achieve this using a `SELECT` statement w... | 25,331 | [
{
"from": "human",
"value": "What is the most efficient way to read the last row with SQL Server?\nThe table is indexed on a unique key -- the \"bottom\" key values represent the last row.\n"
},
{
"from": "gpt",
"value": "To efficiently read the last row from a SQL Server table where the table i... |
I've been looking into implementing an external activator in SQL Server Express 2005, and I added the queues, services, contracts, and event notifications to the database. I also added a trigger to send a message to the target queue. Everything parses, runs, and the trigger is firing. However, when I select from the ta... | Hello William,
It sounds like you're doing a great job setting up SQL Server Service Broker (SSB) with your external activator, but I understand how frustrating it can be when you can't see the messages you expect. Let’s address your questions one by one:
### 1. How is that even possible? Are the messages being auto-... | 18,584 | [
{
"from": "human",
"value": "I've been looking into implementing an external activator in SQL Server Express 2005, and I added the queues, services, contracts, and event notifications to the database. I also added a trigger to send a message to the target queue. Everything parses, runs, and the trigger is f... |
I'm getting married soon and am busy with the seating plan, and am running into the usual issues of who sits where: X and Y must sit together, but A and B cannot stand each other etc.
The numbers I'm dealing with aren't huge (so the manual option will work just fine), but being of the geeky persuasion, I was wondering ... | Congratulations on your upcoming wedding! Managing a seating plan can indeed be challenging. There are several software tools and online platforms specifically designed for wedding seating arrangements. Here are some options you might consider:
### Software Solutions:
1. **AllSeated**: This is a popular online tool th... | 22,465 | [
{
"from": "human",
"value": "I'm getting married soon and am busy with the seating plan, and am running into the usual issues of who sits where: X and Y must sit together, but A and B cannot stand each other etc.\nThe numbers I'm dealing with aren't huge (so the manual option will work just fine), but being... |
I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice.
Please note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and anything .net related.
| Sure! Below is a simple implementation of the QuickSort algorithm in VBA that you can use with MS Project 2003. This code defines a QuickSort procedure that sorts an array of numbers in ascending order.
You can add this code to a module in the Visual Basic for Applications editor in MS Project:
```vba
Sub QuickSortEx... | 22,151 | [
{
"from": "human",
"value": "I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice.\nPlease note that this is to work with MS Project 2003, so should avoid any of the Excel native functions and any... |
I have embedded a Python interpreter in a C program. Suppose the C program reads some bytes from a file into a char array and learns (somehow) that the bytes represent text with a certain encoding (e.g., ISO 8859-1, Windows-1252, or UTF-8). How do I decode the contents of this char array into a Python string?
The Pyt... | To properly decode a byte array that contains characters encoded in a specific character set into a Python Unicode string using the embedded Python interpreter, you can follow the approach you've outlined in your second example. Your first approach failed because `PyString_Decode` expects the input to be a string of by... | 21,435 | [
{
"from": "human",
"value": "I have embedded a Python interpreter in a C program. Suppose the C program reads some bytes from a file into a char array and learns (somehow) that the bytes represent text with a certain encoding (e.g., ISO 8859-1, Windows-1252, or UTF-8). How do I decode the contents of this... |
This XML file contained archived news stories for all of last year. I was asked to sort these stories by story categor[y|ies] into new XML files.
big_story_export.xml
turns into
lifestyles.xml
food.xml
nascar.xml
...and so on.
I got the job done using a one-off python script, however, I originally attempted this usin... | It sounds like you’re tackling a common challenge when working with XML and XSLT, especially when dealing with vendor-supplied data. Here are some strategies and tips to help ensure that your XSLT transformations run smoothly, even when working with less-than-ideal XML structures:
### 1. **Understand the Structure**:
... | 18,814 | [
{
"from": "human",
"value": "This XML file contained archived news stories for all of last year. I was asked to sort these stories by story categor[y|ies] into new XML files.\nbig_story_export.xml\n\nturns into\nlifestyles.xml\nfood.xml\nnascar.xml\n\n...and so on.\nI got the job done using a one-off python... |
I've got a really simple rails question here but I can't seem to find the answer anywhere. I guess some of the problems stem from me following a tutorial for Rails 1.2 with Rails 2.1. Anyway..
I'm writing a blog system and I'm implementing the comments bit. I have comments displaying fine once I've created them using s... | It looks like you're on the right track with your Rails application, but there are a few things to clarify and adjust to get your comment form working correctly. The main issue you're encountering is related to the way you're redirecting and handling the parameters in your `comments_controller.rb`.
1. **Redirecting Co... | 22,568 | [
{
"from": "human",
"value": "I've got a really simple rails question here but I can't seem to find the answer anywhere. I guess some of the problems stem from me following a tutorial for Rails 1.2 with Rails 2.1. Anyway..\nI'm writing a blog system and I'm implementing the comments bit. I have comments disp... |
I'm running my workstation on Server 2008 and a few servers in Hyper-V VM's on that server. I connect to my corporate LAN using VPN from the main OS (the host) but my VM's aren't seeing the servers in the corporate LAN. Internet and local access to my home network work fine. Each of the VMs has one virtual network adap... | To enable your Hyper-V virtual machines (VMs) to access your corporate LAN through a VPN connection on your host system, you'll need to consider a few different options. Since you've stated that your VMs get IP addresses from your home network router (via DHCP) and you're not using NAT through the host, this can compli... | 18,327 | [
{
"from": "human",
"value": "I'm running my workstation on Server 2008 and a few servers in Hyper-V VM's on that server. I connect to my corporate LAN using VPN from the main OS (the host) but my VM's aren't seeing the servers in the corporate LAN. Internet and local access to my home network work fine. Eac... |
New to xml. Looking for XPath to search a xml file with python ElementTree format
<root>
<child>One</child>
<child>Two</child>
<child>Three</child>
</root>
to do search for child with "Two" and return true/false
if it was started off like
from elementtree import ElementTree
root = ElementTree.parse(open(PathFile)).g... | You can use the `ElementTree` module in Python along with XPath to search for the specific child element you're interested in. In this case, you'll want to check if there is a `<child>` element containing the text "Two".
Here’s how you can do that:
```python
from xml.etree import ElementTree as ET
# Assume PathFile... | 25,336 | [
{
"from": "human",
"value": "New to xml. Looking for XPath to search a xml file with python ElementTree format\n<root>\n<child>One</child>\n<child>Two</child>\n<child>Three</child>\n</root>\n\nto do search for child with \"Two\" and return true/false\nif it was started off like \nfrom elementtree import El... |
I'm debugging a Cocoa application that can act as a handler to a custom URL protocol. The application works fine when I click on a link after the application has launched, but something is causing the app to crash if it has not launched at the time the link is clicked.
Is there any way that I can start the app in the d... | Yes, you can simulate a custom URL protocol handler invocation in your Cocoa application while it's running in a debugger. Here's a general approach to achieve that:
### Step 1: Set Up Your URL Scheme
Make sure your custom URL scheme is properly set up in your application's `Info.plist` file under the `CFBundleURLTyp... | 22,736 | [
{
"from": "human",
"value": "I'm debugging a Cocoa application that can act as a handler to a custom URL protocol. The application works fine when I click on a link after the application has launched, but something is causing the app to crash if it has not launched at the time the link is clicked.\nIs there... |
I am new to this community, but I am working on a site that requires implementation of a user/password/register check upon entry, which would check against a database, or write to the database, in the case of registration. I have experience with XHTML and CSS, and just discovered RoR. I honestly have very little insigh... | Welcome to the community! It sounds like you're diving into web development, and it's great that you're exploring Ruby on Rails (RoR) as a framework. RoR is a powerful choice for building web applications, especially for handling user authentication and database interactions. Here are a few points to consider:
### 1. ... | 18,898 | [
{
"from": "human",
"value": "I am new to this community, but I am working on a site that requires implementation of a user/password/register check upon entry, which would check against a database, or write to the database, in the case of registration. I have experience with XHTML and CSS, and just discovere... |
I'm used to coding Java Swing UIs, and in those if you have some properties that change, and you want your UI to update, you would implement the observer/observable pattern. In Java you do this normally by having your class maintain a list of listeners that it notifies of different events.
I've played with Objective-C ... | In iOS development, you can achieve a similar functionality to the observer/observable pattern using several techniques. Here are some of the most common approaches:
### 1. Key-Value Observing (KVO)
Although KVO is more commonly associated with Objective-C, it can also be used in Swift. KVO allows objects to observe ... | 22,024 | [
{
"from": "human",
"value": "I'm used to coding Java Swing UIs, and in those if you have some properties that change, and you want your UI to update, you would implement the observer/observable pattern. In Java you do this normally by having your class maintain a list of listeners that it notifies of differ... |
Is there a command or an existing script that will let me view all of a *NIX system's scheduled cron jobs at once? I'd like it to include all of the user crontabs, as well as /etc/crontab, and whatever's in /etc/cron.d. It would also be nice to see the specific commands run by run-parts in /etc/crontab.
Ideally, I'd li... | You can create a script that will gather all scheduled cron jobs from user crontabs, the global crontab, and any files in `/etc/cron.d`. Below is a shell script that consolidates all these cron jobs and outputs them in a formatted manner.
Here's a sample script that should meet your requirements:
```bash
#!/bin/bash
... | 20,534 | [
{
"from": "human",
"value": "Is there a command or an existing script that will let me view all of a *NIX system's scheduled cron jobs at once? I'd like it to include all of the user crontabs, as well as /etc/crontab, and whatever's in /etc/cron.d. It would also be nice to see the specific commands run by r... |
For a .NET assembly to allow anything other than fully trusted callers the assembly must be signed and attributed with AllowPartiallyTrustedCallers.
But even with this in place the CLR still (fortunately) checks code rights to ensure that the partially trusted caller can execute the desired code.
So my question is, wh... | The design choice to require the `AllowPartiallyTrustedCallers` (APTCA) attribute to be explicitly declared in .NET assemblies rather than assuming it for all assemblies is rooted in the need for security and clarity in the handling of partially trusted code.
Here are a few reasons for this design decision:
1. **Secu... | 24,310 | [
{
"from": "human",
"value": "For a .NET assembly to allow anything other than fully trusted callers the assembly must be signed and attributed with AllowPartiallyTrustedCallers.\nBut even with this in place the CLR still (fortunately) checks code rights to ensure that the partially trusted caller can execut... |
I want to write a odometer-like method in a C#-style-language, but not just using 0-9 for characters, but any set of characters. It will act like a brute-force application, more or less.
If I pass in a char-array of characters from 0 to J, and set length to 5, I want results like 00000, 00001, 00002... HJJJJ, IJJJJJ, J... | Certainly! To implement an odometer-like method in C#, you need to generate all possible combinations of a given set of characters up to a specified length. This can be achieved using a recursive approach or an iterative approach. For simplicity, I will demonstrate an iterative approach to generate the combinations.
H... | 22,652 | [
{
"from": "human",
"value": "I want to write a odometer-like method in a C#-style-language, but not just using 0-9 for characters, but any set of characters. It will act like a brute-force application, more or less.\nIf I pass in a char-array of characters from 0 to J, and set length to 5, I want results li... |
I am writing code for a search results page that needs to highlight search terms. The terms happen to occur within table cells (the app is iterating through GridView Row Cells), and these table cells may have HTML.
Currently, my code looks like this (relevant hunks shown below):
const string highlightPattern = @"<span ... | To achieve the highlighting of search terms that occur only in the text nodes of your HTML while avoiding any matches within HTML tags, you can use a regex pattern that ignores text within angle brackets.
Below is an adjusted version of your code that incorporates a regex pattern to accomplish this. We will use a reg... | 21,892 | [
{
"from": "human",
"value": "I am writing code for a search results page that needs to highlight search terms. The terms happen to occur within table cells (the app is iterating through GridView Row Cells), and these table cells may have HTML.\nCurrently, my code looks like this (relevant hunks shown below)... |
Is it possible to create a form on Windows using Ruby? I have a Ruby script and I would like to have an input form to ask for a user's password, then use this in the rest of my script.
update: I have successfully done this with wxRuby, although it looks ugly. Shoes looks promising, I might look into that if I need to ... | Yes, it is definitely possible to create a GUI form on Windows using Ruby! You've already made progress with wxRuby, and it's good to hear that you are considering Shoes as well. Here are a few options you can explore for creating a user input form in Ruby:
### 1. **Shoes**
Shoes is a simple GUI toolkit for Ruby that ... | 21,771 | [
{
"from": "human",
"value": "Is it possible to create a form on Windows using Ruby? I have a Ruby script and I would like to have an input form to ask for a user's password, then use this in the rest of my script. \nupdate: I have successfully done this with wxRuby, although it looks ugly. Shoes looks promi... |
I have a main frame with a splitter. On the left I have my (imaginatively named) CAppView_Leftand on the right I have CAppView_Right_1and CAppView_Right_2. Through the following code I initialise the two primary views correctly:
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n... | To implement a second view inside a splitter window, you'll need to use a nested splitter. The basic approach is to create a new splitter for the right pane of your main splitter and then create the second view within that nested splitter.
Here’s a step-by-step guide on how to do it:
1. **Create a Nested Splitter for... | 20,950 | [
{
"from": "human",
"value": "I have a main frame with a splitter. On the left I have my (imaginatively named) CAppView_Leftand on the right I have CAppView_Right_1and CAppView_Right_2. Through the following code I initialise the two primary views correctly:\nif (!m_wndSplitter.CreateStatic(this, 1, 2))\n{\n... |
There is probably is simple fix for this but I currently have code similar to
dim dr as dbDataReader
try
dr = connection.getDataReader(sql_str)
Catch ex as sqlClientException
log.error(ex)
finally
if not IsNothing(dr) then
dr.close
end if
end try
However Visual Studio still warns me that the
if... | The warning you are encountering is likely due to the fact that the `dr` variable may still be `Nothing` if an exception occurs before it's assigned (i.e., if the `connection.getDataReader(sql_str)` call throws an exception).
To mitigate this issue while keeping the declaration of `dr` outside the `try` block, you can... | 23,648 | [
{
"from": "human",
"value": "There is probably is simple fix for this but I currently have code similar to \ndim dr as dbDataReader\n\ntry\n dr = connection.getDataReader(sql_str)\nCatch ex as sqlClientException\n log.error(ex)\nfinally \n\n if not IsNothing(dr) then\n dr.close\n end if\nend t... |
I've run across the following line in a VB6 application.
mobjParentWrkBk.ExcelWorkBook.Application.Selection.Insert Shift:=xlToRight
Unfortunately Google and other search engines have not been very useful as they seem to omit the := part.
What would be a C# equivalent?
| In VB6, the `:=` syntax is used for named arguments, allowing you to specify which parameter you are providing a value for without needing to provide the values for all preceding parameters.
In C#, when you are calling a method that takes parameters, you can pass them as positional arguments or use named arguments if ... | 23,621 | [
{
"from": "human",
"value": "I've run across the following line in a VB6 application.\nmobjParentWrkBk.ExcelWorkBook.Application.Selection.Insert Shift:=xlToRight\n\nUnfortunately Google and other search engines have not been very useful as they seem to omit the := part. \nWhat would be a C# equivalent?\n"
... |
I'm trying to map a ManyToMany relationships between 2 tables, both having composite primary keys
LSFOCTB which primary key is composed of : LSFOC_CODSOC,LSFOC_CODLSC,LSFOC_CODFOC
LSFORTB which primary key is composed of : LSFOR_CODSOC,LSFOR_CODLSC,LSFOC_CODFOR
The table in charge of the ManyToMany relationship is :... | In your Hibernate mapping, the error you are encountering is due to the repeated column name in the `@JoinTable` configuration for the `@ManyToMany` relationship. You have specified the same join column name for both the `joinColumns` and `inverseJoinColumns`, which is causing a conflict.
Here's the breakdown of what'... | 20,407 | [
{
"from": "human",
"value": "I'm trying to map a ManyToMany relationships between 2 tables, both having composite primary keys \nLSFOCTB which primary key is composed of : LSFOC_CODSOC,LSFOC_CODLSC,LSFOC_CODFOC\n\nLSFORTB which primary key is composed of : LSFOR_CODSOC,LSFOR_CODLSC,LSFOC_CODFOR\n\nThe table... |
I have code similar to this filtering entries in an Array of Objects:
var filterRegex = new RegExp(".*blah.*","ig");
if (filterRegex.test(events[i].thing) && events[i].show) {
console.log("SUCCESS: filtering thing " + i + " " + events[i].thing);
events[i].show = false;
numevents--;
}
I get inconsistent res... | The issue you're experiencing can often be attributed to a few potential problems, particularly if you're modifying the `events` array while iterating through it. Let's break down some possible causes for the inconsistent behavior:
### 1. Modifying the Array While Iterating
When you set `events[i].show = false` inside... | 21,796 | [
{
"from": "human",
"value": "I have code similar to this filtering entries in an Array of Objects:\nvar filterRegex = new RegExp(\".*blah.*\",\"ig\");\nif (filterRegex.test(events[i].thing) && events[i].show) {\n console.log(\"SUCCESS: filtering thing \" + i + \" \" + events[i].thing);\n events[i].sho... |
I have to connect my rails app in a legacy Postgre database. It uses schemas so in a SQL its is common to use something like
SELECT * FROM "Financial".budget
I want to write a Budget model but I don't know how to set the table name in this case. I've tried the following:
set_table_name 'budget'
set_table_name '"Fina... | To connect your Rails application to a PostgreSQL database with schemas and specify a table that includes a schema name, you can use the following approach to define your model. Starting from Rails 4.0, the method for setting the table name has changed, and you should use the `self.table_name` method instead of `set_ta... | 25,111 | [
{
"from": "human",
"value": "I have to connect my rails app in a legacy Postgre database. It uses schemas so in a SQL its is common to use something like \nSELECT * FROM \"Financial\".budget\n\nI want to write a Budget model but I don't know how to set the table name in this case. I've tried the following:\... |
Let's say you want to count the occurances of chars in some text.
The fastest way i could think of was to use an array like unsigned char charcounts[256], initialize it to zeros, then look at each char in the text input and do charcounts[c]++. then linear search charcounts[] using two vars to keep of track of the lowes... | Your approach of using an array to count character occurrences is efficient, especially for the fixed size of ASCII characters (256). Here are some thoughts about your method and some potential improvements or alternatives:
1. **Using a HashMap or Dictionary**: If your input can contain characters outside the standard... | 17,599 | [
{
"from": "human",
"value": "Let's say you want to count the occurances of chars in some text.\nThe fastest way i could think of was to use an array like unsigned char charcounts[256], initialize it to zeros, then look at each char in the text input and do charcounts[c]++. then linear search charcounts[] us... |
I'm working with some code that is confusing me and I'm wondering if I'm just not grokking the data structures. The data I'm working with utilizes vectors and layers. I believe a vector is just a row of data but I'm not sure.
Any information you could provide or point me to about the use of these would be very helpful.... | Sure! Let's clarify the concepts of vectors and layers, especially in the context of programming and data structures.
### Vectors
1. **General Definition**: A vector is typically a one-dimensional array of numbers. In many programming languages, vectors can store a sequence of elements, where each element can be acce... | 18,352 | [
{
"from": "human",
"value": "I'm working with some code that is confusing me and I'm wondering if I'm just not grokking the data structures. The data I'm working with utilizes vectors and layers. I believe a vector is just a row of data but I'm not sure.\nAny information you could provide or point me to abo... |
Right now, I have
SELECT gp_id FROM gp.keywords
WHERE keyword_id = 15
AND (SELECT practice_link FROM gp.practices
WHERE practice_link IS NOT NULL
AND id = gp_id)
This does not provide a syntax error, however for values where it should return row(s), it just returns 0 rows.
What I'm trying to do is get t... | Your current query has a subquery that may not return any results even when the `gp_id` matches the `id` in the `practices` table. Instead, you might want to use a `JOIN` to combine the two tables in a way that directly checks for the non-null `practice_link`. Here's a revised version of your query using `JOIN`:
```sq... | 25,309 | [
{
"from": "human",
"value": "Right now, I have \nSELECT gp_id FROM gp.keywords \nWHERE keyword_id = 15 \nAND (SELECT practice_link FROM gp.practices \n WHERE practice_link IS NOT NULL \n AND id = gp_id)\n\nThis does not provide a syntax error, however for values where it should return row(s), it jus... |
Is is possible to create COM component and ActiveX controls in .Net (using c# language). I searched internet but i could`t get anything.
Thanks,
santhosh
| Yes, it is possible to create COM components and ActiveX controls in .NET using C#. Here’s a brief overview of how you can achieve this:
### Creating a COM Component in C#
1. **Create a Class Library Project**:
- In Visual Studio, create a new Class Library project.
2. **Set Assembly Information**:
- Go to the... | 18,928 | [
{
"from": "human",
"value": "Is is possible to create COM component and ActiveX controls in .Net (using c# language). I searched internet but i could`t get anything.\nThanks,\nsanthosh\n"
},
{
"from": "gpt",
"value": "Yes, it is possible to create COM components and ActiveX controls in .NET usin... |
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)?
| Yes, you can configure Tomcat to start with security enabled for your Dynamic Web Project in Eclipse by modifying the way Tomcat is launched. Here are the steps to achieve this:
### Step 1: Open Eclipse Preferences
1. Open Eclipse.
2. Go to `Window` -> `Preferences` (or `Eclipse` -> `Preferences` on macOS).
### Step... | 18,193 | [
{
"from": "human",
"value": "Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)?\n"
},
{
"from": "gpt",
"value": "Yes, you can co... |
I have used C# in Visual Studio with .NET, and I have played around a little with Mono on openSUSE Linux, but I don't really understand how it works.
If I write an app in Windows on .NET, how does this relate to Mono? I can't just execute an a Windows .exe file on Linux without Wine, so it doesn't help me execute apps ... | You've got the right idea about the relationship between .NET and Mono, and your questions touch on some important aspects of cross-platform development.
### .NET vs. Mono
1. **.NET Framework and .NET Core/5+**:
- The traditional .NET Framework is primarily Windows-based and applications compiled against it cannot... | 21,860 | [
{
"from": "human",
"value": "I have used C# in Visual Studio with .NET, and I have played around a little with Mono on openSUSE Linux, but I don't really understand how it works.\nIf I write an app in Windows on .NET, how does this relate to Mono? I can't just execute an a Windows .exe file on Linux without... |
During software development, there may be bugs in the codebase which are known issues. These bugs will cause the regression/unit tests to fail, if the tests have been written well.
There is constant debate in our teams about how failing tests should be managed:
Comment out failing test cases with a REVISIT or TODO co... | Your suggestion of a tri-state solution is a thoughtful approach that balances the needs for visibility into known issues while avoiding the noise of multiple failing tests. Here are some best practices and considerations when managing failing tests in software development:
### Best Practices for Managing Failing Test... | 21,875 | [
{
"from": "human",
"value": "During software development, there may be bugs in the codebase which are known issues. These bugs will cause the regression/unit tests to fail, if the tests have been written well.\nThere is constant debate in our teams about how failing tests should be managed:\n\nComment out ... |
I use _vimrc to configure my vim 7.2 (windows) default settings. One setting "set number" will display line numbers on the left side. My vim background color is white (I cannot find setting for this. Maybe the default is white. Anyway I accept this setting).
I would like the background color for line numbers to be Grey... | To change the background color of line numbers in Vim, you'll want to set the highlighting for the `LineNr` group. Since you want to set a grey or dimmed color background for the line numbers while keeping the default white background for the rest of the text, you can add the following line to your `_vimrc` file:
```v... | 26,168 | [
{
"from": "human",
"value": "I use _vimrc to configure my vim 7.2 (windows) default settings. One setting \"set number\" will display line numbers on the left side. My vim background color is white (I cannot find setting for this. Maybe the default is white. Anyway I accept this setting).\nI would like the ... |
I have trouble comparing 2 double in Excel VBA
suppose that I have the following code
Dim a as double
Dim b as double
a = 0.15
b = 0.01
After a few manipulations on b, b is now equal to 0.6
however the imprecision related to the double data type gives me headache because
if a = b then
//this will never trigger
end if... | Dealing with floating-point precision issues in VBA (and most programming languages) can be tricky, especially when comparing `Double` values. Instead of trying to remove the imprecision, a common and effective strategy is to use a tolerance value when comparing doubles. Here's how you can do this in VBA:
### Using a ... | 24,589 | [
{
"from": "human",
"value": "I have trouble comparing 2 double in Excel VBA\nsuppose that I have the following code\nDim a as double\nDim b as double\na = 0.15\nb = 0.01\n\nAfter a few manipulations on b, b is now equal to 0.6\nhowever the imprecision related to the double data type gives me headache becaus... |
In the context of unit testing, what is a "unit"?
| In the context of unit testing, a "unit" refers to the smallest testable part of an application. This typically involves a single function, method, or class. The idea behind unit testing is to isolate each unit of the software to verify that it behaves as expected in terms of its logic and functionality.
Unit tests ar... | 26,924 | [
{
"from": "human",
"value": "In the context of unit testing, what is a \"unit\"? \n"
},
{
"from": "gpt",
"value": "In the context of unit testing, a \"unit\" refers to the smallest testable part of an application. This typically involves a single function, method, or class. The idea behind unit... |
Oracle is giving me an error (ORA-00907: missing right parenthesis) when I run this query:
select *
from reason_for_appointment
where reason_for_appointment_id in
(
select reason_for_appointment_id
from appointment_reason
where appointment_id = 11
order by appointment_reason_id
)
However, when I ... | The error you're encountering, `ORA-00907: missing right parenthesis`, typically indicates that there is an issue with the structure of your SQL query.
In this case, the error arises from the use of the `ORDER BY` clause within the subquery. In Oracle SQL, when using a subquery inside an `IN` clause (or any other cla... | 25,316 | [
{
"from": "human",
"value": "Oracle is giving me an error (ORA-00907: missing right parenthesis) when I run this query:\nselect * \nfrom reason_for_appointment \nwhere reason_for_appointment_id in \n(\n select reason_for_appointment_id \n from appointment_reason \n where appointment_id = 11 \n o... |
How can I hide an element in html on Pocket Internet Explorer running on a Windows Mobile 6 device. The following code does not work even though it apears to be setting the values correctly.
function ShowCollapseElement(sLinkId, sContentId)
{
var oLinkElement;
var oContentElement;
//Get the elements
... | Pocket Internet Explorer on Windows Mobile 6 has some limitations when it comes to JavaScript and CSS support, which can lead to issues with manipulating DOM elements. To address these issues, you may want to modify your approach to toggling the visibility of an element.
Here are a few suggestions to improve your code... | 23,439 | [
{
"from": "human",
"value": "How can I hide an element in html on Pocket Internet Explorer running on a Windows Mobile 6 device. The following code does not work even though it apears to be setting the values correctly.\nfunction ShowCollapseElement(sLinkId, sContentId)\n {\n var oLinkElement;\n va... |
I have several databases where the transaction log (.LDF) is many times larger than the database file (.MDF).
What can I do to automatically shrink these or keep them from getting so large?
| When dealing with SQL Server databases, if you find that your transaction log files (.LDF) are significantly larger than your database files (.MDF), it's essential to manage the log file appropriately to prevent it from growing excessively. Here are some strategies to help you automatically manage the size of your tran... | 16,164 | [
{
"from": "human",
"value": "I have several databases where the transaction log (.LDF) is many times larger than the database file (.MDF).\nWhat can I do to automatically shrink these or keep them from getting so large?\n"
},
{
"from": "gpt",
"value": "When dealing with SQL Server databases, if ... |
I'm trying to find the best way to use 'top' as semi-permanent instrumentation in the development of a box running embedded Linux. (The instrumentation will be removed from the final-test and production releases.)
My first pass is to simply add this to init.d:
top -b -d 15 >/tmp/toploop.out &
This runs top in "batch" ... | Using `top` in batch mode for semi-permanent instrumentation is a common approach, but there are several factors to consider when implementing this strategy in an embedded Linux environment. Let's address your questions one by one:
### 1. Is 15 seconds a good value to choose for general-purpose monitoring?
- **15 seco... | 22,145 | [
{
"from": "human",
"value": "I'm trying to find the best way to use 'top' as semi-permanent instrumentation in the development of a box running embedded Linux. (The instrumentation will be removed from the final-test and production releases.)\nMy first pass is to simply add this to init.d:\ntop -b -d 15 >/t... |
I'm using the ListView control (ASP.NET 2008) to show a bunch of lines of data, and at the bottom I want some totals. I was initially going to define the header and footer in the LayoutTemplate and get the totals with some local function, i.e. <%#GetTheSum()%>, but it appears that the LayoutTemplate does not process th... | In ASP.NET 2008 using the ListView control, displaying totals in the footer can indeed be challenging since the `LayoutTemplate` doesn't directly support data binding expressions (`<%# ... %>`). However, there are a few effective approaches to achieve this.
### Approach 1: Using FindControl in the ListView's ItemDataB... | 20,082 | [
{
"from": "human",
"value": "I'm using the ListView control (ASP.NET 2008) to show a bunch of lines of data, and at the bottom I want some totals. I was initially going to define the header and footer in the LayoutTemplate and get the totals with some local function, i.e. <%#GetTheSum()%>, but it appears th... |
I have a text file in the root of my web app http://localhost/foo.txt and I'd like to load it into a variable in javascript.. in groovy I would do this:
def fileContents = 'http://localhost/foo.txt'.toURL().text;
println fileContents;
How can I get a similar result in javascript?
| In JavaScript, you can use the Fetch API to load the contents of a text file from a URL. Here's how you can achieve a similar result to your Groovy example:
```javascript
// Define the URL of the text file
const url = 'http://localhost/foo.txt';
// Use the Fetch API to get the contents of the file
fetch(url)
.then(... | 25,621 | [
{
"from": "human",
"value": "I have a text file in the root of my web app http://localhost/foo.txt and I'd like to load it into a variable in javascript.. in groovy I would do this:\ndef fileContents = 'http://localhost/foo.txt'.toURL().text;\nprintln fileContents;\n\nHow can I get a similar result in javas... |
I have a .net project that has a web reference to a service. I would like to update that web reference as part of every build. Is that possible?
| Yes, it's possible to update a web reference in a .NET project as part of every build process. To do this, you can use MSBuild, the build engine for .NET projects, to automate the update of the web reference. Here are steps you can follow to achieve this:
### Steps to Update Web Reference Automatically
1. **Open the ... | 18,722 | [
{
"from": "human",
"value": "I have a .net project that has a web reference to a service. I would like to update that web reference as part of every build. Is that possible?\n"
},
{
"from": "gpt",
"value": "Yes, it's possible to update a web reference in a .NET project as part of every build p... |
I want to delete all the previously created indices. I am using Lucene.net.
I tried the following:
Term term = new Term(); //empty because I want to delete all the indices
IndexReader rdr = IndexReader.Open(_directory);
rdr.DeleteDocuments(term);
rdr.Close();
But I get error. Any idea how to go about it?
| In Lucene.Net, you cannot use an empty `Term` when calling `DeleteDocuments` to delete all documents from an index. Instead, you should open a `IndexWriter` and use the `DeleteAll()` method, which is the correct way to delete all documents in an index.
Here’s how you can achieve that:
1. Make sure you have access to ... | 25,878 | [
{
"from": "human",
"value": "I want to delete all the previously created indices. I am using Lucene.net.\nI tried the following:\nTerm term = new Term(); //empty because I want to delete all the indices\nIndexReader rdr = IndexReader.Open(_directory);\n\nrdr.DeleteDocuments(term);\nrdr.Close();\n\nBut I get... |
I feel like a fool, but here goes:
public interface IHasErrorController{
ErrorController ErrorController { get; set; }
}
public class DSErrorController: ErrorController{yadi yadi ya}
public class DSWebsiteController : Controller, IHasErrorController{
public DSErrorController ErrorController { get; set; }
}
Thi... | The error you are encountering arises from the fact that `DSWebsiteController` implements the `IHasErrorController` interface, which defines a property of type `ErrorController`. Since `DSWebsiteController` defines the property with a type of `DSErrorController`, the types do not match exactly. In C#, properties that i... | 23,271 | [
{
"from": "human",
"value": "I feel like a fool, but here goes:\npublic interface IHasErrorController{\n ErrorController ErrorController { get; set; }\n}\n\npublic class DSErrorController: ErrorController{yadi yadi ya}\n\npublic class DSWebsiteController : Controller, IHasErrorController{\n public DSErr... |
I've seen a number of 'code metrics' related questions on SO lately, and have to wonder what the fascination is? Here are some recent examples:
what code metrics convince you that provided code is crappy
when if ever is number of lines of code a useful metric
writing quality tests
In my mind, no metric can substitute... | Your reflections on code metrics raise a number of important points about their utility and limitations. Here’s a deeper look at the role of code metrics, the rationale behind their use, and the implications for software development:
### Understanding Code Metrics
1. **What Are Code Metrics?**
Code metrics are qua... | 21,423 | [
{
"from": "human",
"value": "I've seen a number of 'code metrics' related questions on SO lately, and have to wonder what the fascination is? Here are some recent examples:\n\nwhat code metrics convince you that provided code is crappy\nwhen if ever is number of lines of code a useful metric\nwriting qualit... |
I want to save and store simple mail objects via serializing, but I get always an error and I can't find where it is.
package sotring;
import java.io.*;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import com.sun.org.apache.bcel.internal.generic.INEG;
public class storeing {
... | The error message you're encountering indicates that your `getStoredMails()` method does not have a return path for some cases, which is why the compiler is complaining. Specifically, if an exception occurs during the `try` block and is caught, the method does not return anything.
To fix this, you need to make sure t... | 25,195 | [
{
"from": "human",
"value": "I want to save and store simple mail objects via serializing, but I get always an error and I can't find where it is.\npackage sotring;\nimport java.io.*;\nimport java.text.DateFormat;\nimport java.text.SimpleDateFormat;\nimport java.util.*;\n\nimport com.sun.org.apache.bcel.int... |
I have now worked on two different teams that use the Agile/Scrum approach in the last two years and both teams were eager to improve the way they approach software development. In the first team, we could easily convince our product owner to get time for internal things like improving the build system, setting up bett... | It's great to hear that you've been able to work on Agile/Scrum teams that are focused on continuous improvement. The challenges you're facing with the product owner (PO) are quite common, and many teams encounter similar situations. Here are several approaches that teams have used to address this issue:
### 1. **Crea... | 20,801 | [
{
"from": "human",
"value": "I have now worked on two different teams that use the Agile/Scrum approach in the last two years and both teams were eager to improve the way they approach software development. In the first team, we could easily convince our product owner to get time for internal things like im... |
I tried to package a Twisted program with py2exe, but once I run the exe file I built, I got a "No module named resource" error.
And I found the py2exe said:
The following modules appear to be missing ['FCNTL', 'OpenSSL', 'email.Generator', 'email.Iterators', 'email.Utils', 'pkg_resources', 'pywintypes', 'resource', ... | Packaging a Twisted program (or any other complex application) with `py2exe` can sometimes lead to issues with missing modules. Here are some steps to troubleshoot and resolve the "No module named resource" error and any other missing modules reported by `py2exe`.
### Steps to Resolve Missing Modules
1. **Ensure All ... | 18,345 | [
{
"from": "human",
"value": "I tried to package a Twisted program with py2exe, but once I run the exe file I built, I got a \"No module named resource\" error. \nAnd I found the py2exe said:\n\nThe following modules appear to be missing ['FCNTL', 'OpenSSL', 'email.Generator', 'email.Iterators', 'email.Utils... |
Possible Duplicate:
Emacs, switch to previous window
other-window advances me to the next window in the current frame, but I also want a way to move back to the previous window.
Emacs has next-buffer and previous-buffer, but no analogous interactive functions for window navigation. Just other-window.
| In Emacs, you can navigate back to the previous window using the `other-window` command with a negative argument. By default, `other-window` moves to the next window, but you can specify a negative number to move back.
Here’s how you can do it:
1. **Using `other-window`:**
You can use the command `M-x other-wind... | 25,785 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nEmacs, switch to previous window \n\nother-window advances me to the next window in the current frame, but I also want a way to move back to the previous window.\nEmacs has next-buffer and previous-buffer, but no analogous interactive functions for window ... |
Going back to my previous question on OCSP, does anybody know of "reliable" OCSP libraries for Python, Java and C?
I need "client" OCSP functionality, as I'll be checking the status of Certs against an OCSP responder, so responder functionality is not that important.
Thanks
| Certainly! Here are some reliable OCSP client libraries for Python, Java, and C that you can use to check the status of certificates against an OCSP responder:
### Python
1. **requests[security]**:
- The `requests` library with its `security` extras includes basic support for OCSP.
- Documentation: [Requests Doc... | 11,653 | [
{
"from": "human",
"value": "Going back to my previous question on OCSP, does anybody know of \"reliable\" OCSP libraries for Python, Java and C?\nI need \"client\" OCSP functionality, as I'll be checking the status of Certs against an OCSP responder, so responder functionality is not that important.\nThan... |
I was wondering about the best practices regarding this? I know there are two ways to use IIS and host multiple websites.
The first is to have an IP for every website
The second is to use host headers, and a single IP Address for IIS
I was wondering which was the best practice, and why one should be preferred over t... | When hosting multiple websites on Internet Information Services (IIS), both methods you mentioned—using multiple IP addresses or utilizing host headers with a single IP address—have their own advantages and best practices. The best choice depends on your specific requirements and circumstances. Below is an overview of ... | 21,994 | [
{
"from": "human",
"value": "I was wondering about the best practices regarding this? I know there are two ways to use IIS and host multiple websites. \nThe first is to have an IP for every website \nThe second is to use host headers, and a single IP Address for IIS\nI was wondering which was the best prac... |
I would like to receive suggestions on the data generators that are available, for SQL server. If posting a response, please provide any features that you think are important.
I have never used a application like this, so I am looking to be educated on the topic. Thank you.
(My goal is to fill a database with 10,000+ ... | There are several data generation tools and libraries available for SQL Server that can help you populate your database with test data. Here are some popular options along with their key features:
### 1. **SQL Server Data Tools (SSDT)**
- **Features:**
- Built-in support for generating test data through database pro... | 13,427 | [
{
"from": "human",
"value": "I would like to receive suggestions on the data generators that are available, for SQL server. If posting a response, please provide any features that you think are important. \nI have never used a application like this, so I am looking to be educated on the topic. Thank you.\n(... |
While developing a C++ application, I had to use a third-party library which produced a huge amount of warnings related with a harmless #pragma directive being used.
../File.hpp:1: warning: ignoring #pragma ident
In file included from ../File2.hpp:47,
from ../File3.hpp:57,
from File4.h... | Yes, you can disable specific warnings when using the GNU C++ compiler (g++) by utilizing the `-Wno-` flag to turn off certain warnings. However, in this case, since the warning is related to a `#pragma` directive, it's not always straightforward to suppress warnings for specific pragmas directly, because the warning m... | 24,294 | [
{
"from": "human",
"value": "While developing a C++ application, I had to use a third-party library which produced a huge amount of warnings related with a harmless #pragma directive being used.\n../File.hpp:1: warning: ignoring #pragma ident\nIn file included from ../File2.hpp:47,\n from ..... |
I want to change the order of XML using XDocument
<root>
<one>1</one>
<two>2</two>
</root>
I want to change the order so that 2 appears before 1. Is this capability baked in or do I have to do it myself. For example, remove then AddBeforeSelf()?
Thanks
| In `XDocument`, there is no built-in method to change the order of elements directly by specifying their new positions. However, you can achieve this by removing the element and then inserting it in the desired location.
Here's how you can change the order of the elements using LINQ to XML:
1. Remove the element you ... | 25,056 | [
{
"from": "human",
"value": "I want to change the order of XML using XDocument\n<root>\n <one>1</one>\n <two>2</two>\n</root>\n\nI want to change the order so that 2 appears before 1. Is this capability baked in or do I have to do it myself. For example, remove then AddBeforeSelf()?\nThanks\n"
},
{... |
Last week we released Omniture's analytics code onto a large volume of web sites after tinkering and testing for the last week or so.
On almost all of our site templates, it works just fine. In a few scattered, unpredictable situations, there is a crippling, browser-crashing experience that may turn away some users.
We... | To troubleshoot the crashing issue you're experiencing with the Omniture analytics code and event listeners, you can take a systematic approach to identify if there are any event listeners attached to the elements in question and understand what they might be doing. Here are some steps you can take to diagnose the prob... | 20,018 | [
{
"from": "human",
"value": "Last week we released Omniture's analytics code onto a large volume of web sites after tinkering and testing for the last week or so.\nOn almost all of our site templates, it works just fine. In a few scattered, unpredictable situations, there is a crippling, browser-crashing ex... |
How can I determine if a remote drive has enough space for me to upload a given file using C# in .Net?
| To determine if a remote drive has enough space for uploading a file using C# in .NET, you can use a combination of classes provided by the .NET Framework to check the available disk space on the remote drive. You would typically use the `DriveInfo` class to get information about the drive.
Here is a step-by-step gui... | 19,644 | [
{
"from": "human",
"value": "How can I determine if a remote drive has enough space for me to upload a given file using C# in .Net?\n"
},
{
"from": "gpt",
"value": "To determine if a remote drive has enough space for uploading a file using C# in .NET, you can use a combination of classes provide... |
I have a legacy application that I needed to implement a configuration page for to change text colors, fonts, etc.
This applications output is also replicated with a PHP web application, where the fonts, colors, etc. are configured in a style sheet.
I've not worked with CSS previously.
Is there a programatic way to mod... | To programmatically manipulate CSS without resorting to string parsing or regular expressions, you can use a .NET library designed for working with CSS. One such library is **CsCss**, which provides a straightforward way to read, modify, and write CSS files.
### Steps to Modify CSS Programmatically
1. **Set Up Your P... | 21,256 | [
{
"from": "human",
"value": "I have a legacy application that I needed to implement a configuration page for to change text colors, fonts, etc.\nThis applications output is also replicated with a PHP web application, where the fonts, colors, etc. are configured in a style sheet.\nI've not worked with CSS pr... |
I have saved input from a textarea element to a TEXT column in MySQL. I'm using PHP to pull that data out of the database and want to display it in a p element while still showing the whitespace that the user entered (e.g. multiple spaces and newlines). I've tried a pre tag but it doesn't obey the width set in the co... | To display text with preserved whitespace, including multiple spaces and newlines, you can use a combination of CSS and HTML without having to replace spaces with ` ` and newlines with `<br>` tags manually in PHP.
Here are a few clean solutions:
### Option 1: Using CSS `white-space` Property
You can apply the `... | 21,567 | [
{
"from": "human",
"value": "I have saved input from a textarea element to a TEXT column in MySQL. I'm using PHP to pull that data out of the database and want to display it in a p element while still showing the whitespace that the user entered (e.g. multiple spaces and newlines). I've tried a pre tag bu... |
I am having a problem with FCKeditor reverting html entities entered in the source view back to their original unicode representations.
For example when I enter € into the source view, switch to html and then back to source view, the entity is replaced by an actual € symbol.
The bigger problem, as a result, is t... | This issue with FCKeditor (now known as CKEditor) replacing HTML entities with their corresponding Unicode characters is a common one. It stems from the fact that many WYSIWYG editors are designed to render and display text in a more visually appealing way, which often leads them to convert entities to their Unicode eq... | 22,755 | [
{
"from": "human",
"value": "I am having a problem with FCKeditor reverting html entities entered in the source view back to their original unicode representations. \nFor example when I enter € into the source view, switch to html and then back to source view, the entity is replaced by an actual € symb... |
For some reason, new projects set the version number of the assembly to 1.0.*, which then assigns what appears to be a random number once compiled.
Why is this not set to 1.0.0.0 like all other projects.
Thanks.
| The behavior you're observing with new projects defaulting to a version number of `1.0.*` instead of `1.0.0.0` is due to the way the versioning system works in .NET projects.
When an assembly's version is set to `1.0.*`, the asterisk (`*`) acts as a wildcard. This tells the compiler to automatically generate the buil... | 23,457 | [
{
"from": "human",
"value": "For some reason, new projects set the version number of the assembly to 1.0.*, which then assigns what appears to be a random number once compiled.\nWhy is this not set to 1.0.0.0 like all other projects.\nThanks.\n"
},
{
"from": "gpt",
"value": "The behavior you're ... |
I`m using SQL Server Compact (SQL CE) together with sync framework. However the sync framework creates some system tables when calling the CreateSchema() method of the SqlCeClientSyncProvider (e.g. __sysSyncArticle, __sysSyncSubscription, ...).
I'm not able to delete these tables with SQL statements within Visual Studi... | In SQL Server Compact Edition (SQL CE), certain system tables, especially those created by the Sync Framework, are designed to store internal metadata for synchronization operations. These system tables are essential for the functioning of the Sync Framework, and directly manipulating or deleting them is typically not ... | 24,133 | [
{
"from": "human",
"value": "I`m using SQL Server Compact (SQL CE) together with sync framework. However the sync framework creates some system tables when calling the CreateSchema() method of the SqlCeClientSyncProvider (e.g. __sysSyncArticle, __sysSyncSubscription, ...).\nI'm not able to delete these tabl... |
This is a good candidate for the "Works on My Machine Certification Program".
I have the following code for a LinkButton...
<cc1:PopupDialog ID="pdFamilyPrompt" runat="server" CloseLink="false" Display="true">
<p>Do you wish to upgrade?</p>
<asp:HyperLink ID="hlYes" runat="server" Text="Yes" CssClass="button"></asp... | There are a few potential reasons why your `LinkButton` behaves differently in your local environment versus the development server. Here are some troubleshooting steps and considerations that might help you identify the issue:
### 1. **Validation Group:**
Although you mentioned that the `LinkButton` is not part of an... | 9,890 | [
{
"from": "human",
"value": "This is a good candidate for the \"Works on My Machine Certification Program\".\nI have the following code for a LinkButton...\n<cc1:PopupDialog ID=\"pdFamilyPrompt\" runat=\"server\" CloseLink=\"false\" Display=\"true\">\n <p>Do you wish to upgrade?</p>\n <asp:HyperLink ID=\"... |
I'm using KML and the GGeoXml object to overlay some shapes on an embedded Google map. The placemarks in the KML file have some custom descriptive information that shows up in the balloons.
<Placemark>
<name />
<description>
<![CDATA[
<div class="MapPopup">
<h6>Concession</h6... | When using KML with Google Maps and embedding custom HTML in the `description` tag, there are a few important considerations regarding styling and the way browsers interpret embedded content. Here’s what might be happening in your case:
1. **Limited CSS Support**: The KML popups (info windows) are subject to limitatio... | 19,964 | [
{
"from": "human",
"value": "I'm using KML and the GGeoXml object to overlay some shapes on an embedded Google map. The placemarks in the KML file have some custom descriptive information that shows up in the balloons.\n<Placemark>\n <name />\n <description>\n <![CDATA[\n <div class=... |
Anyone got a ready made function that will take an XML string and return a correctly indented string?
eg
<XML><TAG1>A</TAG1><TAG2><Tag3></Tag3></TAG2></XML>
and will return nicely formatted String in return after inserting linebreaks and tabs or spaces?
| Certainly! If you're looking to format an XML string into a nicely indented structure, you can use Python's `xml.dom.minidom` library, which provides a convenient way to handle XML. Below is a function that takes an XML string and returns a formatted version of it.
Here's the code:
```python
from xml.dom import minid... | 23,437 | [
{
"from": "human",
"value": "Anyone got a ready made function that will take an XML string and return a correctly indented string?\neg\n<XML><TAG1>A</TAG1><TAG2><Tag3></Tag3></TAG2></XML>\n\nand will return nicely formatted String in return after inserting linebreaks and tabs or spaces?\n"
},
{
"fro... |
I am having issues with validators not firing (No expected error messages showing) when using Page.Validate() from code behind. The validators are placed inside an Ajax updatepanel.
It seems there are downloadable Ajax versions of the validators. I am not sure if I need these or if VS 2008 SP1 has them already. When th... | When dealing with ASP.NET validation controls in an `UpdatePanel`, there are a few important points to consider to ensure that client-side validation works correctly when using `Page.Validate()`.
### Key Points to Address:
1. **Validation Group**:
Ensure that all your validators and the control triggering the vali... | 17,278 | [
{
"from": "human",
"value": "I am having issues with validators not firing (No expected error messages showing) when using Page.Validate() from code behind. The validators are placed inside an Ajax updatepanel.\nIt seems there are downloadable Ajax versions of the validators. I am not sure if I need these o... |
Is anyone using or has anyone evaluated OPF3 as an ORM (.NET)? How does it stack up against EntitySpaces or Subsonic?
One thing about OPF3 I like in my evaluation so far is that it is very easy to customize. Since it binds database fields to object members using attributes, you do not need to use any code generation t... | OPF3 (Object-Relational Persistence Framework 3) is an ORM solution for .NET that emphasizes customization and flexibility through the use of attributes for data binding. Your observation about its ease of customization is a significant advantage, especially for developers who prefer to have direct control over their m... | 20,381 | [
{
"from": "human",
"value": "Is anyone using or has anyone evaluated OPF3 as an ORM (.NET)? How does it stack up against EntitySpaces or Subsonic? \nOne thing about OPF3 I like in my evaluation so far is that it is very easy to customize. Since it binds database fields to object members using attributes, yo... |
I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. Pages typically present HTML content. But, some will execute programming.
Examples:
a "contact us" form
a report generator
How should I represent/reference the programming within the database? Should I have a varchar valu... | Creating a database-driven tree hierarchy for your ASP.NET web site is a great way to manage your pages and their relationships. Below, I’ll address how to represent and reference programming logic in your database, along with your site map considerations.
### 1. Representing Programming in the Database
You have a fe... | 20,195 | [
{
"from": "human",
"value": "I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. Pages typically present HTML content. But, some will execute programming.\nExamples: \n\na \"contact us\" form \na report generator\n\nHow should I represent/reference the programming w... |
In the Google C++ Style Guide, the section on Operator Overloading recommends against overloading any operators ("except in rare, special circumstances"). Specifically, it recommends:
In particular, do not overload
operator== or operator< just so that
your class can be used as a key in an
STL container; instead,... | The Google C++ Style Guide's recommendation against overloading operators like `operator==` and `operator<` for the purpose of using your class as a key in STL containers revolves around a few core principles related to clarity, maintainability, and avoiding unintended consequences.
### Why Create Functors Instead of ... | 16,689 | [
{
"from": "human",
"value": "In the Google C++ Style Guide, the section on Operator Overloading recommends against overloading any operators (\"except in rare, special circumstances\"). Specifically, it recommends:\n\nIn particular, do not overload\n operator== or operator< just so that\n your class can b... |
I have a table with multiple rows. Each row is a form. I want to use JQuery to submit all the forms that have the check box checked. The form is posting to an IFrame so there is not much need for AJAX.
So far I have:
$("form").submit();
which submits the form. but all forms. There is arbritary number of rows, c... | To submit only the forms that have their associated checkboxes checked, you can modify your jQuery code to iterate over each form and its corresponding checkbox. You can use the `:checked` selector to select only the checked checkboxes, and then submit their parent forms.
Assuming that your HTML structure looks someth... | 24,320 | [
{
"from": "human",
"value": "I have a table with multiple rows. Each row is a form. I want to use JQuery to submit all the forms that have the check box checked. The form is posting to an IFrame so there is not much need for AJAX.\nSo far I have:\n $(\"form\").submit();\n\nwhich submits the form. but ... |
I'm having trouble with my php code not indenting correctly...
I would like my code to look like this
if (foo)
{
print "i am indented";
}
but it always looks like this:
if (foo)
{
print "i am not indented correctly";
}
I tired googling for similar things and tried adding the following to my .emacs, but it... | It sounds like you're facing issues with the indentation settings for PHP in your Emacs configuration. The indentation behavior you're looking for can often be controlled by adjusting specific settings in your `.emacs` file. Here are a few suggestions that may help you achieve the desired indentation style.
### 1. Adj... | 23,177 | [
{
"from": "human",
"value": "I'm having trouble with my php code not indenting correctly...\nI would like my code to look like this\nif (foo)\n{\n print \"i am indented\";\n}\n\nbut it always looks like this:\nif (foo)\n {\n print \"i am not indented correctly\";\n }\n\nI tired googling for similar ... |
I'm writing a little tile-based game, for which I'd like to support light sources. But my algorithm-fu is too weak, hence I come to you for help.
The situation is like this: There is a tile-based map (held as a 2D array), containing a single light source and several items standing around. I want to calculate which tile... | Certainly! Implementing light sources in a tile-based game can be quite fun. Below, I’ll outline a simple algorithm to determine which tiles are lit by a light source and which are in shadow, along with an extension for a fractional system.
### Basic Approach
1. **Model the Map**: Represent the map as a 2D array, whe... | 18,677 | [
{
"from": "human",
"value": "I'm writing a little tile-based game, for which I'd like to support light sources. But my algorithm-fu is too weak, hence I come to you for help.\nThe situation is like this: There is a tile-based map (held as a 2D array), containing a single light source and several items stand... |
Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003:
System.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)
When NOT running as scheduled task i.e. under a logged in user, as long as the user i... | When you run a scheduled task on Windows Server 2003, it operates under a different security context than a logged-in user, even if the same user account is used. The scheduled task may have more restricted privileges, depending on how it is configured. Here are some factors to consider regarding user privileges for yo... | 22,276 | [
{
"from": "human",
"value": "Does anybody know what user privileges are needed for the following code needs to successfully execute as a scheduled task on Windows Server 2003:\nSystem.Diagnostics.Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)\n\nWhen NOT running as scheduled task i.e. u... |
I'm curious as to what versions of Flash stuff is tested with. How do you manage it across different browsers?
I'm wanting to test things with both swfdec and gnash and hoping maybe there's some way I didn't know about...
| Managing and testing Flash content across different browsers and implementations can indeed be challenging, especially since Adobe Flash Player has been officially discontinued as of December 31, 2020. However, if you are looking to test Flash content using alternative players like **Gnash** and **SWFDec**, here's a ge... | 21,212 | [
{
"from": "human",
"value": "I'm curious as to what versions of Flash stuff is tested with. How do you manage it across different browsers?\nI'm wanting to test things with both swfdec and gnash and hoping maybe there's some way I didn't know about...\n"
},
{
"from": "gpt",
"value": "Managing an... |
I have a ListView in WPF that is databound to a basic table that I pull from the database. The code for the ListView is as follows:
<ListView Canvas.Left="402" Canvas.Top="480" Height="78" ItemsSource="{Binding}" Name="lsvViewEditCardPrint" Width="419">
<ListView.View>
<GridView>
<GridViewColumn Displ... | In WPF, you generally do not handle the data binding in the way that you would with some other frameworks, like ASP.NET Web Forms, where you might use an `OnItemDataBound` event. Instead, the best practice in WPF is to create a view model or a more complex data structure that includes the data you want to display.
To ... | 18,851 | [
{
"from": "human",
"value": "I have a ListView in WPF that is databound to a basic table that I pull from the database. The code for the ListView is as follows:\n<ListView Canvas.Left=\"402\" Canvas.Top=\"480\" Height=\"78\" ItemsSource=\"{Binding}\" Name=\"lsvViewEditCardPrint\" Width=\"419\">\n <ListVie... |
When indenting java code with annotations, vim insists on indenting like this:
@Test
public void ...
I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression but I'm not sure if I can use that together wit... | To achieve the desired indentation of annotations in Java when using Vim, you can indeed modify the behavior of the indentation rules. By default, Vim may indent annotations like `@Test` to a different level than the method definition. Here are a few methods to adjust the indentation behavior:
### Method 1: Adjust `in... | 20,856 | [
{
"from": "human",
"value": "When indenting java code with annotations, vim insists on indenting like this:\n@Test\n public void ...\n\nI want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression bu... |
I need a way to modify a value in a table after a certain amount of time has passed. My current method is as follow:
insert end time for wait period in table
when a user loads a page requesting the value to be changed, check to see if current >= end time
if it is, change the value and remove the end time field, if it... | To improve the efficiency of your current method for modifying a value in a table after a certain amount of time has passed, you could consider the following approaches:
### 1. Database Trigger and Event Scheduler (If Supported)
If your database supports triggers and events (like MySQL), you can create an event that ... | 12,855 | [
{
"from": "human",
"value": "I need a way to modify a value in a table after a certain amount of time has passed. My current method is as follow:\n\ninsert end time for wait period in table\nwhen a user loads a page requesting the value to be changed, check to see if current >= end time\nif it is, change t... |
What are pros and cons of having dedicated application pools over keeping web applications in one default app pool?
| When configuring web applications in a server environment, one of the key decisions is whether to use dedicated application pools for each application or keep multiple applications in a single default application pool. Here are the pros and cons of each approach:
### Pros of Dedicated Application Pools
1. **Isolation... | 22,507 | [
{
"from": "human",
"value": "What are pros and cons of having dedicated application pools over keeping web applications in one default app pool?\n"
},
{
"from": "gpt",
"value": "When configuring web applications in a server environment, one of the key decisions is whether to use dedicated applic... |
I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files. The files are very simple; they just include a directive that looks like this:
url.rewrite-once = ("^/project(.*)$"=>"project/router.php?args=$1")
Unfortunately, I just discovered that I can't simply loop through them, becaus... | To properly manage your `lighttpd.conf` configurations across multiple projects while avoiding the "duplicate config variable" error, you should consolidate your rewrite rules into a single configuration block instead of trying to include multiple directives from different files.
Here's how you can do that:
### 1. U... | 17,332 | [
{
"from": "human",
"value": "I have a bunch of projects in parallel subdirectories that all have etc/lighttpd.conf files. The files are very simple; they just include a directive that looks like this:\nurl.rewrite-once = (\"^/project(.*)$\"=>\"project/router.php?args=$1\")\n\nUnfortunately, I just discover... |
I'm venturing into web programming for the first time and would like a nice way to display a frequency indicator of some data, in the form of a tag cloud.
For example, pretend I have some simple data of three types of pets: Dog, Cat, Monkey.
There are 5 Dogs, 27 Cats and 101 Monkeys.
Given this data, what's the best w... | Creating a tag cloud to visually represent the frequency of different types of pets is a great way to illustrate the data you have. Below is a step-by-step guide on how to implement a simple tag cloud using HTML, CSS, and JavaScript. I will also include a relevant link to a Stack Overflow discussion that covers some co... | 20,043 | [
{
"from": "human",
"value": "I'm venturing into web programming for the first time and would like a nice way to display a frequency indicator of some data, in the form of a tag cloud.\nFor example, pretend I have some simple data of three types of pets: Dog, Cat, Monkey.\nThere are 5 Dogs, 27 Cats and 101 M... |
I have some simple shell scripting tasks that I want to do
For example: Selecting a file in the working directory from a list of the files matching some regular expression.
I know that I can do this sort of thing using standard bash and grep but I would be nice to be able to hack quick scripts that will work in wind... | To write Ruby shell scripts, especially for tasks like selecting files in the current directory based on regular expressions, you'll need to familiarize yourself with several core parts of the Ruby standard library. Below are the key components and some examples that will help you get started.
### Key Ruby Libraries a... | 19,251 | [
{
"from": "human",
"value": "I have some simple shell scripting tasks that I want to do \nFor example: Selecting a file in the working directory from a list of the files matching some regular expression.\nI know that I can do this sort of thing using standard bash and grep but I would be nice to be able t... |
Good morning everyone,
I'm running into an issue using a SharePoint workflow project (C#,
VS 2008) and connecting to a database. Here is my database connection
string:
Data Source=DBSERVER;Initial Catalog=DBNAME;Integrated Security=True;
When I attempt to run the following code I get the following error ...
SqlCo... | Good morning Scott,
The issue you're experiencing is related to how the database connection is being authenticated. When you use `Integrated Security=True` in your connection string, SQL Server is attempting to authenticate the connection using the Windows account of the process that is running the code, which in this... | 23,775 | [
{
"from": "human",
"value": "Good morning everyone, \nI'm running into an issue using a SharePoint workflow project (C#, \nVS 2008) and connecting to a database. Here is my database connection \nstring:\nData Source=DBSERVER;Initial Catalog=DBNAME;Integrated Security=True; \n\nWhen I attempt to run the foll... |
i'm fairly new to NHibernate and although I'm finding tons of infos on NHibernate mapping on the web, I am too silly to find this piece of information.
So the problem is, i've got the following Model:
this is how I'd like it to look. One clean person that has two Address Properties.
In the database I'd like to persis... | It's great to hear that you've found a solution for mapping your `Person` entity with two addresses using NHibernate XML configuration. Just to summarize and provide clarity for others who might face a similar challenge, here's how to do it:
### Model Structure
You want a `Person` class that contains two properties of... | 24,693 | [
{
"from": "human",
"value": "i'm fairly new to NHibernate and although I'm finding tons of infos on NHibernate mapping on the web, I am too silly to find this piece of information.\nSo the problem is, i've got the following Model:\n\nthis is how I'd like it to look. One clean person that has two Address Pro... |
If I grant execute permissions to a role via
GRANT EXECUTE ON [DBO].[MYPROC] TO MY_ROLE
what's the equivalent syntax to remove them?
| To revoke the execute permissions that were granted to a role for a stored procedure in SQL Server, you can use the `REVOKE` statement. The equivalent syntax to remove the execute permissions would be:
```sql
REVOKE EXECUTE ON [DBO].[MYPROC] FROM MY_ROLE;
```
This command will remove the execute permissions for the s... | 26,877 | [
{
"from": "human",
"value": "If I grant execute permissions to a role via\nGRANT EXECUTE ON [DBO].[MYPROC] TO MY_ROLE\n\nwhat's the equivalent syntax to remove them?\n"
},
{
"from": "gpt",
"value": "To revoke the execute permissions that were granted to a role for a stored procedure in SQL Serve... |
If I have the core of a class defined in one file as "public partial" and I wish to create additions to this in another file, what is the difference between defining "public partial" again in my second file or just defining "partial"?
What happens if I define "private partial" in my second file?
| In C#, the `partial` keyword is used to define a class, struct, or interface across multiple files. When you use the `partial` keyword, the compiler combines all parts into a single type when it compiles the application. Here’s what happens in the different scenarios you mentioned:
### 1. Defining `public partial` Aga... | 20,309 | [
{
"from": "human",
"value": "If I have the core of a class defined in one file as \"public partial\" and I wish to create additions to this in another file, what is the difference between defining \"public partial\" again in my second file or just defining \"partial\"?\nWhat happens if I define \"private pa... |
Hi I was looking into Ruby to actionscript 3 bytecode compilers and found a mention of a project called Red Sun but can find very little information on it.
So my Question is ... what tools are available to convert Ruby source into AS3 bytecode
| As of my last update in October 2023, there are several approaches and tools that have been developed to convert Ruby code into ActionScript 3 (AS3) bytecode, but the options may be limited and not as straightforward as for other languages. Here are some approaches you might consider:
1. **Red Sun**: You mentioned Red... | 14,345 | [
{
"from": "human",
"value": "Hi I was looking into Ruby to actionscript 3 bytecode compilers and found a mention of a project called Red Sun but can find very little information on it. \nSo my Question is ... what tools are available to convert Ruby source into AS3 bytecode\n"
},
{
"from": "gpt",
... |
I am curious if anyone has done a comparison between the different options out there. So far I am leaning towards using Moo.fx because loading prototype.js just to use scriptaculous seems a bit much. Does that make sense? Are there any other effects libraries worth trying? Thanks.
| Your consideration of Moo.fx is a valid one, especially if you're looking for a lightweight alternative for creating effects without the overhead of loading larger libraries like Prototype.js. Moo.fx offers a simpler, more minimalistic approach to effects and animations.
If you're exploring other options, here are a f... | 22,659 | [
{
"from": "human",
"value": "I am curious if anyone has done a comparison between the different options out there. So far I am leaning towards using Moo.fx because loading prototype.js just to use scriptaculous seems a bit much. Does that make sense? Are there any other effects libraries worth trying? Thank... |
I have a list of times in a database column (representing visits to a website).
I need to group them in intervals and then get a 'cumulative frequency' table of those dates.
For instance I might have:
9:01
9:04
9:11
9:13
9:22
9:24
9:28
and i want to convert that into
9:05 - 2
9:15 - 4
9:25 - 6
9:30 - 7
How can I do t... | You can achieve this in SQL, though the method to do so will depend on the specific SQL database you are using (e.g., MySQL, PostgreSQL, SQL Server, etc.). Below, I'll outline a general approach that can be adapted for most SQL databases.
### Step-by-Step Approach
1. **Create a table with your times.**
2. **Define th... | 20,836 | [
{
"from": "human",
"value": "I have a list of times in a database column (representing visits to a website).\nI need to group them in intervals and then get a 'cumulative frequency' table of those dates.\nFor instance I might have:\n9:01\n9:04\n9:11\n9:13\n9:22\n9:24\n9:28\n\nand i want to convert that into... |
I'd like to make a click event fire on an <input type="file"> tag programmatically.
Just calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog.
I've been experimenting with capturing events using listeners and redirecting the event, but I haven't been able to get that to actu... | To programmatically trigger a file selection dialog using an `<input type="file">` element, you typically should be able to call the `click()` method on the input element, and this should prompt the user to select files. If it's not working, there are a few considerations:
1. **User Interaction Required**: Modern brow... | 23,066 | [
{
"from": "human",
"value": "I'd like to make a click event fire on an <input type=\"file\"> tag programmatically.\nJust calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog.\nI've been experimenting with capturing events using listeners and redirecting the event... |
I am designing a crawler which will get certain content from a webpage (using either string manipulation or regex).
I'm able to get the contents of the webpage as a response stream (using the whole httpwebrequest thing), and then for testing/dev purposes, I write the stream content to a multi-line textbox in my ASP.NET... | Yes, you can definitely achieve what you're looking for, both by using a multi-line textbox in ASP.NET and by writing to a file. Here’s how you can approach both methods, along with handling the formatting issues.
### Method 1: Using a Multi-line TextBox
In ASP.NET, if you want to work with a multi-line TextBox and c... | 23,864 | [
{
"from": "human",
"value": "I am designing a crawler which will get certain content from a webpage (using either string manipulation or regex).\nI'm able to get the contents of the webpage as a response stream (using the whole httpwebrequest thing), and then for testing/dev purposes, I write the stream con... |
What's the best way to pipe the output from an java.io.OutputStream to a String in Java?
Say I have the method:
writeToStream(Object o, OutputStream out)
Which writes certain data from the object to the given stream. However, I want to get this output into a String as easily as possible.
I'm considering writing a cl... | Your approach using a custom `OutputStream` subclass is a valid way to capture the output into a `String`. However, there are a few improvements and considerations to make it more robust and efficient.
1. **Initialize the StringBuilder:** Make sure to initialize the `StringBuilder` in the constructor.
2. **Handle mult... | 21,914 | [
{
"from": "human",
"value": "What's the best way to pipe the output from an java.io.OutputStream to a String in Java?\nSay I have the method:\n writeToStream(Object o, OutputStream out)\n\nWhich writes certain data from the object to the given stream. However, I want to get this output into a String as eas... |
When working on developing new software i normally get stuck with the redundancy vs dependencies problem. That is, to either accept a 3rd party library that i have a huge dependencies to or code it myself duplicate all the effect but reduce the dependencies.
Though I've recently been trying to come up with a metric way... | When evaluating the trade-offs between code redundancy and dependencies, it's essential to have a systematic approach that quantifies both aspects. Here are some metrics and considerations that can help in making a decision:
### Metrics to Evaluate Dependencies
1. **Dependency Count**: Count the number of direct and ... | 18,061 | [
{
"from": "human",
"value": "When working on developing new software i normally get stuck with the redundancy vs dependencies problem. That is, to either accept a 3rd party library that i have a huge dependencies to or code it myself duplicate all the effect but reduce the dependencies.\nThough I've recentl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.