instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content.
This basically means that I have to make sure that the dropbox is wide enough to display the longest selection possible. This makes my page look very ugl... | To ensure that the dropdown list (the options) and the dropdown box (the select element) can have different widths in different browsers, you can use a combination of CSS and potentially some JavaScript. Unfortunately, the behavior of dropdowns can vary between browsers, but here are a few methods to achieve more consi... | 12,474 | [
{
"from": "human",
"value": "In IE, the dropdown-list takes the same width as the dropbox (I hope I am making sense) whereas in Firefox the dropdown-list's width varies according to the content. \nThis basically means that I have to make sure that the dropbox is wide enough to display the longest selection ... |
Which type of input is least vulnerable to Cross-Site Scripting (XSS) and SQL Injection attacks.
PHP, HTML, BBCode, etc. I need to know for a forum I'm helping a friend set up.
| When considering vulnerability to Cross-Site Scripting (XSS) and SQL Injection attacks, it's important to recognize that no type of input is inherently immune; the security primarily depends on how user inputs are handled and sanitized. However, some input formats can provide better inherent protections when properly i... | 16,584 | [
{
"from": "human",
"value": "Which type of input is least vulnerable to Cross-Site Scripting (XSS) and SQL Injection attacks.\nPHP, HTML, BBCode, etc. I need to know for a forum I'm helping a friend set up.\n"
},
{
"from": "gpt",
"value": "When considering vulnerability to Cross-Site Scripting (... |
System.IO.BinaryReader reads values in a little-endian format.
I have a C# application connecting to a proprietary networking library on the server side. The server-side sends everything down in network byte order, as one would expect, but I find that dealing with this on the client side is awkward, particularly for u... | In C#, the `BinaryReader` class does not provide a built-in way to handle different endianness directly. However, there are some alternatives to streamline the process of converting the values from network byte order (big-endian) to the host byte order (little-endian).
### Solution 1: Create a Helper Class
You could ... | 16,100 | [
{
"from": "human",
"value": "System.IO.BinaryReader reads values in a little-endian format.\nI have a C# application connecting to a proprietary networking library on the server side. The server-side sends everything down in network byte order, as one would expect, but I find that dealing with this on the ... |
I am about to start a new project and would like to document its development in a very simple blog.
My requirements are:
self-hosted on my Gentoo-based LAMP stack (that seems to rule out blogger)
Integration in a django based website (as in www.myproject.com/about, www.myproject.com/blog etc rather than www.myproject.... | Given your requirements, here are two options to consider for your project:
### Option A: Install a Minimal Blog Engine
**1. Django Blog App**: Since you're already using Django, one of the most straightforward approaches is to use a Django blog application. Some good options include:
- **Django Blog Zinnia**: A sim... | 10,034 | [
{
"from": "human",
"value": "I am about to start a new project and would like to document its development in a very simple blog.\nMy requirements are:\n\nself-hosted on my Gentoo-based LAMP stack (that seems to rule out blogger)\nIntegration in a django based website (as in www.myproject.com/about, www.mypr... |
I'm after (short) opinions on FCKeditor vs TinyMCE and whether either or both are XHTML compliant.
In the interest of keeping with the spirit of stackoverflow, if someone has already made your point, just upvote them.
| Both FCKeditor (now known as CKEditor) and TinyMCE are popular WYSIWYG editors with their own strengths.
1. **CKEditor (formerly FCKeditor)**:
- **Pros**: Highly customizable with a robust plugin ecosystem, strong support for rich text editing, and better handling of complex content structures. It is generally mo... | 18,658 | [
{
"from": "human",
"value": "I'm after (short) opinions on FCKeditor vs TinyMCE and whether either or both are XHTML compliant.\nIn the interest of keeping with the spirit of stackoverflow, if someone has already made your point, just upvote them.\n"
},
{
"from": "gpt",
"value": "Both FCKeditor ... |
I've started with ASP.NET MVC recently, reading blogs, tutorials, trying some routes, etc. Now, i've stumbled on a issue where i need some help.
Basically, i have an URL like /products.aspx?categoryid=foo&productid=bar
Most tutorials/examples propose to map this to something like: /products/category/foo/bar where "prod... | Absolutely, you can configure ASP.NET MVC to map URLs in the format you want. The routing system in ASP.NET MVC is flexible and allows you to create custom routes that fit your desired URL structure.
In your case, you want to map `/products/foo/bar` to a specific action in your controller. To do this, you need to defi... | 16,646 | [
{
"from": "human",
"value": "I've started with ASP.NET MVC recently, reading blogs, tutorials, trying some routes, etc. Now, i've stumbled on a issue where i need some help.\nBasically, i have an URL like /products.aspx?categoryid=foo&productid=bar\nMost tutorials/examples propose to map this to something l... |
I'm working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I'd like to show some grey text in the background of the search field itself ('Search terms', for example). When the user starts entering text in the search field... | You can achieve this placeholder effect in a WinForms application by subclassing the TextBox control to handle the display of the placeholder text. Unfortunately, the standard TextBox control in .NET 3.5 does not natively support placeholder text, but you can implement this feature with a bit of code.
Here’s a step-by... | 13,203 | [
{
"from": "human",
"value": "I'm working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I'd like to show some grey text in the background of the search field itself ('Search terms', for example). When the user... |
I have an ISAm table in mySql that was created similar to this:
create table mytable (
id int not null auto_increment primary key,
name varchar(64) not null );
create unique index nameIndex on mytable (name);
I have multiple processes inserting rows into this table. If two processes try to insert the same "name", I... | In your case, leveraging the unique index to ensure data integrity is the better approach compared to manually locking the table. By using the unique index (`nameIndex`) on the `name` column, the database will automatically enforce uniqueness. This means if two processes try to insert a duplicate `name`, one of them wi... | 16,980 | [
{
"from": "human",
"value": "I have an ISAm table in mySql that was created similar to this:\ncreate table mytable (\n id int not null auto_increment primary key,\n name varchar(64) not null );\n\ncreate unique index nameIndex on mytable (name);\n\nI have multiple processes inserting rows into this table. I... |
I am running VS Team Studio 2008. I have created a web test that I want to use for monitoring a company web site. It interacts with the site and does some round trip processing. I want to create a standalone EXE file that can be run remotely. I have tried converting it to VB code and C# code and then creating compili... | Creating a standalone EXE for running a web test designed in Visual Studio Team System 2008 can be a bit tricky, particularly when trying to convert a web test to C# or VB and execute it outside of the Visual Studio environment. Here are some potential solutions and considerations to help you troubleshoot and successfu... | 12,638 | [
{
"from": "human",
"value": "I am running VS Team Studio 2008. I have created a web test that I want to use for monitoring a company web site. It interacts with the site and does some round trip processing. I want to create a standalone EXE file that can be run remotely. I have tried converting it to VB c... |
I require a tree / directed acyclic graph implementation something like this:
public class TreeNode<K, V> {
private K key; // 'key' for this node, always present
private V value; // 'value' for this node, doesn't have to be set
private TreeNode<K, V> parent;
private Set<TreeNode<K, V>> children;
}
T... | In standard Java APIs and popular libraries, there isn't a direct implementation of a tree or directed acyclic graph (DAG) structure that perfectly matches your requirements as described. However, you can find some structures in libraries like Apache Commons or Guava that can provide similar functionalities, but they m... | 12,491 | [
{
"from": "human",
"value": "I require a tree / directed acyclic graph implementation something like this:\npublic class TreeNode<K, V> {\n private K key; // 'key' for this node, always present\n private V value; // 'value' for this node, doesn't have to be set\n\n private TreeNode<K, V> parent;\n ... |
I need to convert HTML documents into valid XML, preferably XHTML. What's the best way to do this? Does anybody know a toolkit/library/sample/...whatever that helps me to get that task done?
To be a bit more clear here, my application has to do the conversion automatically at runtime. I don't look for a tool that helps... | Converting HTML documents to valid XHTML can be done automatically using several libraries and tools available in different programming languages. Below are some recommendations depending on the language you prefer to work with:
### Python
1. **BeautifulSoup**: This library can parse HTML and allows you to output XHTM... | 12,058 | [
{
"from": "human",
"value": "I need to convert HTML documents into valid XML, preferably XHTML. What's the best way to do this? Does anybody know a toolkit/library/sample/...whatever that helps me to get that task done?\nTo be a bit more clear here, my application has to do the conversion automatically at r... |
I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of more structured method.
It'd be great if I could somehow define a record consisting of certain fie... | Creating a structured catalogue for your collection of retro game consoles and computers in Drupal is definitely possible and can be achieved using the core capabilities of Drupal along with a few key modules. Since you're looking to define records with specific fields and have a form to fill in, you'll want to make us... | 13,587 | [
{
"from": "human",
"value": "I have a large collection of retro games consoles and computers, I want to create some sort of catalogue to keep track of them using Drupal. I could do it as a series of pages in Drupal, but would rather have some sort of more structured method.\nIt'd be great if I could somehow... |
I'm not sure if this is something I should do in T-SQL or not, and I'm pretty sure using the word 'iterate' was wrong in this context, since you should never iterate anything in sql. It should be a set based operation, correct? Anyway, here's the scenario:
I have a stored proc that returns many uniqueidentifiers (singl... | You're correct that in SQL, it's best to work with set-based operations instead of iterating over rows, which can be inefficient and less performant. In your scenario, you want to update a table based on the results from a stored procedure that returns a list of unique identifiers.
Assuming you have a stored procedure... | 16,508 | [
{
"from": "human",
"value": "I'm not sure if this is something I should do in T-SQL or not, and I'm pretty sure using the word 'iterate' was wrong in this context, since you should never iterate anything in sql. It should be a set based operation, correct? Anyway, here's the scenario:\nI have a stored proc ... |
We have a 12-year-old Ms Access app that we use for our core inventory warehousing and invoicing system. It IS already running on an SQL Server backend, but all the "logic", forms and reports are in Access. After experiencing the massive amounts of maintenance sludge it took to turn inventory transactions from non-temp... | Converting a legacy MS Access application to a .NET application is a significant task, but it can lead to a more maintainable and flexible system. Here are some techniques and strategies to help you manage this process:
### 1. **Assess and Document the Current Application**
- **Inventory Existing Features**: List o... | 9,377 | [
{
"from": "human",
"value": "We have a 12-year-old Ms Access app that we use for our core inventory warehousing and invoicing system. It IS already running on an SQL Server backend, but all the \"logic\", forms and reports are in Access. After experiencing the massive amounts of maintenance sludge it took t... |
The Project's Web section (under project properties in VS2008) has a list of debuggers: ASP.NET, Native Code, SQL Server. What is Native Code?
| In the context of Visual Studio 2008 and its debugging options, "Native Code" refers to the type of code that is directly executed by the CPU without any intermediary, typically written in languages like C or C++. Native code is compiled into machine code that can be run on the target hardware, as opposed to managed co... | 19,979 | [
{
"from": "human",
"value": "The Project's Web section (under project properties in VS2008) has a list of debuggers: ASP.NET, Native Code, SQL Server. What is Native Code?\n"
},
{
"from": "gpt",
"value": "In the context of Visual Studio 2008 and its debugging options, \"Native Code\" refers to t... |
My employer was recently acquired by a much larger company. In the process of sorting out all the legal details around our licenses for our development software, we have learned that the vendor of our IDE charges a "nominal" fee of 25% of the cost of a new license to transfer our existing licenses to the new corporate... | It's understandable that you would find a 25% fee for transferring licenses to be excessive and unfriendly, especially if you're coming from an industry where such practices are uncommon or where transfer fees are significantly lower. Here are a few points to consider:
1. **Industry Norms**: While some software vendor... | 18,035 | [
{
"from": "human",
"value": "My employer was recently acquired by a much larger company. In the process of sorting out all the legal details around our licenses for our development software, we have learned that the vendor of our IDE charges a \"nominal\" fee of 25% of the cost of a new license to transfer... |
Is there any useful way to load DIB into inputstream and get a handle to it and all that in JavaScript (js) ?
| Loading a Device Independent Bitmap (DIB) file into an InputStream and then obtaining a handle in JavaScript typically requires a few steps, as JavaScript does not have built-in support for DIB files directly. However, you can use the File API in browsers and related libraries to work with binary data, including images... | 15,242 | [
{
"from": "human",
"value": "Is there any useful way to load DIB into inputstream and get a handle to it and all that in JavaScript (js) ?\n"
},
{
"from": "gpt",
"value": "Loading a Device Independent Bitmap (DIB) file into an InputStream and then obtaining a handle in JavaScript typically requi... |
I deleted millions of rows of old data from a production SQL database recently, and it didn't seem to shrink the size of the .MDF file much. We have a finite amount of disk space.
I am wondering if there is anything else I can do to "tighten" the file (like something analogous to Access' Compact and Repair function)?
| When you delete rows from a SQL Server database, the space that was previously occupied by those rows is not automatically released back to the operating system. Instead, that space is marked as available for new data, but the database file itself (the .MDF file) may not shrink in size. If you're looking to free up dis... | 15,518 | [
{
"from": "human",
"value": "I deleted millions of rows of old data from a production SQL database recently, and it didn't seem to shrink the size of the .MDF file much. We have a finite amount of disk space.\nI am wondering if there is anything else I can do to \"tighten\" the file (like something analogou... |
We are using JetBrains' dotTrace. What other profiling tools can be recommended that are better for profiling C# Windows Forms applications?
| When profiling C# Windows Forms applications, there are several tools besides JetBrains' dotTrace that you can consider. Here’s a list of some popular alternatives:
1. **Visual Studio Profiler**:
- Built into Visual Studio, it provides performance and memory profiling capabilities. It's especially useful if you're ... | 16,597 | [
{
"from": "human",
"value": "We are using JetBrains' dotTrace. What other profiling tools can be recommended that are better for profiling C# Windows Forms applications?\n"
},
{
"from": "gpt",
"value": "When profiling C# Windows Forms applications, there are several tools besides JetBrains' dotT... |
How do I iterate over a set of records in RPG(LE) with embedded SQL?
| To iterate over a set of records in RPG IV (RPGLE) with embedded SQL, you can use a combination of SQL `DECLARE`, `OPEN`, `FETCH`, and `CLOSE` statements. This approach allows you to retrieve rows from a database file (table) and process them one by one. Below is a general example illustrating how to do this:
### Exam... | 13,493 | [
{
"from": "human",
"value": "How do I iterate over a set of records in RPG(LE) with embedded SQL?\n"
},
{
"from": "gpt",
"value": "To iterate over a set of records in RPG IV (RPGLE) with embedded SQL, you can use a combination of SQL `DECLARE`, `OPEN`, `FETCH`, and `CLOSE` statements. This appro... |
I want to create a c# application with multiple windows that are all transparent with some text on.
The tricky part is making these forms sit on top of the desktop but under the desktop icons. Is this possible?
| Creating a C# application with multiple transparent windows that appear on top of the desktop but beneath the desktop icons can be challenging due to Windows' handling of window Z-ordering. However, you can achieve a similar effect by using layered windows with specific styles.
Here's how you can create transparent wi... | 8,414 | [
{
"from": "human",
"value": "I want to create a c# application with multiple windows that are all transparent with some text on.\nThe tricky part is making these forms sit on top of the desktop but under the desktop icons. Is this possible?\n"
},
{
"from": "gpt",
"value": "Creating a C# applicat... |
Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this:
<ListView x:Name="myList" ItemsSource="{Binding SomeList}">
<ListView.View>
<GridView>
<GridViewColumn>
<GridViewColumn.CellTemplate>
... | The issue you're encountering is due to how the `ListView` generates its visual items and how the `FindName` method works in WPF. When you call `FindName` on the `ListView`, it looks for named elements in the logical tree of the `ListView`, but since `myBox` is defined inside a `DataTemplate`, it is not directly access... | 8,061 | [
{
"from": "human",
"value": "Within an event, I'd like to put the focus on a specific TextBox within the ListViewItem's template. The XAML looks like this:\n<ListView x:Name=\"myList\" ItemsSource=\"{Binding SomeList}\">\n <ListView.View>\n <GridView>\n <GridViewColumn>\n ... |
I need to create some reports from a sql server database for end users to view.
Is it possible to hook into sql server from excel?
Update
The end user will only click on the file to view the reports, asking them to do more is too much to ask!
| Yes, it is indeed possible to connect Excel to a SQL Server database, allowing you to create reports that end users can view without needing to perform any complex tasks. You can set up the Excel file to connect to the database and pull data directly into the spreadsheet, allowing the end user to simply open the file t... | 14,953 | [
{
"from": "human",
"value": "I need to create some reports from a sql server database for end users to view.\nIs it possible to hook into sql server from excel?\nUpdate\nThe end user will only click on the file to view the reports, asking them to do more is too much to ask!\n"
},
{
"from": "gpt",
... |
I'm trying to format a column in a <table/> using a <col/> element. I can set background-color, width, etc., but can't set the font-weight. Why doesn't it work?
<table>
<col style="font-weight:bold; background-color:#CCC;">
<col>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</t... | The issue you're encountering stems from the fact that the `<col>` element does not support all CSS properties. While you can set properties like `background-color` and `width` on a `<col>`, properties that affect text styling, such as `font-weight`, do not apply to the `<col>` itself.
The `<col>` element is used to ... | 13,495 | [
{
"from": "human",
"value": "I'm trying to format a column in a <table/> using a <col/> element. I can set background-color, width, etc., but can't set the font-weight. Why doesn't it work?\n<table>\n <col style=\"font-weight:bold; background-color:#CCC;\">\n <col>\n <tr>\n <td>1</td>\n ... |
When is the proper time to restore the UI layout settings of a System.Windows.Forms.Control?
I tried this:
FooBarGadget control = new FooBarGadget();
parent.Controls.Add(control);
control.FobnicatorWidth = lastLayoutSettings.FobWidth;
No cigar. Reason? control isn't finished laying out its internals; it's in its defau... | In Windows Forms, the `Load` event of a form is typically the best place to perform initialization that requires the control to be fully constructed and ready to be displayed. However, for a custom control like `FooBarGadget`, you may need to consider a few options to ensure that the control has been properly laid out ... | 15,357 | [
{
"from": "human",
"value": "When is the proper time to restore the UI layout settings of a System.Windows.Forms.Control?\nI tried this:\nFooBarGadget control = new FooBarGadget();\nparent.Controls.Add(control);\ncontrol.FobnicatorWidth = lastLayoutSettings.FobWidth;\n\nNo cigar. Reason? control isn't finis... |
To start, I know there are two "kinds" of JSON serialization currently built into ASP.Net: you can either use the JavaScriptSerializer class to serialize your object to JSON or the new DataContractJsonSerializer class to convert a object to JSON.
If you use the JavaScriptSerializer() method, you must mark your class as... | The `JavaScriptSerializer` class in ASP.NET does not provide a built-in mechanism for customizing the property names during serialization like the `DataContractJsonSerializer` does with its `DataMember` attribute. However, you can achieve similar functionality by creating a custom serialization method or by using attri... | 17,382 | [
{
"from": "human",
"value": "To start, I know there are two \"kinds\" of JSON serialization currently built into ASP.Net: you can either use the JavaScriptSerializer class to serialize your object to JSON or the new DataContractJsonSerializer class to convert a object to JSON.\nIf you use the JavaScriptSeri... |
I'm trying to get a large result set to stream and having no luck. The MySQL docs are somewhat unclear as to whether this should even work. E.g.:
When using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier than 5.0.3, the `setFetchSize()` method has no effect, other than to toggl... | Streaming result sets in MySQL using JDBC is indeed possible, but you may face some limitations and nuances with older versions of MySQL, such as 4.1.x, and older versions of the MySQL Connector/J driver. Here are some considerations to help you effectively stream large result sets.
### Important Notes
1. **Version L... | 16,162 | [
{
"from": "human",
"value": "I'm trying to get a large result set to stream and having no luck. The MySQL docs are somewhat unclear as to whether this should even work. E.g.:\nWhen using versions of the JDBC driver earlier than 3.2.1, and connected to server versions earlier than 5.0.3, the `setFetchSize()`... |
The Flot API documentation describes the library's extensive hooks for customizing the axes of a graph. You can set the number of ticks, their color, etc. separately for each axis. However, I can not figure out how to prevent Flot from drawing the vertical grid lines without also removing the x-axis labels. I've tried ... | To remove the vertical grid lines in Flot without affecting the x-axis labels, you can use the `grid` options in the Flot plot settings. Specifically, you can set the `verticalLines` property to `false`. This will allow you to keep the x-axis labels intact while removing the vertical grid lines that may be cluttering y... | 18,262 | [
{
"from": "human",
"value": "The Flot API documentation describes the library's extensive hooks for customizing the axes of a graph. You can set the number of ticks, their color, etc. separately for each axis. However, I can not figure out how to prevent Flot from drawing the vertical grid lines without als... |
I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when it's loaded. The problem is that this DLL is a Vista DLL, and this a known issue for XP users that have IE7 installed. The recommendation is to uninstall IE7 or repair the .NET Framework via Add/Remove programs. I did the repair, and nothing chan... | It looks like you've done quite a bit of troubleshooting already, and it's great that you've shared your findings regarding the DWMAPI.DLL issue. Let's summarize some key points and provide a clearer direction for resolving your specific problem with Maya and the .dll loading.
### Key Points:
1. **DWMAPI.DLL Dependenc... | 14,910 | [
{
"from": "human",
"value": "I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when it's loaded. The problem is that this DLL is a Vista DLL, and this a known issue for XP users that have IE7 installed. The recommendation is to uninstall IE7 or repair the .NET Framework via Add/Remove pro... |
Is there a way to change the way asp.net generates elements in the WSDL generated from a .asmx file? Specifically, it seems to mark all elements minoccurs="0" and there are some elements that I want to be minoccurs="1" (aka required fields).
One of these is an argument to the web service (e.g. foo(arg1, arg2) where ... | In ASP.NET Web Services (ASMX), the WSDL generation is quite limited in terms of customization compared to WCF (Windows Communication Foundation). By default, the WSDL generated from an .asmx file treats all parameters as optional by assigning `minOccurs="0"` to them. Unfortunately, there is no straightforward way to c... | 17,167 | [
{
"from": "human",
"value": "Is there a way to change the way asp.net generates elements in the WSDL generated from a .asmx file? Specifically, it seems to mark all elements minoccurs=\"0\" and there are some elements that I want to be minoccurs=\"1\" (aka required fields). \nOne of these is an argument to... |
I would find out the floppy inserted state:
no floppy inserted
unformatted floppy inserted
formatted floppy inserted
Can this determined using "WMI" in the System.Management namespace?
If so, can I generate events when the floppy inserted state changes?
| You can determine the state of floppy disks in the system using Windows Management Instrumentation (WMI) in the `System.Management` namespace in .NET. However, WMI may not provide direct information about the status of floppy disks specifically, especially for unformatted versus formatted states, as modern operating sy... | 16,070 | [
{
"from": "human",
"value": "I would find out the floppy inserted state:\n\nno floppy inserted\nunformatted floppy inserted\nformatted floppy inserted\n\nCan this determined using \"WMI\" in the System.Management namespace?\nIf so, can I generate events when the floppy inserted state changes? \n"
},
{
... |
I need to create an installer program that will do install the following:
ASP.Net Website
Windows Service
SQL Express if it isn't installed
and the user doesn't have a SQL
Server
Dundas Charts
ASP.Net AJAX v.1.0
ReportViewer control (for 2.0 Framework)
Check Framework prerequisites (2.0)
Configure IIS and app.config ... | Creating a comprehensive installer that handles all the requirements you've specified can be challenging with a Visual Studio Setup Project. While it might be possible to achieve some of these tasks, there are significant limitations to the Setup Project that could lead you to consider other installation solutions. Her... | 16,451 | [
{
"from": "human",
"value": "I need to create an installer program that will do install the following:\n\nASP.Net Website \nWindows Service\nSQL Express if it isn't installed\nand the user doesn't have a SQL\nServer\nDundas Charts\nASP.Net AJAX v.1.0\nReportViewer control (for 2.0 Framework)\nCheck Framewor... |
I have an array of characters that are Points and I want to take any character and be able to loop through that array and find the top 3 closest (using Point.distance) neighbors. Could anyone give me an idea of how to do this?
| To find the top 3 closest neighbors of a given point in an array of points, you can follow these steps:
1. **Define the Point class** (if not already defined) with a method to calculate the distance between two points.
2. **Loop through the array of points** and calculate the distance from the target point to each of ... | 14,192 | [
{
"from": "human",
"value": "I have an array of characters that are Points and I want to take any character and be able to loop through that array and find the top 3 closest (using Point.distance) neighbors. Could anyone give me an idea of how to do this?\n"
},
{
"from": "gpt",
"value": "To find... |
In Subversion you can specify a range of versions to get an aggregate view of a series of commits. Is this possible in git? If so, how?
| Yes, in Git, you can specify a range of commits to get an aggregate view of changes, similar to what you can do in Subversion. There are several ways to work with commit ranges in Git. Here are some common methods:
### 1. Using `git log` with commit ranges
You can use `git log` to view commits between two specific co... | 16,065 | [
{
"from": "human",
"value": "In Subversion you can specify a range of versions to get an aggregate view of a series of commits. Is this possible in git? If so, how?\n"
},
{
"from": "gpt",
"value": "Yes, in Git, you can specify a range of commits to get an aggregate view of changes, similar to ... |
I'm using the Prawn Ruby library (http://prawn.majesticseacreature.com/) to generate some pdf documents. I draw a table without any problem. Next, I want to insert some lines after the table for various people's signatures. Before I draw the lines, I would like to see if there is enough remaining room on the page to... | In the Prawn Ruby library, you can determine the current cursor position using the `cursor` method. This method returns the current position of the cursor, which is useful for determining whether you have enough space on the page to draw additional elements like signature lines.
Here's a step-by-step approach to check... | 16,228 | [
{
"from": "human",
"value": "I'm using the Prawn Ruby library (http://prawn.majesticseacreature.com/) to generate some pdf documents. I draw a table without any problem. Next, I want to insert some lines after the table for various people's signatures. Before I draw the lines, I would like to see if ther... |
The error I'm getting:
in /Users/robert/Documents/funWithFrameworks/build/Debug-iphonesimulator/funWithFrameworks.framework/funWithFrameworks, can't link with a main executable
Cliff notes:
trying to include framework
doesn't want to link
More detail:
I'm developing for a mobile device... hint, hint using Xcode and ... | It looks like you're trying to create a custom framework in Xcode and are encountering a linking issue. The error message you're seeing indicates that Xcode cannot link the framework with a main executable, which can happen for several reasons. Here are some steps you can take to troubleshoot and resolve this issue:
#... | 4,328 | [
{
"from": "human",
"value": "The error I'm getting:\nin /Users/robert/Documents/funWithFrameworks/build/Debug-iphonesimulator/funWithFrameworks.framework/funWithFrameworks, can't link with a main executable\n\nCliff notes:\n\ntrying to include framework\ndoesn't want to link\n\nMore detail:\nI'm developing ... |
At my current gig, we use iBATIS through Java to CRUD our databases. I like the abstract qualities of the tool, especially when working with legacy databases, as it doesn't impose its own syntax on you.
I'm looking for a Python analogue to this library, since the website only has Java/.NET/Ruby versions available. I ... | If you're looking for a Python alternative to iBATIS that provides similar functionality, you have several options to consider. Here are a few libraries that might fit your needs:
1. **SQLAlchemy**: This is one of the most popular ORM (Object-Relational Mapping) libraries in Python. SQLAlchemy allows you to work with ... | 17,491 | [
{
"from": "human",
"value": "At my current gig, we use iBATIS through Java to CRUD our databases. I like the abstract qualities of the tool, especially when working with legacy databases, as it doesn't impose its own syntax on you.\nI'm looking for a Python analogue to this library, since the website only ... |
Is there anyway to declare an object of a class before the class is created in C++? I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the first class. I realize that you may think I might get into an infin... | In C++, you cannot create an object of a class before the class is defined, which means you cannot declare a variable of a class type unless the class is fully defined. However, you can use forward declarations to break the circular dependency between two classes.
Here's how you can accomplish this using forward decla... | 16,415 | [
{
"from": "human",
"value": "Is there anyway to declare an object of a class before the class is created in C++? I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the first class. I realize tha... |
Is it possible in PHP (as it is in C++) to declare a class method OUTSIDE the class definition?
| In PHP, you cannot declare a class method outside of the class definition in the same way that you can in C++. PHP requires that all method declarations be made within the class body.
However, you can define methods using traits or extend classes, but these methods still need to be within a class or trait context.
H... | 17,830 | [
{
"from": "human",
"value": "Is it possible in PHP (as it is in C++) to declare a class method OUTSIDE the class definition?\n"
},
{
"from": "gpt",
"value": "In PHP, you cannot declare a class method outside of the class definition in the same way that you can in C++. PHP requires that all metho... |
Should be pretty simple: I have an InputStream where I want to peek at (not read) the first two bytes, i.e. I want the "current position" of the InputStream to stil be at 0 after my peeking. What is the best and safest way to do this?
Answer - As I had suspected, the solution was to wrap it in a BufferedInputStream whi... | You're correct that one of the simplest and safest ways to peek at the first few bytes of an `InputStream` without changing its position is to use a `BufferedInputStream`. The `BufferedInputStream` allows you to mark a position in the stream and later reset back to that position, making it possible to read bytes for pe... | 15,737 | [
{
"from": "human",
"value": "Should be pretty simple: I have an InputStream where I want to peek at (not read) the first two bytes, i.e. I want the \"current position\" of the InputStream to stil be at 0 after my peeking. What is the best and safest way to do this?\nAnswer - As I had suspected, the solution... |
I've got a form where I have two radio buttons and two interchangeable controls (made up of a ListView and a handful of buttons). Based on which radio button is selected I want to display the proper control to the user.
The way I'm doing this now is just loading both controls and setting up an OnRadioButtonSelectionCha... | Your current approach of using radio buttons to control which control is displayed (using the `Visible` property) is quite common and generally acceptable. However, there are several other techniques and best practices that can enhance your implementation or make it cleaner and more maintainable. Here are a few suggest... | 14,843 | [
{
"from": "human",
"value": "I've got a form where I have two radio buttons and two interchangeable controls (made up of a ListView and a handful of buttons). Based on which radio button is selected I want to display the proper control to the user.\nThe way I'm doing this now is just loading both controls a... |
We have a .NET 2.0 application which we normally run on IIS6, and used to run fine on IIS7, but recently after installing SP1 for Vista IIS7 seems to be choking on a line in the Web.Config file:
<system.web AllowLocation="true">
Is it safe to remove the AllowLocation attribute? What does this attribute do?
| The `AllowLocation` attribute in the `<system.web>` section of the `Web.config` file specifies whether the application can allow configuration settings to be overridden at the location level.
Here's a brief overview of its purpose:
- **AllowLocation="true"**: This setting allows configuration sections in child `<loc... | 16,639 | [
{
"from": "human",
"value": "We have a .NET 2.0 application which we normally run on IIS6, and used to run fine on IIS7, but recently after installing SP1 for Vista IIS7 seems to be choking on a line in the Web.Config file:\n<system.web AllowLocation=\"true\">\n\nIs it safe to remove the AllowLocation attr... |
I'm looking for a cross-browser method - I know IE has something (I've already forgotten what), and the way to do it in Mozilla may have to do with a focusNode thing I found, that seems related to getting text selections.
Methods involving jQuery or another common JS library are fine by me.
Thanks!
| To create a cross-browser method for getting the text selection in a web page, you can use the `window.getSelection()` method, which is supported in most modern browsers, including Chrome, Firefox, Safari, and Edge. However, Internet Explorer has a different API for this purpose. Below, I'll provide a cross-browser sol... | 17,423 | [
{
"from": "human",
"value": "I'm looking for a cross-browser method - I know IE has something (I've already forgotten what), and the way to do it in Mozilla may have to do with a focusNode thing I found, that seems related to getting text selections.\nMethods involving jQuery or another common JS library ar... |
To do an unattended installation of any MSI package, one can simply use the following command:
msiexec /qn /i package.msi
However, this triggers an asynchronous installation: if you happen to chain 2 dependent installations, you will have to wait somehow for the 1st installation to complete.
Is there a way to do this ... | Yes, when you are performing unattended installations and want to chain two MSI packages while ensuring that the first installation completes before the second one begins, you can use the `start /wait` command in the command line. This command will wait for the first command to finish before proceeding to the next comm... | 19,135 | [
{
"from": "human",
"value": "To do an unattended installation of any MSI package, one can simply use the following command:\nmsiexec /qn /i package.msi\n\nHowever, this triggers an asynchronous installation: if you happen to chain 2 dependent installations, you will have to wait somehow for the 1st installa... |
I installed Mono on my iMac last night and I immidiately had a change of heart! I don't think Mono is ready for prime time.
The Mono website says to run the following script to uninstall:
#!/bin/sh -x
#This script removes Mono from an OS X System. It must be run as root
rm -r /Library/Frameworks/Mono.framework
rm -r ... | Uninstalling Mono from your iMac using the provided script should work for most cases, as it covers the main components installed by Mono. However, there are a few things to consider:
1. **Permissions**: Ensure that you run the script with root permissions. You can do this by prefacing the command with `sudo`, or by r... | 14,848 | [
{
"from": "human",
"value": "I installed Mono on my iMac last night and I immidiately had a change of heart! I don't think Mono is ready for prime time. \nThe Mono website says to run the following script to uninstall:\n#!/bin/sh -x\n#This script removes Mono from an OS X System. It must be run as root\nrm... |
I need to get some AVI animations for use with the Borland VCL TAnimate component, to display during operations such as 'online update', 'burning cd' and a few others.
I have only come across the glyFX Animation Pack so far.
Can anybody recomend other places to get nice avi animations?
| Finding AVI animations for specific use cases can be a bit challenging, especially since many resources have shifted to more modern formats like GIF or MP4. However, here are some places where you can find AVI animations or create your own:
1. **Animation Marketplaces**: Websites like **VideoHive** or **Pond5** offer ... | 17,183 | [
{
"from": "human",
"value": "I need to get some AVI animations for use with the Borland VCL TAnimate component, to display during operations such as 'online update', 'burning cd' and a few others.\nI have only come across the glyFX Animation Pack so far.\nCan anybody recomend other places to get nice avi an... |
What are some of the new features that can be used in .NET 2.0 that are specific to C# 3.0/3.5 after upgrading to Visual Studio 2008? Also, what are some of the features that aren't available?
Available
Lambdas
Extension methods (by declaring an empty System.Runtime.CompilerServices.ExtensionAttribute)
Automatic prope... | When upgrading from .NET 2.0 to .NET 3.0/3.5 using Visual Studio 2008, you can take advantage of several new features specific to C# 3.0 and 3.5. Here's a summary of what is available and what is not available after the upgrade:
### Available Features
1. **Lambdas**: C# 3.0 introduced lambda expressions, which provid... | 16,424 | [
{
"from": "human",
"value": "What are some of the new features that can be used in .NET 2.0 that are specific to C# 3.0/3.5 after upgrading to Visual Studio 2008? Also, what are some of the features that aren't available?\nAvailable\n\nLambdas\nExtension methods (by declaring an empty System.Runtime.Compile... |
I have a subversion repository with the standard layout, i.e. trunk/ and branches/ (and tags/). When working on a bigger change, a feature branch is used, regularly synced with trunk, and later reintegrated back into trunk (using 1.5 now). Pretty standard stuff.
What I am wondering is whether such a feature branch, onc... | When deciding whether to keep or delete feature branches in a Subversion (SVN) repository after they've been merged, there are several pros and cons to consider. Here's a breakdown of each approach:
### Keeping Feature Branches
**Pros:**
1. **Historical Reference:** Keeping branches can provide a historical referenc... | 14,743 | [
{
"from": "human",
"value": "I have a subversion repository with the standard layout, i.e. trunk/ and branches/ (and tags/). When working on a bigger change, a feature branch is used, regularly synced with trunk, and later reintegrated back into trunk (using 1.5 now). Pretty standard stuff.\nWhat I am wonde... |
I'm using a ASP.NET menu control. I'd like the menu to look like this, where link 1 through 10 are in one sitemap file and link 11 through 20 in another.
root
--link 1
(...)
--link 10
--link 11
(...)
--link 20
However, sitemap file MUST have a root which I cannot seem to suppress.
Any thoughts?
-Edoode
| In ASP.NET, the `SiteMap` functionality does require a root node, which can make it tricky if you want to present multiple sets of links in a single menu structure without a clear hierarchy.
One approach you can take is to create a single `SiteMap` file that combines both sets of links under a common root. You can the... | 8,598 | [
{
"from": "human",
"value": "I'm using a ASP.NET menu control. I'd like the menu to look like this, where link 1 through 10 are in one sitemap file and link 11 through 20 in another. \nroot\n--link 1\n(...)\n--link 10\n--link 11\n(...)\n--link 20\n\nHowever, sitemap file MUST have a root which I cannot see... |
I wrote a sample program at http://codepad.org/ko8vVCDF that uses a template function.
How do I retrict the template function to only use numbers? (int, double etc.)
#include <vector>
#include <iostream>
using namespace std;
template <typename T>
T sum(vector<T>& a)
{
T result = 0;
int size = a.size();
... | To restrict your template function to only work with numeric types like `int`, `double`, and other types that support arithmetic operations, you can use **SFINAE (Substitution Failure Is Not An Error)** combined with type traits from the `<type_traits>` header in C++.
Specifically, you can use `std::enable_if` along ... | 16,236 | [
{
"from": "human",
"value": "I wrote a sample program at http://codepad.org/ko8vVCDF that uses a template function.\nHow do I retrict the template function to only use numbers? (int, double etc.)\n#include <vector>\n#include <iostream>\n\nusing namespace std;\n\n template <typename T>\nT sum(vector<T>& a... |
I have been playing with this for a while, but the closest I have gotten is a button that opens the Paste Special dialog box and requires another couple of mouse clicks to paste the contents of the clipboard as unformatted text.
So often I am doing a copy-paste from a web site into a document where I don't want the ad... | If you're looking to paste text without formatting (unformatted text) directly into a document using a keyboard shortcut or toolbar button in applications like Microsoft Word, there are a couple of methods you can use. Here's how to set it up:
### Method 1: Create a Keyboard Shortcut
1. **Open Microsoft Word.**
2. **... | 13,297 | [
{
"from": "human",
"value": "I have been playing with this for a while, but the closest I have gotten is a button that opens the Paste Special dialog box and requires another couple of mouse clicks to paste the contents of the clipboard as unformatted text. \nSo often I am doing a copy-paste from a web site... |
Server virtualization is a big thing these days, so I'm tasked at work to install some of our software on a virtualized server and see what happens. Long story short: a rsync transfer promptly brings the virtualized server to its knees. The virtualization host is a beefy machine with no other load; I don't think this s... | You're not alone in encountering challenges with virtualization, especially as it relates to performance and resource management. Virtualization can be complex, and troubleshooting issues like the one you're experiencing often requires a mix of understanding both the virtualization layer and the underlying operating sy... | 11,908 | [
{
"from": "human",
"value": "Server virtualization is a big thing these days, so I'm tasked at work to install some of our software on a virtualized server and see what happens. Long story short: a rsync transfer promptly brings the virtualized server to its knees. The virtualization host is a beefy machine... |
I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) should I use to prevent it from showing up?
class MyControl : System.Web.U... | To prevent a public property from appearing in the Visual Studio Property Window for a UserControl in an ASP.NET project, you can use the `BrowsableAttribute` class and set its value to `false`. This attribute is part of the `System.ComponentModel` namespace.
Here's how you can apply it to your `SampleProperty`:
```c... | 17,750 | [
{
"from": "human",
"value": "I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) should I use to prevent it from s... |
I know there are emulators, but is this good enough? If someone is serious about iPhone development, do they absolutely need an iPhone?
| While emulators (like the iOS Simulator provided in Xcode) are powerful tools for iPhone development, having a physical iPhone can be quite beneficial for serious development work. Here are some reasons why:
1. **Real Device Testing**: Emulators cannot fully replicate the hardware characteristics of an actual device, ... | 17,788 | [
{
"from": "human",
"value": "I know there are emulators, but is this good enough? If someone is serious about iPhone development, do they absolutely need an iPhone?\n"
},
{
"from": "gpt",
"value": "While emulators (like the iOS Simulator provided in Xcode) are powerful tools for iPhone developme... |
Given an MLS#, I'd like to get an XML document with details about the listing, like address, price and such. Not a NAR or CREA member. Mostly interested in North American rental property listing data.
| To obtain real estate listing data, including details like address and price, from an MLS (Multiple Listing Service) using an MLS number (MLS#), you typically need access to a database or API that provides this information. However, access to such data is usually restricted to licensed real estate professionals, and me... | 13,283 | [
{
"from": "human",
"value": "Given an MLS#, I'd like to get an XML document with details about the listing, like address, price and such. Not a NAR or CREA member. Mostly interested in North American rental property listing data.\n"
},
{
"from": "gpt",
"value": "To obtain real estate listing dat... |
In java world you have log4j and a a pretty decent logging framework, is there anything like that for C#/.NET?
| Yes, in the C#/.NET world, there are several logging frameworks similar to Log4j for Java. Some of the most popular ones include:
1. **NLog**: A flexible and free logging platform for various .NET platforms. It supports multiple logging targets, such as files, databases, email, and more. NLog is highly configurable an... | 17,601 | [
{
"from": "human",
"value": "In java world you have log4j and a a pretty decent logging framework, is there anything like that for C#/.NET?\n"
},
{
"from": "gpt",
"value": "Yes, in the C#/.NET world, there are several logging frameworks similar to Log4j for Java. Some of the most popular ones in... |
See code:
var file1 = "50.xsl";
var file2 = "30.doc";
getFileExtension(file1); //returns xsl
getFileExtension(file2); //returns doc
function getFileExtension(filename) {
/*TODO*/
}
| To implement the `getFileExtension` function, you can use JavaScript's string manipulation methods. Here is a simple way to extract the file extension from a filename:
```javascript
function getFileExtension(filename) {
// Split the filename by the dot (.) character
var parts = filename.split('.');
//... | 17,849 | [
{
"from": "human",
"value": "See code: \nvar file1 = \"50.xsl\";\nvar file2 = \"30.doc\";\ngetFileExtension(file1); //returns xsl\ngetFileExtension(file2); //returns doc\n\nfunction getFileExtension(filename) {\n /*TODO*/\n}\n\n"
},
{
"from": "gpt",
"value": "To implement the `getFileExtensio... |
Suppose I have a date, i.e. year, month and day, as integers. What's a good (correct), concise and fairly readable algorithm for computing the ISO 8601 week number of the week the given date falls into? I have come across some truly horrendous code that makes me think surely there must be a better way.
I'm looking to d... | Certainly! Computing the ISO 8601 week number for a given date can be done concisely using basic date manipulation. The ISO 8601 standard defines a week as starting on Monday and that the first week of the year is the week that contains the first Thursday of the year. This means it might not start on January 1st.
Her... | 13,038 | [
{
"from": "human",
"value": "Suppose I have a date, i.e. year, month and day, as integers. What's a good (correct), concise and fairly readable algorithm for computing the ISO 8601 week number of the week the given date falls into? I have come across some truly horrendous code that makes me think surely the... |
On a file path field, I want to capture the directory path like:
textbox1.Text = directory path
Anyone?
| If you're working with a text box in a programming environment and want to capture the directory path from a file path, you can usually achieve this by manipulating the string that contains the file path. Below are examples in different programming languages to extract the directory path from a full file path.
### C#
... | 12,411 | [
{
"from": "human",
"value": "On a file path field, I want to capture the directory path like:\ntextbox1.Text = directory path\n\nAnyone?\n"
},
{
"from": "gpt",
"value": "If you're working with a text box in a programming environment and want to capture the directory path from a file path, you ca... |
What's the performance penalty on defining classes in an aspx/ascx codebehind rather than compiling them into a dll beforehand? I know that this isn't a best practice and that there are numerous problems with this (e.g. difficult to unit test, code is not reusable, etc.), but it does come in very handy when you're dea... | Defining classes directly in the ASPX/ASCX code-behind files (rather than compiling them into a DLL) can introduce performance implications, but the exact penalty may vary depending on several factors. Here are the main considerations:
### Performance Implications
1. **Compilation Overhead:**
- When you define cla... | 14,925 | [
{
"from": "human",
"value": "What's the performance penalty on defining classes in an aspx/ascx codebehind rather than compiling them into a dll beforehand? I know that this isn't a best practice and that there are numerous problems with this (e.g. difficult to unit test, code is not reusable, etc.), but i... |
I am looking for a simple way to get a mime type where the file extension is incorrect or not given, something similar to this question only in .Net.
| In .NET, you can determine the MIME type of a file even if the file extension is missing or incorrect by reading the file's contents. One common approach is to use the `System.Web.MimeMapping` class or the `Microsoft.AspNetCore.StaticFiles` library for ASP.NET Core applications. However, if you're looking for a more ge... | 5,798 | [
{
"from": "human",
"value": "I am looking for a simple way to get a mime type where the file extension is incorrect or not given, something similar to this question only in .Net.\n"
},
{
"from": "gpt",
"value": "In .NET, you can determine the MIME type of a file even if the file extension is mis... |
Possible Duplicate:
ListView multiple selection behavior?
The ListView in Comtl32.dll v6.0 does multiple selection (when using Shift key) as follows (x means selected)
00xxxx
xxxxxx
xxxx00
Earlier versions of ListView do it as follows :
00xx00
00xx00
00xx00
Is there any way to have it do the first way (the comct... | To achieve the multiple selection behavior of the ListView in Comctl32.dll version 6.0 (where a range of items can be selected by holding down the Shift key), you can enable the extended styles for your ListView control.
Here's how to do it:
1. **Set the ListView Control to Use the Extended Styles:**
Use the `LVS_... | 17,126 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nListView multiple selection behavior? \n\nThe ListView in Comtl32.dll v6.0 does multiple selection (when using Shift key) as follows (x means selected)\n\n00xxxx\nxxxxxx\nxxxx00\n\nEarlier versions of ListView do it as follows :\n\n00xx00\n00xx00\n00xx00\n... |
There is a select dropdown and I want to add "No selection" item to the list which should give me 'null' when submitted.
I'm using SimpleFormController derived controller.
protected Map referenceData(HttpServletRequest httpServletRequest, Object o, Errors errors) throws Exception {
Map<String, Object> map = new Has... | Adding a "No selection" option to a dropdown in a web application while ensuring that it submits `null` can be accomplished in a couple of ways. You can indeed use a custom `PropertyEditor` to handle the display of the "No selection" option and map it to `null` on submission. However, there are more straightforward met... | 14,561 | [
{
"from": "human",
"value": "There is a select dropdown and I want to add \"No selection\" item to the list which should give me 'null' when submitted.\nI'm using SimpleFormController derived controller.\nprotected Map referenceData(HttpServletRequest httpServletRequest, Object o, Errors errors) throws Exce... |
I'm just trying to time a piece of code. The pseudocode looks like:
start = get_ticks()
do_long_code()
print "It took " + (get_ticks() - start) + " seconds."
How does this look in Python?
More specifically, how do I get the number of ticks since midnight (or however Python organizes that timing)?
| In Python, you can time a piece of code using the `time` module, which provides various functions to work with time. To measure the duration of a code block in seconds, you can use `time.time()` which returns the current time in seconds since the epoch (January 1, 1970). Here's how you can implement your pseudocode in ... | 12,715 | [
{
"from": "human",
"value": "I'm just trying to time a piece of code. The pseudocode looks like:\nstart = get_ticks()\ndo_long_code()\nprint \"It took \" + (get_ticks() - start) + \" seconds.\"\n\nHow does this look in Python?\nMore specifically, how do I get the number of ticks since midnight (or however P... |
To be more precise, I need to know whether (and if possible, how) I can find whether a given string has double byte characters or not. Basically, I need to open a pop-up to display a given text which can contain double byte characters, like Chinese or Japanese. In this case, we need to adjust the window size than it wo... | To determine whether a given string contains double byte characters (like Chinese or Japanese) or just single byte characters (like ASCII), you can analyze the character encoding of the string. Double byte characters typically fall outside the ASCII range and are commonly found in encodings such as UTF-16 or UTF-8 (whe... | 14,876 | [
{
"from": "human",
"value": "To be more precise, I need to know whether (and if possible, how) I can find whether a given string has double byte characters or not. Basically, I need to open a pop-up to display a given text which can contain double byte characters, like Chinese or Japanese. In this case, we ... |
How do you update a summary field's value from post function in JIRA?
| In JIRA, updating a summary field's value through a post function typically requires using a plugin or custom script, as the built-in post functions do not directly support modifying the summary field. Here’s a general approach to accomplish this:
### Using ScriptRunner for JIRA
If you have the ScriptRunner plugin in... | 12,824 | [
{
"from": "human",
"value": "How do you update a summary field's value from post function in JIRA?\n"
},
{
"from": "gpt",
"value": "In JIRA, updating a summary field's value through a post function typically requires using a plugin or custom script, as the built-in post functions do not directly... |
I'm looking at ways to deploy a Ruby on Rails app (running on JRuby) to a Tomcat instance for testing.
The tomcat instance is running on a Solaris server that I can SSH to. I've looked at using Capistrano, but there doesn't seem to be a lot out there about using it to deploy to Tomcat, or even about running it under JR... | Deploying a Ruby on Rails application running on JRuby to a Tomcat server using Capistrano can be challenging, particularly when working around some of the limitations of JRuby and the deployment environment. While the documentation may be sparse, you can still set up a deployment workflow. Here’s a general outline you... | 14,507 | [
{
"from": "human",
"value": "I'm looking at ways to deploy a Ruby on Rails app (running on JRuby) to a Tomcat instance for testing.\nThe tomcat instance is running on a Solaris server that I can SSH to. I've looked at using Capistrano, but there doesn't seem to be a lot out there about using it to deploy to... |
In an AI application I am writing in C++,
there is not much numerical computation
there are lot of structures for which run-time polymorphism is needed
very often, several polymorphic structures interact during computation
In such a situation, are there any optimization techniques? While I won't care to optimize... | In a C++ application that heavily utilizes runtime polymorphism through virtual functions, there are several optimization techniques you can consider to mitigate the performance costs associated with virtual function calls and to improve data locality. Here's a detailed look at these areas:
### 1. Reducing Virtual Fun... | 12,678 | [
{
"from": "human",
"value": "In an AI application I am writing in C++, \n\nthere is not much numerical computation \nthere are lot of structures for which run-time polymorphism is needed \nvery often, several polymorphic structures interact during computation\n\nIn such a situation, are there any optimiza... |
I would like to be able to, as part of a maven build, set the build number (doesn't matter exactly what) in a properties file/class (so I can show it in a UI). Any ideas?
| Certainly! You can set a build number in a properties file during a Maven build by utilizing Maven's build lifecycle along with the `buildnumber-maven-plugin`. Here's a general approach to achieve this:
1. **Add the buildnumber-maven-plugin to your POM file**: This plugin will allow you to generate a build number and ... | 12,944 | [
{
"from": "human",
"value": "I would like to be able to, as part of a maven build, set the build number (doesn't matter exactly what) in a properties file/class (so I can show it in a UI). Any ideas? \n"
},
{
"from": "gpt",
"value": "Certainly! You can set a build number in a properties file dur... |
We are using EntLib Logging Application Block. And also it turned out that we should use msmq for logging because of performance.
Now we are trying to use Msmqdistributor service to log those messages in the queue.
What are pros and cons of Msmqdistributor service of Enterprise Library?
Please share your experience.
| The **MSMQDistributor** service in the Enterprise Library (EntLib) provides a way to log messages asynchronously using Microsoft Message Queuing (MSMQ), which can help improve the performance of applications that generate a lot of log data. Here are the pros and cons of using the **MSMQDistributor** service for logging... | 13,231 | [
{
"from": "human",
"value": "We are using EntLib Logging Application Block. And also it turned out that we should use msmq for logging because of performance. \nNow we are trying to use Msmqdistributor service to log those messages in the queue.\nWhat are pros and cons of Msmqdistributor service of Enterpri... |
In .NET, how can I prevent multiple instances of an app from running at the same time and what caveats should I consider if there are multiple ways to do it?
| To prevent multiple instances of a .NET application from running at the same time, you can use several approaches. Each method has its pros and cons, so you should consider the specific requirements and context of your application before deciding which to implement. Here are some common methods:
### 1. Mutex
Using a ... | 9,652 | [
{
"from": "human",
"value": "In .NET, how can I prevent multiple instances of an app from running at the same time and what caveats should I consider if there are multiple ways to do it?\n"
},
{
"from": "gpt",
"value": "To prevent multiple instances of a .NET application from running at the same... |
I have the following VB.net interface that I need to port to C#. C# does not allow enumerations in interfaces. How can I port this without changing code that uses this interface?
Public Interface MyInterface
Enum MyEnum
Yes = 0
No = 1
Maybe = 2
End Enum
ReadOnly Property Number()... | In C#, you can't define an enum inside an interface directly as you can in VB.NET. However, you can define the enum outside of the interface and still maintain the same functionality. Here’s how you can port the VB.NET interface to C# without changing the code that uses the interface:
1. Define the enum outside the in... | 17,878 | [
{
"from": "human",
"value": "I have the following VB.net interface that I need to port to C#. C# does not allow enumerations in interfaces. How can I port this without changing code that uses this interface?\nPublic Interface MyInterface\n\n Enum MyEnum\n Yes = 0\n No = 1\n Maybe =... |
I have a folder, c:\websites\test, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the subfolders and files?
I know I could simply delete the .svn folder, but there are a lot of sub-folders in many layers.
| If you want to stop Subversion from tracking a directory and its subdirectories without manually deleting each `.svn` folder, you can use the following method.
### Method: Using a Command-Line Script
1. **Open Command Prompt:**
- Press `Win + R`, type `cmd`, and press `Enter`.
2. **Navigate to your target directo... | 16,561 | [
{
"from": "human",
"value": "I have a folder, c:\\websites\\test, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the subfolders and files? \nI know I could simply delete the .svn folder, but the... |
I have some dynamically created inputs which are not server-side controls. I want to relate them to some CalendarExtender and MaskedEditExtender on the clientside. Is there a way to do that?
| Yes, you can certainly associate dynamically created inputs with `CalendarExtender` and `MaskedEditExtender` on the client side, but it requires a bit of client-side manipulation since these controls are typically associated with server-side controls in ASP.NET.
Here's a general approach to accomplish this:
### Steps... | 10,171 | [
{
"from": "human",
"value": "I have some dynamically created inputs which are not server-side controls. I want to relate them to some CalendarExtender and MaskedEditExtender on the clientside. Is there a way to do that?\n"
},
{
"from": "gpt",
"value": "Yes, you can certainly associate dynamicall... |
What is the most proper way to sending email of minimal 1000 or more in PHP? Any reliable email queuing technique that is capable to handle that?
| When you need to send a large number of emails (like 1,000 or more) using PHP, it's important to do so in a way that is efficient and reliable, while avoiding issues like getting your IP blacklisted or running into server resource limits. Here are some techniques and strategies you can implement for effective email que... | 6,332 | [
{
"from": "human",
"value": "What is the most proper way to sending email of minimal 1000 or more in PHP? Any reliable email queuing technique that is capable to handle that?\n\n"
},
{
"from": "gpt",
"value": "When you need to send a large number of emails (like... |
I am looking for a regex that will find repeating letters. So any letter twice or more, for example:
booooooot or abbott
I won't know the letter I am looking for ahead of time.
This is a question I was asked in interviews and then asked in interviews. Not so many people get it correct.
| To create a regex pattern that finds repeating letters (i.e., any letter that appears two or more times consecutively), you can use the following regex pattern:
```
([a-zA-Z])\1+
```
### Explanation:
- `([a-zA-Z])`: This captures any letter (uppercase or lowercase) and stores it in a capture group.
- `\1+`: This refe... | 18,202 | [
{
"from": "human",
"value": "I am looking for a regex that will find repeating letters. So any letter twice or more, for example:\nbooooooot or abbott\n\nI won't know the letter I am looking for ahead of time. \nThis is a question I was asked in interviews and then asked in interviews. Not so many people ge... |
If you were the administrator of an Apache web server, what protocol(s) would you prefer to provide, for the web developers to upload static files (html/gif/css/...), with the goal of maximum security ?
If you were the web developer/graphic designer, what protocols would you prefer to be available at the Apache server,... | As an administrator of an Apache web server focused on maximum security for file uploads, the preferred protocols for web developers to upload static files (HTML, GIF, CSS, etc.) would include:
### Preferred Protocols for Secure Uploads:
1. **SFTP (SSH File Transfer Protocol):**
- SFTP encrypts both commands and da... | 14,294 | [
{
"from": "human",
"value": "If you were the administrator of an Apache web server, what protocol(s) would you prefer to provide, for the web developers to upload static files (html/gif/css/...), with the goal of maximum security ?\nIf you were the web developer/graphic designer, what protocols would you pr... |
I'm trying to highlight just one specific row in a table using jQuery. The row will have an 'active' status. I have seen plenty of examples online which show how to do zebra striping for alternate row styling. Does anyone know of a jQuery expression which will get a element based on the value of a element in a specif... | Certainly! You can use jQuery to target a specific row in a table based on the value of a cell in that row. In your case, you want to highlight a row that has an 'active' status in a specific column.
Here’s a simple example of how to achieve this. Let's assume your table looks something like this:
```html
<table id="... | 16,154 | [
{
"from": "human",
"value": "I'm trying to highlight just one specific row in a table using jQuery. The row will have an 'active' status. I have seen plenty of examples online which show how to do zebra striping for alternate row styling. Does anyone know of a jQuery expression which will get a element bas... |
I have heard that it's best not to actually have any html in your helpers; my question is, Why not? And furthermore, if you were trying to generate an html list or something like that, how can I avoid actual tags?
Thanks!
-fREW
| The idea of avoiding HTML in helpers (often referred to as view helpers in web development) primarily revolves around the principle of separation of concerns. Here are a few reasons why it's generally advised not to include HTML directly in helper methods:
1. **Separation of Concerns**: Keeping logic and presentation ... | 14,696 | [
{
"from": "human",
"value": "I have heard that it's best not to actually have any html in your helpers; my question is, Why not? And furthermore, if you were trying to generate an html list or something like that, how can I avoid actual tags?\nThanks!\n-fREW\n"
},
{
"from": "gpt",
"value": "The... |
I've got an ASP.NET app using NHibernate to transactionally update a few tables upon a user action. There is a date range involved whereby only one entry to a table 'Booking' can be made such that exclusive dates are specified.
My problem is how to prevent a race condition whereby two user actions occur almost simultan... | To prevent race conditions in your scenario where multiple users may attempt to create overlapping bookings at the same time, you can utilize a combination of database constraints and transaction management strategies.
Here are a few options you can consider:
### 1. Unique Constraint
The first approach is to define a... | 12,471 | [
{
"from": "human",
"value": "I've got an ASP.NET app using NHibernate to transactionally update a few tables upon a user action. There is a date range involved whereby only one entry to a table 'Booking' can be made such that exclusive dates are specified.\nMy problem is how to prevent a race condition wher... |
I want to index this view but because it has subquery i cant index. Can anyone suggest how to change this view so that i can index it.
ALTER VIEW [dbo].[Recon2]
WITH SCHEMABINDING
AS
SELECT
dbo.Transactions.CustomerCode,
dbo.Customer_Master.CustomerName,
dbo.Transactions.TransDate,
dbo.Transactions.PubCode,
db... | In SQL Server, when creating an indexed view (also known as a materialized view), there are certain restrictions, including the use of subqueries. The use of subqueries is one of the main reasons your current view cannot be indexed.
To create an indexed view, you must remove any subqueries and ensure the view adheres ... | 13,326 | [
{
"from": "human",
"value": "I want to index this view but because it has subquery i cant index. Can anyone suggest how to change this view so that i can index it.\nALTER VIEW [dbo].[Recon2]\nWITH SCHEMABINDING\nAS\nSELECT \ndbo.Transactions.CustomerCode, \ndbo.Customer_Master.CustomerName, \ndbo.Transa... |
When building some of my PHP apps, a lot of the functionality could be coded using PEAR/PECL modules, however, the fact that some people using it may not have the access to install things, It poses a puzzler for me.
Should I forsake some users to use PEAR/PECL for functionality, where these will allow me to have a syst... | When deciding whether to use PEAR/PECL modules in your PHP application, there are several factors to consider. Here’s a structured way to approach the decision:
### Pros and Cons of Using PEAR/PECL
#### Pros:
1. **Speed of Development**: Using existing libraries allows you to build features faster and take advantage ... | 10,642 | [
{
"from": "human",
"value": "When building some of my PHP apps, a lot of the functionality could be coded using PEAR/PECL modules, however, the fact that some people using it may not have the access to install things, It poses a puzzler for me.\nShould I forsake some users to use PEAR/PECL for functionality... |
Am I correct in assuming that I always need to explicitly deploy referenced assemblies when their source changes?
| Yes, you are correct in assuming that when the source code of referenced assemblies changes, you generally need to redeploy those assemblies. This is important for ensuring that your application has the latest version of the assemblies it depends on, which may include bug fixes, performance improvements, or new feature... | 18,827 | [
{
"from": "human",
"value": "Am I correct in assuming that I always need to explicitly deploy referenced assemblies when their source changes?\n"
},
{
"from": "gpt",
"value": "Yes, you are correct in assuming that when the source code of referenced assemblies changes, you generally need to redep... |
I have great doubts about this forum, but I am willing to be pleasantly surprised ;) Kudos and great karma to those who get me back on track.
I am attempting to use the blitz implementation of JavaSpaces (http://www.dancres.org/blitz/blitz_js.html) to implement the ComputeFarm example provided at http://today.java.net/... | The `ClassNotFoundException: com.sun.jini.mahalo.TxnMgrProxy` error you're encountering indicates that the Java runtime is unable to find the class `com.sun.jini.mahalo.TxnMgrProxy` when it's trying to unmarshal a remote method call. Here are a few steps you can take to troubleshoot and resolve this issue:
1. **Check ... | 10,939 | [
{
"from": "human",
"value": "I have great doubts about this forum, but I am willing to be pleasantly surprised ;) Kudos and great karma to those who get me back on track.\nI am attempting to use the blitz implementation of JavaSpaces (http://www.dancres.org/blitz/blitz_js.html) to implement the ComputeFarm ... |
I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would help.
int ret;
ret = execl ("/bin/ls", "... | Creating an interactive shell that executes basic commands like `cd`, `ls`, and `echo` can indeed utilize the `exec` family of functions in C. To implement this, you'll need to fork a new process using `fork()`, and in the child process, use one of the `exec` functions to replace the child’s process image with the new ... | 12,634 | [
{
"from": "human",
"value": "I have a project the requires the use of the exec family. My project consist of making an interactive shell. The shell will implement a few basic commands like cd, ls, echo, etc. I have been researching the use of exec, but have not found a useful site. Any suggested links would... |
I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at?
I wish I had more details on how I am implementing this timed delay, but until I have more information on how to add a timed delay I am not sure on how I should even attempt... | In C++, there are several ways to introduce a timed delay in your program. The most common approaches involve using standard library functions or operating system-specific APIs. Below are a few methods that you can use to implement a timed delay in your C++ program:
### 1. Using `std::this_thread::sleep_for` (C++11 an... | 13,999 | [
{
"from": "human",
"value": "I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at?\nI wish I had more details on how I am implementing this timed delay, but until I have more information on how to add a timed delay ... |
I've looked at this explanation on Wikipedia, specifically the C++ sample, and fail to recognize the difference between just defining 3 classes, creating instances and calling them, and that example. What I saw was just placing two other classes into the process and cannot see where there would be a benefit. Now I'm su... | It's great that you're looking to understand the nuances of design patterns like the Strategy Pattern. Your example captures a significant aspect of the pattern and its application in a straightforward manner. However, let's explore the benefits of using the Strategy Pattern more deeply, especially in a real-world scen... | 15,178 | [
{
"from": "human",
"value": "I've looked at this explanation on Wikipedia, specifically the C++ sample, and fail to recognize the difference between just defining 3 classes, creating instances and calling them, and that example. What I saw was just placing two other classes into the process and cannot see w... |
I want to delete all directories and subdirectories under a root directory that are contain "tmp" in their names. This should include any .svn files too. My first guess is to use
<delete>
<dirset dir="${root}">
<include name="**/*tmp*" />
</dirset>
</delete>
This does not seem to work as you can't n... | In Apache Ant, to delete directories and subdirectories with "tmp" in their names, you need to use the `<fileset>` or `<path>` elements instead of nesting a `<dirset>` within a `<delete>` tag. The `<delete>` task does not allow for nested `<dirset>` elements in the way you've attempted.
You can achieve this using the ... | 14,045 | [
{
"from": "human",
"value": "I want to delete all directories and subdirectories under a root directory that are contain \"tmp\" in their names. This should include any .svn files too. My first guess is to use \n<delete>\n <dirset dir=\"${root}\">\n <include name=\"**/*tmp*\" />\n </dirset>\n... |
I've recently come across a feature of doing a large query in oracle, where changing one thing resulted in a query that used to take 10 minutes taking 3 hours.
To briefly summarise, I store a lot of coordinates in the database, with each coordinate having a probability. I then want to 'bin' these coordinates into 50 me... | The behavior you're observing with your Oracle queries is a classic case of performance issues related to grouping and hashing, particularly when the distribution of your data changes.
### Explanation of the Behavior
1. **Hash Grouping**: Oracle uses a hash-based method to handle `GROUP BY` operations efficiently. Th... | 15,785 | [
{
"from": "human",
"value": "I've recently come across a feature of doing a large query in oracle, where changing one thing resulted in a query that used to take 10 minutes taking 3 hours.\nTo briefly summarise, I store a lot of coordinates in the database, with each coordinate having a probability. I then ... |
I have recently learned about binary space partitioning trees and their application to 3d graphics and collision detection. I have also briefly perused material relating to quadtrees and octrees. When would you use quadtrees over bsp trees, or vice versa? Are they interchangeable? I would be satisfied if I had enou... | Certainly! Binary Space Partitioning (BSP) trees, quadtrees, and octrees are all spatial data structures used in various applications, including computer graphics, collision detection, and spatial indexing. Each has its strengths and weaknesses, making them more suitable for certain situations than others. Below is a t... | 16,234 | [
{
"from": "human",
"value": "I have recently learned about binary space partitioning trees and their application to 3d graphics and collision detection. I have also briefly perused material relating to quadtrees and octrees. When would you use quadtrees over bsp trees, or vice versa? Are they interchange... |
I´m programming a .NET Compact Framework application which shows maps on a PDA.
I´ve created an ad hoc component that paints it´s own piece of the whole map, using several of this components the big picture is composed. I did it this way to avoid the latency of painting the whole map in a single step.
What I would like... | Your approach to painting map pieces in separate threads is conceptually sound for improving the responsiveness of the user interface. However, the .NET Compact Framework, like most UI frameworks, has certain threading limitations, especially when it comes to modifying the UI. UI components must generally be accessed a... | 14,096 | [
{
"from": "human",
"value": "I´m programming a .NET Compact Framework application which shows maps on a PDA.\nI´ve created an ad hoc component that paints it´s own piece of the whole map, using several of this components the big picture is composed. I did it this way to avoid the latency of painting the who... |
How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?
| You can create a batch script (.bat) that stops and starts a Windows service while incorporating error checking to ensure that each action was successful. Below is an example of such a script. This script uses the `sc` command to interact with services and performs checks after each command to determine if the operatio... | 14,789 | [
{
"from": "human",
"value": "How can I script a bat or cmd to stop and start a service reliably with error checking (or let me know that it wasn't successful for whatever reason)?\n"
},
{
"from": "gpt",
"value": "You can create a batch script (.bat) that stops and starts a Windows service while ... |
Is there an easy way to return data to web service clients in JSON using java? I'm fine with servlets, spring, etc.
| Yes, there are several easy ways to return data in JSON format to web service clients using Java, depending on the framework you choose. Below are methods for doing this using both Servlets and Spring Framework.
### Using Servlets
You can create a simple servlet that responds with JSON data by setting the appropriate... | 8,402 | [
{
"from": "human",
"value": "Is there an easy way to return data to web service clients in JSON using java? I'm fine with servlets, spring, etc.\n"
},
{
"from": "gpt",
"value": "Yes, there are several easy ways to return data in JSON format to web service clients using Java, depending on the fr... |
Is TLS 1.1 support included in Windows XP SP3?
| Yes, Windows XP SP3 includes support for TLS 1.0, but it does not natively support TLS 1.1 or TLS 1.2. However, it is possible to enable TLS 1.1 and TLS 1.2 on Windows XP by applying specific updates and patches. Microsoft released a few updates that can help enable TLS 1.1 and 1.2 on Windows XP, but these are not part... | 19,956 | [
{
"from": "human",
"value": "Is TLS 1.1 support included in Windows XP SP3? \n"
},
{
"from": "gpt",
"value": "Yes, Windows XP SP3 includes support for TLS 1.0, but it does not natively support TLS 1.1 or TLS 1.2. However, it is possible to enable TLS 1.1 and TLS 1.2 on Windows XP by applying spe... |
By default the session expiry seems to be 20 minutes.
Update: I do not want the session to expire until the browser is closed.
Update2: This is my scenario. User logs into site. Plays around the site. Leaves computer to go for a shower (>20 mins ;)). Comes back to computer and should be able to play around. He closes ... | To achieve the behavior you described, you need to set the session cookies in PHP in such a way that they expire when the browser is closed, but persist while the browser is open. Here's how you can implement this:
1. **Set `session.cookie_lifetime`**: In your `php.ini` file, ensure that `session.cookie_lifetime` is s... | 9,470 | [
{
"from": "human",
"value": "By default the session expiry seems to be 20 minutes. \nUpdate: I do not want the session to expire until the browser is closed.\nUpdate2: This is my scenario. User logs into site. Plays around the site. Leaves computer to go for a shower (>20 mins ;)). Comes back to computer an... |
In a question answer I find the following coding tip:-
2) simple lambdas with one parameter:
x => x.ToString() //simplify so many calls
As someone who has not yet used 3.0 I don't really understand this tip but it looks interesting so I would appreciate an expantion on how this simplifies calls with a few examples.
I'... | Certainly! Let's break this down.
### What are Lambdas?
In programming, a **lambda expression** (or simply a **lambda**) is a way to define an anonymous function that can be used to create delegates or expression tree types. In simpler terms, it's a way to create short snippets of code that can be executed later. Lam... | 13,049 | [
{
"from": "human",
"value": "In a question answer I find the following coding tip:-\n2) simple lambdas with one parameter:\nx => x.ToString() //simplify so many calls\n\nAs someone who has not yet used 3.0 I don't really understand this tip but it looks interesting so I would appreciate an expantion on how ... |
I have just read this question and I really loved this answer to the question. Naturally, an interesting question popped in my head...
How to add my own events (of my own applications) in the Control Panel -> Sounds and Audio Devices -> Sounds -> Program Events?
And another related question, that I suppose should be an... | To add your own events to the Control Panel -> Sounds and Audio Devices -> Sounds -> Program Events, and to play those sounds from your application, you can follow these steps:
### Adding Custom Sound Events
1. **Registry Editing**:
- You can add custom events to the Windows sound scheme using the Windows Registry... | 12,557 | [
{
"from": "human",
"value": "I have just read this question and I really loved this answer to the question. Naturally, an interesting question popped in my head...\nHow to add my own events (of my own applications) in the Control Panel -> Sounds and Audio Devices -> Sounds -> Program Events?\nAnd another re... |
What is the most efficient way to clone a JavaScript object? I've seen obj = eval(uneval(o)); being used, but that's non-standard and only supported by Firefox. I've done things like obj = JSON.parse(JSON.stringify(o)); but question the efficiency. I've also seen recursive copying functions with various flaws.
I'm su... | Cloning a JavaScript object can indeed be approached in multiple ways, each with its trade-offs in terms of efficiency, depth of cloning, and handling of different data types. Here are some common methods to clone objects, along with their pros and cons:
### 1. JSON Method
```javascript
const clone = JSON.parse(JSON.s... | 15,062 | [
{
"from": "human",
"value": "What is the most efficient way to clone a JavaScript object? I've seen obj = eval(uneval(o)); being used, but that's non-standard and only supported by Firefox. I've done things like obj = JSON.parse(JSON.stringify(o)); but question the efficiency. I've also seen recursive copy... |
Folks, we all know that IP blacklisting doesn't work - spammers can come in through a proxy, plus, legitimate users might get affected... That said, blacklisting seems to me to be an efficient mechanism to stop a persistent attacker, given that the actual list of IP's is determined dynamically, based on application's f... | The mechanism you're proposing is a combination of rate-limiting and dynamic IP blacklisting, which can be an effective way to mitigate abuse in web applications. Here’s a breakdown of how your approach can work, along with potential tools and implementations:
### Proposed Mechanism
1. **Reporting Offenses**: Impleme... | 14,125 | [
{
"from": "human",
"value": "Folks, we all know that IP blacklisting doesn't work - spammers can come in through a proxy, plus, legitimate users might get affected... That said, blacklisting seems to me to be an efficient mechanism to stop a persistent attacker, given that the actual list of IP's is determi... |
I am looking for a good way to consistently test my web applications from the end users point of view. I have all kinds of ways to check to make sure my code is working behind the scenes. I can't count the number of times that I make a change to a piece of code, test it and it works fine and then deploy it only to have... | Hi Scott and the Dev Team,
It's great that you're looking for a robust way to test your web applications from an end-user's point of view. To achieve consistent end-to-end (E2E) testing and ensure that changes in your code don’t introduce regressions, you can consider the following approaches:
### 1. **Automated End-... | 12,546 | [
{
"from": "human",
"value": "I am looking for a good way to consistently test my web applications from the end users point of view. I have all kinds of ways to check to make sure my code is working behind the scenes. I can't count the number of times that I make a change to a piece of code, test it and it w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.