instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have a method that can return either a single object or a collection of objects. I want to be able to run object.collect on the result of that method whether or not it is a single object or a collection already. How can i do this? profiles = ProfileResource.search(params) output = profiles.collect do | profile | ...
To handle both scenarios where `profiles` could be either a single object or a collection, you can use the `Array` class in Ruby to ensure that you always have an enumerable collection to work with. You can convert the result into an array, and if it's already an array, it will remain unchanged. If it's a single object...
5,659
[ { "from": "human", "value": "I have a method that can return either a single object or a collection of objects. I want to be able to run object.collect on the result of that method whether or not it is a single object or a collection already. How can i do this?\nprofiles = ProfileResource.search(params)\nou...
Does anyone know why when using BindingUtils on the selectedItem property of a ComboBox you get the following warning? Any ideas how to resolve the issue? The binding still works properly, but it would be nice to get rid of the warning. warning: multiple describeType entries for 'selectedItem' on type 'mx.controls::Com...
The warning you are encountering with the `BindingUtils` and the `selectedItem` property of a `ComboBox` is related to the fact that the property has multiple type descriptors due to the binding system in Flex. The ComboBox component in Flex defines `selectedItem` with a `Bindable` metadata tag, which makes it part of...
4,791
[ { "from": "human", "value": "Does anyone know why when using BindingUtils on the selectedItem property of a ComboBox you get the following warning? Any ideas how to resolve the issue?\nThe binding still works properly, but it would be nice to get rid of the warning.\nwarning: multiple describeType entries f...
In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and Proc.new on the other. What are those differences? Can you give guidelines on how to decide which one to choose? In Ruby 1.9, proc and lambda are different. What's the deal?
In Ruby 1.8, `Proc.new` and `lambda` (along with `proc`) were both ways to create closures, but there were some subtle differences in how they behaved. Here's a summary of those differences, as well as guidelines on which to choose. ### Differences Between `Proc.new`, `proc`, and `lambda` in Ruby 1.8 1. **Return Beha...
2,818
[ { "from": "human", "value": "In Ruby 1.8, there are subtle differences between proc/lambda on the one hand, and Proc.new on the other. \n\nWhat are those differences?\nCan you give guidelines on how to decide which one to choose?\nIn Ruby 1.9, proc and lambda are different. What's the deal?\n\n" }, { ...
I'm just about to make my first trip into the world of JNI (Java Native Interface) to provide file system change notifications from platform specific C/C++ code to Java. That is unless someone suggest some brilliant library for doing this that I've missed. Being new to JNI I've managed to find much documentation on the...
Using JNI to bridge Java and native C/C++ code is a powerful approach, especially when it comes to accessing low-level system functionality like file system change notifications. Here are some thoughts on how to approach the build process using Ant and Make. ### Building Native Libraries 1. **Keep Build Responsibilit...
2,380
[ { "from": "human", "value": "I'm just about to make my first trip into the world of JNI (Java Native Interface) to provide file system change notifications from platform specific C/C++ code to Java. That is unless someone suggest some brilliant library for doing this that I've missed.\nBeing new to JNI I've...
I'm new to SQL Server Reporting Services, and was wondering the best way to do the following: Query to get a list of popular IDs Subquery on each item to get properties from another table Ideally, the final report columns would look like this: [ID] [property1] [property2] [SELECT COUNT(*) ...
Welcome to SQL Server Reporting Services (SSRS)! There are different ways to structure your report, and it's great that you want to compartmentalize your logic. However, using VB functions to perform a subquery for each row is not the most efficient method. Instead, you can achieve your goals with SQL queries and SSRS ...
3,394
[ { "from": "human", "value": "I'm new to SQL Server Reporting Services, and was wondering the best way to do the following:\n\n\nQuery to get a list of popular IDs\nSubquery on each item to get properties from another table\n\n\nIdeally, the final report columns would look like this:\n[ID] [property1] [prope...
My firm have a talented and smart operations staff who are working very hard. I'd like to give them a SQL-execution tool that helps them avoid common, easily-detected SQL mistakes that are easy to make when they are in a hurry. Can anyone suggest such a tool? Details follow. Part of the operations team remit is writing...
To help your operations staff avoid common SQL mistakes when writing complex queries, there are several tools and approaches you can consider that are suitable for MySQL and can provide real-time feedback and error checking: ### 1. **SQL Development Tools with Static Analysis** While you mentioned TOAD, here are some...
3,285
[ { "from": "human", "value": "My firm have a talented and smart operations staff who are working very hard. I'd like to give them a SQL-execution tool that helps them avoid common, easily-detected SQL mistakes that are easy to make when they are in a hurry. Can anyone suggest such a tool? Details follow.\nPa...
Out of the box, in MS Reporting Services, the image element does not allow for the centering of the image itself, when the dimensions are unknown at design time. In other words, the image (if smaller than the dimensions allotted on the design surface) will be anchored to the top left corner, not in the center. My repor...
To center an image in SQL Server Reporting Services (SSRS) when the dimensions are unknown at design time, you can use a combination of a container (such as a Rectangle or a Placeholder) and some formatting options. Here’s how to achieve this: ### Step-by-step Instructions: 1. **Add a Rectangle or Placeholder:** -...
2,871
[ { "from": "human", "value": "Out of the box, in MS Reporting Services, the image element does not allow for the centering of the image itself, when the dimensions are unknown at design time. In other words, the image (if smaller than the dimensions allotted on the design surface) will be anchored to the top...
One of my clients uses McAfee ScanAlert (i.e., HackerSafe). It basically hits the site with about 1500 bad requests a day looking for security holes. Since it demonstrates malicious behavior it is tempting to just block it after a couple bad requests, but maybe I should let it exercise the UI. Is it a true test if I ...
Allowing McAfee ScanAlert (HackerSafe) to complete its scanning process can provide valuable insights into your website's security vulnerabilities. Here are a few points to consider: 1. **Purpose of the Scan**: McAfee ScanAlert is designed to identify security issues in your application, which is beneficial for improv...
4,736
[ { "from": "human", "value": "One of my clients uses McAfee ScanAlert (i.e., HackerSafe). It basically hits the site with about 1500 bad requests a day looking for security holes. Since it demonstrates malicious behavior it is tempting to just block it after a couple bad requests, but maybe I should let it...
Let's say I'm writing a PHP (>= 5.0) class that's meant to be a singleton. All of the docs I've read say to make the class constructor private so the class can't be directly instantiated. So if I have something like this: class SillyDB { private function __construct() { } public static function getConnection...
In your implementation of a singleton class in PHP, the constructor is made private to prevent instantiation of the class from outside the class itself. This is a common design pattern for ensuring that only one instance of the class can exist. To answer your questions: 1. **Are there any cases where `__construct()` ...
2,411
[ { "from": "human", "value": "Let's say I'm writing a PHP (>= 5.0) class that's meant to be a singleton. All of the docs I've read say to make the class constructor private so the class can't be directly instantiated.\nSo if I have something like this:\nclass SillyDB\n{\n private function __construct()\n ...
Can anyone recommend any good add-ons or plugins for Microsoft Visual Studio? Freebies are preferred, but if it is worth the cost then that's fine.
Absolutely! There are numerous add-ons and plugins that can enhance your experience with Microsoft Visual Studio. Here’s a mix of free and paid options worth checking out: ### Free Add-ons/Plugins 1. **Visual Studio IntelliCode**: - Provides AI-assisted recommendations for code completions, based on best practices...
2,479
[ { "from": "human", "value": "Can anyone recommend any good add-ons or plugins for Microsoft Visual Studio?\nFreebies are preferred, but if it is worth the cost then that's fine.\n" }, { "from": "gpt", "value": "Absolutely! There are numerous add-ons and plugins that can enhance your experience w...
Just what the title says, I need to change the password for an existing sql server login and I want to do it via sql script.
To change the password for an existing SQL Server login using a SQL script, you can use the `ALTER LOGIN` statement. Here’s the basic syntax for changing the password: ```sql ALTER LOGIN [YourLoginName] WITH PASSWORD = 'NewPassword'; ``` Replace `[YourLoginName]` with the name of the SQL Server login for which you wa...
5,635
[ { "from": "human", "value": "Just what the title says, I need to change the password for an existing sql server login and I want to do it via sql script.\n" }, { "from": "gpt", "value": "To change the password for an existing SQL Server login using a SQL script, you can use the `ALTER LOGIN` sta...
I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, but I'm just not over the hump yet. How do...
Welcome to the world of Objective-C and Cocoa! Understanding memory management, especially the reference counting model that Cocoa uses, can be a bit daunting at first, but it becomes clearer with practice. Let's break down the concepts of `retain`, `release`, and `autorelease`. ### Reference Counting Basics Cocoa us...
1,120
[ { "from": "human", "value": "I'm just beginning to have a look at Objective-C and Cocoa with a view to playing with the iPhone SDK. I'm reasonably comfortable with C's malloc and free concept, but Cocoa's references counting scheme has me rather confused. I'm told it's very elegant once you understand it, b...
I've inherited a large VB6 app at my current workplace. I'm kinda learning VB6 on the job and there are a number of problems I'm having. The major issue at the moment is I can't figure out how to check if a key exists in a Collection object. Can anyone help?
In VB6, the `Collection` object does not have a built-in method to directly check if a key exists. However, you can use a workaround by trying to access the item with the specified key. If the key does not exist, an error will occur, which you can handle using error handling techniques. Here's a simple way to check if ...
3,830
[ { "from": "human", "value": "I've inherited a large VB6 app at my current workplace. I'm kinda learning VB6 on the job and there are a number of problems I'm having. The major issue at the moment is I can't figure out how to check if a key exists in a Collection object. Can anyone help?\n" }, { "fro...
Lets say I have a Dictionary object: Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>(); Now I want to iterate through the dictionary in reverse order. I can't use a simple for loop because I don't know the keys of the dictionary. A foreach is easy: foreach (SomeObject object in myDictiona...
To iterate through a `Dictionary<TKey, TValue>` in reverse order when you don't know the keys, you can use LINQ to convert the values into a list and then iterate that list in reverse. Here's an example of how to do this: ```csharp using System; using System.Collections.Generic; using System.Linq; public class SomeOb...
3,031
[ { "from": "human", "value": "Lets say I have a Dictionary object:\nDictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();\n\nNow I want to iterate through the dictionary in reverse order. I can't use a simple for loop because I don't know the keys of the dictionary. A foreach is ea...
I need to grab the base64-encoded representation of the ViewState. Obviously, this would not be available until fairly late in the request lifecycle, which is OK. For example, if the output of the page includes: <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODU0Njc5MD...==" /> I need a way...
To capture the ViewState value that is being rendered to the client in an ASP.NET Web Forms application, you can take advantage of the page lifecycle events. Specifically, the `Page.PreRender` event is a good point to access the ViewState before it is sent to the client. Here's a step-by-step guide on how to achieve t...
3,355
[ { "from": "human", "value": "I need to grab the base64-encoded representation of the ViewState. Obviously, this would not be available until fairly late in the request lifecycle, which is OK.\nFor example, if the output of the page includes:\n<input type=\"hidden\" name=\"__VIEWSTATE\" \n id=\"__VIEWSTATE\...
I'm trying to use jQuery to format code blocks, specifically to add a <pre> tag inside the <code> tag: $(document).ready(function() { $("code").wrapInner("<pre></pre>"); }); Firefox applies the formatting correctly, but IE puts the entire code block on one line. If I add an alert alert($("code").html()); I see t...
The issue you're encountering is related to how certain browsers (specifically older versions of Internet Explorer) handle nested HTML elements. According to the HTML specification, the `<code>` tag is an inline element, while `<pre>` is a block element. Nesting block elements inside inline elements can cause unpredict...
4,148
[ { "from": "human", "value": "I'm trying to use jQuery to format code blocks, specifically to add a <pre> tag inside the <code> tag:\n$(document).ready(function() {\n $(\"code\").wrapInner(\"<pre></pre>\");\n});\n\nFirefox applies the formatting correctly, but IE puts the entire code block on one line. If ...
I have an extender control that raises a textbox's OnTextChanged event 500ms after the user has finished typing. The problem with this is that OnTextChanged gets raised when the textbox loses focus, which causes problems (because of the postback). What I'd like to do is give the extender control its own server-side eve...
To achieve your goal of having a server-side event triggered by your extender control after a delay, you can follow these steps to create a custom client-side event and a corresponding server-side event handler. ### Step 1: Create a Custom Extender Control First, create a custom AJAX extender or modify the existing e...
1,821
[ { "from": "human", "value": "I have an extender control that raises a textbox's OnTextChanged event 500ms after the user has finished typing. The problem with this is that OnTextChanged gets raised when the textbox loses focus, which causes problems (because of the postback).\nWhat I'd like to do is give th...
I'm unsure whether the following code would ensure all conditions given in Comparator's Javadoc. class TotalOrder<T> implements Comparator<T> { public boolean compare(T o1, T o2) { if (o1 == o2 || equal(o1, o2)) return 0; int h1 = System.identityHashCode(o1); int h2 = System.identityHashC...
The code provided does not properly implement the `Comparator` interface in Java. There are several issues with the implementation of the `compare` method, which leads to misunderstandings about how comparison should be conducted. 1. **Return Type Mismatch**: The `compare` method in the `Comparator` interface has a re...
1,703
[ { "from": "human", "value": "I'm unsure whether the following code would ensure all conditions given in Comparator's Javadoc. \nclass TotalOrder<T> implements Comparator<T> {\n\n public boolean compare(T o1, T o2) {\n if (o1 == o2 || equal(o1, o2)) return 0;\n\n int h1 = System.identityHash...
How to restrict the maximum number of characters that can be entered into an HTML <textarea>? I'm looking for a cross-browser solution.
To restrict the maximum number of characters that can be entered into an HTML `<textarea>`, you can use the `maxlength` attribute, which is supported in most modern browsers. This is a straightforward and effective way to limit the number of characters a user can enter. Here’s a simple example: ```html <form> <la...
4,030
[ { "from": "human", "value": "How to restrict the maximum number of characters that can be entered into an HTML <textarea>? I'm looking for a cross-browser solution.\n" }, { "from": "gpt", "value": "To restrict the maximum number of characters that can be entered into an HTML `<textarea>`, you ca...
What is the best way to display Flash content in a C# WinForms application? I would like to create a user control (similar to the current PictureBox) that will be able to display images and flash content. It would be great to be able to load the flash content from a stream of sorts rather than a file on disk.
To display Flash content in a C# WinForms application, you can use the Shockwave Flash ActiveX control. This control allows you to embed and play Flash content within your WinForms application. Here’s how you can create a user control that can display both images and Flash content: 1. **Add the Shockwave Flash Active...
3,365
[ { "from": "human", "value": "What is the best way to display Flash content in a C# WinForms application? I would like to create a user control (similar to the current PictureBox) that will be able to display images and flash content.\nIt would be great to be able to load the flash content from a stream of s...
I'm fairly new to ASP.NET and trying to learn how things are done. I come from a C# background so the code-behind portion is easy, but thinking like a web developer is unfamiliar. I have an aspx page that contains a grid of checkboxes. I have a button that is coded via a Button_Click event to collect a list of which ro...
It sounds like you have a situation where you want to gather data from your ASPX page (specifically a grid of checkboxes) and use that data to set a session variable, while simultaneously triggering a modal popup defined in an ASCX control. Since you're working with ASP.NET Web Forms, managing control interactions acro...
2,852
[ { "from": "human", "value": "I'm fairly new to ASP.NET and trying to learn how things are done. I come from a C# background so the code-behind portion is easy, but thinking like a web developer is unfamiliar.\nI have an aspx page that contains a grid of checkboxes. I have a button that is coded via a Button...
Is there a way, when I parse an XML document using lxml, to validate that document against its DTD using an external catalog file? I need to be able to work the fixed attributes defined in a document’s DTD.
Yes, you can validate an XML document against its DTD using the `lxml` library in Python, and you can also specify an external catalog file to resolve the DTD. The `lxml` library has built-in support for validating XML documents with DTDs. To use an external catalog file, you will typically rely on the `lxml.etree` mo...
2,196
[ { "from": "human", "value": "Is there a way, when I parse an XML document using lxml, to validate that document against its DTD using an external catalog file? I need to be able to work the fixed attributes defined in a document’s DTD.\n" }, { "from": "gpt", "value": "Yes, you can validate an ...
I would like to monitor a log file that is being written to by an application. I want to process the file line by line as, or shortly after, it is written. I have not found a way of detecting that a file has been extended after reaching eof. The code needs to work on Mac and PC, and can be in any language, though I am ...
To monitor a log file that is actively being written to, you can use a technique often referred to as "tailing" the file. You can achieve this in both C++ and Perl. Below are implementations in both languages. ### Perl Implementation Perl is particularly well-suited for file handling and text processing. Here’s a sim...
2,046
[ { "from": "human", "value": "I would like to monitor a log file that is being written to by an application. I want to process the file line by line as, or shortly after, it is written. I have not found a way of detecting that a file has been extended after reaching eof.\nThe code needs to work on Mac and PC...
What profilers have you used when working with .net programs, and which would you particularly recommend?
When working with .NET programs, several profilers can be used to analyze performance, memory usage, and other aspects of applications. Here are some of the most common profilers, along with recommendations based on specific use cases: ### 1. **Visual Studio Profiler** - **Use Case**: Integrated profiling for .NET ...
4,071
[ { "from": "human", "value": "What profilers have you used when working with .net programs, and which would you particularly recommend?\n" }, { "from": "gpt", "value": "When working with .NET programs, several profilers can be used to analyze performance, memory usage, and other aspects of applic...
I apologize for asking such a generalized question, but it's something that can prove challenging for me. My team is about to embark on a large project that will hopefully drag together all of the random one-off codebases that have evolved through the years. Given that this project will cover standardizing logical enti...
It sounds like you’re tackling a significant project with a lot of moving parts, and it’s understandable that you’re seeking guidance on structuring your codebase and namespaces effectively. Below are some key principles and recommendations that could help you create a scalable, maintainable architecture for your proje...
332
[ { "from": "human", "value": "I apologize for asking such a generalized question, but it's something that can prove challenging for me. My team is about to embark on a large project that will hopefully drag together all of the random one-off codebases that have evolved through the years. Given that this proj...
What tool would you recommend to detect Java package cyclic dependencies, knowing that the goal is to list explicitly the specific classes involved in the detected 'across-packages cycle'? I know about classycle and JDepend, but they both fail to list the classes involved in a cyclic package dependency. Metrics has an ...
It sounds like you’ve done quite a bit of research already, and I'm glad you found some tools like FindBugs helpful for detecting cyclic dependencies. However, if you're looking for alternatives, here are a few more options you might consider: 1. **SonarQube**: While it's primarily a code quality tool, SonarQube has r...
3,485
[ { "from": "human", "value": "What tool would you recommend to detect Java package cyclic dependencies,\nknowing that the goal is to list explicitly the specific classes involved in the detected 'across-packages cycle'?\nI know about classycle and JDepend, but they both fail to list the classes involved in a...
I have an executable (compiled by someone else) that is hitting an assertion near my code. I work on the code in Visual C++ 2003, but I don't have a project file for this particular executable (the code is used to build many different tools). Is it possible to launch the binary in Visual C++'s debugger and just tell it...
Yes, you can definitely use Visual C++'s debugger to debug an executable, even if you don’t have the original project file, as long as you have the relevant source code. Here's how you can do it: 1. **Prepare the Executable and Source Files**: Make sure you have the executable you want to debug and the corresponding s...
3,171
[ { "from": "human", "value": "I have an executable (compiled by someone else) that is hitting an assertion near my code. I work on the code in Visual C++ 2003, but I don't have a project file for this particular executable (the code is used to build many different tools). Is it possible to launch the binary ...
I've got many, many mp3 files that I would like to merge into a single file. I've used the command line method copy /b 1.mp3+2.mp3 3.mp3 but it's a pain when there's a lot of them and their namings are inconsistent. The time never seems to come out right either.
Merging many MP3 files using the command line can be cumbersome, especially when dealing with inconsistent file naming. Fortunately, there are more efficient methods and tools that can help you achieve this. ### Option 1: Using FFmpeg FFmpeg is a powerful multimedia framework that can handle the merging of audio file...
1,801
[ { "from": "human", "value": "I've got many, many mp3 files that I would like to merge into a single file. I've used the command line method\ncopy /b 1.mp3+2.mp3 3.mp3\n\nbut it's a pain when there's a lot of them and their namings are inconsistent. The time never seems to come out right either.\n" }, ...
Is there a way to fall through multiple case statements without stating case value: repeatedly? I know this works: switch (value) { case 1: case 2: case 3: // Do some stuff break; case 4: case 5: case 6: // Do some different stuff break; default: // Default stuff ...
The syntax you're thinking of, where you can specify multiple case values in a comma-separated format within a `switch` statement, doesn't exist in languages like C, C++, Java, or JavaScript. In these languages, the way to group multiple case statements is by stacking them one after the other, as you’ve shown in your f...
4,782
[ { "from": "human", "value": "Is there a way to fall through multiple case statements without stating case value: repeatedly?\nI know this works:\nswitch (value)\n{\n case 1:\n case 2:\n case 3:\n // Do some stuff\n break;\n case 4:\n case 5:\n case 6:\n // Do some different stuff\...
This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly spamish terminology. Of late, some of the emails I send out programmatically have started being shuffled into people's spam folder automatically...
It's not uncommon for legitimate emails to end up in spam folders, especially when sending programmatically. Here are several strategies you can use to improve your email deliverability and reduce the chances of your important emails, like those containing license keys, being marked as spam: ### 1. **Authenticate Your...
2,283
[ { "from": "human", "value": "This is a tricky one and I've always relied on techniques, such as permission-based emails (i.e. only sending to people you have permission to send to) and not using blatantly spamish terminology.\nOf late, some of the emails I send out programmatically have started being shuffl...
Is it possible to delete an GAE application after it has been created? I made a mistake while typing the name and now have a dummy application that I haven't been able to remove.
Yes, it is possible to delete a Google App Engine (GAE) application after it has been created, but there are some steps you need to follow, and certain conditions apply. ### Steps to Delete a GAE Application 1. **Ensure the Application is Not in Use**: Before you delete an application, make sure that there are no run...
4,305
[ { "from": "human", "value": "Is it possible to delete an GAE application after it has been created?\nI made a mistake while typing the name and now have a dummy application that I haven't been able to remove.\n" }, { "from": "gpt", "value": "Yes, it is possible to delete a Google App Engine (GAE...
I am running OS X 10.5, Ruby 1.8.6, Rails 2.1, sqlite3-ruby 1.2.2 and I get the following error when trying to rake db:migrate on an app that works find connected to MySQL. rake aborted! no such file to load -- sqlite3/database
The error you're encountering suggests that the SQLite3 gem is not properly installed or accessible in your current Ruby environment. Since you're using a relatively older version of Ruby, Rails, and macOS, here are the steps you can take to resolve the issue: 1. **Ensure SQLite3 is installed**: First, make sure that ...
3,214
[ { "from": "human", "value": "I am running \n\nOS X 10.5, \nRuby 1.8.6, \nRails 2.1, \nsqlite3-ruby 1.2.2 \n\nand I get the following error when trying to rake db:migrate on an app that works find connected to MySQL.\n\nrake aborted!\n no such file to load -- sqlite3/database\n\n" }, { "from": "gpt"...
I would like to show some hidden text in a Flex application and have it fade out in a couple of seconds... I have looked into Delay and Pause effects in Flex, but have yet to see an example of how to do this realistically easy effect... anyone now how to do it or have a good resource? Thanks.
In a Flex application, you can achieve the effect of showing hidden text and then fading it out after a few seconds using the `Fade` effect in combination with a `Delay` effect. Here’s a simple example to illustrate how you can implement this functionality: ### Example Code Here is a basic example that demonstrates h...
1,965
[ { "from": "human", "value": "I would like to show some hidden text in a Flex application and have it fade out in a couple of seconds...\nI have looked into Delay and Pause effects in Flex, but have yet to see an example of how to do this realistically easy effect...\nanyone now how to do it or have a good r...
What is the best way to transparently rewrite a URL over an SSL connection with Apache 2.2? Apache 2 does not natively support multiple name-based virtual hosts for an SSL connection and I have heard that mod_rewrite can help with this. I would like to do something like this: I have set up the server so that the sites ...
To achieve transparent URL rewriting in Apache 2.2 with SSL, you can use the `mod_rewrite` module along with a combination of VirtualHost configurations. The goal here is to redirect requests from `dbadmin.example.com` to `secure.example.com/dbadmin` without changing what the user sees in their browser. ### Step 1: En...
2,143
[ { "from": "human", "value": "What is the best way to transparently rewrite a URL over an SSL connection with Apache 2.2?\nApache 2 does not natively support multiple name-based virtual hosts for an SSL connection and I have heard that mod_rewrite can help with this. I would like to do something like this:\n...
Is it possible to undo the changes caused by the following command? If so, how? git reset --hard HEAD~1
The command `git reset --hard HEAD~1` effectively moves your current branch back one commit and discards all changes in the working directory and the staging area. This means that any changes introduced by that last commit will be lost, and the working directory will also reflect the state of the repository as it was a...
3,154
[ { "from": "human", "value": "Is it possible to undo the changes caused by the following command? If so, how?\ngit reset --hard HEAD~1\n\n" }, { "from": "gpt", "value": "The command `git reset --hard HEAD~1` effectively moves your current branch back one commit and discards all changes in the wor...
How would you attach a propertychanged callback to a property that is inherited? Like such: class A { DependencyProperty prop; } class B : A { //... prop.AddListener(PropertyChangeCallback); }
To attach a property changed callback to a dependency property in an inherited class in WPF (Windows Presentation Foundation), you typically use the `PropertyChangedCallback` when you register the dependency property in the base class. However, if the property is defined in the base class, you can override the property...
975
[ { "from": "human", "value": "How would you attach a propertychanged callback to a property that is inherited? Like such:\nclass A {\n DependencyProperty prop;\n}\n\nclass B : A {\n //...\n prop.AddListener(PropertyChangeCallback);\n}\n\n" }, { "from": "gpt", "value": "To attach a property ...
Does anyone know a good way to do this? I need to have simple forms that submit to email without writing a lot of code. These forms will be hosted in content-viewer web parts or similar in MOSS 2007. I'd like to avoid using InfoPath.
If you're using MOSS 2007 and want to create simple forms that submit to email without writing a lot of code, you have a few options: 1. **Use SharePoint Designer**: You can create simple forms using SharePoint Designer. Create a custom ASPX page with a form and use built-in SharePoint functionalities to handle form s...
2,688
[ { "from": "human", "value": "Does anyone know a good way to do this? I need to have simple forms that submit to email without writing a lot of code. These forms will be hosted in content-viewer web parts or similar in MOSS 2007. I'd like to avoid using InfoPath.\n" }, { "from": "gpt", "value"...
I'm working on a web application that needs to prints silently -- that is without user involvement. What's the best way to accomplish this? It doesn't like it can be done with strictly with Javascript, nor Flash and/or AIR. The closest I've seen involves a Java applet. I can understand why it would a Bad Idea for ju...
Printing silently from a web application without user involvement presents various security and functionality challenges, as most modern browsers are designed to prevent any web page from executing such actions to protect user privacy and security. However, since you mentioned that this is for an internal application a...
2,648
[ { "from": "human", "value": "I'm working on a web application that needs to prints silently -- that is without user involvement. What's the best way to accomplish this? It doesn't like it can be done with strictly with Javascript, nor Flash and/or AIR. The closest I've seen involves a Java applet.\nI can...
I am having problems manually looping through xml data that is received via an HTTPService call, the xml looks something like this: <DataTable> <Row> <text>foo</text> </Row> <Row> <text>bar</text> </Row> </DataTable> When the webservice result event is fired I do something like this: f...
The issue you're experiencing arises from the fact that when there's only one `<Row>` node returned, the `Row` property is not an array but a single object. This leads to your code breaking when trying to access `event.result.DataTable.Row[i]`, as `Row` is not an array. To handle this situation gracefully, you can con...
4,999
[ { "from": "human", "value": "I am having problems manually looping through xml data that is received via an HTTPService call, the xml looks something like this: \n<DataTable>\n <Row>\n <text>foo</text>\n </Row>\n <Row>\n <text>bar</text>\n </Row>\n</DataTable>\n\nWhen the webservic...
Is the Sql Server 2008 control available for download? Does it yet support the 2008 RDL schema?
SQL Server 2008 Reporting Services introduced the Report Definition Language (RDL) schema for reports, and it indeed includes enhancements and features that are specific to that version. However, as of my last knowledge update in October 2023, SQL Server 2008 is considered an outdated version, and Microsoft no longer s...
5,551
[ { "from": "human", "value": "Is the Sql Server 2008 control available for download? Does it yet support the 2008 RDL schema?\n" }, { "from": "gpt", "value": "SQL Server 2008 Reporting Services introduced the Report Definition Language (RDL) schema for reports, and it indeed includes enhancement...
I have to use a third-party component without source code. I have the release DLL and release PDB file. Let's call it 'CorporateComponent.dll'. My own code creates objects from this DLL and calls methods on these objects. CorpObject o = new CorpObject(); Int32 result = o.DoSomethingLousy(); While debugging, the method...
The Program Database (PDB) file is a crucial component in the debugging process when working with compiled code, particularly when you don't have access to the source code. Here's what the PDB file does for you and how you can leverage it effectively: ### What the PDB File Does 1. **Symbol Information**: The PDB file...
3,876
[ { "from": "human", "value": "I have to use a third-party component without source code. I have the release DLL and release PDB file. Let's call it 'CorporateComponent.dll'. My own code creates objects from this DLL and calls methods on these objects.\nCorpObject o = new CorpObject();\nInt32 result = o.DoSom...
I have heard that Microsoft SharePoint was used by many companies. Could someone tell me briefly what is SharePoint and why is it popular?
Microsoft SharePoint is a web-based collaboration platform that integrates with Microsoft Office. It is used for document management, storage, collaboration, and content management, allowing teams to create websites for sharing information and managing documents. Key features include: 1. **Document Management**: Share...
5,314
[ { "from": "human", "value": "I have heard that Microsoft SharePoint was used by many companies. Could someone tell me briefly what is SharePoint and why is it popular?\n" }, { "from": "gpt", "value": "Microsoft SharePoint is a web-based collaboration platform that integrates with Microsoft Offic...
What command checks if a directory exists or not within a Bash shell script?
In a Bash shell script, you can check if a directory exists using the `-d` option within an `if` statement. Here’s a simple example of how you can do this: ```bash DIRECTORY="/path/to/directory" if [ -d "$DIRECTORY" ]; then echo "Directory exists." else echo "Directory does not exist." fi ``` In this code: -...
5,776
[ { "from": "human", "value": "What command checks if a directory exists or not within a Bash shell script?\n" }, { "from": "gpt", "value": "In a Bash shell script, you can check if a directory exists using the `-d` option within an `if` statement. Here’s a simple example of how you can do this:\n...
So, in Java, the first line of your constructor HAS to be a call to super... be it implicitly calling super(), or explicitly calling another constructor. What I want to know is, why can't I put a try block around that? My specific case is that I have a mock class for a test. There is no default constructor, but I wan...
You are correct in your understanding of Java's constructor rules and the reasoning behind them. In Java, the first statement of any constructor must be a call to `super()` or another constructor within the same class (via `this()`). This restriction is in place to ensure that an object is fully initialized before any ...
2,907
[ { "from": "human", "value": "So, in Java, the first line of your constructor HAS to be a call to super... be it implicitly calling super(), or explicitly calling another constructor. What I want to know is, why can't I put a try block around that?\nMy specific case is that I have a mock class for a test. ...
In the STL almost all containers have an erase function. The question I have is in a vector, the erase function returns an iterator pointing to the next element in the vector. The map container does not do this. Instead it returns a void. Anyone know why there is this inconsistancy?
The difference in behavior of the `erase` function between `std::vector` and `std::map` (and other associative containers like `std::set`) stems from their respective design and usage patterns. 1. **Iterator and Position Context**: - In `std::vector`, elements are stored in a contiguous block of memory, and the con...
4,274
[ { "from": "human", "value": "In the STL almost all containers have an erase function. The question I have is in a vector, the erase function returns an iterator pointing to the next element in the vector. The map container does not do this. Instead it returns a void. Anyone know why there is this incons...
How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET?
To calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET, you can utilize the `Crc32` class which you may need to implement, as .NET does not provide a built-in CRC32 implementation. Here's a step-by-step guide, including a sample implementation: 1. **Create a Crc32 class**: You'll need to create a clas...
1,880
[ { "from": "human", "value": "How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET?\n" }, { "from": "gpt", "value": "To calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET, you can utilize the `Crc32` class which you may need to implement, as .NET does no...
When can 64-bit writes be guaranteed to be atomic, when programming in C on an Intel x86-based platform (in particular, an Intel-based Mac running MacOSX 10.4 using the Intel compiler)? For example: unsigned long long int y; y = 0xfedcba87654321ULL; /* ... a bunch of other time-consuming stuff happens... */ y = 0x1234...
When programming in C on an Intel x86-based platform, such as an Intel-based Mac running MacOSX 10.4, you can generally expect that 64-bit writes to aligned variables will be atomic. However, there are some important details to consider regarding atomicity and thread safety: 1. **Alignment**: For a 64-bit variable (li...
4,091
[ { "from": "human", "value": "When can 64-bit writes be guaranteed to be atomic, when programming in C on an Intel x86-based platform (in particular, an Intel-based Mac running MacOSX 10.4 using the Intel compiler)? For example:\nunsigned long long int y;\ny = 0xfedcba87654321ULL;\n/* ... a bunch of other t...
In my code fprintf returns successfully by returning the number of bytes written in STREAM, but in the actual file the string I wrote is not there.
When using `fprintf` in C (or C++), if the function returns a positive number indicating the number of bytes written, but the actual file does not contain the expected string, there may be a few potential issues to consider: 1. **File Buffering**: `fprintf` writes to a buffer rather than immediately writing to the fil...
2,700
[ { "from": "human", "value": "In my code fprintf returns successfully by returning the number of bytes written in STREAM, but in the actual file the string I wrote is not there.\n" }, { "from": "gpt", "value": "When using `fprintf` in C (or C++), if the function returns a positive number indicati...
When doing calculations on very large numbers where integral data types such as double or int64 falls short, a separate class to handle such large numbers may be needed. Does anyone care to offer an efficient algorithm on how best to do this?
To handle very large numbers beyond the limits of standard integral data types (like `int64` or `double`), you can create a class to represent large numbers using a string or an array of digits. Below is a brief overview of an efficient algorithm to implement basic operations (addition, subtraction, multiplication, and...
2,424
[ { "from": "human", "value": "When doing calculations on very large numbers where integral data types such as double or int64 falls short, a separate class to handle such large numbers may be needed. \nDoes anyone care to offer an efficient algorithm on how best to do this?\n" }, { "from": "gpt", ...
I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3: proc2 -> stdout / proc1 \ proc3 -> stdout I tried proc1 | (proc2 & proc3) but it doesn't seem to work, i.e. echo 123 | (tr 1 a & tr 1 b) writes b23 to stdout instead of a23 b23
To redirect the stdout of a process to two separate processes simultaneously, you can use a technique involving a `tee` command, which is designed to split the output into multiple streams. Here's how you can achieve that with your `proc1`, `proc2`, and `proc3` setup: ```bash echo 123 | tee >(tr 1 a) | tr 1 b ``` ###...
2,693
[ { "from": "human", "value": "I'd like to redirect the stdout of process proc1 to two processes proc2 and proc3:\n proc2 -> stdout\n /\n proc1\n \\ \n proc3 -> stdout\n\nI tried\n proc1 | (proc2 & proc3)\n\nbut it doesn't seem to work, i.e.\n echo 123 | (tr 1 a & tr 1 b)\n\nwrites...
I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it?
A `NoSuchMethodError` in Java indicates that your program is trying to call a method that does not exist at runtime. This error typically occurs due to a mismatch between the compiled code and the runtime environment. Here are some common reasons for this error and how to fix it: 1. **Version Mismatch**: - You migh...
2,962
[ { "from": "human", "value": "I'm getting a NoSuchMethodError error when running my Java program. What's wrong and how do I fix it?\n" }, { "from": "gpt", "value": "A `NoSuchMethodError` in Java indicates that your program is trying to call a method that does not exist at runtime. This error typ...
How can I left-align the numbers in an ordered list? 1. an item // skip some items for brevity 9. another item 10. notice the 1 is under the 9, and the item contents also line up Change the character after the number in an ordered list? 1) an item Also is there a CSS solution to change from numbers to alphabetic/r...
To left-align the numbers in an ordered list and achieve a consistent appearance for the items, you can use CSS to customize the display. Here's how you can do it: ### Left-aligning Numbers in an Ordered List To ensure that the numbers in your ordered list are left-aligned and that the items line up correctly, you can...
791
[ { "from": "human", "value": "How can I left-align the numbers in an ordered list?\n1. an item\n// skip some items for brevity \n9. another item\n10. notice the 1 is under the 9, and the item contents also line up\n\nChange the character after the number in an ordered list?\n1) an item\n\nAlso is there a C...
How do I set the symbol for the angle or annuity operation in LaTeX? Specifically, this is the actuarial a angle s = (1-vs)/i.
In LaTeX, you can use the `\angle` command to represent the angle symbol (∠), but for the specific notation used in actuarial science for the angle or annuity operation, it's common to define a custom command to ensure it looks just right. To set up the notation for the angle or annuity operation (for example, the sym...
5,667
[ { "from": "human", "value": "How do I set the symbol for the angle or annuity operation in LaTeX? Specifically, this is the actuarial a angle s = (1-vs)/i.\n" }, { "from": "gpt", "value": "In LaTeX, you can use the `\\angle` command to represent the angle symbol (∠), but for the specific notatio...
For example: >>> x = [1, 1, 2, 'a', 'a', 3] >>> unique(x) [1, 2, 'a', 3] Assume list elements are hashable. Clarification: The result should keep the first duplicate in the list. For example, [1, 2, 3, 2, 3, 1] becomes [1, 2, 3].
To create a function `unique` that returns a list of unique elements while keeping the first occurrence of each element, you can use the following approach: 1. Initialize an empty list to store the unique elements. 2. Use a set to keep track of elements that have already been encountered. 3. Iterate through the input ...
5,359
[ { "from": "human", "value": "For example:\n>>> x = [1, 1, 2, 'a', 'a', 3]\n>>> unique(x)\n[1, 2, 'a', 3]\n\nAssume list elements are hashable.\nClarification: The result should keep the first duplicate in the list. For example, [1, 2, 3, 2, 3, 1] becomes [1, 2, 3].\n" }, { "from": "gpt", "value"...
I've been looking for a decent guide to Haskell for some time, but haven't been able to find one that seems interesting enough to read through and/or makes sense. I've had prior exposure to Haskell a few years back, but I can't remember much about it. I remember the "Aha!"-feeling was incredible when I finally got it, ...
It's great to hear that you're interested in rediscovering Haskell! There are several resources that can help rekindle that "Aha!" feeling you experienced before. Here’s a curated list of guides and books that should be both interesting and helpful: ### Online Resources 1. **Haskell.org**: The official Haskell websit...
2,236
[ { "from": "human", "value": "I've been looking for a decent guide to Haskell for some time, but haven't been able to find one that seems interesting enough to read through and/or makes sense.\nI've had prior exposure to Haskell a few years back, but I can't remember much about it. I remember the \"Aha!\"-fe...
The default check-in action for a work-item is "resolve". I'd like to set it to "associate" so that this work item isn't automaticaly closed if I check-in stuff too fast. How can I do that?
To change the default check-in action for a work item from "resolve" to "associate," you'll typically need to adjust the settings in your version control system or project management tool. Here’s a general guide on how to do this, though specific steps may vary depending on the tool you are using (like Azure DevOps, Ji...
3,488
[ { "from": "human", "value": "The default check-in action for a work-item is \"resolve\". I'd like to set it to \"associate\" so that this work item isn't automaticaly closed if I check-in stuff too fast. How can I do that?\n" }, { "from": "gpt", "value": "To change the default check-in action fo...
Every time I create an object that has a collection property I go back and forth on the best way to do it? public property with a getter that returns a reference to private variable explicit get_ObjList and set_ObjList methods that return and create new or cloned objects every time explicit get_ObjList that returns an...
When designing your class with a collection property, you have a variety of options, each with its own trade-offs regarding encapsulation, performance, memory management, and serialization. Let's break down your options, their implications, and provide some guidance based on common design principles. ### 1. Public Pro...
2,520
[ { "from": "human", "value": "Every time I create an object that has a collection property I go back and forth on the best way to do it?\n\npublic property with a getter that\nreturns a reference to private variable\nexplicit get_ObjList and set_ObjList\nmethods that return and create new or cloned\nobjects ...
I have seen two ways of implementing DAO-DVO design. 1) DVO are objects and DAOs are instantiated using factories i.e DAOs are also objects 2) DVOs are again objects but in this case, DAOs are classes which contain only static methods which accept DVOs to perform tasks. I was wondering which way is better and more scal...
The choice between using instantiable DAOs (Data Access Objects) as objects versus using DAOs as static classes with static methods depends on various factors, including your project's requirements, architectural preferences, and the complexity of your application. Here’s a breakdown of the pros and cons of each approa...
1,288
[ { "from": "human", "value": "I have seen two ways of implementing DAO-DVO design.\n1) DVO are objects and DAOs are instantiated using factories i.e DAOs are also objects\n2) DVOs are again objects but in this case, DAOs are classes which contain only static methods which accept DVOs to perform tasks.\nI was...
I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet. Using TCPTrace I was able to get the soap packet passed to the web s...
Yes, you can test your web service using the raw SOAP request by sending it directly to the service. There are several tools you can use to achieve this. Here are a few options: ### 1. Postman Postman is a versatile API testing tool that allows you to send various types of requests, including SOAP requests. 1. Open P...
1,127
[ { "from": "human", "value": "I have a web service that I created in C# and a test harness that was provided by my client. Unfortunately my web service doesn't seem to be parsing the objects created by the test harness. I believe the problem lies with serializing the soap packet. \nUsing TCPTrace I was able ...
We are in the initial planning stages of building out a mobile site for one of our clients. This mobile site will be in addition to the main site that we have already built for them. We've determined that the content is going to be a small subsection of the main site and will target the main audience that is expected...
WAP (Wireless Application Protocol) and WML (Wireless Markup Language) are indeed considered technologies of the past, especially with the advent of modern smartphones like the iPhone and Android devices that can render standard HTML, CSS, and JavaScript quite effectively. Here's how you can approach building a mobile ...
1,755
[ { "from": "human", "value": "We are in the initial planning stages of building out a mobile site for one of our clients. This mobile site will be in addition to the main site that we have already built for them. We've determined that the content is going to be a small subsection of the main site and will ...
I would like the version property of my application to be incremented for each build but I'm not sure on how to enable this functionality in Visual Studio (2005/2008). I have tried to specify the AssemblyVersion as 1.0.* but it doesn't get me exactly what I want. I'm also using a settings file and in earlier attempts ...
To achieve automatic version incrementing in your application built with Visual Studio 2005 or 2008, and to maintain a user-friendly versioning format, you can use the following approach: ### Understanding Versioning In .NET, the assembly version consists of four parts: - **Major Version**: Incremented for significa...
2,829
[ { "from": "human", "value": "I would like the version property of my application to be incremented for each build but I'm not sure on how to enable this functionality in Visual Studio (2005/2008). I have tried to specify the AssemblyVersion as 1.0.* but it doesn't get me exactly what I want. \nI'm also usin...
I've got a database server that I am unable to connect to using the credentials I've been provided. However, on the staging version of the same server, there's a linked server that points to the production database. Both the staging server and the linked server have the same schema. I've been reassured that I should ex...
To work with linked servers using an ORM like Subsonic, you typically need to interact with the linked server through the context of the main database connection, which means you won't be able to specify a separate connection string directly for the linked server within Subsonic itself. However, there are a couple of ...
310
[ { "from": "human", "value": "I've got a database server that I am unable to connect to using the credentials I've been provided. However, on the staging version of the same server, there's a linked server that points to the production database. Both the staging server and the linked server have the same sch...
Can anyone recommend some good resources that highlight the differences between Oracle and the AS/400 database? I am trying to help someone with a lot of AS/400 experience implement an Oracle installation, and they need some guidance. A book or online resource would be ideal.
Certainly! Transitioning from AS/400 (now known as IBM i) to Oracle can involve several differences in terms of database architecture, SQL dialects, and tools. Here are some recommended resources that can help bridge the gap: ### Books 1. **"Oracle Database 12c SQL" by Jason Price** - This book provides a comprehen...
3,593
[ { "from": "human", "value": "Can anyone recommend some good resources that highlight the differences between Oracle and the AS/400 database?\nI am trying to help someone with a lot of AS/400 experience implement an Oracle installation, and they need some guidance.\nA book or online resource would be ideal.\...
I am working on a program that needs to create a multiple temporary folders for the application. These will not be seen by the user. The app is written in VB.net. I can think of a few ways to do it such as incremental folder name or random numbered folder names, but I was wondering, how other people solve this problem?...
Creating temporary folders in a VB.NET application can be done in various ways, and the method you choose can depend on your specific requirements such as security, uniqueness, and ease of management. Below are some common approaches to creating temporary folders, along with a recommended method. ### Common Approaches...
1,382
[ { "from": "human", "value": "I am working on a program that needs to create a multiple temporary folders for the application. These will not be seen by the user. The app is written in VB.net. I can think of a few ways to do it such as incremental folder name or random numbered folder names, but I was wonder...
What is the best way to sanitize user input for a Python-based web application? Is there a single function to remove HTML characters and any other necessary characters combinations to prevent an XSS or SQL injection attack?
Sanitizing user input is crucial for preventing security vulnerabilities such as Cross-Site Scripting (XSS) and SQL Injection in web applications. However, there is no single function that can comprehensively sanitize input for all possible contexts. The approach you take will depend on the specific context of your app...
1,937
[ { "from": "human", "value": "What is the best way to sanitize user input for a Python-based web application? Is there a single function to remove HTML characters and any other necessary characters combinations to prevent an XSS or SQL injection attack?\n" }, { "from": "gpt", "value": "Sanitizing...
I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show. Is there a good way to hide it without resorting to silly "width = 0" sort of games? Or perhaps there's a generic way to walk through the parts of a composite control like this and hide individual p...
In ASP.NET 2.0, the `ChangePassword` control is a composite control that contains several child controls, including the "Cancel" button. While there's no direct property to hide the Cancel button, you can use the control's `FindControl` method to access and hide the specific button programmatically. Here’s a way to do...
4,232
[ { "from": "human", "value": "I'm considering using the ChangePassword control on an ASP.NET 2.0 Webform. I don't want the 'cancel' button to show.\nIs there a good way to hide it without resorting to silly \"width = 0\" sort of games? \nOr perhaps there's a generic way to walk through the parts of a compo...
I am trying to create a rather simple effect on a set of images. When an image doesn't have the mouse over it, I'd like it to have a simple, gray border. When it does have an image over it, I'd like it to have a different, "selected", border. The following CSS works great in Firefox: .myImage a img { border: 1px ...
It sounds like you're running into a common issue with Internet Explorer when dealing with border styles on images. A workaround is to apply the border style to the anchor (`<a>`) element instead of directly to the image. Here’s how you can modify your CSS to achieve the desired effect: ```css .myImage a { display...
4,943
[ { "from": "human", "value": "I am trying to create a rather simple effect on a set of images. When an image doesn't have the mouse over it, I'd like it to have a simple, gray border. When it does have an image over it, I'd like it to have a different, \"selected\", border.\nThe following CSS works great i...
Using NSURLRequest, I am trying to access a web site that has an expired certificate. When I send the request, my connection:didFailWithError delegate method is invoked with the following info: -1203, NSURLErrorDomain, bad server certificate My searches have only turned up one solution: a hidden class method in NSURLR...
Using an expired or self-signed certificate can be a common scenario in development and testing environments, but it's important to handle it correctly in your production apps to avoid security vulnerabilities. As of iPhone OS 3.0, you can implement your own `NSURLConnectionDelegate` to handle SSL authentication challe...
2,206
[ { "from": "human", "value": "Using NSURLRequest, I am trying to access a web site that has an expired certificate. When I send the request, my connection:didFailWithError delegate method is invoked with the following info:\n-1203, NSURLErrorDomain, bad server certificate\n\nMy searches have only turned up o...
There is a request to make the SO search default to an AND style functionality over the current OR when multiple terms are used. The official response was: not as simple as it sounds; we use SQL Server 2005's FREETEXT() function, and I can't find a way to specify AND vs. OR -- can you? So, is there a way? There are a...
In SQL Server, the `FREETEXT()` function is designed to search for words that match the meaning of the specified string, using an underlying full-text search feature. As you noted, `FREETEXT()` inherently uses an OR logic, meaning that it will return results that match any of the words in the search string. If you wan...
4,130
[ { "from": "human", "value": "There is a request to make the SO search default to an AND style functionality over the current OR when multiple terms are used.\nThe official response was:\n\nnot as simple as it sounds; we use SQL Server 2005's FREETEXT() function, and I can't find a way to specify AND vs. OR ...
I know I need to have (although I don't know why) a GROUP BY clause on the end of a SQL query that uses any aggregate functions like count, sum, avg, etc: SELECT count(userID), userName FROM users GROUP BY userName When else would GROUP BY be useful, and what are the performance ramifications?
The `GROUP BY` clause in SQL is essential whenever you want to aggregate results based on specific columns. Let's break down when it's useful and its performance implications. ### When to Use `GROUP BY` 1. **Aggregating Data**: - You typically use `GROUP BY` when you want to compute aggregate values (like `SUM`, `...
2,434
[ { "from": "human", "value": "I know I need to have (although I don't know why) a GROUP BY clause on the end of a SQL query that uses any aggregate functions like count, sum, avg, etc:\nSELECT count(userID), userName\nFROM users\nGROUP BY userName\n\nWhen else would GROUP BY be useful, and what are the perfo...
Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding thread on each core. So, when I run the program ...
To implement parallel processing in C# for a computationally expensive task like encoding WAV files to MP3, you can use the `Parallel` class from the `System.Threading.Tasks` namespace, which simplifies working with multithreading. Here’s how you can determine the number of available CPU cores and use that information...
2,697
[ { "from": "human", "value": "Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding thread ...
What is the best method for including a CSS or Javascript file for a specific node in Drupal 6. I want to create a page on my site that has a little javascript application running, so the CSS and javascript is specific to that page and would not want to be included in other page loads at all.
In Drupal 6, you can include specific CSS and JavaScript files for individual nodes or pages by implementing hook_page_alter() or hook_node_view() in a custom module or theme. Here's how you can do it: ### Using hook_page_alter() This method allows you to add scripts or styles to the entire page based on conditions. ...
3,236
[ { "from": "human", "value": "What is the best method for including a CSS or Javascript file for a specific node in Drupal 6.\nI want to create a page on my site that has a little javascript application running, so the CSS and javascript is specific to that page and would not want to be included in other pag...
What is the fastest method of parsing an XML file in C#? I'm using .Net 2.0
In .NET 2.0, the fastest method of parsing XML files is typically to use the `XmlReader` class. This class provides a fast, forward-only, read-only way to process XML data. It is more efficient than using `XmlDocument` or `XDocument`, particularly for large XML files, because it does not load the entire document into m...
1,007
[ { "from": "human", "value": "What is the fastest method of parsing an XML file in C#? I'm using .Net 2.0 \n" }, { "from": "gpt", "value": "In .NET 2.0, the fastest method of parsing XML files is typically to use the `XmlReader` class. This class provides a fast, forward-only, read-only way to pr...
I am looking for a tool that can detect malicious requests (such as obvious SQL injection gets or posts) and will immediately ban the IP address of the requester/add to a blacklist. I am aware that in an ideal world our code should be able to handle such requests and treat them accordingly, but there is a lot of value ...
There are several tools and approaches available for detecting and blocking malicious requests such as SQL injection attempts at a higher level than your application stack. Here are some options that you can consider for a cross-platform solution: ### 1. Web Application Firewalls (WAF) WAFs are designed to monitor, fi...
99
[ { "from": "human", "value": "I am looking for a tool that can detect malicious requests (such as obvious SQL injection gets or posts) and will immediately ban the IP address of the requester/add to a blacklist. I am aware that in an ideal world our code should be able to handle such requests and treat them ...
I.e., a web browser client would be written in C++ !!!
Yes, a web browser client can indeed be written in C++. In fact, several well-known web browsers and their components have been developed using C++. For example: 1. **Chromium**: The open-source project behind Google Chrome and Microsoft Edge is primarily written in C++. It handles rendering, networking, and many othe...
6,140
[ { "from": "human", "value": "I.e., a web browser client would be written in C++ !!!\n" }, { "from": "gpt", "value": "Yes, a web browser client can indeed be written in C++. In fact, several well-known web browsers and their components have been developed using C++. For example:\n\n1. **Chromium*...
I need to validate a date/time field on a webpage but want it to do it without reloading the page and would like 'instant' feedback for the users. What's the best/easiest solution. BTW: easiest scores 65% of total points Edit: What if best was 65% of total points?
To validate a date/time field on a webpage without reloading the page and to provide instant feedback to users, you can use JavaScript, specifically with the help of HTML and CSS for the UI. Here’s a simple and effective approach that balances both ease and effectiveness. ### Solution Overview: 1. **HTML**: Create an ...
493
[ { "from": "human", "value": "I need to validate a date/time field on a webpage but want it to do it without reloading the page and would like 'instant' feedback for the users.\nWhat's the best/easiest solution.\nBTW: easiest scores 65% of total points\nEdit:\nWhat if best was 65% of total points?\n" }, ...
I'm developing a Linux application that has its own file format. I want my app to open when you double-click on those files. How can I register a file extension and associate it with my application on Linux? I'm looking for a way that is standard (works with GNOME and KDE based systems) and can be done automatic when m...
To associate a custom file extension with your Linux application and ensure it opens automatically when a user double-clicks on files of that type, you can follow the standard procedure of creating a desktop entry and registering your file type. This process typically involves creating a `.desktop` file and MIME type r...
2,755
[ { "from": "human", "value": "I'm developing a Linux application that has its own file format. I want my app to open when you double-click on those files.\nHow can I register a file extension and associate it with my application on Linux? I'm looking for a way that is standard (works with GNOME and KDE based...
What's the best way to get the contents of the mixed body element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after. The code as written almost does what I want, but includes the...
To extract the contents of the `<body>` element without the surrounding `<body>` tags, you can use the `Element` method to retrieve the element and then use the `CreateReader` method to read its contents as an XML string. After that, you can use the `ReadOuterXml` method to get only the inner content without the outer ...
3,123
[ { "from": "human", "value": "What's the best way to get the contents of the mixed body element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The XmlElement type has the InnerXml property which is exactly what I'm after.\nThe code as written...
Is there a command that would allow me to check if the string "xyz" was ever in file foo.c in the repository and print which revisions they were found in?
Yes, you can use the `git` command to check the history of a specific file in a Git repository and search for a string within that file's revisions. Here's how you can do it: 1. Open your terminal (or command prompt). 2. Navigate to your Git repository where `foo.c` is located. 3. Use the following command: ```bash g...
5,169
[ { "from": "human", "value": "Is there a command that would allow me to check if the string \"xyz\" was ever in file foo.c in the repository and print which revisions they were found in? \n" }, { "from": "gpt", "value": "Yes, you can use the `git` command to check the history of a specific file ...
I'm curious to hear the experiences of those who are currently running their SVN server on Windows. Jeff Atwood has a post on how to setup SVN as a Windows service. It's a great first step, but it doesn't touch on other topics, such as: What to use for a web-based repository browser? WebSVN can work on Windows, but i...
Running an SVN server on Windows can indeed present some unique challenges and opportunities. Here are some tips and insights based on experiences shared by others in the community: ### 1. Web-Based Repository Browsers While WebSVN is a popular choice, there are alternatives that might offer a more aesthetically pleas...
1,037
[ { "from": "human", "value": "I'm curious to hear the experiences of those who are currently running their SVN server on Windows. \nJeff Atwood has a post on how to setup SVN as a Windows service. It's a great first step, but it doesn't touch on other topics, such as:\n\nWhat to use for a web-based repositor...
I'm drawing old school (unthemed - themed radios are a whole other problem) radio buttons myself using DrawFrameControl: DrawFrameControl(dc, &rectRadio, DFC_BUTTON, isChecked() ? DFCS_BUTTONRADIO | DFCS_CHECKED : DFCS_BUTTONRADIO); I've never been able to figure out a sure fire way to figure out what to pass for the ...
To get the correct size for drawing radio buttons (or any other standard control), you can use the `GetSystemMetrics` function in the Windows API, which retrieves the system metrics or system configuration settings. For radio buttons, you typically want to use the `SM_CXVSCROLL` or `SM_CYVSCROLL` system metrics to get ...
3,237
[ { "from": "human", "value": "I'm drawing old school (unthemed - themed radios are a whole other problem) radio buttons myself using DrawFrameControl:\nDrawFrameControl(dc, &rectRadio, DFC_BUTTON, isChecked() ? DFCS_BUTTONRADIO | DFCS_CHECKED : DFCS_BUTTONRADIO);\n\nI've never been able to figure out a sure ...
All of my Visio experience is with LAN/WAN documentation. I recently had a desire to visualize the relationship between objects in the Nagios configuration and I realized I didn't know how to do it properly and moved on to something more important. I was reading the responses to this thread and realized this is somet...
Documenting object relationships in Visio can be quite effective for visualizing complex configurations like those found in Nagios or other software setups. Here are some tips and best practices that you might find useful for your task: ### 1. Choosing the Right Template: - **Flowchart Template**: A flowchart can be a...
3,813
[ { "from": "human", "value": "All of my Visio experience is with LAN/WAN documentation. I recently had a desire to visualize the relationship between objects in the Nagios configuration and I realized I didn't know how to do it properly and moved on to something more important. I was reading the responses ...
Programmatic solution of course...
It seems like you're looking for a programmatic solution for a particular problem or task, but you haven't specified the exact requirements or the context of the problem you're facing. Could you please provide more details? For example: - What is the specific task or problem you're trying to solve? - What programming ...
6,333
[ { "from": "human", "value": "Programmatic solution of course...\n" }, { "from": "gpt", "value": "It seems like you're looking for a programmatic solution for a particular problem or task, but you haven't specified the exact requirements or the context of the problem you're facing. Could you plea...
Is there a pattern using Linq to dynamically create a filter? I have the need to create custom filtering on a list, in the past I would just dynamically create the SQL...it doesn't seem like this is possible with Linq.
Yes, it is possible to create dynamic filters using LINQ, although the approach differs from constructing SQL queries directly. You can accomplish this by building an `IQueryable` or an `IEnumerable` dynamically based on your filtering criteria. Below are a few methods to create dynamic filters with LINQ. ### Using Ex...
2,481
[ { "from": "human", "value": "Is there a pattern using Linq to dynamically create a filter?\nI have the need to create custom filtering on a list, in the past I would just dynamically create the SQL...it doesn't seem like this is possible with Linq.\n" }, { "from": "gpt", "value": "Yes, it is pos...
I'm currently evaluating the MSF for CMMI process template under TFS for use on my development team, and I'm having trouble understanding the need for separate bug and change request work item types. I understand that it is beneficial to be able to differentiate between bugs (errors) and change requests (changing requi...
It's great that you're evaluating the MSF for CMMI process template and thinking critically about how to optimize your work item management in TFS. Let's unpack your questions regarding the separation of bugs and change requests and clarify the intended workflow. ### Benefits of Separate Work Item Types 1. **Clarity ...
2,913
[ { "from": "human", "value": "I'm currently evaluating the MSF for CMMI process template under TFS for use on my development team, and I'm having trouble understanding the need for separate bug and change request work item types.\nI understand that it is beneficial to be able to differentiate between bugs (e...
Can I get a 'when to use' for these and others? <% %> <%# EVAL() %> Thanks
Certainly! In ASP.NET Web Forms, there are different syntax options for embedding code in markup. The most common ones include `<% %>`, `<%# %>`, and `<%= %>`. Here’s a brief overview of when to use each: ### 1. `<% %>` (Code Block) - **When to use:** This syntax is used to execute server-side code. You use it when yo...
1,679
[ { "from": "human", "value": "Can I get a 'when to use' for these and others? \n<% %>\n<%# EVAL() %>\n\nThanks\n" }, { "from": "gpt", "value": "Certainly! In ASP.NET Web Forms, there are different syntax options for embedding code in markup. The most common ones include `<% %>`, `<%# %>`, and `<%...
Recently I have been having issues with Firefox 3 on Ubuntu Hardy Heron. I will click on a link and it will hang for a while. I don't know if its a bug in Firefox 3 or a page running too much client side JavaScript, but I would like to try and debug it a bit. So, my question is "is there a way to have some kind of pro...
Firefox 3 is quite an old version, and it may not support some of the newer features and tools available in later versions. However, you can still try a few things to debug the performance issues you're facing. ### 1. **Use about:performance** In Firefox 57 and later, there's a built-in tool called `about:performance`...
4,083
[ { "from": "human", "value": "Recently I have been having issues with Firefox 3 on Ubuntu Hardy Heron.\nI will click on a link and it will hang for a while. I don't know if its a bug in Firefox 3 or a page running too much client side JavaScript, but I would like to try and debug it a bit.\nSo, my question ...
What tools would you recommend for setting up CI for build and deployment of multiple websites built on DotNetNuke using SVN for source control? We are currently looking at configuring Cruise Control to work with NAnt, NUnit, NCover and Trac as a test case. What other combinations would worth investigating? We have fu...
Setting up a Continuous Integration (CI) system for DotNetNuke (DNN) websites using SVN for source control is a great step towards improving your development workflow. Here are some tools and approaches you might consider, in addition to the ones you've already mentioned (CruiseControl, NAnt, NUnit, NCover, and Trac): ...
2,474
[ { "from": "human", "value": "What tools would you recommend for setting up CI for build and deployment of multiple websites built on DotNetNuke using SVN for source control? \nWe are currently looking at configuring Cruise Control to work with NAnt, NUnit, NCover and Trac as a test case. What other combinat...
I am trying to be a "good" programmer and have unit tests for my ColdFusion application but haven't been able to find a code coverage tool that can tie into the test that I'm using. For those of you who do unit tests on your ColdFusion code, how have you approached this problem?
Unit testing in ColdFusion can indeed be a challenge, especially when it comes to measuring code coverage. However, there are several tools and methodologies you can use to effectively manage unit tests and achieve code coverage in your ColdFusion applications. Here are a few approaches and tools you can consider: ##...
1,559
[ { "from": "human", "value": "I am trying to be a \"good\" programmer and have unit tests for my ColdFusion application but haven't been able to find a code coverage tool that can tie into the test that I'm using. For those of you who do unit tests on your ColdFusion code, how have you approached this proble...
Everyone I work with is obsessed with the data-centric approach to enterprise development and hates the idea of using custom collections/objects. What is the best way to convince them otherwise?
Convincing your colleagues to consider using custom collections or objects in a data-centric approach requires a blend of persuasive communication, demonstrating value, and addressing their concerns. Here are some strategies you can employ: ### 1. Understand Their Perspective - **Listen to Concerns:** Understand why y...
1,104
[ { "from": "human", "value": "Everyone I work with is obsessed with the data-centric approach to enterprise development and hates the idea of using custom collections/objects. What is the best way to convince them otherwise?\n" }, { "from": "gpt", "value": "Convincing your colleagues to consider...
Are there any handy general items you put in your .procmailrc file?
Certainly! The `.procmailrc` file is a configuration file for Procmail, a popular email processing tool that can filter and sort incoming emails. Here are some handy general items you might consider including in your `.procmailrc` file: ### Basic Structure ```procmail # Set the default mailbox DEFAULT=$HOME/Maildir/ ...
2,345
[ { "from": "human", "value": "Are there any handy general items you put in your .procmailrc file?\n" }, { "from": "gpt", "value": "Certainly! The `.procmailrc` file is a configuration file for Procmail, a popular email processing tool that can filter and sort incoming emails. Here are some handy ...
I want to embed a wikipedia article into a page but I don't want all the wrapper (navigation, etc.) that sits around the articles. I saw it done here: http://www.dayah.com/periodic/. Click on an element and the iframe is displayed and links to the article only (no wrapper). So how'd they do that? Seems like JavaScr...
To achieve an embedded Wikipedia article without the surrounding navigation or wrapper, you can use the Wikipedia API to retrieve only the content you need. Here’s a basic approach to accomplish this: 1. **Use Wikipedia's API**: You can fetch the content of a Wikipedia page in a format that excludes the surrounding la...
3,326
[ { "from": "human", "value": "I want to embed a wikipedia article into a page but I don't want all the wrapper (navigation, etc.) that sits around the articles. I saw it done here: http://www.dayah.com/periodic/. Click on an element and the iframe is displayed and links to the article only (no wrapper). S...
I’m creating a UserControl for a rich TreeView (one that has context menus for renaming nodes, adding child nodes, etc.). I want to be able to use this control to manage or navigate any hierarchical data structures I will create. I currently have it working for any data structure that implements the following interface...
To achieve the functionality you desire in your `RichTreeView` UserControl, you'll want to provide properties that allow the consumer of your UserControl to specify the names of the properties to bind to for the header and children. This can be done through dependency properties, which will enable you to dynamically se...
2,021
[ { "from": "human", "value": "I’m creating a UserControl for a rich TreeView (one that has context menus for renaming nodes, adding child nodes, etc.). I want to be able to use this control to manage or navigate any hierarchical data structures I will create. I currently have it working for any data structur...
Is there an easy way to produce MSDN-style documentation from the Visual Studio XML output? I'm not patient enough to set up a good xslt for it because I know I'm not the first person to cross this bridge. Also, I tried setting up sandcastle recently, but it really made my eyes cross. Either I was missing something ...
If you're looking for a simpler way to generate MSDN-style documentation from XML comments in your C# code without delving into the complexities of Sandcastle, you have a few alternatives that might fit your needs better. Here are some options: ### 1. **DocFX** DocFX is a documentation generation tool that can easily ...
3,089
[ { "from": "human", "value": "Is there an easy way to produce MSDN-style documentation from the Visual Studio XML output?\nI'm not patient enough to set up a good xslt for it because I know I'm not the first person to cross this bridge. \nAlso, I tried setting up sandcastle recently, but it really made my e...
CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution that works well with a version control system such as Subversion. Some solu...
To achieve effective caching for CSS and JavaScript files while ensuring that users receive updates automatically without clearing their browser cache, using a versioning system is a great approach. Below, I outline a solution that involves using Subversion (SVN) revision numbers and dynamically appending this versioni...
948
[ { "from": "human", "value": "CSS and Javascript files don't change very often, so I want them to be cached by the web browser. But I also want the web browser to see changes made to these files without requiring the user to clear their browser cache. Also want a solution that works well with a version contr...
Some things look strange to me: What is the distinction between 0.0.0.0, 127.0.0.1, and [::]? How should each part of the foreign address be read (part1:part2)? What does a state Time_Wait, Close_Wait mean? etc. Could someone give a quick overview of how to interpret these results?
Sure! Here’s a quick overview of the concepts you've mentioned regarding IP addresses, socket states, and interpreting network connections. ### Distinction Between IP Addresses 1. **0.0.0.0**: - This is a special address that refers to all IPv4 addresses on the local machine. - It’s often used to signify that ...
3,403
[ { "from": "human", "value": "Some things look strange to me:\n\nWhat is the distinction between 0.0.0.0, 127.0.0.1, and [::]?\nHow should each part of the foreign address be read (part1:part2)?\nWhat does a state Time_Wait, Close_Wait mean?\netc.\n\nCould someone give a quick overview of how to interpret th...
With SharePoint Server 2007, there is also a Search Feature and a Crawler. However, the Crawler is somewhat limited in that it only supports Basic Auth when crawling external sites and that there is no way to tell it to ignore no-index,no-follow attributes. Now, there is a site i'd like to index, unfortunately this sit...
Extending the crawler in SharePoint Server 2007 is quite limited, especially compared to more modern versions of SharePoint. The built-in capabilities of the SharePoint 2007 crawler are designed to work within certain constraints, primarily focused on Basic Authentication and the handling of the no-index, no-follow met...
3,519
[ { "from": "human", "value": "With SharePoint Server 2007, there is also a Search Feature and a Crawler. However, the Crawler is somewhat limited in that it only supports Basic Auth when crawling external sites and that there is no way to tell it to ignore no-index,no-follow attributes.\nNow, there is a site...
I know the combination Ctrl+A to jump to the beginning of the current command, and Ctrl+E to jump to the end. But is there any way to jump word by word, like Alt+←/→ in Cocoa applications does?
Yes, in many terminal applications, you can move the cursor word by word using the following shortcuts: - **Alt + B**: Move the cursor back one word. - **Alt + F**: Move the cursor forward one word. These shortcuts are quite common in Unix-like systems and work in bash, zsh, and other shell environments. If you are u...
6,117
[ { "from": "human", "value": "I know the combination Ctrl+A to jump to the beginning of the current command, and Ctrl+E to jump to the end. \nBut is there any way to jump word by word, like Alt+←/→ in Cocoa applications does?\n" }, { "from": "gpt", "value": "Yes, in many terminal applications, yo...
What is the best SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution?
When working with a VB.NET solution in TortoiseSVN (or any version control system), it is essential to set up an appropriate `.svnignore` file to prevent unnecessary files from being tracked. Ignoring certain files and directories can help keep the repository clean and manageable. Below is a recommended SVN ignore patt...
4,595
[ { "from": "human", "value": "What is the best SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution?\n" }, { "from": "gpt", "value": "When working with a VB.NET solution in TortoiseSVN (or any version control system), it is essential to set up an appropriate `.svnignore` file to preve...
I find myself doing this sort of thing all the time. I've been considering writing a macro/function to make this sort of thing easier, but it occurs to me that I'm probably reinventing the wheel. Is there an existing function that will let me accomplish this same sort of thing more succinctly? (defun remove-low-words ...
It looks like you're trying to filter a list of words based on their scores using a function called `good-enough-score-p`. In Common Lisp, you can accomplish this more succinctly using the `remove-if-not` function, which is designed to filter a list based on a predicate. Here's how you could rewrite your `remove-low-w...
6,065
[ { "from": "human", "value": "I find myself doing this sort of thing all the time. I've been considering writing a macro/function to make this sort of thing easier, but it occurs to me that I'm probably reinventing the wheel.\nIs there an existing function that will let me accomplish this same sort of thing...