instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
What are the best/most popular ways to do aspect-oriented programming (AOP) in C#/.Net?
| Aspect-Oriented Programming (AOP) is a programming paradigm that allows you to separate cross-cutting concerns (like logging, security, transactions, etc.) from the main business logic of your application. In C#/.NET, there are several popular ways to implement AOP:
### 1. **PostSharp**
- **Description**: PostSharp is... | 14,923 | [
{
"from": "human",
"value": "What are the best/most popular ways to do aspect-oriented programming (AOP) in C#/.Net?\n"
},
{
"from": "gpt",
"value": "Aspect-Oriented Programming (AOP) is a programming paradigm that allows you to separate cross-cutting concerns (like logging, security, transactio... |
Sometimes my c++ program crashes in debug mode, and what I got is a message box saying that an assertion failed in some of the internal memory management routines (accessing unallocated memory etc.). But I don't know where that was called from, because I didn't get any stack trace. How do I get a stack trace or at leas... | When your C++ program crashes with an assertion failure, especially in debug mode, it typically indicates that there's a problem in your code, such as accessing invalid memory. To get more insight into the issue and obtain a stack trace, you can follow these steps:
### 1. Enable Debugging Symbols
Make sure that you ar... | 12,341 | [
{
"from": "human",
"value": "Sometimes my c++ program crashes in debug mode, and what I got is a message box saying that an assertion failed in some of the internal memory management routines (accessing unallocated memory etc.). But I don't know where that was called from, because I didn't get any stack tra... |
I need your advice regarding migration. I want to migrate existing project to ASP.NET MVC and I can figure out the proccess except of url rewriting issue:
for example how can I make following route:
http://www.eireads.com/ireland/mayo/cars-3/1263-used-cars-citroen-c5-for-sale.aspx
Or maybe I could somehow keep support... | Migrating to ASP.NET MVC from an existing system can be a great move, as it provides a more structured and manageable way to build web applications. When it comes to handling URL rewriting, you have a few options, especially since you want to maintain legacy URLs while implementing new routes. Here’s how you can approa... | 15,155 | [
{
"from": "human",
"value": "I need your advice regarding migration. I want to migrate existing project to ASP.NET MVC and I can figure out the proccess except of url rewriting issue:\nfor example how can I make following route: \nhttp://www.eireads.com/ireland/mayo/cars-3/1263-used-cars-citroen-c5-for-sale... |
I have an object of class F. I want to output the contents of the object using Console.WriteLine for quick and dirty status updates like this:
Console.WriteLine(objectF);
This prints out only the name of the class to the console:
F
I want to overload this somehow so that I can instead print out some useful informatio... | You can achieve the desired behavior by overriding the `ToString` method in your class `F`, as you've already mentioned. This is the standard way to customize the string representation of an object in C#. When you call `Console.WriteLine(objectF);`, the `ToString` method will automatically be invoked, so there's no nee... | 17,146 | [
{
"from": "human",
"value": "I have an object of class F. I want to output the contents of the object using Console.WriteLine for quick and dirty status updates like this:\nConsole.WriteLine(objectF);\nThis prints out only the name of the class to the console:\nF\n\nI want to overload this somehow so that ... |
We are currently evaluating different applications that interface with Visual Studio 2008 (C#) and Subversion to do automated builds of our core libraries. We are hoping to have nightly builds performed and either email the list of changes made to each developer or have the latest versions be pushed to each workstatio... | When evaluating tools for automated builds, especially in conjunction with Visual Studio 2008 (C#) and Subversion (SVN), it’s essential to consider the specific requirements of your development environment, team size, and workflow preferences. Here’s a breakdown of the suggested tools and their fit for your scenario, a... | 15,383 | [
{
"from": "human",
"value": "We are currently evaluating different applications that interface with Visual Studio 2008 (C#) and Subversion to do automated builds of our core libraries. We are hoping to have nightly builds performed and either email the list of changes made to each developer or have the lat... |
I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs.
So far I have something like this:
start "~\iexplore.exe" "url1"
start "~\iexplore.exe" "url2"
What I get is one instance of Internet Explor... | To launch two separate instances of Internet Explorer with different URLs from a batch file, and to ensure that the command line window closes automatically after executing the commands, you can use the following syntax:
```batch
@echo off
start "IE1" "C:\Program Files\Internet Explorer\iexplore.exe" "http://url1"
sta... | 17,326 | [
{
"from": "human",
"value": "I would like a batch file to launch two separate programs then have the command line window close. Actually, to clarify, I am launching Internet Explorer with two different URLs.\nSo far I have something like this:\nstart \"~\\iexplore.exe\" \"url1\"\nstart \"~\\iexplore.exe\" \... |
I have a self-signed root certificate with just the code signing extension (no other extensions) in my Mac keychain; I use it to sign all code coming out of ∞labs using Apple's codesign tool and it works great.
I was looking to expand myself a little and doing some Java development. I know Apple provides a KeyStore imp... | The issue you're encountering is likely because the `jarsigner` tool requires a private key along with the corresponding public key certificate chain to sign the JAR file. The fact that your self-signed root certificate is only used for code signing (without a private key associated with it) means that you cannot use i... | 16,033 | [
{
"from": "human",
"value": "I have a self-signed root certificate with just the code signing extension (no other extensions) in my Mac keychain; I use it to sign all code coming out of ∞labs using Apple's codesign tool and it works great.\nI was looking to expand myself a little and doing some Java develop... |
This error seems to just pop up now and again. It is not restricted to a single table and even happens on tables it just created. Anybody else see this weird behavior?
[Edit w/solution] It turns out that this query is used to determine if the table exists. Apparently it is much quicker to query an invalid column tha... | It sounds like you're experiencing an intermittent issue where you're trying to determine if a table exists in your SQL database, and running a query on a potentially invalid column leads to errors. This can happen if you're using a query that references a column that doesn't exist, which would cause an error if that t... | 16,577 | [
{
"from": "human",
"value": "This error seems to just pop up now and again. It is not restricted to a single table and even happens on tables it just created. Anybody else see this weird behavior?\n[Edit w/solution] It turns out that this query is used to determine if the table exists. Apparently it is m... |
What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated)
| You can determine the length of an MP3 file using Python's built-in functionality without relying on external libraries. One way to achieve this is by reading the MP3 file's frames and extracting timing information from the headers.
Here’s a simple way to calculate the duration by reading the MP3 headers and summing t... | 14,050 | [
{
"from": "human",
"value": "What is the simplest way to determine the length (in seconds) of a given mp3 file, without using outside libraries? (python source highly appreciated)\n"
},
{
"from": "gpt",
"value": "You can determine the length of an MP3 file using Python's built-in functionality w... |
My question is possibly a subtle one:
Web services - are they extensions of the presentation/web layer? ..or are they extensions of the biz/data layer?
That may seem like a dumb question. Web services are an extension of the web tier. I'm not so sure though. I'm building a pretty standard webform with some AJAX-y fe... | Your question touches on an important architectural consideration in web application design. The role of web services can indeed vary depending on how they are implemented and the specific requirements of the application. Let's explore both perspectives:
### Web Services as an Extension of the Business/Data Layer
Whe... | 11,866 | [
{
"from": "human",
"value": "My question is possibly a subtle one:\nWeb services - are they extensions of the presentation/web layer? ..or are they extensions of the biz/data layer?\nThat may seem like a dumb question. Web services are an extension of the web tier. I'm not so sure though. I'm building a ... |
Several years back, I innocently tried to write a little app to save my tactically placed desktop icons because I was sick of dragging them back to their locations when some event reset them. I gave up after buring WAY too much time having failed to find a way to query, much less save and reset, my icons' desktop posi... | Hi Richard,
The issue you experienced with desktop icons moving around is a common frustration for many users. Unfortunately, Windows does not provide a straightforward API to query or manipulate the position of desktop icons directly. However, there are some approaches you can consider to work around this limitation.... | 17,250 | [
{
"from": "human",
"value": "Several years back, I innocently tried to write a little app to save my tactically placed desktop icons because I was sick of dragging them back to their locations when some event reset them. I gave up after buring WAY too much time having failed to find a way to query, much le... |
We are creating a Windows Form application (C# or VB.NET) that needs to reference an Office 2003 or Office 2007 COM object, depending on the version of office installed. What is the best way to handle this scenario and reference the correct COM object at runtime?
| When you are developing a Windows Forms application in C# or VB.NET that needs to work with different versions of Office (e.g., Office 2003 and Office 2007), it is important to handle the references to COM objects dynamically at runtime. This approach allows your application to function correctly regardless of which ve... | 13,894 | [
{
"from": "human",
"value": "We are creating a Windows Form application (C# or VB.NET) that needs to reference an Office 2003 or Office 2007 COM object, depending on the version of office installed. What is the best way to handle this scenario and reference the correct COM object at runtime?\n"
},
{
... |
I'm looking for a way to obtain offsets of data members of a C++ class which is of non-POD nature.
Here's why:
I'd like to store data in HDF5 format, which seems most suited for my kind of material (numerical simulation output), but it is perhaps a rather C-oriented library. I want to use it through the C++ interface,... | To solve the issue of obtaining the offsets of data members of a non-POD (Plain Old Data) C++ class for use with the HDF5 library, you can consider the following options:
### 1. Use a POD Structure for Serialization
Even though you want to avoid copying data, creating a separate POD structure for serialization is a c... | 16,943 | [
{
"from": "human",
"value": "I'm looking for a way to obtain offsets of data members of a C++ class which is of non-POD nature.\nHere's why: \nI'd like to store data in HDF5 format, which seems most suited for my kind of material (numerical simulation output), but it is perhaps a rather C-oriented library. ... |
I am writing a C# control that wraps DirectX 9 and provides a simplified interface to perform 2D pixel level drawing. .NET requires that I wrap this code in an unsafe code block and compile with the allow unsafe code option.
I'm locking the entire surface which then returns a pointer to the locked area of memory. I can... | If your primary goal is high-performance 2D pixel manipulation in a C# application, using unsafe code and pointers for direct pixel access is indeed one of the fastest approaches. However, there are a few alternatives and optimizations that you might consider, which could provide a balance between performance and safet... | 13,514 | [
{
"from": "human",
"value": "I am writing a C# control that wraps DirectX 9 and provides a simplified interface to perform 2D pixel level drawing. .NET requires that I wrap this code in an unsafe code block and compile with the allow unsafe code option.\nI'm locking the entire surface which then returns a p... |
Is there a way to tell if an event handler has been added to an object? I'm serializing a list of objects into/out of session state so we can use SQL based session state... When an object in the list has a property changed it needs to be flagged, which the event handler took care of properly before. However now when ... | Yes, you can determine if an event handler has already been added to an event in C#. The typical way to do this involves using reflection to access the event's underlying delegate, allowing you to check if your specific event handler is already in the invocation list.
Here's how you can achieve that:
1. **Define your... | 18,080 | [
{
"from": "human",
"value": "Is there a way to tell if an event handler has been added to an object? I'm serializing a list of objects into/out of session state so we can use SQL based session state... When an object in the list has a property changed it needs to be flagged, which the event handler took ca... |
I have been tasked with coming up with a compatibility guide for SharePoint 2007 comparing Office 2003 and Office 2007. Does anyone know where to find such a list?
I have been searching for awhile but I cannot seem to find a comprehensive list.
Thanks :)
| Creating a compatibility guide for SharePoint 2007 in relation to Office 2003 and Office 2007 can be quite useful, especially since there were significant changes between these two versions of Office. Here’s a summary of the compatibility aspects you might want to consider:
### Compatibility Overview
1. **File Format... | 16,271 | [
{
"from": "human",
"value": "I have been tasked with coming up with a compatibility guide for SharePoint 2007 comparing Office 2003 and Office 2007. Does anyone know where to find such a list?\nI have been searching for awhile but I cannot seem to find a comprehensive list.\nThanks :)\n"
},
{
"from"... |
Is there an app or way to browse a directory that requires different login credentials without using a mapped drive?
The issue is given one login credential Windows Explorer only allows you to map it to one drive and disallows using the same login credential to map to a different drive.
| Yes, there are ways to access network directories that require different login credentials without mapping them to network drives. Here are a few methods you can try:
### 1. Use the Command Prompt
You can use the Command Prompt to access a shared folder with different credentials. You can do this by using the `net use... | 15,267 | [
{
"from": "human",
"value": "Is there an app or way to browse a directory that requires different login credentials without using a mapped drive? \nThe issue is given one login credential Windows Explorer only allows you to map it to one drive and disallows using the same login credential to map to a diffe... |
Ok sorry this might seem like a dumb question but I cannot figure this thing out :
I am trying to parse a string and simply want to check whether it only contains the following characters : '0123456789dD+ '
I have tried many things but just can't get to figure out the right regex to use!
Regex oReg = new Regex(@"[\d... | It's not a silly question at all! Regex can be a bit tricky sometimes. The issue you're encountering is that the regex pattern you've written will match any string that contains at least one of the allowed characters, which is why `"e4"` returns true.
To ensure that the entire string only contains the allowed characte... | 18,003 | [
{
"from": "human",
"value": "Ok sorry this might seem like a dumb question but I cannot figure this thing out :\nI am trying to parse a string and simply want to check whether it only contains the following characters : '0123456789dD+ '\nI have tried many things but just can't get to figure out the right re... |
My normal work flow to create a new repository with subversion is to create a new repos, do a checkout of the repos root, create my branches tags and trunk folders and place in the trunk my initial files. Then I do a commit of this "initial import", delete the checked out repos from my hard drive and do a checkout of t... | Yes, you can streamline the process of committing a large initial import to a Subversion repository and avoid the need to perform a second checkout of the trunk. Here's a step-by-step method to achieve that:
### 1. Create a Local Working Copy
Instead of deleting your local working copy after the initial commit, you ca... | 16,077 | [
{
"from": "human",
"value": "My normal work flow to create a new repository with subversion is to create a new repos, do a checkout of the repos root, create my branches tags and trunk folders and place in the trunk my initial files. Then I do a commit of this \"initial import\", delete the checked out repo... |
when putting a ScrollViewer inside a window(not keeping all the window's size)
inside the ScrollViewer there's (with other stuff) a WinFormsHost and a control inside (let's say a DateTimePicker). when scrolling, the inner winforms control keeps being visible when there's no longer a reason (it's outside of the scrollin... | This behavior occurs because the `WinFormsHost` does not integrate with the WPF rendering system in the same way that native WPF controls do. When you scroll the `ScrollViewer`, WPF correctly clips its contained WPF elements, but the WinForms control is rendered on a separate surface, which does not get clipped in the ... | 16,722 | [
{
"from": "human",
"value": "when putting a ScrollViewer inside a window(not keeping all the window's size)\ninside the ScrollViewer there's (with other stuff) a WinFormsHost and a control inside (let's say a DateTimePicker). when scrolling, the inner winforms control keeps being visible when there's no lon... |
Is there a way to find out what gcc flags a particular binary was compiled with?
| Yes, there are a few methods you can use to infer the GCC flags that were used to compile a particular binary, but it's important to note that you cannot directly extract the exact flags from a binary. Instead, you can use the following techniques to get some hints:
1. **Using `readelf` or `objdump`:** You can inspect... | 17,780 | [
{
"from": "human",
"value": "Is there a way to find out what gcc flags a particular binary was compiled with?\n"
},
{
"from": "gpt",
"value": "Yes, there are a few methods you can use to infer the GCC flags that were used to compile a particular binary, but it's important to note that you cannot... |
I'm a contract programmer with lots of experience. I'm used to being hired by a client to go in and do a software project of one form or another on my own, usually from nothing. That means a clean slate, almost every time. I can bring in libraries I've developed to get a quick start, but they're always optional. (an... | Your situation as an experienced contract programmer certainly gives you a unique perspective on software development, particularly concerning test-driven development (TDD). While you have valid points about the challenges of adopting TDD in a solo or small-team context, there are several reasons why some developers, i... | 13,483 | [
{
"from": "human",
"value": "I'm a contract programmer with lots of experience. I'm used to being hired by a client to go in and do a software project of one form or another on my own, usually from nothing. That means a clean slate, almost every time. I can bring in libraries I've developed to get a quic... |
I have a function that is declared and defined in a header file. This is a problem all by itself. When that function is not inlined, every translation unit that uses that header gets a copy of the function, and when they are linked together there are duplicated.
I've "fixed" that by making the function inline, but I'm ... | You're correct that having a function defined in a header file can lead to multiple definitions of that function across different translation units if the function is not marked as `inline`. When you declare a function as `inline`, it suggests to the compiler that it should consider inlining it, but as you noted, the c... | 17,811 | [
{
"from": "human",
"value": "I have a function that is declared and defined in a header file. This is a problem all by itself. When that function is not inlined, every translation unit that uses that header gets a copy of the function, and when they are linked together there are duplicated.\nI've \"fixed\" ... |
I want to copy text files and only text files from src/ to dst/
groovy:000> "cp src/*.txt dst/".execute().text
===>
groovy:000>
You can see the command executes w/out error but the file src/test.txt does not get copied to dst/
This also fails:
groovy:000> "cp src/* dst/".execute().text
===>
groovy:... | The issue you're facing is related to how the shell command execution works in Groovy. When you run the command with wildcards (`*`), the Groovy `execute()` method does not expand those wildcards as a shell would. Instead, it passes the command exactly as you wrote it to the system, and the system does not perform the ... | 16,442 | [
{
"from": "human",
"value": "I want to copy text files and only text files from src/ to dst/\n\ngroovy:000> \"cp src/*.txt dst/\".execute().text \n===> \ngroovy:000> \n\nYou can see the command executes w/out error but the file src/test.txt does not get copied to dst/\nThis also fails: \n\ngroovy:000>... |
Can you package up the .Net framework in an installer created in Visual Studio? If so how?
I've seen this done with Install4J packaging a JVM but I think that was the JVM to run Install4J.
| Yes, you can package the .NET Framework with your application in an installer created using Visual Studio. This can be accomplished using various installer projects in Visual Studio, such as using the Visual Studio Installer Projects extension, WiX Toolset, or other third-party installer tools. Here’s a general approac... | 15,440 | [
{
"from": "human",
"value": "Can you package up the .Net framework in an installer created in Visual Studio? If so how?\nI've seen this done with Install4J packaging a JVM but I think that was the JVM to run Install4J.\n"
},
{
"from": "gpt",
"value": "Yes, you can package the .NET Framework with... |
Let's say I'm writing a Library application for a publishing company who already has a People application.
So in my Library application I have
class Person < ActiveResource::Base
self.site = "http://api.people.mypublisher.com/"
end
and now I want to store Articles for each Person:
class Article < ActiveRecord::Base... | You're in an interesting scenario where you're trying to combine an `ActiveResource` object (`Person`) with an `ActiveRecord` object (`Article`) without a direct database-backed relationship between the two. Here are some suggestions to address your questions.
### 1. Establishing the Relationship:
Even though the `Pe... | 16,682 | [
{
"from": "human",
"value": "Let's say I'm writing a Library application for a publishing company who already has a People application.\nSo in my Library application I have\nclass Person < ActiveResource::Base\n self.site = \"http://api.people.mypublisher.com/\"\nend\n\nand now I want to store Articles for... |
What features of C++ should be avoided in embedded systems?
Please classify the answer by reason such as:
memory usage
code size
speed
portability
EDIT: Lets' use an ARM7TDMI with 64k ram as a target to control the scope of the answers.
| When programming for embedded systems, particularly for microcontrollers like the ARM7TDMI with only 64KB of RAM, certain features of C++ should be avoided due to various limitations. Below is a classification of these features based on reasons such as memory usage, code size, speed, and portability.
### 1. Memory Usa... | 17,222 | [
{
"from": "human",
"value": "What features of C++ should be avoided in embedded systems?\nPlease classify the answer by reason such as:\n\nmemory usage \ncode size\nspeed\nportability\n\nEDIT: Lets' use an ARM7TDMI with 64k ram as a target to control the scope of the answers.\n"
},
{
"from": "gpt",... |
First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one.
If, for example, I see a cool Perl module, I have to try it out. If I see a nice Python app, I hav... | Choosing a single language to master for tool writing and exploit development, especially given your background and interests, can certainly enhance your productivity and depth of knowledge in that area. Here's a breakdown of the three languages you've mentioned—Perl, Python, and Ruby—considering their strengths in the... | 9,163 | [
{
"from": "human",
"value": "First of all, I want to avoid a flame-war on languages. The languages to choose from are Perl, Python and Ruby . I want to mention that I'm comfortable with all of them, but the problem is that I can't focus just on one. \nIf, for example, I see a cool Perl module, I have to try... |
I'm trying to figure out how to decide when to use NSDictionary or NSCoder/NSCoding?
It seems that for general property lists and such that NSDictionary is the easy way to go that generates XML files that are easily editable outside of the application.
When dealing with custom classes that holds data or possibly other ... | You're on the right track with your understanding of when to use `NSDictionary` versus `NSCoder`/`NSCoding`. Let's break it down a bit further and address your considerations, including some additional insights.
### `NSDictionary`
- **Use Case**: `NSDictionary` is great for representing simple key-value pairs, espec... | 15,724 | [
{
"from": "human",
"value": "I'm trying to figure out how to decide when to use NSDictionary or NSCoder/NSCoding?\nIt seems that for general property lists and such that NSDictionary is the easy way to go that generates XML files that are easily editable outside of the application.\nWhen dealing with custom... |
I have gone through their developer guide but haven't been able to find a way to print the value at points (in case of line charts) or after bars (bar charts).Is there a way to do it?
| To display values on line charts and bar charts, the method to achieve this usually depends on the charting library you are using. Here are some common approaches for popular JavaScript chart libraries:
### Chart.js
If you are using Chart.js, you can display values on your chart using the `chartjs-plugin-datalabels` p... | 16,119 | [
{
"from": "human",
"value": "I have gone through their developer guide but haven't been able to find a way to print the value at points (in case of line charts) or after bars (bar charts).Is there a way to do it?\n"
},
{
"from": "gpt",
"value": "To display values on line charts and bar charts, t... |
I use a MacBook, but I've got a usual keyboard attached to it.
The problem is that the keys don't exactly map 1-to-1. One thing is the APPLE and ALT keys. They map to WIN and ALT, but they are usually physically inverted, so if you want to use them with the same layout you have to invert them in the OS.
The Function ke... | It sounds like you've made significant progress in configuring your MacBook to work smoothly with your external keyboard. Remapping modifier keys for different keyboards is a helpful feature and can greatly improve your workflow.
For anyone else facing similar issues, here’s a summary of tips and methods to manage key... | 18,418 | [
{
"from": "human",
"value": "I use a MacBook, but I've got a usual keyboard attached to it.\nThe problem is that the keys don't exactly map 1-to-1. One thing is the APPLE and ALT keys. They map to WIN and ALT, but they are usually physically inverted, so if you want to use them with the same layout you have... |
I am running a mysql server. I would like to somehow make sure that the whole DB is loaded into the ram as I heard it would be alot faster.
Is this true? and how do I vertify it?
| Loading a MySQL database into RAM can significantly improve performance, particularly for read-heavy workloads. However, the entire database being loaded into RAM is not strictly necessary or practical for most applications, especially with larger databases that exceed available memory. Instead, MySQL utilizes caching ... | 12,198 | [
{
"from": "human",
"value": "I am running a mysql server. I would like to somehow make sure that the whole DB is loaded into the ram as I heard it would be alot faster.\nIs this true? and how do I vertify it?\n"
},
{
"from": "gpt",
"value": "Loading a MySQL database into RAM can significantly im... |
I'm firing off a Java application from inside of a C# .NET console application. It works fine for the case where the Java application doesn't care what the "default" directory is, but fails for a Java application that only searches the current directory for support files.
Is there a process parameter that can be set to... | Yes, when you start a new process in a C# .NET application using the `System.Diagnostics.Process` class, you can specify the working directory for that process. This can be useful if your Java application looks for files in the current directory.
To set the working directory for the process, you can use the `ProcessSt... | 13,758 | [
{
"from": "human",
"value": "I'm firing off a Java application from inside of a C# .NET console application. It works fine for the case where the Java application doesn't care what the \"default\" directory is, but fails for a Java application that only searches the current directory for support files.\nIs ... |
If you want to develop against WordPress (i.e., have a local instance running on your machine so you can develop themes, get blogs and sites laid out, etc.) and you're running Windows on your development machine with IIS and SQL Server already installed, what's the best way to do it?
I found a method online which sets ... | To develop against WordPress on a Windows machine running IIS (Internet Information Services) and SQL Server, you can follow these guidelines. Here are the key points to set up a WordPress development environment:
### Using IIS and PHP
1. **Install PHP on IIS**:
- You can install PHP using the Microsoft Web Platfo... | 15,646 | [
{
"from": "human",
"value": "If you want to develop against WordPress (i.e., have a local instance running on your machine so you can develop themes, get blogs and sites laid out, etc.) and you're running Windows on your development machine with IIS and SQL Server already installed, what's the best way to d... |
I have this working definition:
IDENTIFIER [a-zA-Z][a-zA-Z0-9]*
I don't want to keep repeating the [a-zA-Z] and [0-9], so I made two new definitions
DIGIT [0-9]
VALID [a-zA-Z]
How can I rewrite the IDENTIFIER rule to use the DIGIT and VALID definitions?
I don't know how to do the "second" match, I'm stuck her... | You can rewrite your `IDENTIFIER` rule to use the `VALID` and `DIGIT` definitions by making use of grouping and concatenation in the proper syntax. Since `IDENTIFIER` should start with a `VALID` character followed by any combination of `VALID` characters and `DIGIT`s, you can write it like this:
```plaintext
IDENTIFIE... | 18,394 | [
{
"from": "human",
"value": "I have this working definition:\nIDENTIFIER [a-zA-Z][a-zA-Z0-9]*\n\nI don't want to keep repeating the [a-zA-Z] and [0-9], so I made two new definitions\nDIGIT [0-9]\nVALID [a-zA-Z]\n\nHow can I rewrite the IDENTIFIER rule to use the DIGIT and VALID definitions?\nI don't... |
I have a large amount of audio stored on my web server in a very custom format that can't be replayed by anything other than my own application. That application is a Win32 app that can connect to my web server and stream and replay that audio.
I'd really like to be able to do the streaming and replaying from within... | You have a few options for streaming and replaying your custom audio format in a cross-platform, cross-browser environment. Here are some potential approaches you might consider:
### 1. **WebAssembly and JavaScript:**
You could write a decoder for your custom audio format in a language like C or C++ and compile it to ... | 14,318 | [
{
"from": "human",
"value": "I have a large amount of audio stored on my web server in a very custom format that can't be replayed by anything other than my own application. That application is a Win32 app that can connect to my web server and stream and replay that audio. \nI'd really like to be able to ... |
From the Apple developer faq
Safari ships with a conservative
cookie policy which limits cookie
writes to only the pages chosen
("navigated to") by the user.
By default Safari only allows cookies from sites you navigate to directly. (i.e. if you click on links with the url of that domainname).
This means that i... | To create a seamless user experience while navigating between your site and a third-party site in an iframe, given Safari's cookie restrictions, here are some strategies you can implement using the `postMessage` API along with some JavaScript:
### Steps to Implement
1. **Detect Cookie Availability**:
Unfortunately... | 15,519 | [
{
"from": "human",
"value": "From the Apple developer faq\n\nSafari ships with a conservative\n cookie policy which limits cookie\n writes to only the pages chosen\n (\"navigated to\") by the user.\n\nBy default Safari only allows cookies from sites you navigate to directly. (i.e. if you click on links w... |
Why is NodeList undefined in IE6/7?
<form action="/" method="post" id="testform">
<input type="checkbox" name="foobar[]" value="1" id="" />
<input type="checkbox" name="foobar[]" value="2" id="" />
<input type="checkbox" name="foobar[]" value="3" id="" />
</form>
<script type="text/javascript" charset=... | In IE6 and IE7, the way that form elements are accessed differs from more modern browsers. Specifically, the collection returned when accessing form elements by their name is not an instance of `NodeList`. Instead, it returns an array-like object that contains the form elements with that name.
In your case, when you a... | 17,467 | [
{
"from": "human",
"value": "Why is NodeList undefined in IE6/7?\n<form action=\"/\" method=\"post\" id=\"testform\">\n <input type=\"checkbox\" name=\"foobar[]\" value=\"1\" id=\"\" />\n <input type=\"checkbox\" name=\"foobar[]\" value=\"2\" id=\"\" />\n <input type=\"checkbox\" name=\"foobar[]\" ... |
I am working on a build system. The build system posts the results as a zip file in a directory. Unfortunately I have no easy way to know the name of the zip file, because it is timestamped. For the next operation, I must decompress this zip file to some specific location and then do some more file operations.
I gue... | You can achieve this using a combination of shell commands to identify the newest zip file in a directory and then unzip it. Below are examples for different environments:
### Bash (Linux/Mac)
You can use the following command in a bash script:
```bash
unzip "$(ls -t /path/to/directory/*.zip | head -n 1)" -d /path/t... | 18,322 | [
{
"from": "human",
"value": "I am working on a build system. The build system posts the results as a zip file in a directory. Unfortunately I have no easy way to know the name of the zip file, because it is timestamped. For the next operation, I must decompress this zip file to some specific location and... |
grant {
permission java.security.AllPermission;
};
This works.
grant file:///- {
permission java.security.AllPermission;
};
This does not work. Could someone please explain to me why?
| The distinction between the two `grant` statements you've provided relates to how Java's security policy works, particularly regarding the use of code source locations in policy files.
1. **First Statement**:
```java
grant {
permission java.security.AllPermission;
};
```
This grants `AllPermissio... | 17,188 | [
{
"from": "human",
"value": "grant {\n permission java.security.AllPermission;\n};\n\nThis works.\ngrant file:///- {\n permission java.security.AllPermission;\n};\n\nThis does not work. Could someone please explain to me why?\n"
},
{
"from": "gpt",
"value": "The distinction between the tw... |
I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great.
When you are panning in this way and you are release, the page stops dead where you dropped it.
I'd like it to continue slightly with some momentum, and stop eventually. Rather like the 'throw' in the iPhone UI, I guess.
I'm no... | To achieve a "throw" effect with momentum when panning, you can implement a simple inertia-based scrolling mechanism. This involves tracking the user's finger movement speed when they stop dragging and then applying that speed to continue scrolling for a short period before decelerating to a stop.
Here's a basic outli... | 12,045 | [
{
"from": "human",
"value": "I have a page in my desktop app, and I've implemented simple grab-and-pan. It works great.\nWhen you are panning in this way and you are release, the page stops dead where you dropped it.\nI'd like it to continue slightly with some momentum, and stop eventually. Rather like th... |
Our installer is written with Inno Setup and we are actually quite happy with it. Yet some customers keep asking for an MSI installer which they could more easily distribute via Active Directory. We have already gone to some lengths to make the installer deal really well with automated and unattended installations by e... | Wrapping your Inno Setup installer inside an MSI using WiX can be a feasible approach to address your customers' needs, but it comes with some considerations. Here's a breakdown of the pros and cons, and how you might implement it.
### Pros of Wrapping Inno Setup in MSI
1. **Active Directory Compatibility**: Creating... | 15,565 | [
{
"from": "human",
"value": "Our installer is written with Inno Setup and we are actually quite happy with it. Yet some customers keep asking for an MSI installer which they could more easily distribute via Active Directory. We have already gone to some lengths to make the installer deal really well with au... |
What are the best free resources for learning advanced batch-file usage?
| Learning advanced batch file scripting can enhance your automation capabilities in Windows. Here are some of the best free resources to help you delve deeper into advanced batch file usage:
1. **Microsoft Documentation**:
- [Batch files - Microsoft Docs](https://docs.microsoft.com/en-us/windows-server/administratio... | 17,665 | [
{
"from": "human",
"value": "What are the best free resources for learning advanced batch-file usage?\n"
},
{
"from": "gpt",
"value": "Learning advanced batch file scripting can enhance your automation capabilities in Windows. Here are some of the best free resources to help you delve deeper int... |
Ok, here's one for the JavaScript gurus:
In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple beans containing the car's name, id, year of production etc.
So, the map looks something like this (this... | Certainly! Let's tackle this step by step. Since you're working with JSP and want to dynamically change the contents of the second combobox based on the selection in the first one using plain JavaScript, here's how you can achieve that.
### Step 1: Prepare the Data in JSP
Assuming you have a `TreeMap` of car manufact... | 13,063 | [
{
"from": "human",
"value": "Ok, here's one for the JavaScript gurus:\nIn my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple beans containing the car's name, id, year of production etc.\n... |
When using Mercurial I sometimes find that it is hard to understand the relationship between changesets when there are thousands of changesets, and sometimes ten or more active branches at any one time. Currently, I use hgview which is okay, and while it makes a reasonable attempt to represent the parent relationships... | Managing and visualizing the history of a large repository in Mercurial can indeed be challenging, especially with thousands of changesets and multiple active branches. While `hgview` provides a basic representation, you might find the following alternatives and techniques more suitable for navigating extensive histori... | 15,601 | [
{
"from": "human",
"value": "When using Mercurial I sometimes find that it is hard to understand the relationship between changesets when there are thousands of changesets, and sometimes ten or more active branches at any one time. Currently, I use hgview which is okay, and while it makes a reasonable atte... |
I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function:
function conditional-do {
if [ -f $1 ]
then
echo "Doing stuff"
$2
else
echo "File doesn't exist!"
... | You can achieve the desired behavior using a technique called "command substitution" or "function passing" in Bash. One common way to do this is to pass a command block to your function using a combination of `eval` and a here document or a quoted string.
Here’s a version of your `conditional-do` function that allows... | 16,124 | [
{
"from": "human",
"value": "I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function:\nfunction conditional-do {\n if [ -f $1 ]\n then\n echo \"Doing stuff\"\n $... |
I have a asp:menu object which I set up to use a SiteMapDataSource but everytime I try to run the site, I get a yellow screen from firefox saying it cannot find the web.sitemap. Here's the code for the sitemapdatasource and the menu. The Web.sitemap file is sitting in the root directory of the website.
<div>
<asp:... | The issue you're experiencing with the `SiteMapDataSource` and `asp:Menu` control seems to be related to the configuration of the `Web.sitemap` file and potentially its accessibility. Let's go through some key points to help you resolve the problem.
### Check the Web.sitemap Structure
Ensure that your `Web.sitemap` f... | 10,511 | [
{
"from": "human",
"value": "I have a asp:menu object which I set up to use a SiteMapDataSource but everytime I try to run the site, I get a yellow screen from firefox saying it cannot find the web.sitemap. Here's the code for the sitemapdatasource and the menu. The Web.sitemap file is sitting in the root d... |
I'm currently trying to debug a customer's issue with an FTP upload feature in one of our products. The feature allows customers to upload files (< 1MB) to a central FTP server for further processing. The FTP client code was written in-house in VB.NET.
The customer reports that they receive "Connection forcibly closed ... | You're correct in thinking that the TCP protocol has built-in mechanisms for flow control, which typically manage the rate at which data is sent between a client and server. However, various factors can lead to the issue you're observing, particularly in the customer's environment. Here are some considerations regardin... | 15,354 | [
{
"from": "human",
"value": "I'm currently trying to debug a customer's issue with an FTP upload feature in one of our products. The feature allows customers to upload files (< 1MB) to a central FTP server for further processing. The FTP client code was written in-house in VB.NET.\nThe customer reports that... |
My ultimate goal here is to write a utility that lets me quickly set the folder on any dialog box, choosing from a preset list of 'favorites'. As I'm just a hobbyist, not a pro, I'd prefer to use .NET as that's what I know best. I do realize that some of this stuff might require something more than what I could do in C... | Creating a utility to set the folder in common dialog boxes (like "Save As" or "File Open") programmatically in .NET can be quite challenging, especially given that the common dialog boxes are not designed to be easily extensible. However, there are a few approaches you can take, both for creating a custom solution and... | 10,573 | [
{
"from": "human",
"value": "My ultimate goal here is to write a utility that lets me quickly set the folder on any dialog box, choosing from a preset list of 'favorites'. As I'm just a hobbyist, not a pro, I'd prefer to use .NET as that's what I know best. I do realize that some of this stuff might require... |
I want to know if my server is running Subversion 1.5.
How can I find that out?
Also would be nice to know my SVN client version number. svn help hasn't been helpful.
Note: I don't want my project's revision number, etc. This question is about the Subversion software itself.
| To check the version of the Subversion (SVN) server and client you are using, you can use the following methods:
### Check SVN Client Version
1. **Using the Command Line:**
You can check the version of your SVN client by running the following command in your terminal or command prompt:
```bash
svn --version... | 16,578 | [
{
"from": "human",
"value": "I want to know if my server is running Subversion 1.5.\nHow can I find that out?\nAlso would be nice to know my SVN client version number. svn help hasn't been helpful.\nNote: I don't want my project's revision number, etc. This question is about the Subversion software itself.\... |
I have a Hashtable<Integer, Sport> called sportMap and a list of sportIds (List<Integer> sportIds) from my backing bean. The Sport object has a List<String> equipmentList. Can I do the following using the unified EL to get the list of equipment for each sport?
<h:dataTable value="#{bean.sportIds}" var="_sportId" >
... | The issue you are facing is due to the fact that the `c:forEach` tag from the JSTL library expects a collection as the `items` attribute, and when you attempt to access `#{bean.sportMap[_sportId].equipmentList}`, you are using the expression language (EL) to reference a list directly. Unfortunately, the EL does not all... | 16,731 | [
{
"from": "human",
"value": "I have a Hashtable<Integer, Sport> called sportMap and a list of sportIds (List<Integer> sportIds) from my backing bean. The Sport object has a List<String> equipmentList. Can I do the following using the unified EL to get the list of equipment for each sport?\n<h:dataTable va... |
I have an asp.net application that runs exclusively on IE7 (internal web site).
When a user needs to enter data, I pop up a child window with a form. When the form closes, it calls javascript:window.opener.location.reload(true) so that the new data will display on the main page.
The problem is that the browser complain... | The issue you're encountering with Internet Explorer 7 regarding the "confirm form resubmission" dialog is related to the HTTP POST method being used to load the main page. When a page is loaded using a POST request, refreshing that page or navigating back to it usually triggers this prompt, as the browser wants to pre... | 11,063 | [
{
"from": "human",
"value": "I have an asp.net application that runs exclusively on IE7 (internal web site).\nWhen a user needs to enter data, I pop up a child window with a form. When the form closes, it calls javascript:window.opener.location.reload(true) so that the new data will display on the main page... |
Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) * sizeof(char) . Sizeof(char) currently being 2.
What I am interested in is whether anyone knows of a way which on a character by charac... | In Delphi 2009, you can determine if a character is an ASCII character (which fits in a single byte) by examining its ordinal value. ASCII characters range from 0 to 127. If a character's ordinal value is within this range, it can be represented in a single byte; otherwise, it is a Unicode character that requires two b... | 17,631 | [
{
"from": "human",
"value": "Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) * sizeof(char) . Sizeof(char) currently being 2. \nWhat I am interested in is whether anyone kno... |
Is there any free hosting for Javascript? Recently google has been hosting jQuery,etc... and Yahoo hosts it's YUI, which is great, but it'd be even better if there was a service that could host user scripts and things like that.
Any ideas?
| Yes, there are several options for free hosting services where you can host your JavaScript files and other assets. Here are some popular options:
1. **GitHub Pages**:
- If you have a GitHub account, you can host static files including JavaScript, HTML, and CSS for free using GitHub Pages. You can create a reposito... | 15,940 | [
{
"from": "human",
"value": "Is there any free hosting for Javascript? Recently google has been hosting jQuery,etc... and Yahoo hosts it's YUI, which is great, but it'd be even better if there was a service that could host user scripts and things like that.\nAny ideas?\n"
},
{
"from": "gpt",
"va... |
I am trying to start a service from the command line using "net start SERVICENAME" and I get an access denied error.
I am an administrator on this server since I am in a domain group that are admins on the server. I can start/stop the service from the Services tool.
I am new to 2008/Vista so maybe I am just missing som... | Yes, "Run as Administrator" is a feature introduced in Windows Vista and is also present in Windows Server 2008. Even if your user account is in the Administrators group, User Account Control (UAC) may still restrict certain actions unless you explicitly run applications with elevated privileges.
To run the Command Pr... | 19,384 | [
{
"from": "human",
"value": "I am trying to start a service from the command line using \"net start SERVICENAME\" and I get an access denied error.\nI am an administrator on this server since I am in a domain group that are admins on the server. I can start/stop the service from the Services tool.\nI am new... |
I need to get the actual local network IP address of the computer (e.g. 192.168.0.220) from my program using C# and .NET 3.5. I can't just use 127.0.0.1 in this case.
How can I accomplish this?
| To obtain the local network IP address of a computer in C# using .NET Framework 3.5, you can use the `System.Net` namespace, particularly the `Dns` and `NetworkInterface` classes. Below is a simple method to retrieve the local IP address that is not the loopback address (127.0.0.1).
Here's a sample code snippet to dem... | 16,384 | [
{
"from": "human",
"value": "I need to get the actual local network IP address of the computer (e.g. 192.168.0.220) from my program using C# and .NET 3.5. I can't just use 127.0.0.1 in this case.\nHow can I accomplish this?\n"
},
{
"from": "gpt",
"value": "To obtain the local network IP address ... |
I need to create a windows service that will monitor a directory for newly uploaded files.
The files will be around 100K to 400K in size.
Is there a chance that my monitoring system will notice a new file, but the file hasn't completetly finished copying over? i.e. it is still streaming in and the EOF hasn't been writt... | Yes, there is a chance that your monitoring system could detect a new file before the file copy operation has completed. When a file is created or copied into a directory, the file system may trigger events such as `Created` or `Changed` even if the file is still being written to. This is particularly true for larger f... | 16,032 | [
{
"from": "human",
"value": "I need to create a windows service that will monitor a directory for newly uploaded files.\nThe files will be around 100K to 400K in size.\nIs there a chance that my monitoring system will notice a new file, but the file hasn't completetly finished copying over? i.e. it is still... |
I have have some code which adds new cells to a table and fills them with text boxes.
The way I've coded it so far works fine:
TableCell tCell1 = new TableCell();
TableCell tCell2 = new TableCell();
TableCell tCell3 = new TableCell();
TableCell tCell4 = new TableCell();
TableCel... | You're on the right track! You can indeed achieve your goal using a loop without having to repeat the same instructions multiple times. However, you can't directly use array-like syntax (`tCell[i]` and `txt[i]`) in your current context, because you'll need to create arrays or lists to store these objects.
Here's how y... | 15,828 | [
{
"from": "human",
"value": "I have have some code which adds new cells to a table and fills them with text boxes. \nThe way I've coded it so far works fine:\n TableCell tCell1 = new TableCell();\n TableCell tCell2 = new TableCell();\n TableCell tCell3 = new TableCell();\n TableC... |
I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently.
The Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically.
Here is the scenario: * So we hash out a system quickly to a
specified set of interfaces, it has
zero op... | The concept you’re describing resembles aspects of adaptive systems and evolutionary computing, with specific focus on improving software performance through a dynamic and iterative replacement process. While similar principles can be found in various fields, your idea has unique characteristics. Here’s a breakdown of ... | 12,581 | [
{
"from": "human",
"value": "I had an idea I was mulling over with some colleagues. None of us knew whether or not it exists currently.\nThe Basic Premise is to have a system that has 100% uptime but can become more efficient dynamically.\n\nHere is the scenario: * So we hash out a system quickly to a\n ... |
In javascript, we can do:
["a string", 10, {x : 1}, function() {}].push("another value");
What is the Scala equivalent?
| In Scala, you can use a `List` or `ArrayBuffer` to achieve similar behavior to JavaScript's array. However, keep in mind that in Scala, `List` is immutable, which means you cannot modify it directly. Instead, you create a new list when you want to "add" an element. On the other hand, `ArrayBuffer` is mutable and allows... | 19,067 | [
{
"from": "human",
"value": "In javascript, we can do:\n[\"a string\", 10, {x : 1}, function() {}].push(\"another value\");\n\nWhat is the Scala equivalent?\n"
},
{
"from": "gpt",
"value": "In Scala, you can use a `List` or `ArrayBuffer` to achieve similar behavior to JavaScript's array. However... |
I use Codesmith to create our code generation templates and have had success in learning how to use the tool by looking at example templates and the built in documentation. However I was wondering if there are any other resources (books, articles, tutorials, etc.) for getting a better grasp of Codesmith?
| Codesmith is a powerful code generation tool, and while the built-in documentation and example templates are great starting points, there are several additional resources that can help you deepen your understanding and proficiency with Codesmith. Here are some recommendations:
1. **Official Codesmith Documentation**:
... | 15,698 | [
{
"from": "human",
"value": "I use Codesmith to create our code generation templates and have had success in learning how to use the tool by looking at example templates and the built in documentation. However I was wondering if there are any other resources (books, articles, tutorials, etc.) for getting a... |
Unquestionably, I would choose to use the STL for most C++ programming projects. The question was presented to me recently however, "Are there any cases where you wouldn't use the STL?"...
The more I thought about it, the more I realized that perhaps there SHOULD be cases where I choose not to use the STL... For exampl... | Using the Standard Template Library (STL) in C++ provides many benefits such as code reuse, standardization, and often better performance through well-optimized algorithms and data structures. However, there are cases where you might consider not using the STL:
1. **Specific Performance Needs**: If your project has ve... | 15,667 | [
{
"from": "human",
"value": "Unquestionably, I would choose to use the STL for most C++ programming projects. The question was presented to me recently however, \"Are there any cases where you wouldn't use the STL?\"...\nThe more I thought about it, the more I realized that perhaps there SHOULD be cases whe... |
How do I calculate the position of an accelerating body (e.g. a car) after a certain time (e.g. 1 second)?
For a moving body that it not accelerating, it is a linear relationship, so I presume for an accelerating body it involves a square somewhere.
Any ideas?
| Yes, you are correct that the position of an accelerating body can be calculated using a quadratic relationship due to the nature of uniform acceleration. The basic kinematic equation that relates position, initial velocity, acceleration, and time is given by:
\[
s = s_0 + v_0 t + \frac{1}{2} a t^2
\]
Where:
- \( s \... | 17,213 | [
{
"from": "human",
"value": "How do I calculate the position of an accelerating body (e.g. a car) after a certain time (e.g. 1 second)?\nFor a moving body that it not accelerating, it is a linear relationship, so I presume for an accelerating body it involves a square somewhere.\nAny ideas? \n"
},
{
... |
I have a pseudo random number generator (PRNG) class that I want to unit test. There are two approaches:
write a test case that takes a large amount of samples and test whether they are properly distributed. This approach may lead to a fairly long execution time for the test case;
calculate a small series of samples '... | Both approaches you outlined have their merits and shortcomings, and the choice between them depends on your specific testing goals and the context in which the PRNG is being used. Here's a breakdown of both approaches:
### First Approach: Statistical Testing
**Pros:**
- It evaluates the quality of randomness over a l... | 18,876 | [
{
"from": "human",
"value": "I have a pseudo random number generator (PRNG) class that I want to unit test. There are two approaches:\n\nwrite a test case that takes a large amount of samples and test whether they are properly distributed. This approach may lead to a fairly long execution time for the test ... |
When you create a procedure (or a function) in Oracle PL/SQL, you cannot specify the maximum length of the varchar2 arguments, only the datatype. For example
create or replace procedure testproc(arg1 in varchar2) is
begin
null;
end;
Do you know the maximum length of a string that you can pass as the arg1 argument to... | In Oracle PL/SQL, the maximum length of a `VARCHAR2` string that you can pass as an argument to a procedure (or function) depends on the version of Oracle Database you are using and the environment settings.
1. **Oracle Database 12c and later (when using the standard VARCHAR2 size):**
- The maximum length for `VARC... | 20,448 | [
{
"from": "human",
"value": "When you create a procedure (or a function) in Oracle PL/SQL, you cannot specify the maximum length of the varchar2 arguments, only the datatype. For example\ncreate or replace procedure testproc(arg1 in varchar2) is\nbegin\n null;\nend;\n\nDo you know the maximum length of a s... |
I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will become 12300 and 0.012345 will become 0.0123. Occasion... | To format decimal numbers with a specific number of significant figures before pushing them to a SharePoint list, you can create a function in your programming or scripting language that will handle the rounding for you. Here’s how you can achieve this in Python, which is commonly used for data processing.
### Python ... | 13,709 | [
{
"from": "human",
"value": "I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will become 12300 a... |
I'm getting warnings about CSS3.0 properties like text-overflow. Is there a way to validate against 3.0?
HTML5 and CSS3 support is coming to VS2010 in SP1.
Link
And now its here.
http://visualstudiogallery.msdn.microsoft.com/7211bcac-091b-4a32-be2d-e797be0db210/view/Reviews/0?showReviewForm=True
| To validate against CSS3 properties like `text-overflow`, you'll need to use tools that specifically support CSS3 validation. Visual Studio 2010 itself may not have built-in support for CSS3 properties, especially if you're relying on the default validation tools that were available in the IDE at that time.
Here are s... | 16,507 | [
{
"from": "human",
"value": "I'm getting warnings about CSS3.0 properties like text-overflow. Is there a way to validate against 3.0?\n\nHTML5 and CSS3 support is coming to VS2010 in SP1.\nLink\n\nAnd now its here.\nhttp://visualstudiogallery.msdn.microsoft.com/7211bcac-091b-4a32-be2d-e797be0db210/view/Rev... |
I would like to find out if a particular python datetime object is older than X hours or minutes. I am trying to do something similar to:
if (datetime.now() - self.timestamp) > 100
# Where 100 is either seconds or minutes
This generates a type error.
What is the proper way to do date time comparison in python? I al... | To compare a `datetime` object with a certain time duration in Python, you should use `timedelta` from the `datetime` module. This allows you to represent the duration in seconds, minutes, or hours and compare it with the difference between two `datetime` objects.
Here’s how to correctly perform such a comparison:
``... | 14,314 | [
{
"from": "human",
"value": "I would like to find out if a particular python datetime object is older than X hours or minutes. I am trying to do something similar to: \nif (datetime.now() - self.timestamp) > 100\n# Where 100 is either seconds or minutes\n\nThis generates a type error. \nWhat is the proper ... |
The win32.perl.org web site provides references to several Perl distributions for MS Windows.
For a long time I have been using ActivePerl from
ActiveState but recently I switched to
Strawberry Perl.
IMHO The only advantage that Active Perl still has over Strawberry Perl is the fact that it comes with Perl Tk which m... | You've made a valid comparison between ActivePerl and Strawberry Perl, and many users share similar sentiments. Here’s a breakdown of some advantages and considerations for both distributions:
### Advantages of Strawberry Perl:
1. **Compiler Integration**: Strawberry Perl comes with a compiler (GCC), making it easier ... | 18,048 | [
{
"from": "human",
"value": "The win32.perl.org web site provides references to several Perl distributions for MS Windows.\nFor a long time I have been using ActivePerl from \nActiveState but recently I switched to \nStrawberry Perl.\nIMHO The only advantage that Active Perl still has over Strawberry Perl i... |
I'm quite curious about this.
In a broad way, how does one go about doing the following:
Detection of word separations.
Detection of syllables.
Compensate for normal speech word connections.
| Detecting word separations, syllables, and compensating for normal speech word connections involves several steps and techniques from the fields of linguistics, speech processing, and natural language processing (NLP). Here’s a broad overview of how one might approach each of these tasks:
### 1. Detection of Word Sepa... | 12,443 | [
{
"from": "human",
"value": "I'm quite curious about this.\nIn a broad way, how does one go about doing the following:\n\nDetection of word separations.\nDetection of syllables.\nCompensate for normal speech word connections.\n\n"
},
{
"from": "gpt",
"value": "Detecting word separations, syllabl... |
I came aboard a new project with a new company and we are trying to use JPA to do some DB work. So we have an Ear with an EJB, a webservice, and then there is a app client in the ear that really does all the work. The Webservice, calls the EJB, and the EJB calls the client to do the DB work. So within the appclient ... | It sounds like you're running into some typical challenges when working with JPA in a Java EE environment, particularly with how JPA manages the `EntityManager` in the context of EJBs, and how to use it effectively within your application client.
### Key Points to Consider
1. **Contextual Usage of JPA and EntityManag... | 12,908 | [
{
"from": "human",
"value": "I came aboard a new project with a new company and we are trying to use JPA to do some DB work. So we have an Ear with an EJB, a webservice, and then there is a app client in the ear that really does all the work. The Webservice, calls the EJB, and the EJB calls the client to ... |
Every time I use the "at" command, I get this message:
warning: commands will be executed using /bin/sh
What is it trying to warn me about? More importantly, how do I turn the warning off?
| The warning message you're seeing when using the `at` command is simply an informative note indicating that the commands you schedule with `at` will be executed using the default shell, which is `/bin/sh` on many Unix-like systems. This is not an error; rather, it's meant to make you aware of the environment in which y... | 18,910 | [
{
"from": "human",
"value": "Every time I use the \"at\" command, I get this message:\nwarning: commands will be executed using /bin/sh\n\nWhat is it trying to warn me about? More importantly, how do I turn the warning off?\n"
},
{
"from": "gpt",
"value": "The warning message you're seeing when ... |
When I used to write libraries in C/C++ I got into the habit of having a method to return the compile date/time. This was always a compiled into the library so would differentiate builds of the library. I got this by returning a #define in the code:
C++:
#ifdef _BuildDateTime_
char* SomeClass::getBuildDateTime() {
... | In Java, there isn't a direct equivalent to C/C++ preprocessor directives like `#define` for injecting constants at compile time. However, you can still achieve a similar effect using build tools like Maven or Gradle, which can inject properties into your classes during the build process. Here are a couple of approache... | 12,369 | [
{
"from": "human",
"value": "When I used to write libraries in C/C++ I got into the habit of having a method to return the compile date/time. This was always a compiled into the library so would differentiate builds of the library. I got this by returning a #define in the code:\nC++:\n#ifdef _BuildDateTime_... |
Let's say I have a database, and an RSS feed. I have to find out what is the new data from an RSS feed, that isn't already in the database. How would you go about approaching this problem?
| To identify new data from an RSS feed that isn't already present in your database, you can follow a systematic approach. Here’s a step-by-step guide:
### 1. Fetch the RSS Feed
- **Read the RSS feed**: Use an appropriate library in your programming language (e.g., `feedparser` in Python) to fetch and parse the RSS feed... | 14,567 | [
{
"from": "human",
"value": "Let's say I have a database, and an RSS feed. I have to find out what is the new data from an RSS feed, that isn't already in the database. How would you go about approaching this problem?\n"
},
{
"from": "gpt",
"value": "To identify new data from an RSS feed that is... |
Does anyone know of any good image resizing libraries that will handling resizing large images(~7573 x ~9485). Something that is fast and doesn't chew to much memory would be great. At the moment I am using IrfanView and just shell invoking it with arguments but I would like to find something that integrates into .ne... | For handling large image resizing in .NET with better integration than using an external tool like IrfanView, here are a few libraries you might consider:
1. **ImageSharp**:
- **Description**: A popular and modern library for processing images in .NET. It is cross-platform and doesn't rely on any native dependencie... | 15,056 | [
{
"from": "human",
"value": "Does anyone know of any good image resizing libraries that will handling resizing large images(~7573 x ~9485). Something that is fast and doesn't chew to much memory would be great. At the moment I am using IrfanView and just shell invoking it with arguments but I would like t... |
How to disable the Minimize button of FireFox Browser or How to hide titlebar of FireFox Browser. I am using Window.Open to Open Window in fullscreen Mode using javascript
| Disabling the Minimize button or hiding the title bar of the Firefox browser through JavaScript is not straightforward due to security and user experience guidelines that modern browsers adhere to. Browsers, including Firefox, are designed to prevent web pages from manipulating the window's chrome (the parts of the bro... | 17,659 | [
{
"from": "human",
"value": "How to disable the Minimize button of FireFox Browser or How to hide titlebar of FireFox Browser. I am using Window.Open to Open Window in fullscreen Mode using javascript\n"
},
{
"from": "gpt",
"value": "Disabling the Minimize button or hiding the title bar of the F... |
When should one do the following?
class Foo : Control
{
protected override void OnClick(EventArgs e)
{
// new code here
}
}
As opposed to this?
class Foo : Control
{
public Foo()
{
this.Click += new EventHandler(Clicked);
}
private void Clicked(object sender, EventArgs e)
... | In C#, both approaches you've provided can be used to handle events such as a click on a control, but they serve different purposes and are suitable for different scenarios. Here's an explanation of when to use each approach:
### 1. Overriding `OnClick`
```csharp
class Foo : Control
{
protected override void OnCl... | 17,522 | [
{
"from": "human",
"value": "When should one do the following?\nclass Foo : Control\n{\n protected override void OnClick(EventArgs e)\n {\n // new code here\n }\n}\n\nAs opposed to this?\nclass Foo : Control\n{\n public Foo()\n {\n this.Click += new EventHandler(Clicked);\n }... |
If I have a Resource bundle property file:
A.properties:
thekey={0} This is a test
And then I have java code that loads the resource bundle:
ResourceBundle labels = ResourceBundle.getBundle("A", currentLocale);
labels.getString("thekey");
How can I replace the {0} text with some value
labels.getString("thekey", "Yes!... | In Java, `ResourceBundle` does not directly support parameterized messages using `getString` in the way you're trying to call it with `labels.getString("thekey", "Yes!!!")`. However, you can achieve what you need by retrieving the string and then manually formatting it.
You can use `MessageFormat` from `java.text` pac... | 7,159 | [
{
"from": "human",
"value": "If I have a Resource bundle property file:\nA.properties:\nthekey={0} This is a test\n\nAnd then I have java code that loads the resource bundle:\nResourceBundle labels = ResourceBundle.getBundle(\"A\", currentLocale);\nlabels.getString(\"thekey\");\n\nHow can I replace the {0} ... |
Looking at learning some C since i saw in another SO question that is good to learn for the language and for the historical experience.
Wondering about what IDE's professionals use and what other tools are useful while programming in C?
| Learning C is a great decision, especially since it is foundational to understanding many programming concepts and other languages. When it comes to development environments and tools, there are several options that professionals often use. Here’s a breakdown:
### IDEs and Editors
1. **Visual Studio** (Windows)
- A... | 15,340 | [
{
"from": "human",
"value": "Looking at learning some C since i saw in another SO question that is good to learn for the language and for the historical experience.\nWondering about what IDE's professionals use and what other tools are useful while programming in C?\n"
},
{
"from": "gpt",
"value... |
I'm quite new to NHibernate and starting to find my way around.
I have a domain model that is somewhat like a tree.
Funds have Periods have Selections have Audits
Now I would like to get all Audits for a specific Fund
Would look like this if I made it in SQL
SELECT A.*
FROM Audit A
JOIN Selection S ON A.fkSelectionID =... | To achieve the same result in NHibernate, you can use HQL (Hibernate Query Language) or Criteria API. I'll show you both methods for retrieving all `Audit` records for a specific `Fund`.
### Domain Model Example
First, make sure your domain model is set up correctly. It should look something like this:
```csharp
pub... | 15,523 | [
{
"from": "human",
"value": "I'm quite new to NHibernate and starting to find my way around.\nI have a domain model that is somewhat like a tree.\nFunds have Periods have Selections have Audits\nNow I would like to get all Audits for a specific Fund\nWould look like this if I made it in SQL\nSELECT A.*\nFRO... |
In C++ you can initialize a variable in an if statement, like so:
if (CThing* pThing = GetThing())
{
}
Why would one consider this bad or good style? What are the benefits and disadvantages?
Personally i like this style because it limits the scope of the pThing variable, so it can never be used accidentally when it is... | The style of initializing a variable within an `if` statement in C++ can have both benefits and disadvantages, and opinions on whether it is good or bad style often depend on individual preferences and coding conventions. Let's discuss both sides.
### Benefits
1. **Scope Limitation**: As you've noted, the variable `p... | 16,334 | [
{
"from": "human",
"value": "In C++ you can initialize a variable in an if statement, like so:\nif (CThing* pThing = GetThing())\n{\n}\n\nWhy would one consider this bad or good style? What are the benefits and disadvantages?\nPersonally i like this style because it limits the scope of the pThing variable, ... |
We are doing some performance tests on our website and we are getting the following error a lot:
*** 'C:\inetpub\foo.plex' log message at: 2008/10/07 13:19:58
DBD::ODBC::st execute failed: [Microsoft][SQL Native Client]String data, right truncation (SQL-22001) at C:\inetpub\foo.plex line 25.
Line 25 is the following:
... | The error message you're encountering indicates that there is a problem with the data being passed to the SQL query, specifically a string data truncation issue. This typically occurs when the string you're trying to insert into the database exceeds the maximum length defined for that particular column.
In your case, ... | 16,516 | [
{
"from": "human",
"value": "We are doing some performance tests on our website and we are getting the following error a lot:\n*** 'C:\\inetpub\\foo.plex' log message at: 2008/10/07 13:19:58\nDBD::ODBC::st execute failed: [Microsoft][SQL Native Client]String data, right truncation (SQL-22001) at C:\\inetpub... |
I was looking into sorting tables by a column designated given some input, and from what I've found, there is no easy way to do this. The best I've found is a switch statement:
SELECT Column1, Column2, Column3, Column4
FROM Table
ORDER BY CASE WHEN @OrderBY = 'Column1' THEN Column1
WHEN @OrderBY = 'Colu... | You are correct that using a `CASE` statement for dynamic column sorting can become cumbersome as the number of sortable columns increases. However, SQL itself does not provide a built-in way to directly achieve dynamic ordering without using either a `CASE` statement or constructing dynamic SQL strings.
That said, us... | 17,398 | [
{
"from": "human",
"value": "I was looking into sorting tables by a column designated given some input, and from what I've found, there is no easy way to do this. The best I've found is a switch statement: \nSELECT Column1, Column2, Column3, Column4\nFROM Table\nORDER BY CASE WHEN @OrderBY = 'Column1' THEN... |
What's the best way to write a simple frame-based expert system, which determines if object is relative to some group? It's a kind of lab work for Intelligent Systems course in university. Or are there any OpenSource projects to study it's realization?
| Writing a simple frame-based expert system can be a rewarding project for your Intelligent Systems course. Here's a structured approach to help you design and implement your expert system, along with resources to study.
### Step-by-Step Approach
1. **Define the Domain**:
- Identify the group and the attributes tha... | 14,214 | [
{
"from": "human",
"value": "What's the best way to write a simple frame-based expert system, which determines if object is relative to some group? It's a kind of lab work for Intelligent Systems course in university. Or are there any OpenSource projects to study it's realization?\n"
},
{
"from": "g... |
You can use ftplib for full FTP support in Python. However the preferred way of getting a directory listing is:
# File: ftplib-example-1.py
import ftplib
ftp = ftplib.FTP("www.python.org")
ftp.login("anonymous", "ftplib-example-1")
data = []
ftp.dir(data.append)
ftp.quit()
for line in data:
print "-", line
W... | Yes, you can parse the directory listing returned by the FTP server to extract only the folder names. Since the format of the listing is indeed dependent on the server and can vary, you'll need to apply some common parsing rules based on typical formats. The following example demonstrates how to get just the directory ... | 15,549 | [
{
"from": "human",
"value": "You can use ftplib for full FTP support in Python. However the preferred way of getting a directory listing is:\n# File: ftplib-example-1.py\n\nimport ftplib\n\nftp = ftplib.FTP(\"www.python.org\")\nftp.login(\"anonymous\", \"ftplib-example-1\")\n\ndata = []\n\nftp.dir(data.appe... |
I'm starting with Python coming from java.
I was wondering if there exists something similar to JavaDoc API where I can find the class, its methods and and example of how to use it.
I've found very helpul to use help( thing ) from the Python ( command line )
I have found this also:
http://docs.python.org/2/
https://d... | Welcome to Python! Transitioning from Java to Python can be quite smooth, especially if you're familiar with concepts like object-oriented programming.
You're right that Python's documentation is structured differently from JavaDoc, and it may take some getting used to. Here are some resources and approaches you can u... | 16,786 | [
{
"from": "human",
"value": "I'm starting with Python coming from java. \nI was wondering if there exists something similar to JavaDoc API where I can find the class, its methods and and example of how to use it.\nI've found very helpul to use help( thing ) from the Python ( command line ) \nI have found th... |
Is it possible to subscribe to a url with log4j logs?
I understand that many applications do have daily error logs notification by email. But a problem with this approach is that the server that host the application may not provide smtp capability. Thus the RSS subscribe approach seens to be more flexibile.
Anyone know... | Yes, it is indeed possible to set up a system where you can "subscribe" to logs generated by Log4j (or other logging frameworks) via an RSS feed or similar approach. While Log4j itself does not provide a built-in mechanism for RSS feeds, you can implement a solution by integrating additional tools or frameworks. Here a... | 14,888 | [
{
"from": "human",
"value": "Is it possible to subscribe to a url with log4j logs?\nI understand that many applications do have daily error logs notification by email. But a problem with this approach is that the server that host the application may not provide smtp capability. Thus the RSS subscribe approa... |
Is there any way to embed a widget in a data-bound DataGridViewCell when it is not in editing mode?
For example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calendar instead of the text.
We could create a custom cell and ov... | Embedding a widget like a calendar directly into a non-editing `DataGridViewCell` in a Windows Forms application can be tricky because `DataGridView` cells are not designed to host controls in the same way as, for instance, panels. However, there are workarounds to achieve the desired effect.
### Approach 1: Using a ... | 16,000 | [
{
"from": "human",
"value": "Is there any way to embed a widget in a data-bound DataGridViewCell when it is not in editing mode?\nFor example, we are wanting to display an existing calendar widget in a cell. That cell contains a comma separated list of dates. We want to show the calendar instead of the te... |
I really love the philosophy of chaining methods, like jQuery emphasys in its library. I found it quite elegant and clear.
Being primarily Java developper, I've always wondering myself why this practice was not more used in this language. For example, the Collection interface was not designed in the that way (for addin... | Chaining methods can indeed lead to elegant and readable code, allowing you to express complex operations succinctly. While it's more common in some languages and libraries (like jQuery in JavaScript), there are several reasons why method chaining is not as widely adopted in Java, especially in the context of the Colle... | 16,472 | [
{
"from": "human",
"value": "I really love the philosophy of chaining methods, like jQuery emphasys in its library. I found it quite elegant and clear.\nBeing primarily Java developper, I've always wondering myself why this practice was not more used in this language. For example, the Collection interface w... |
The output we get when printing C++ sources from Eclipse is rather ugly.
Is there are way/a plugin to pretty print C++ source code like e.g. with a2ps (which is probably using yet another filter for C source code)?
| Yes, Eclipse can be configured to format C++ source code more elegantly by using built-in formatting options or plugins. Here are a few ways to achieve better formatting for C++ source code in Eclipse:
### 1. Built-in Code Formatter
Eclipse has a built-in code formatter that can be configured:
1. **Open Preferences*... | 16,112 | [
{
"from": "human",
"value": "The output we get when printing C++ sources from Eclipse is rather ugly. \nIs there are way/a plugin to pretty print C++ source code like e.g. with a2ps (which is probably using yet another filter for C source code)?\n"
},
{
"from": "gpt",
"value": "Yes, Eclipse can ... |
For technical reasons, I can't use ClickOnce to auto-update my .NET application and its assemblies. What is the best way to handle auto-updating in .NET?
| If ClickOnce is not an option for auto-updating your .NET application, you can consider implementing your own custom auto-update mechanism. Here are some commonly used approaches to achieve this:
### 1. **Self-Update Logic Using a Version Check**
You can create a version checking mechanism in your application that doe... | 15,403 | [
{
"from": "human",
"value": "For technical reasons, I can't use ClickOnce to auto-update my .NET application and its assemblies. What is the best way to handle auto-updating in .NET?\n"
},
{
"from": "gpt",
"value": "If ClickOnce is not an option for auto-updating your .NET application, you can ... |
According to select name from system_privilege_map System has been granted:
SELECT ANY TABLE
...and lots of other * ANY TABLES.
Plainly running
select * from the_table;
select * from the_table;
...nets the given response:
ERROR at line 1:
ORA-00942: table or view does not exist
I can log in as that user and run ... | Your assumption is correct that having the `SELECT ANY TABLE` privilege allows a user to select data from any table in the database. However, there are some important details to consider which might help explain why you are encountering the `ORA-00942: table or view does not exist` error when trying to run your queries... | 16,937 | [
{
"from": "human",
"value": "According to select name from system_privilege_map System has been granted:\nSELECT ANY TABLE\n\n...and lots of other * ANY TABLES.\nPlainly running\nselect * from the_table;\nselect * from the_table;\n\n...nets the given response:\n\nERROR at line 1:\n ORA-00942: table or vie... |
When an ASP.NET application is running under IIS6.0 in Windows 2003 Server with impersonation, what user account is relevant for deciding file read/write/execute access privileges? I have two scenarios where I am trying to understand what access to grant/revoke. I thought the most relevant user is probably the identi... | When working with ASP.NET applications hosted on IIS 6.0 in Windows Server 2003, understanding user accounts and permissions can be a bit complex due to how impersonation and application pool identities work. Let's break down the two scenarios you've described.
### Scenario 1: Executing a Local Batch File via `System.... | 15,976 | [
{
"from": "human",
"value": "When an ASP.NET application is running under IIS6.0 in Windows 2003 Server with impersonation, what user account is relevant for deciding file read/write/execute access privileges? I have two scenarios where I am trying to understand what access to grant/revoke. I thought the ... |
I have some code in a javascript file that needs to send queries back to the server. The question is, how do I find the url for the script that I am in, so I can build a proper request url for ajax.
I.e., the same script is included on /, /help, /whatever, and so on, while it will always need to request from /data.json... | To find the URL of the script that's currently executing in a JavaScript file and use it to build a proper request URL for an AJAX call, you can utilize the `document.currentScript` property, which is widely supported in modern browsers. However, to ensure compatibility with older browsers, you might need a slightly di... | 10,108 | [
{
"from": "human",
"value": "I have some code in a javascript file that needs to send queries back to the server. The question is, how do I find the url for the script that I am in, so I can build a proper request url for ajax.\nI.e., the same script is included on /, /help, /whatever, and so on, while it w... |
I'm wondering if there is an easy way to load data from analysis services (SSAS) into SPSS.
SPSS offers a product to put SPSS functionality on the analysis server, but to me this is backwards. I don't want to learn about SPSS or have the SPSS users in the office learn something else.
I just want to give the analysis... | Loading data from SQL Server Analysis Services (SSAS) into SPSS can be somewhat complex, given that SSAS is primarily designed for analytical processing and SPSS is a statistical analysis tool. However, there are a few approaches that you can take to facilitate this process without requiring SPSS users to learn new too... | 17,127 | [
{
"from": "human",
"value": "I'm wondering if there is an easy way to load data from analysis services (SSAS) into SPSS.\nSPSS offers a product to put SPSS functionality on the analysis server, but to me this is backwards. I don't want to learn about SPSS or have the SPSS users in the office learn somethin... |
I have a set of callback classes that I use for handling callbacks with variable numbers of parameters. Right now I have about 6 different instances of it to handle differing numbers of arguments. Is there a way to make one instance than can handle a variable number of arguments?? Ultimately I would love to have each p... | You can achieve a flexible callback mechanism that can handle a variable number of parameters using templates and variadic functions. This approach allows you to define a single callback class that can take any number of parameters while still allowing you to specify types for each parameter.
Here’s a possible impleme... | 16,273 | [
{
"from": "human",
"value": "I have a set of callback classes that I use for handling callbacks with variable numbers of parameters. Right now I have about 6 different instances of it to handle differing numbers of arguments. Is there a way to make one instance than can handle a variable number of arguments... |
I'm on a team maintaining a .Net web app with a SQL Server 2005 back end. The system's been running a little slow in places lately, so after doing all the tuning kind of stuff we could think of (adding indexes, cleaning up really badly written stored procedures, etc.) I ran a typical workload through the Tuning Adviso... | Using the SQL Server Database Engine Tuning Advisor can provide valuable insights into potential performance improvements, but there are several considerations to keep in mind before implementing all of its recommendations:
1. **Index Bloat**: Creating too many indexes can lead to performance degradation for data modi... | 14,807 | [
{
"from": "human",
"value": "I'm on a team maintaining a .Net web app with a SQL Server 2005 back end. The system's been running a little slow in places lately, so after doing all the tuning kind of stuff we could think of (adding indexes, cleaning up really badly written stored procedures, etc.) I ran a t... |
I'm trying to test if a given default constraint exists. I don't want to use the sysobjects table, but the more standard INFORMATION_SCHEMA.
I've used this to check for tables and primary key constraints before, but I don't see default constraints anywhere.
Are they not there? (I'm using MS SQL Server 2000).
EDIT: I'm ... | In SQL Server, default constraints are indeed stored in the system catalog, but they do not appear in the `INFORMATION_SCHEMA` views directly. If you're specifically looking for a way to check for the existence of a default constraint by its name, you'll need to query the `sys.objects` or `sys.default_constraints` syst... | 20,724 | [
{
"from": "human",
"value": "I'm trying to test if a given default constraint exists. I don't want to use the sysobjects table, but the more standard INFORMATION_SCHEMA.\nI've used this to check for tables and primary key constraints before, but I don't see default constraints anywhere.\nAre they not there?... |
I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts. I'm using php, and at the moment this little snippet is responsible for generating the UID:
$id = tempnam (".", "");
unlink($id);
$id = substr($id, 2);
This code is hideous: it creates a temporary file on the ... | Yes, there are better ways to generate a unique identifier in PHP without creating temporary files. One common approach is to use the `uniqid()` function, which generates a unique ID based on the current time in microseconds. To make it even more unique, you can combine it with `bin2hex(random_bytes())` for additional ... | 18,652 | [
{
"from": "human",
"value": "I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts. I'm using php, and at the moment this little snippet is responsible for generating the UID:\n$id = tempnam (\".\", \"\");\nunlink($id);\n$id = substr($id, 2);\n\nThis co... |
According to this post on how to do query auto-completionsuggestions in lucene getting "Did You Mean" functionality best involves using a LuceneDictionary. But I probably would have used a fuzzy query for this before reading this post. Now I'm wondering which is faster, which is easier to implement?
| When implementing "Did You Mean" functionality in Lucene, both the use of a `LuceneDictionary` (often with a spelling correction library like Lucene's own spell checker) and fuzzy queries have their pros and cons in terms of speed, ease of implementation, and effectiveness. Here’s a comparison to help you decide which ... | 16,025 | [
{
"from": "human",
"value": "According to this post on how to do query auto-completionsuggestions in lucene getting \"Did You Mean\" functionality best involves using a LuceneDictionary. But I probably would have used a fuzzy query for this before reading this post. Now I'm wondering which is faster, which ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.