instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
How can I use the Prototype library and create unobtrusive javascript to inject the onmouseover and onmouseout events to each row, rather than putting the javascript in each table row tag? An answer utilizing the Prototype library (instead of mootools, jQuery, etc) would be most helpful.
To create unobtrusive JavaScript using the Prototype library, you can separate your JavaScript from the HTML by using event delegation. This means you will not include JavaScript event handlers directly in your HTML, but will instead attach event listeners using JavaScript. Here’s an example of how to inject `onmouseo...
2,193
[ { "from": "human", "value": "How can I use the Prototype library and create unobtrusive javascript to inject the onmouseover and onmouseout events to each row, rather than putting the javascript in each table row tag?\nAn answer utilizing the Prototype library (instead of mootools, jQuery, etc) would be mos...
Attempting to insert an escape character into a table results in a warning. For example: create table EscapeTest (text varchar(50)); insert into EscapeTest (text) values ('This is the first part \n And this is the second'); Produces the warning: WARNING: nonstandard use of escape in a string literal (Using PSQL 8....
The warning you are encountering in PostgreSQL 8.2 is due to the way you are using the escape character (`\n`) in your string. PostgreSQL treats string literals with backslashes in a non-standard way unless you're using a specific format for your string. There are two common approaches to handle this situation: ### 1...
3,169
[ { "from": "human", "value": "Attempting to insert an escape character into a table results in a warning. \nFor example:\ncreate table EscapeTest (text varchar(50));\n\ninsert into EscapeTest (text) values ('This is the first part \\n And this is the second');\n\nProduces the warning:\nWARNING: nonstandard ...
I'm starting developing with Flex on my Mac but i don't find good tools to ease the development (apart from Flex Builder). What is your favourite choice for Flex development on Mac?
While Flex Builder (now known as Flash Builder) was the primary IDE for Flex development, there are other tools and options you can consider for developing Flex applications on a Mac: 1. **Flash Builder**: If you haven't already, consider using Adobe Flash Builder, which is the official IDE for developing Flex applica...
618
[ { "from": "human", "value": "I'm starting developing with Flex on my Mac but i don't find good tools to ease the development (apart from Flex Builder).\nWhat is your favourite choice for Flex development on Mac?\n" }, { "from": "gpt", "value": "While Flex Builder (now known as Flash Builder) was...
How do you write the syntax for a While loop? C# int i = 0; while (i != 10) { Console.WriteLine(i); i++; } VB.Net Dim i As Integer = 0 While i <> 10 Console.WriteLine(i) i += 1 End While PHP <?php while(CONDITION) { //Do something here. } ?> <?php //MySQL query stuff here $result = mysql_query($...
Here’s a concise summary of the syntax for a `while` loop in various programming languages, including the examples you provided: ### C# ```csharp int i = 0; while (i != 10) { Console.WriteLine(i); i++; } ``` ### VB.Net ```vb.net Dim i As Integer = 0 While i <> 10 Console.WriteLine(i) i += 1 End Whil...
2,763
[ { "from": "human", "value": "How do you write the syntax for a While loop?\nC#\nint i = 0; \nwhile (i != 10)\n{ \n Console.WriteLine(i); \n i++; \n}\n\nVB.Net\nDim i As Integer = 0\nWhile i <> 10\n Console.WriteLine(i)\n i += 1\nEnd While \n\nPHP\n<?php\nwhile(CONDITION)\n{\n//Do something here.\...
TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics?
The design choice to have `TreeNodeCollection` (as well as other collections in `System.Windows.Forms`) implement `IEnumerable` can be attributed to several factors, including ease of use, flexibility, and historical context. 1. **Ease of Use**: Implementing `IEnumerable` allows developers to use foreach loops to iter...
2,086
[ { "from": "human", "value": "TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics?\n" }, { "from": "gpt", "value": "The design choice to have ...
Should be available to non-U.S. companies, easy to setup, reliable, cheap, customizable, etc. What are your experiences?
It seems like you're looking for options or services that meet specific criteria for non-U.S. companies, focusing on aspects like ease of setup, reliability, cost-effectiveness, and customization. While I don't have personal experiences, I can provide some insights into various types of services and platforms that migh...
2,382
[ { "from": "human", "value": "Should be available to non-U.S. companies, easy to setup, reliable, cheap, customizable, etc. What are your experiences?\n" }, { "from": "gpt", "value": "It seems like you're looking for options or services that meet specific criteria for non-U.S. companies, focusing...
I'd love to know if there is such a thing as a Gecko.NET ;) I mean, just like we can embed a WebView and that is an "instance" of IE7 inside any Windows Forms application (and tell it to navigateto(fancy_url);). I'd love to use Firefox or WebKit. Anybody tried this? UPDATE: Please bear in mind that although it is poss...
Yes, there are options available for embedding web browsers in .NET applications that utilize different rendering engines, such as Gecko (Firefox) or Chromium. Here’s a summary of some options that you can explore: ### Gecko-Based Options 1. **GeckoFX**: - GeckoFX is a .NET wrapper for Mozilla's Gecko engine, allo...
2,573
[ { "from": "human", "value": "I'd love to know if there is such a thing as a Gecko.NET ;) I mean, just like we can embed a WebView and that is an \"instance\" of IE7 inside any Windows Forms application (and tell it to navigateto(fancy_url);). I'd love to use Firefox or WebKit. \nAnybody tried this?\nUPDATE:...
I've got a combo-box that sits inside of a panel in Flex 3. Basically I want to fade the panel using a Fade effect in ActionScript. I can get the fade to work fine, however the label of the combo-box does not fade. I had this same issue with buttons and found that their fonts needed to be embedded. No problem. I e...
It seems like you're on the right track with embedding fonts for your ComboBox in Flex 3, but there are a few adjustments you might want to consider to ensure that the selected item label of the ComboBox also fades properly. Here's a step-by-step guide on how to achieve that: ### 1. Ensure Your Item Renderer Uses the...
534
[ { "from": "human", "value": "I've got a combo-box that sits inside of a panel in Flex 3. Basically I want to fade the panel using a Fade effect in ActionScript. I can get the fade to work fine, however the label of the combo-box does not fade. I had this same issue with buttons and found that their fonts...
Do you know if there is a built-in function to build a dictionary from an arbitrary object? I'd like to do something like this: >>> class Foo: ... bar = 'hello' ... baz = 'world' ... >>> f = Foo() >>> props(f) { 'bar' : 'hello', 'baz' : 'world' } NOTE: It should not include methods. Only fields.
Yes, you can create a function to build a dictionary from an object's attributes while excluding methods. In Python, the built-in `vars()` function can be used in combination with `type()` and `dir()` to filter out methods and return only the instance variables (attributes). Here’s how you can implement the `props` fu...
3,108
[ { "from": "human", "value": "Do you know if there is a built-in function to build a dictionary from an arbitrary object? I'd like to do something like this:\n>>> class Foo:\n... bar = 'hello'\n... baz = 'world'\n...\n>>> f = Foo()\n>>> props(f)\n{ 'bar' : 'hello', 'baz' : 'world' }\n\nNOTE: It shoul...
My dream IDE does full code hints, explains and completes PHP, Javascript, HTML and CSS. I know it exists! so far, Zend studio 6, under the Eclipse IDE does a great job at hinting PHP, some Javascript and HTML, any way I can expand this? edit: a bit more information: right now, using zend-6 under eclipse, i type in <?p...
To enhance your coding experience in Zend Studio 6 under the Eclipse IDE and get more robust code hints and completions for JavaScript, HTML, and CSS, you can try the following approaches: ### 1. Install Additional Plugins Eclipse has a rich ecosystem of plugins that can enhance its capabilities. You can look into ins...
1,435
[ { "from": "human", "value": "My dream IDE does full code hints, explains and completes PHP, Javascript, HTML and CSS. I know it exists!\nso far, Zend studio 6, under the Eclipse IDE does a great job at hinting PHP, some Javascript and HTML, any way I can expand this?\nedit: a bit more information: right now...
I'm looking for a library to handle iCalendar data in Java. Open source, well-documented implementations with a good object model are preferred. iCal parsing capabilities are less important to me, but still nice to have. Does anyone have any recommendations?
There are several open-source libraries in Java that handle iCalendar data and come with good documentation and a robust object model. Here are a few recommendations: 1. **ical4j**: - **Description**: ical4j is one of the most widely used libraries for handling iCalendar data in Java. It provides a comprehensive se...
2,077
[ { "from": "human", "value": "I'm looking for a library to handle iCalendar data in Java.\nOpen source, well-documented implementations with a good object model are preferred. iCal parsing capabilities are less important to me, but still nice to have.\nDoes anyone have any recommendations?\n" }, { "...
When learning a new programming language, one of the possible roadblocks you might encounter is the question whether the language is, by default, pass-by-value or pass-by-reference. So here is my question to all of you, in your favorite language, how is it actually done? And what are the possible pitfalls? Your favorit...
The concepts of pass-by-value and pass-by-reference can significantly impact how you work with a programming language. Let’s take a look at some popular programming languages and how they handle parameter passing, along with potential pitfalls for each. ### Python - **Default**: Python uses a mechanism often described...
1,198
[ { "from": "human", "value": "When learning a new programming language, one of the possible roadblocks you might encounter is the question whether the language is, by default, pass-by-value or pass-by-reference.\nSo here is my question to all of you, in your favorite language, how is it actually done? And wh...
How can I create rounded corners using CSS?
You can create rounded corners in CSS using the `border-radius` property. This property allows you to set the radius of the corners of an element, making them appear rounded. Here are some examples of how to use it: ### Basic Example ```css .box { width: 200px; height: 100px; background-color: blue; b...
2,220
[ { "from": "human", "value": "How can I create rounded corners using CSS?\n" }, { "from": "gpt", "value": "You can create rounded corners in CSS using the `border-radius` property. This property allows you to set the radius of the corners of an element, making them appear rounded. Here are some e...
Our company is currently writing a GUI automation testing tool for compact framework applications. We have initially searched many tools but none of them was right for us. By using the tool you can record test-cases and group them together to test-suites. For every test-suite there is generated an application, which l...
Creating a GUI automation testing tool for compact framework applications can be challenging, especially when using window handles for simulating user input. Here are a few alternative approaches and strategies that you might consider to address the limitations you're facing: ### 1. **Using UI Automation Frameworks:**...
1,467
[ { "from": "human", "value": "Our company is currently writing a GUI automation testing tool for compact framework applications. We have initially searched many tools but none of them was right for us. \nBy using the tool you can record test-cases and group them together to test-suites. For every test-suite ...
I maintain several client sites that have no dynamic data whatsoever, everything is static asp.net with c#. Are there any pitfalls to caching the entire page for extreme periods of time, like a week? Kibbee, We use a couple controls on the sites (ad rotator, some of the ajax extensions) on the sites. They could probab...
Caching entire static pages for extended periods (like a week) can be a good strategy for improving performance, reducing server load, and providing faster response times for your clients. However, there are several potential pitfalls and considerations you should keep in mind: 1. **Stale Content**: If any content on ...
1,393
[ { "from": "human", "value": "I maintain several client sites that have no dynamic data whatsoever, everything is static asp.net with c#.\nAre there any pitfalls to caching the entire page for extreme periods of time, like a week?\nKibbee, We use a couple controls on the sites (ad rotator, some of the ajax e...
I'm translating my C# code for YouTube video comments into PHP. In order to properly nest comment replies, I need to re-arrange XML nodes. In PHP I'm using DOMDocument and DOMXPath which closely corresponds to C# XmlDocument. I've gotten pretty far in my translation but now I'm stuck on getting the parent node of a DOM...
In PHP's DOM extension, a `DOMElement` does not have a direct method to access its parent node. Instead, you can utilize the `parentNode` property from the `DOMNode` class, which is the parent class for `DOMElement`. To retrieve the parent node of a `DOMElement`, simply access the `parentNode` property. Here's how you...
2,242
[ { "from": "human", "value": "I'm translating my C# code for YouTube video comments into PHP. In order to properly nest comment replies, I need to re-arrange XML nodes. In PHP I'm using DOMDocument and DOMXPath which closely corresponds to C# XmlDocument. I've gotten pretty far in my translation but now I'm ...
Our group (corporate environment) needs to monitor a couple of faceless accounts' Outlook inbox for specific types of bounced e-mails. WebDAV (using C# 2.0) is one of the paths we've traveled and we're almost there, except for one minor problem: we're getting the response below for the e-mail body element <a:propstat...
It seems you are encountering a specific issue when trying to access the body of undeliverable email messages via WebDAV. The HTTP 404 Resource Not Found error indicates that the server cannot find the resource you are trying to access. In the context of undeliverable emails, this might occur due to the following reaso...
1,516
[ { "from": "human", "value": "Our group (corporate environment) needs to monitor a couple of faceless accounts' Outlook inbox for specific types of bounced e-mails. \nWebDAV (using C# 2.0) is one of the paths we've traveled and we're almost there, except for one minor problem: we're getting the response bel...
Is there a good ruby gem for a WYSIWYG editor that will easily work with a rails app?
Yes, there are several Ruby gems that can be used to integrate WYSIWYG editors into a Ruby on Rails application. Here are some popular options: 1. **ActionText**: If you're using Rails 6 or later, ActionText is built-in and provides a rich text editor with many useful features. It supports file uploads and comes with ...
1,128
[ { "from": "human", "value": "Is there a good ruby gem for a WYSIWYG editor that will easily work with a rails app?\n" }, { "from": "gpt", "value": "Yes, there are several Ruby gems that can be used to integrate WYSIWYG editors into a Ruby on Rails application. Here are some popular options:\n\n1...
Is there a way to disable entering multi-line entries in a Text Box (i.e., I'd like to stop my users from doing ctrl-enter to get a newline)?
Yes, you can disable multi-line entries in a text box by preventing the default behavior of the Enter key (and possibly Ctrl + Enter) using JavaScript. Below are a couple of examples for different scenarios: ### Using HTML and JavaScript If you're using a standard HTML `<textarea>` or an `<input>` element for single-...
2,033
[ { "from": "human", "value": "Is there a way to disable entering multi-line entries in a Text Box (i.e., I'd like to stop my users from doing ctrl-enter to get a newline)?\n" }, { "from": "gpt", "value": "Yes, you can disable multi-line entries in a text box by preventing the default behavior of ...
Does anyone know of a powershell cmdlet out there for automating task scheduler in XP/2003? If you've ever tried to work w/ schtasks you know it's pretty painful.
In Windows XP and Windows Server 2003, PowerShell is not natively included, but you can utilize the `schtasks` command-line tool for task scheduling. However, since you find `schtasks` painful to work with, here are some alternatives to manage the Task Scheduler more easily. ### Using VBScript If PowerShell is not an...
1,551
[ { "from": "human", "value": "Does anyone know of a powershell cmdlet out there for automating task scheduler in XP/2003? If you've ever tried to work w/ schtasks you know it's pretty painful.\n" }, { "from": "gpt", "value": "In Windows XP and Windows Server 2003, PowerShell is not natively incl...
Is there a built-in function/method that can check if a given string is a valid URI or not in the Mozilla XUL toolkit? I have looked for one but found none, but since this is my first time using XUL and its documentation it could be that I just overlooked it. So I'm just making sure before I start writing my own IsVali...
In the Mozilla XUL toolkit, there isn't a specific built-in function dedicated solely to validating URIs like you might find in some other frameworks. However, you can use JavaScript's built-in capabilities to help with URI validation. One common approach is to use the `URL` constructor in JavaScript, which can throw ...
3,674
[ { "from": "human", "value": "Is there a built-in function/method that can check if a given string is a valid URI or not in the Mozilla XUL toolkit? I have looked for one but found none, but since this is my first time using XUL and its documentation it could be that I just overlooked it. So I'm just making ...
I run Flex Builder 3 on a mac and as my project grows - the compile time gets longer and longer and longer. I am using some SWC's and there is a fair amount of code but it shouldn't take minutes to build and crash daily should it?
Compile times increasing significantly as a project grows is a common issue, especially in environments like Flex Builder (also known as Adobe Flash Builder). Here are some strategies you can consider to improve your compile times and reduce crashes: 1. **Optimize SWC Usage**: - Minimize the number of SWCs you're ...
1,456
[ { "from": "human", "value": "I run Flex Builder 3 on a mac and as my project grows - the compile time gets longer and longer and longer. I am using some SWC's and there is a fair amount of code but it shouldn't take minutes to build and crash daily should it?\n" }, { "from": "gpt", "value": "Co...
Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd) that is only sized at 8.2 GB. I would like to double the size to something like 16-20GB. I see options for compacting the VHD but nothing to expand it. It's set to "dynamically expand" but I'm installing some software and it doesn't seem to...
Expanding a Virtual Hard Disk (VHD) in Virtual PC is not directly supported through the Virtual PC interface, but you can achieve this through a few steps. Here's how you can expand your VHD: ### Step 1: Create a new larger VHD 1. Open Virtual PC and create a new virtual machine with a new VHD of the desired size (16-...
2,356
[ { "from": "human", "value": "Hey everyone, I'm using Virtual PC and working with a virtual hard disk (*.vhd) that is only sized at 8.2 GB. I would like to double the size to something like 16-20GB. I see options for compacting the VHD but nothing to expand it. It's set to \"dynamically expand\" but I'm inst...
Has anyone run into this error message before when using a timer on an ASP.NET page to update a DataGrid every x seconds? Searching google yielded this blog entry and many more but nothing that seems to apply to me yet. The full text of the error message below: Sys.WebForms.PageRequestManagerParserErrorException: ...
Yes, the `Sys.WebForms.PageRequestManagerParserErrorException` error is a common issue when working with ASP.NET Web Forms, especially when using AJAX features like timers or UpdatePanels. This error usually occurs when the response from the server is not in the expected format, often caused by one of the following rea...
410
[ { "from": "human", "value": "Has anyone run into this error message before when using a timer on an ASP.NET page to update a DataGrid every x seconds? \nSearching google yielded this blog entry and many more but nothing that seems to apply to me yet. \nThe full text of the error message below:\n\nSys.WebF...
This line in YUI's Reset CSS is causing trouble for me: address,caption,cite,code,dfn,em,strong,th,var { font-style: normal; font-weight: normal; } It makes my em not italic and my strong not bold. Which is okay. I know how to override that in my own stylesheet. strong, b { font-weight: bold; } em, i { ...
To achieve the desired styling where both `<strong>` and `<em>` elements maintain their formatting within the same text, you need to ensure that your CSS rules allow nested elements to inherit the correct styles. Since YUI's Reset CSS is overriding the default behavior of `<em>` and `<strong>`, you'll want to write y...
1,992
[ { "from": "human", "value": "This line in YUI's Reset CSS is causing trouble for me:\naddress,caption,cite,code,dfn,em,strong,th,var {\n font-style: normal;\n font-weight: normal;\n}\n\nIt makes my em not italic and my strong not bold. Which is okay. I know how to override that in my own stylesheet.\n...
I have a small VB.NET application that I'm working on using the full version of Visual Studio 2005. In the Publish properties of the project, I have it set to Automatically increment revision with each publish. The issue is that it's only incrementing the revision in the Setup files. It doesn't seem to be updating the ...
In a VB.NET application, the version number that is displayed in the About Box is indeed derived from `My.Application.Info.Version`. This version number is determined by the assembly version specified in your project settings. When you set the project to "Automatically increment revision with each publish", it updates ...
1,942
[ { "from": "human", "value": "I have a small VB.NET application that I'm working on using the full version of Visual Studio 2005. In the Publish properties of the project, I have it set to Automatically increment revision with each publish.\nThe issue is that it's only incrementing the revision in the Setup ...
Is there a simple way in Perl that will allow me to determine if a given variable is numeric? Something along the lines of: if (is_number($x)) { ... } would be ideal. A technique that won't throw warnings when the -w switch is being used is certainly preferred.
Yes, you can easily determine if a variable is numeric in Perl without causing warnings, even when using the `-w` switch. One common way to check if a variable is numeric is by using a regular expression. Here's a simple subroutine you can define called `is_number`: ```perl sub is_number { my ($x) = @_; return...
2,444
[ { "from": "human", "value": "Is there a simple way in Perl that will allow me to determine if a given variable is numeric? Something along the lines of:\nif (is_number($x))\n{ ... }\n\nwould be ideal. A technique that won't throw warnings when the -w switch is being used is certainly preferred.\n" }, ...
A question related to Regular cast vs. static_cast vs. dynamic_cast: What cast syntax style do you prefer in C++? C-style cast syntax: (int)foo C++-style cast syntax: static_cast<int>(foo) constructor syntax: int(foo) They may not translate to exactly the same instructions (do they?) but their effect should be the sa...
Casting in C++ can indeed be done in multiple ways, each with its own implications and best use cases. Let's break down the different types of casting you mentioned: 1. **C-style cast**: ```cpp (int)foo ``` This syntax can perform a variety of casts (static, const, or reinterpret), which can lead to poten...
1,462
[ { "from": "human", "value": "A question related to Regular cast vs. static_cast vs. dynamic_cast:\nWhat cast syntax style do you prefer in C++?\n\nC-style cast syntax: (int)foo\nC++-style cast syntax: static_cast<int>(foo)\nconstructor syntax: int(foo)\n\nThey may not translate to exactly the same instructi...
I have a program that spits out both standard error and standard out, and I want to run my pager less on the standard error, but ignore standard out. How do I do that? Update: That's it ... I didn't want to lose stdout ... just keep it out of pager program 2>&1 >log | less then later less log
You can achieve your goal of sending only the standard error (stderr) output to `less`, while keeping standard output (stdout) visible in your terminal. Here's how to do it in a single command line: ```bash your_program 2>&1 1>/dev/null | less ``` ### Explanation: 1. `your_program`: Replace this with the command you ...
3,307
[ { "from": "human", "value": "I have a program that spits out both standard error and standard out, and I want to run my pager less on the standard error, but ignore standard out. How do I do that?\nUpdate:\nThat's it ... I didn't want to lose stdout ... just keep it out of pager\nprogram 2>&1 >log | less\n\...
Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable IE: public class CollectionBase : IEnumerable and then would derive their Business Object collections from that. public class BusinessObjectCollection : CollectionBase Now with t...
Your approach of deriving a business object collection from `List<BusinessObject>` is quite common and has several advantages, especially with the advent of generics in C#. Let's break down the considerations and benefits of different approaches to managing collections in your business logic. ### 1. Using `List<T>` Di...
1,426
[ { "from": "human", "value": "Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable\nIE:\npublic class CollectionBase : IEnumerable\n\nand then would derive their Business Object collections from that.\npublic class Busines...
I've been banging my head against SQL Server 2005 trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren't encapsulated, so you can't deal with an...
Migrating data from SQL Server 2005 to MySQL can indeed be challenging, especially with a large number of tables and the need to handle data types properly. Here are several tools and methods that can help you with this task: 1. **SQL Server Integration Services (SSIS)**: - If you have access to SQL Server Manageme...
1,030
[ { "from": "human", "value": "I've been banging my head against SQL Server 2005 trying to get a lot of data out. I've been given a database with nearly 300 tables in it and I need to turn this into a MySQL database. My first call was to use bcp but unfortunately it doesn't produce valid CSV - strings aren'...
Is there a method (other than trial and error) I can use to find unused image files? How about CSS declarations for ID's and Classes that don't even exist in the site? It seems like there might be a way to write a script that scans the site, profile it, and see which images and styles are never loaded.
Yes, there are more systematic methods than trial and error to find unused image files and unused CSS declarations. Here’s how you can approach both tasks using various tools and techniques: ### Finding Unused Image Files 1. **Web Crawlers/Scrapers**: You can use web scraping tools or libraries (e.g., Scrapy, Beautif...
200
[ { "from": "human", "value": "Is there a method (other than trial and error) I can use to find unused image files? How about CSS declarations for ID's and Classes that don't even exist in the site?\nIt seems like there might be a way to write a script that scans the site, profile it, and see which images and...
Searching for some sample code for converting a point in WGS84 coordinate system to a map position in Google Maps (pixel position), also supporting zoom levels. If the codes is well commented, then it can also be in some other language. You can also point me to a open source Java project :) Some resources found: OpenL...
Converting a WGS84 coordinate (latitude, longitude) to a pixel position on a Google Maps tile involves a few steps, including calculating the appropriate zoom level, converting to the correct projection (Web Mercator), and then determining the tile coordinates and pixel positions. Here's a sample implementation in Pyt...
245
[ { "from": "human", "value": "Searching for some sample code for converting a point in WGS84 coordinate system to a map position in Google Maps (pixel position), also supporting zoom levels. \nIf the codes is well commented, then it can also be in some other language.\nYou can also point me to a open source ...
If one has a peer-to-peer system that can be queried, one would like to reduce the total number of queries across the network (by distributing "popular" items widely and "similar" items together) avoid excess storage at each node assure good availability to even moderately rare items in the face of client downtime, ...
Your inquiry touches on several intricate challenges in the design of peer-to-peer (P2P) systems. Here are some key points regarding existing approaches, research avenues, criteria, and collaboration opportunities: ### Existing Approaches 1. **Content-based Distribution**: - **DHTs (Distributed Hash Tables)**: Sys...
284
[ { "from": "human", "value": "If one has a peer-to-peer system that can be queried, one would like to \n\nreduce the total number of queries across the network (by distributing \"popular\" items widely and \"similar\" items together) \navoid excess storage at each node\nassure good availability to even moder...
Does C# have built-in support for parsing strings of page numbers? By page numbers, I mean the format you might enter into a print dialog that's a mixture of comma and dash-delimited. Something like this: 1,3,5-10,12 What would be really nice is a solution that gave me back some kind of list of all page numbers repre...
C# does not have built-in support specifically for parsing page numbers formatted in the way you've described (i.e., with a mixture of commas and dashes), but you can easily achieve this by writing a custom method to parse the input string. Here's a simple example of how you can implement this functionality to conver...
926
[ { "from": "human", "value": "Does C# have built-in support for parsing strings of page numbers? By page numbers, I mean the format you might enter into a print dialog that's a mixture of comma and dash-delimited.\nSomething like this:\n1,3,5-10,12\n\nWhat would be really nice is a solution that gave me bac...
We are about to get a canned package in that has been modified to our needs. I'm part of the team setup to prepare tests for it. It has an Oracle back end and I believe it's written in C++ .NET. My question is what free or open source testing tools would you recommend. Thanks Ken
Hi Ken, For testing an application with an Oracle backend and likely written in C++ with .NET, there are several free and open-source testing tools that you can consider. Here’s a breakdown of tools that might be useful for your testing needs: ### 1. **Unit Testing Frameworks** - **Google Test**: A widely-used tes...
122
[ { "from": "human", "value": "We are about to get a canned package in that has been modified to our needs. I'm part of the team setup to prepare tests for it. It has an Oracle back end and I believe it's written in C++ .NET.\nMy question is what free or open source testing tools would you recommend.\nThanks\...
I am creating a small modal form that is used in Winforms application. It is basically a progress bar of sorts. But I would like the user to be able to click anywhere in the form and drag it to move it around on the desktop while it is still being displayed. How can I implement this behavior?
To implement a draggable modal form in a WinForms application, you can override the mouse events to allow the user to click and drag the form around while it is being displayed. Here’s a step-by-step guide on how to achieve this: 1. **Create a new Form**: Start by creating a new Form that will serve as your modal dial...
233
[ { "from": "human", "value": "I am creating a small modal form that is used in Winforms application. It is basically a progress bar of sorts. But I would like the user to be able to click anywhere in the form and drag it to move it around on the desktop while it is still being displayed.\nHow can I implement...
Is it possible in .NET to list files on a remote location like an URL? Much in the same way the System.IO classes work. All I need is the URLs to images that are on a remote server.
In .NET, the `System.IO` namespace does not provide direct support for listing files from a remote server via a URL as it does for local file systems. However, you can achieve this using other approaches depending on the type of remote server and its configuration. Here are a few options to list files from a remote lo...
912
[ { "from": "human", "value": "Is it possible in .NET to list files on a remote location like an URL? Much in the same way the System.IO classes work. All I need is the URLs to images that are on a remote server.\n" }, { "from": "gpt", "value": "In .NET, the `System.IO` namespace does not provide ...
In my automated NAnt build we have a step that generates a lot of code off of the database (using SubSonic) and the code is separated into folders that match the schema name in the database. For example: /generated-code /dbo SomeTable.cs OtherTable.cs /abc Customer.cs Order.cs The schema names are there to...
You bring up some valid pain points regarding your automated build process with NAnt and the management of generated code from your database. Here are some suggestions that might help you improve the situation: ### 1. Centralize Code Generation in NAnt Instead of having each application maintain its own pre-build eve...
823
[ { "from": "human", "value": "In my automated NAnt build we have a step that generates a lot of code off of the database (using SubSonic) and the code is separated into folders that match the schema name in the database. For example:\n\n/generated-code\n\n\n/dbo\n\n\nSomeTable.cs\nOtherTable.cs\n\n/abc\n\n\...
Wifi support on Vista is fine, but Native Wifi on XP is half baked. NDIS 802.11 Wireless LAN Miniport Drivers only gets you part of the way there (e.g. network scanning). From what I've read (and tried), the 802.11 NDIS drivers on XP will not allow you to configure a wireless connection. You have to use the Native Wifi...
Configuring Wi-Fi networks on Windows XP, especially when you're constrained to using a custom application on a closed system and cannot use the built-in Wireless Zero Configuration (WZC), can indeed be a challenge. The Native Wi-Fi API (also known as the Native Wi-Fi Autoconfiguration API) provides a way to manage Wi-...
413
[ { "from": "human", "value": "Wifi support on Vista is fine, but Native Wifi on XP is half baked. NDIS 802.11 Wireless LAN Miniport Drivers only gets you part of the way there (e.g. network scanning). From what I've read (and tried), the 802.11 NDIS drivers on XP will not allow you to configure a wireless co...
It will be important for developers wanting to develop for the chrome browser to be able to review existing bugs (to avoid too much pulling-out of hair), and to add new ones (to improve the thing). Yet I can't seem to find the bug tracking for this project. It is open source, right?
Yes, the Chrome browser is developed as part of the Chromium open-source project, which is indeed open source. Developers can report bugs and track existing ones through the Chromium project's issue tracker. You can access the Chromium issue tracker at the following link: [Chromium Issue Tracker](https://bugs.chromiu...
4,116
[ { "from": "human", "value": "It will be important for developers wanting to develop for the chrome browser to be able to review existing bugs (to avoid too much pulling-out of hair), and to add new ones (to improve the thing). Yet I can't seem to find the bug tracking for this project. It is open source, ...
What is the best way to measure exception handling overhead/performance in C++? Please give standalone code samples. I'm targeting Microsoft Visual C++ 2008 and gcc. I need to get results from the following cases: Overhead when there are no try/catch blocks Overhead when there are try/catch blocks but exceptions are n...
Measuring exception handling overhead in C++ can be done using timing techniques to quantify the performance differences in various scenarios. Below is a standalone code sample that you can use to benchmark the three specified cases: 1. No `try/catch` blocks. 2. `try/catch` blocks without exceptions being thrown. 3. ...
873
[ { "from": "human", "value": "What is the best way to measure exception handling overhead/performance in C++?\nPlease give standalone code samples.\nI'm targeting Microsoft Visual C++ 2008 and gcc.\nI need to get results from the following cases:\n\nOverhead when there are no try/catch blocks\nOverhead when ...
I want to create a simple http proxy server that does some very basic processing on the http headers (i.e. if header x == y, do z). The server may need to support hundreds of users. I can write the server in C# (pretty easy) or c++ (much harder). However, would a C# version have as good of performance as a C++ versi...
The choice between C# and C++ for implementing an HTTP proxy server depends on various factors, including performance requirements, ease of development, and maintainability. Let's break down these considerations: ### Performance 1. **Speed and Efficiency**: - C++ generally provides better performance than C# due t...
2,047
[ { "from": "human", "value": "I want to create a simple http proxy server that does some very basic processing on the http headers (i.e. if header x == y, do z). The server may need to support hundreds of users. I can write the server in C# (pretty easy) or c++ (much harder). However, would a C# version h...
In Ruby, what's the difference between {} and []? {} seems to be used for both code blocks and hashes. Are [] only for arrays? The documention isn't very clear.
In Ruby, both `{}` and `[]` are used for different purposes, and it's important to understand their distinctions. ### `{}` (Curly Braces) 1. **Code Blocks**: - `{}` is often used to define a block of code. Blocks can be passed to methods and are a way to encapsulate a chunk of code that can be executed. - Examp...
2,017
[ { "from": "human", "value": "In Ruby, what's the difference between {} and []?\n{} seems to be used for both code blocks and hashes.\nAre [] only for arrays?\nThe documention isn't very clear.\n" }, { "from": "gpt", "value": "In Ruby, both `{}` and `[]` are used for different purposes, and it's ...
I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks.
Absolutely! In SQL Server, many tasks that can be done through the graphical user interface (GUI) can also be accomplished through T-SQL, which can be more efficient, especially when scripting or automating tasks. For example, if you want to modify a table's properties such as changing its schema, renaming it, or modi...
2,450
[ { "from": "human", "value": "I think most people know how to do this via the GUI (right click table, properties), but doing this in T-SQL totally rocks.\n" }, { "from": "gpt", "value": "Absolutely! In SQL Server, many tasks that can be done through the graphical user interface (GUI) can also be ...
For some reason I never see this done. Is there a reason why not? For instance I like _blah for private variables, and at least in Windows Forms controls are by default private member variables, but I can't remember ever seeing them named that way. In the case that I am creating/storing control objects in local vari...
Using a naming convention like a leading underscore (e.g., `_blah`) for private member variables is a practice that some developers adopt to easily distinguish between private fields and other variables (like local variables or parameters) within their classes. However, it's not universally adopted in all programming c...
1,753
[ { "from": "human", "value": "For some reason I never see this done. Is there a reason why not? For instance I like _blah for private variables, and at least in Windows Forms controls are by default private member variables, but I can't remember ever seeing them named that way. In the case that I am creat...
I installed TortoiseHg (Mercurial) in my Vista 64-bit and the context menu is not showing up when I right click a file or folder. Is there any workaround for this problem?
The issue of the TortoiseHg context menu not appearing in Windows Vista can arise due to various reasons, including compatibility issues or installation problems. Here are some workarounds you can try to resolve the problem: 1. **Run as Administrator**: - Make sure that TortoiseHg is installed and running with the ...
756
[ { "from": "human", "value": "I installed TortoiseHg (Mercurial) in my Vista 64-bit and the context menu is not showing up when I right click a file or folder. \nIs there any workaround for this problem?\n" }, { "from": "gpt", "value": "The issue of the TortoiseHg context menu not appearing in Wi...
What do I need to look at to see whether I'm on Windows or Unix, etc.?
To determine whether you are using a Windows or Unix-like operating system (such as Linux or macOS), you can look at several different indicators: ### 1. Command Line Interface If you have access to the command line or terminal, you can use specific commands to identify your operating system. - **Windows Command Prom...
869
[ { "from": "human", "value": "What do I need to look at to see whether I'm on Windows or Unix, etc.?\n" }, { "from": "gpt", "value": "To determine whether you are using a Windows or Unix-like operating system (such as Linux or macOS), you can look at several different indicators:\n\n### 1. Comman...
Browsing through the git documentation, I can't see anything analogous to SVN's commit hooks or the "propset" features that can, say, update a version number or copyright notice within a file whenever it is committed to the repository. Are git users expected to write external scripts for this sort of functionality (whi...
In Git, you can achieve similar functionality to SVN's commit hooks and properties using Git hooks and possibly external scripts. Here's how you can do this: ### Git Hooks Git provides a mechanism called **hooks**, which are scripts that run at different points in the Git workflow. Specifically, you can use the `pre-...
754
[ { "from": "human", "value": "Browsing through the git documentation, I can't see anything analogous to SVN's commit hooks or the \"propset\" features that can, say, update a version number or copyright notice within a file whenever it is committed to the repository.\nAre git users expected to write external...
I need to access the OpenGL state variables (such as the MVP matrices) in my Cg shader program. I'm passing these values to my Cg shader program manually using calls such as cgGLSetStateMatrixParameter() in my C/C++ code. Is there an easier way to do this?
In Cg, if you want to access OpenGL state variables (like the Model-View-Projection matrices) in a shader without manually passing them as parameters, you can use built-in uniform variables. However, the standard way is still to set these uniforms from your C/C++ application code, as Cg itself does not inherently retri...
2,325
[ { "from": "human", "value": "I need to access the OpenGL state variables (such as the MVP matrices) in my Cg shader program. I'm passing these values to my Cg shader program manually using calls such as cgGLSetStateMatrixParameter() in my C/C++ code. Is there an easier way to do this?\n" }, { "from"...
I am currently working on a project and my goal is to locate text in an image. OCR'ing the text is not my intention as of yet. I want to basically obtain the bounds of text within an image. I am using the AForge.Net imaging component for manipulation. Any assistance in some sense or another? Update 2/5/09: I've since w...
To locate text in an image without performing OCR, you'll want to focus on identifying the areas where text is likely to be present based on certain characteristics, such as contrast, edges, and regions of interest. Here are some steps and techniques you can use with AForge.Net to locate text bounds in an image: ### S...
868
[ { "from": "human", "value": "I am currently working on a project and my goal is to locate text in an image. OCR'ing the text is not my intention as of yet. I want to basically obtain the bounds of text within an image. I am using the AForge.Net imaging component for manipulation. Any assistance in some sens...
The following code writes no data to the back buffer on Intel integrated video cards,for example, on a MacBook. On ATI cards, such as in the iMac, it draws to the back buffer. The width and height are correct (and 800x600 buffer) and m_PixelBuffer is correctly filled with 0xAA00AA00. My best guess so far is that there ...
It sounds like you are encountering a platform-specific issue with rendering using OpenGL. Here are several suggestions that might help you troubleshoot and resolve the issue: 1. **Check OpenGL Context**: Ensure that you have a valid OpenGL context created before calling `glDrawPixels`. Make sure you're making the con...
932
[ { "from": "human", "value": "The following code writes no data to the back buffer on Intel integrated video cards,for example, on a MacBook. On ATI cards, such as in the iMac, it draws to the back buffer. The width and height are correct (and 800x600 buffer) and m_PixelBuffer is correctly filled with 0xAA00...
Over the past few years I've changed from having a long flowing page of controls that I hid/showed to using a lot of user controls. I've always had a bit of a discussion between co-workers on best practices. Should you have properties that you populate, or use paramterized sub's to load the information in your control...
Choosing between properties and parameterized methods (or subroutines) for populating controls in user controls can depend on several factors, including your team's coding standards, the specific use case of the controls, and how you envision the future evolution of your application. Below are some guidelines and best ...
1,348
[ { "from": "human", "value": "Over the past few years I've changed from having a long flowing page of controls that I hid/showed to using a lot of user controls. I've always had a bit of a discussion between co-workers on best practices. \nShould you have properties that you populate, or use paramterized sub...
When I do a file search on eclipse it includes the .svn directories by default. I tried excluding them from the build path but they still appear on file search results.
In Eclipse, you can exclude certain directories, such as `.svn` directories, from search results through the preferences. Here’s how you can exclude `.svn` directories from your file search: ### Method 1: Exclude .svn in Search Scope 1. **Open the Search Dialog**: - Press `Ctrl + H` or go to `Search > File...` fro...
638
[ { "from": "human", "value": "When I do a file search on eclipse it includes the .svn directories by default. I tried excluding them from the build path but they still appear on file search results.\n" }, { "from": "gpt", "value": "In Eclipse, you can exclude certain directories, such as `.svn` d...
I'm trying to do a simple test php script for sessions. Basically it increments a counter (stored in $_SESSION) every time you refresh that page. That works, but I'm trying to have a link to destroy the session which reloads the page with the ?destroy=1 parameter. I've tried a couple of if statements to see if that par...
It looks like you have a small issue with how you're handling the session destruction and how you're checking for the `destroy` parameter. Here's a corrected version of your PHP script: ```php <?php session_start(); // Start the session at the beginning // Check if the 'destroy' parameter is set in the URL if (isset(...
1,892
[ { "from": "human", "value": "I'm trying to do a simple test php script for sessions. Basically it increments a counter (stored in $_SESSION) every time you refresh that page. That works, but I'm trying to have a link to destroy the session which reloads the page with the ?destroy=1 parameter. I've tried a c...
Does anyone ever found/used an ASP.NET application similar to Joomla? I need to set up a quick and dirty CMS on a Windows Server and our client doesn't want us to use something else than ASP.NET.
Yes, there are several ASP.NET-based content management systems (CMS) that you can use as alternatives to Joomla. Here are some popular options that you might consider: 1. **Umbraco**: Umbraco is an open-source CMS built on ASP.NET that is very flexible and user-friendly. It has a strong community and offers a range o...
1,934
[ { "from": "human", "value": "Does anyone ever found/used an ASP.NET application similar to Joomla?\nI need to set up a quick and dirty CMS on a Windows Server and our client doesn't want us to use something else than ASP.NET.\n" }, { "from": "gpt", "value": "Yes, there are several ASP.NET-based ...
I want my controller to return the right HTTP response code when the user lacks permission to view a particular page.
When a user lacks permission to access a particular page, the appropriate HTTP response code to return is **403 Forbidden**. This status code indicates that the server understands the request but refuses to authorize it. In other words, the user does not have the necessary permissions to access the resource. Here's a ...
2,634
[ { "from": "human", "value": "I want my controller to return the right HTTP response code when the user lacks permission to view a particular page.\n" }, { "from": "gpt", "value": "When a user lacks permission to access a particular page, the appropriate HTTP response code to return is **403 Forb...
in C# I'd like to invoke the label edit of a newly added item to a ListView. basically, if I have a click here to add scenario, as soon as the new item is added, I want the text label to be in a user editable state. Thanks!
To invoke label editing for a newly added item in a `ListView` in C#, you can follow these steps: 1. Add the new item to the `ListView`. 2. Use the `BeginEdit` method to start the editing of the item's label immediately after adding it. Here's a simple example to illustrate this process. Assuming you have a `ListView...
1,207
[ { "from": "human", "value": "in C# I'd like to invoke the label edit of a newly added item to a ListView.\nbasically, if I have a click here to add scenario, as soon as the new item is added, I want the text label to be in a user editable state.\nThanks!\n" }, { "from": "gpt", "value": "To invok...
I have some classes layed out like this class A { public virtual void Render() { } } class B : A { public override void Render() { // Prepare the object for rendering SpecialRender(); // Do some cleanup } protected virtual void SpecialRender() { } } class C :...
Yes, it is possible to prevent the `C` class from overriding the `Render` method while still maintaining the current functionality of your code. You can achieve this by using the `sealed` modifier in C# on the `Render` method in class `B`. This way, class `C` will not be able to override the `Render` method, but it wil...
2,799
[ { "from": "human", "value": "I have some classes layed out like this\nclass A\n{\n public virtual void Render()\n {\n }\n}\nclass B : A\n{\n public override void Render()\n {\n // Prepare the object for rendering\n SpecialRender();\n // Do some cleanup\n }\n\n prote...
I have to do some JavaScript in the future, so it is time to update my toolbox. Right now I use Firefox with some addons: JavaScript Shell from https://www.squarefree.com/bookmarklets/webdevel.html Firefox Dom Inspector Firebug Greasemonkey Stylish I plan to use Venkman Javascript debugger as well as jsunit and js-l...
It sounds like you have a solid foundation for your JavaScript development environment! Here are some additional tools and resources you might consider adding to your toolkit to enhance your JavaScript development experience: ### Browsers and DevTools: 1. **Chrome DevTools**: Even if you prefer Firefox, Google Chrome'...
202
[ { "from": "human", "value": "I have to do some JavaScript in the future, so it is time to update my toolbox. Right now I use Firefox with some addons:\n\nJavaScript Shell from https://www.squarefree.com/bookmarklets/webdevel.html\nFirefox Dom Inspector\nFirebug\nGreasemonkey\nStylish\n\nI plan to use Venkma...
Can we have the database and transaction logs on the same drive? What will be its consequences if it is not recommended?
Having both the database files and transaction logs on the same drive is technically possible, but it is generally not recommended for several reasons. Here are some potential consequences if you choose to do this: 1. **Performance Issues**: Database and transaction logs often have different I/O patterns. Databases ma...
874
[ { "from": "human", "value": "Can we have the database and transaction logs on the same drive? What will be its consequences if it is not recommended?\n" }, { "from": "gpt", "value": "Having both the database files and transaction logs on the same drive is technically possible, but it is generall...
Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary number and be able to perform simple arithmetic operations on two of the...
Your project to create a class that can handle 128-bit integers in PHP is interesting, and each of the approaches you've outlined has its pros and cons. Let's break them down a bit further to help guide your decision. ### Approach #1: Using Four 32-bit Integers **Pros:** - Represents the number with fixed-size compon...
1,183
[ { "from": "human", "value": "Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary number and be able to perform s...
I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and the standard SFTP deployment mechanism doesn't seem to work unless you do some manual preparation work. I have come across some old postings on oth...
Automating the deployment of releases to SourceForge using Maven can indeed be tricky, especially given the specifics of how SourceForge handles file releases. As you pointed out, the standard SFTP deployment mechanism may require some manual preparation, which can complicate automation efforts. ### Recent Approaches ...
961
[ { "from": "human", "value": "I am using SourceForge for some Open Source projects and I want to automate the deployment of releases to the SourceForge File Release System. I use Maven for my builds and the standard SFTP deployment mechanism doesn't seem to work unless you do some manual preparation work. I ...
This should be fine seeing as the CLR hasn't actually changed? The boxes running the C# 2.0 code have had .NET 3.5 rolled out. The background is that we have a windows service (.NET 2.0 exe built with VS2005, deployed to ~150 servers) that dynamically loads assemblies (almost like plug-ins) to complete various work ite...
In your scenario, you want to leverage C# 3.0 features while still running your existing Windows service, which is built on .NET 2.0. Here are some key points to consider: 1. **Targeting .NET 3.5**: You can build your new assemblies using Visual Studio 2008 and target them to .NET 3.5. Since .NET 3.5 is an extension o...
2,129
[ { "from": "human", "value": "This should be fine seeing as the CLR hasn't actually changed?\nThe boxes running the C# 2.0 code have had .NET 3.5 rolled out.\nThe background is that we have a windows service (.NET 2.0 exe built with VS2005, deployed to ~150 servers) that dynamically loads assemblies (almost ...
What could be the problem with reversing the array of DOM objects as in the following code: var imagesArr = new Array(); imagesArr = document.getElementById("myDivHolderId").getElementsByTagName("img"); imagesArr.reverse(); In Firefox 3, when I call the reverse() method the script stops executing and shows the followi...
The issue you're encountering is due to the fact that `getElementsByTagName()` returns an **HTMLCollection**, not a true array. In JavaScript, while `HTMLCollection` is array-like (it has indexed access and a `.length` property), it does not have the full array methods (like `reverse`, `map`, `filter`, etc.) that you w...
2,750
[ { "from": "human", "value": "What could be the problem with reversing the array of DOM objects as in the following code:\nvar imagesArr = new Array();\nimagesArr = document.getElementById(\"myDivHolderId\").getElementsByTagName(\"img\");\nimagesArr.reverse();\n\nIn Firefox 3, when I call the reverse() metho...
I've found syntax highlighters that highlight pre-existing code, but I'd like to do it as you type with a WYSIWYG-style editor. I don't need auto-completed functions, just the highlighting. As a follow-up question, what is the WYSIWYG editor that stackoverflow uses? Edit: Thanks to the answer below, I found two that lo...
For a WYSIWYG-style editor that provides syntax highlighting as you type, there are several options available. Here are a few you might want to consider: 1. **CodeMirror**: This is a versatile text editor implemented in JavaScript for the browser. It can handle syntax highlighting and has various modes for different p...
3,182
[ { "from": "human", "value": "I've found syntax highlighters that highlight pre-existing code, but I'd like to do it as you type with a WYSIWYG-style editor. I don't need auto-completed functions, just the highlighting.\nAs a follow-up question, what is the WYSIWYG editor that stackoverflow uses?\nEdit: Than...
How can I find out which Service Pack is installed on my copy of SQL Server?
To find out which Service Pack (SP) or cumulative update (CU) is installed on your SQL Server, you can use one of the following methods: ### Method 1: Using SQL Server Management Studio (SSMS) 1. **Open SQL Server Management Studio (SSMS)** and connect to your SQL Server instance. 2. Open a new query window. 3. Execu...
778
[ { "from": "human", "value": "How can I find out which Service Pack is installed on my copy of SQL Server?\n" }, { "from": "gpt", "value": "To find out which Service Pack (SP) or cumulative update (CU) is installed on your SQL Server, you can use one of the following methods:\n\n### Method 1: Usi...
I have a class property exposing an internal IList<> through System.Collections.ObjectModel.ReadOnlyCollection<> How can I pass a part of this ReadOnlyCollection<> without copying elements into a new array (I need a live view, and the target device is short on memory)? I'm targetting Compact Framework 2.0.
In .NET Compact Framework 2.0, if you're working with a `ReadOnlyCollection<T>` and you want to expose part of it without creating a copy of the elements, you will need to implement a custom view. Since `ReadOnlyCollection<T>` does not provide a built-in way to slice it into a subcollection, you can create a custom cla...
546
[ { "from": "human", "value": "I have a class property exposing an internal IList<> through\nSystem.Collections.ObjectModel.ReadOnlyCollection<>\n\nHow can I pass a part of this ReadOnlyCollection<> without copying elements into a new array (I need a live view, and the target device is short on memory)? I'm t...
I am using Windows Media Format SDK to capture the desktop in real time and save it in a WMV file (actually this is an oversimplification of my project, but this is the relevant part). For encoding, I am using the Windows Media Video 9 Screen codec because it is very efficient for screen captures and because it is avai...
The Windows Media Encoder (WME) does indeed use more efficient methods for screen capturing and feeding video data to the WMV encoder than traditional GDI methods. Here are a few techniques that WME likely uses, which could help improve the performance of your own desktop capture implementation: 1. **DirectX or Deskto...
2,570
[ { "from": "human", "value": "I am using Windows Media Format SDK to capture the desktop in real time and save it in a WMV file (actually this is an oversimplification of my project, but this is the relevant part). For encoding, I am using the Windows Media Video 9 Screen codec because it is very efficient f...
I need to figure out what div is visible out of four possible divs using jQuery. Only one of those div's will be visible at any given time. This is what I have that works so far: $("#FeatureImage1:visible, #FeatureImage2:visible, #FeatureImage3:visible, #FeatureImage4:visible").attr("id"); Is there a way to refactor ...
Yes, there is a more concise way to achieve this using jQuery. Since you only want to check which of the divs is visible and they all share a common attribute (like a class or common parent), you can simplify your selector and use `.filter()` along with `:visible`. Here's a refactored version of your code: ```javascr...
3,106
[ { "from": "human", "value": "I need to figure out what div is visible out of four possible divs using jQuery. Only one of those div's will be visible at any given time.\nThis is what I have that works so far:\n$(\"#FeatureImage1:visible, #FeatureImage2:visible, #FeatureImage3:visible, #FeatureImage4:visibl...
Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or summing up numbers. I just want to pivot some string data. For example, I have a query returning the following. Action1 VIEW Action1 EDIT Action2 VIEW Action3 VIEW Action3 EDIT I would like to ...
Yes, it is possible to use the PIVOT functionality in SQL Server to achieve your desired output, even with string data. The PIVOT operator is typically used for aggregating values, but you can still use it to transform your string data into columns. Here’s how you can use the PIVOT functionality to get your desired re...
662
[ { "from": "human", "value": "Trying to find some simple SQL Server PIVOT examples. Most of the examples that I have found involve counting or summing up numbers. I just want to pivot some string data. For example, I have a query returning the following.\nAction1 VIEW \nAction1 EDIT \nAction2 VIEW \nAc...
I infrequently (monthly/quarterly) generate hundreds of Crystal Reports reports using Microsoft SQL Server 2005 database views. Are those views wasting CPU cycles and RAM during all the time that I am not reading from them? Should I instead use stored procedures, temporary tables, or short-lived normal tables since I...
When it comes to SQL Server and the use of views, it's good to understand how SQL Server handles them, especially when you're generating reports infrequently. Here are some key points to consider: ### How Views Work 1. **Views as Virtual Tables**: Views in SQL Server are essentially saved SQL queries. They don’t stor...
928
[ { "from": "human", "value": "I infrequently (monthly/quarterly) generate hundreds of Crystal Reports reports using Microsoft SQL Server 2005 database views. Are those views wasting CPU cycles and RAM during all the time that I am not reading from them? Should I instead use stored procedures, temporary tab...
I am using MS Access 2003. I want to run a lot of insert SQL statements in what is called 'Query' in MS Access. Is there any easy(or indeed any way) to do it?
In MS Access 2003, you can run multiple SQL INSERT statements by using a few different methods, but there's no direct way to execute multiple INSERT statements in a single Query window. However, here are a few methods you can use: ### Method 1: Use a Macro 1. **Create a Macro**: - Open your database and go to the ...
1,762
[ { "from": "human", "value": "I am using MS Access 2003. I want to run a lot of insert SQL statements in what is called 'Query' in MS Access. Is there any easy(or indeed any way) to do it?\n" }, { "from": "gpt", "value": "In MS Access 2003, you can run multiple SQL INSERT statements by using a fe...
Let's say we have a simple function defined in a pseudo language. List<Numbers> SortNumbers(List<Numbers> unsorted, bool ascending); We pass in an unsorted list of numbers and a boolean specifying ascending or descending sort order. In return, we get a sorted list of numbers. In my experience, some people are better a...
Knowing when you are "done" capturing test cases can be challenging, especially with something as fundamental as sorting. However, there are some general guidelines and techniques that can help you determine when you have sufficiently covered the test cases for the `SortNumbers` function: ### 1. **Consider the Specifi...
2,018
[ { "from": "human", "value": "Let's say we have a simple function defined in a pseudo language.\nList<Numbers> SortNumbers(List<Numbers> unsorted, bool ascending);\n\nWe pass in an unsorted list of numbers and a boolean specifying ascending or descending sort order. In return, we get a sorted list of numbers...
I know that the MsNLB can be configured to user mulitcast with IGMP. However, if the switch does not support IGMP what are the options?
If the switch does not support IGMP (Internet Group Management Protocol) and you want to use Microsoft Network Load Balancing (NLB) in multicast mode, there are a few options you can consider: 1. **Use Unicast Mode**: If multicast is not an option due to lack of IGMP support on the switch, you could configure NLB to u...
2,619
[ { "from": "human", "value": "I know that the MsNLB can be configured to user mulitcast with IGMP. However, if the switch does not support IGMP what are the options?\n" }, { "from": "gpt", "value": "If the switch does not support IGMP (Internet Group Management Protocol) and you want to use Micro...
Is it possible to handle POSIX signals within the Java Virtual Machine? At least SIGINT and SIGKILL should be quite platform independent.
Yes, it is possible to handle certain POSIX signals in a Java application, but with some limitations. The Java Virtual Machine (JVM) does not provide built-in support for handling POSIX signals like `SIGINT` or `SIGKILL` in a direct manner. However, there are ways to interact with native system features, including sign...
1,867
[ { "from": "human", "value": "Is it possible to handle POSIX signals within the Java Virtual Machine?\nAt least SIGINT and SIGKILL should be quite platform independent.\n" }, { "from": "gpt", "value": "Yes, it is possible to handle certain POSIX signals in a Java application, but with some limita...
Two reasons this would be useful, in case there's some other way to achieve these goals: 1) Building in the Flash IDE is really slow; I was hoping a third-party compiler would be faster. 2) It would be nice to be able to build projects on machines that don't have the Flash IDE installed. I'm familiar with other AS3 com...
If you’re looking to speed up your build process and work on machines without the Flash IDE, there are a few alternatives and approaches you might consider. Here are two main options that might help you achieve your goals: ### 1. Use Apache Flex with a Command-Line Build System **Apache Flex**: This is an open-source...
2,497
[ { "from": "human", "value": "Two reasons this would be useful, in case there's some other way to achieve these goals:\n1) Building in the Flash IDE is really slow; I was hoping a third-party compiler would be faster.\n2) It would be nice to be able to build projects on machines that don't have the Flash IDE...
I'd like to have dashes separate words in my URLs. So instead of: /MyController/MyAction I'd like: /My-Controller/My-Action Is this possible?
Yes, it's possible to modify URL formats in web applications to use dashes instead of the default separators (usually slashes). How you implement this depends on the web framework you are using. Below are examples for a few popular frameworks: ### ASP.NET MVC In ASP.NET MVC, you can create custom routing to format yo...
713
[ { "from": "human", "value": "I'd like to have dashes separate words in my URLs. So instead of:\n/MyController/MyAction\n\nI'd like:\n/My-Controller/My-Action\n\nIs this possible?\n" }, { "from": "gpt", "value": "Yes, it's possible to modify URL formats in web applications to use dashes instead ...
I just wonder a bit whether or not GDI+ is still a technology worth using, especially in a .net sense. Granted, GDI+ is still THE technology to handle Images in Windows, but it is also unmanaged code (obviously). Now, after discovering that GDI+ is actually not supported on ASP.net¹, I just wonder: Is it actually feasi...
GDI+ is indeed a longstanding technology for graphics programming on Windows, and while it's still usable, its usage has evolved with the .NET framework and newer technologies. Let’s break down some key points regarding GDI+, image manipulation in .NET, and alternatives you may consider. ### GDI+ Overview - GDI+ is a ...
1,000
[ { "from": "human", "value": "I just wonder a bit whether or not GDI+ is still a technology worth using, especially in a .net sense.\nGranted, GDI+ is still THE technology to handle Images in Windows, but it is also unmanaged code (obviously). Now, after discovering that GDI+ is actually not supported on ASP...
I've been using Emacs's sql interactive mode to talk to the MySQL db server and gotten to enjoy it. A developer has set up another db on a new non-default port number but I don't know how to access it using sql-mysql. How do I specify a port number when I'm trying to connect to a database? It would be even better if Em...
In Emacs's SQL mode, when connecting to a MySQL database using `sql-mysql`, you can specify a port number by setting the `SQL_MYSQL_OPTIONS` variable with the appropriate connection parameters, including the port. Here's how you can do it: 1. Open your Emacs configuration file, usually located at `~/.emacs` or `~/.em...
2,324
[ { "from": "human", "value": "I've been using Emacs's sql interactive mode to talk to the MySQL db server and gotten to enjoy it. A developer has set up another db on a new non-default port number but I don't know how to access it using sql-mysql.\nHow do I specify a port number when I'm trying to connect to...
How do you give a C# auto-property an initial value? I either use the constructor, or revert to the old syntax. Using the Constructor: class Person { public Person() { Name = "Initial Name"; } public string Name { get; set; } } Using normal property syntax (with an initial value) private st...
In C#, you can give an auto-property an initial value directly in the property declaration starting from C# 6.0. This is known as an "auto-property initializer." This allows you to set a default value for the auto-property without needing to write a constructor or revert to the older property syntax. Here's how you can...
4,388
[ { "from": "human", "value": "How do you give a C# auto-property an initial value?\nI either use the constructor, or revert to the old syntax. \n Using the Constructor:\nclass Person \n{\n public Person()\n {\n Name = \"Initial Name\";\n }\n public string Name { get; set; }\n}\n\nUsing nor...
I think it can be done by applying the transformation matrix of the scenegraph to z-normal (0, 0, 1), but it doesn't work. My code goes like this: Vector3f toScreenVector = new Vector3f(0, 0, 1); Transform3D t3d = new Transform3D(); tg.getTransform(t3d); //tg is Transform Group of all objects in a scene t3d.transform(t...
Based on your description and the code snippets you've provided, it looks like you're trying to compute a vector that points from the camera's eye position toward a specific point on the image plane (the mouse position), which is a common task in 3D graphics to determine the direction of a ray from the camera. Here ar...
1,594
[ { "from": "human", "value": "I think it can be done by applying the transformation matrix of the scenegraph to z-normal (0, 0, 1), but it doesn't work. My code goes like this:\nVector3f toScreenVector = new Vector3f(0, 0, 1);\nTransform3D t3d = new Transform3D();\ntg.getTransform(t3d); //tg is Transform Gro...
I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer)
One effective way to improve the performance of NHibernate is to use **batch fetching**. This approach allows NHibernate to load multiple entities in a single database call instead of one at a time, which reduces the number of round trips to the database. To implement batch fetching, you can configure the fetching str...
4,145
[ { "from": "human", "value": "I have an application that uses NHibernate as its ORM and sometimes it experiences performance issues due to how the data is being accessed by it. What kind of things can be done to improve the performance of NHibernate? (Please limit to one recommendation per answer)\n" }, ...
I load some XML from a servlet from my Flex application like this: _loader = new URLLoader(); _loader.load(new URLRequest(_servletURL+"?do=load&id="+_id)); As you can imagine _servletURL is something like http://foo.bar/path/to/servlet In some cases, this URL contains accented characters (long story). I pass the unesc...
In ActionScript, the `URLRequest` class automatically encodes the URL you provide, which can cause problems if you're dealing with accented characters or other special characters that need to remain unescaped. The behavior you're experiencing is because the URL is being encoded, resulting in an invalid request. To han...
3,544
[ { "from": "human", "value": "I load some XML from a servlet from my Flex application like this:\n_loader = new URLLoader();\n_loader.load(new URLRequest(_servletURL+\"?do=load&id=\"+_id));\n\nAs you can imagine _servletURL is something like http://foo.bar/path/to/servlet\nIn some cases, this URL contains ac...
How can I set the background color of an HTML element using css in JavaScript?
You can set the background color of an HTML element using CSS in JavaScript by modifying the element's `style` property. Here are a few methods to do this: ### Method 1: Using `style` Property You can directly access the element using `document.getElementById`, `document.querySelector`, or similar methods, and then s...
1,252
[ { "from": "human", "value": "How can I set the background color of an HTML element using css in JavaScript?\n" }, { "from": "gpt", "value": "You can set the background color of an HTML element using CSS in JavaScript by modifying the element's `style` property. Here are a few methods to do this:...
I'm receiving "Package Load Failure" error when I open VS 2005 after I installed the latest VisualSVN (v. 1.5.2). Anyone facing this error? Is there any tool out there to help identify which package didn't load and/or help unload a specific package?
The "Package Load Failure" error in Visual Studio often occurs when an extension or package is not compatible with your version of Visual Studio or has not been installed correctly. In your case, since it started happening after installing VisualSVN, it might be related to that extension. ### Steps to Troubleshoot and...
1,737
[ { "from": "human", "value": "I'm receiving \"Package Load Failure\" error when I open VS 2005 after I installed the latest VisualSVN (v. 1.5.2). Anyone facing this error? Is there any tool out there to help identify which package didn't load and/or help unload a specific package?\n" }, { "from": "gp...
Are there any useful techniques for reducing the repetition of constants in a CSS file? (For example, a bunch of different selectors which should all apply the same colour, or the same font size)?
Yes, there are several techniques you can use to reduce the repetition of constants in your CSS file, making it more maintainable and easier to manage. Here are some useful approaches: ### 1. CSS Variables (Custom Properties) CSS variables allow you to define reusable values that can be applied throughout your CSS fil...
85
[ { "from": "human", "value": "Are there any useful techniques for reducing the repetition of constants in a CSS file?\n(For example, a bunch of different selectors which should all apply the same colour, or the same font size)?\n" }, { "from": "gpt", "value": "Yes, there are several techniques yo...
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters that belong to a stored procedure on a SQL Server before I actually execute it? I have an a "multi-environment" scenario where there are multiple versions of the same database schema. Examples of environments might be "Development", "St...
Yes, you can retrieve the parameters of a stored procedure in SQL Server using the `INFORMATION_SCHEMA.PARAMETERS` view or the `sys.parameters` system catalog view. This way, you can validate the existence of a parameter before executing the stored procedure. Below is a C# example that demonstrates how to retrieve the...
1,455
[ { "from": "human", "value": "Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters that belong to a stored procedure on a SQL Server before I actually execute it?\nI have an a \"multi-environment\" scenario where there are multiple versions of the same database schema. Examples...
I would like to think that some of the software I'm writing today will be used in 30 years. But I am also aware that a lot of it is based upon the UNIX tradition of exposing time as the number of seconds since 1970. #include <stdio.h> #include <time.h> #include <limits.h> void print(time_t rt) { struct tm * t = gm...
You've touched on a very important topic concerning time representation in software and the potential issues that could arise from using traditional data types and libraries that may not handle time correctly for extended periods. ### Unix Time Limitations The issue you're referencing, often called the "Year 2038 pro...
1,016
[ { "from": "human", "value": "I would like to think that some of the software I'm writing today will be used in 30 years. But I am also aware that a lot of it is based upon the UNIX tradition of exposing time as the number of seconds since 1970.\n#include <stdio.h>\n#include <time.h>\n#include <limits.h>\n\n...
I'm using JBoss Seam Framework, but it's seems to me isn't very popular among java developers. I want to know how many java programmers here are using it, and in what kind of projects. Is as good as django, or RoR?
JBoss Seam is a framework that was once popular for building Java-based web applications, particularly those that required a combination of Java EE technologies and rich user interfaces. However, its popularity has declined over the years as newer frameworks and technologies have emerged. ### Current Usage While there...
651
[ { "from": "human", "value": "I'm using JBoss Seam Framework, but it's seems to me isn't very popular among java developers. \nI want to know how many java programmers here are using it, and in what kind of projects.\nIs as good as django, or RoR?\n" }, { "from": "gpt", "value": "JBoss Seam is a ...
While I've seen rare cases where private inheritance was needed, I've never encountered a case where protected inheritance is needed. Does someone have an example?
Protected inheritance is relatively rare in practice, and many programmers tend to favor public inheritance or private inheritance depending on the use case. However, there are scenarios where protected inheritance can be useful, particularly in object-oriented design where you want to restrict the visibility of certai...
856
[ { "from": "human", "value": "While I've seen rare cases where private inheritance was needed, I've never encountered a case where protected inheritance is needed. Does someone have an example?\n" }, { "from": "gpt", "value": "Protected inheritance is relatively rare in practice, and many program...
I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application. I've got two roles: Users Administrators I want pages to be viewable by four different groups: Everyone (Default, Help) Anonymous (CreateUser, Login, PasswordRecovery) Users (ChangePassword, DataE...
Yes, you can set permissions at the page level in ASP.NET using the `<location>` tag in your `Web.config` file. This method allows you to specify access rules for individual pages rather than organizing everything into folders. This way, you can achieve more granular control without the complications that come with fol...
212
[ { "from": "human", "value": "I'm using the ASP.NET Login Controls and Forms Authentication for membership/credentials for an ASP.NET web application.\nI've got two roles:\n\nUsers\nAdministrators\n\nI want pages to be viewable by four different groups:\n\nEveryone (Default, Help)\nAnonymous (CreateUser, Log...
I am looking to implement a data-driven wizard with the question tree stored in an Oracle database. What is the best schema to use to make the database portion flexible (i.e. easy to add new paths of questions) without sacrificing too much in terms of performance?
Designing a flexible schema for a question tree that can be easily modified while ensuring performance is a common challenge in database design. Below is a suggested schema that leverages a hierarchical structure using a parent-child relationship to manage questions and answers. This design allows for easy addition and...
767
[ { "from": "human", "value": "I am looking to implement a data-driven wizard with the question tree stored in an Oracle database. What is the best schema to use to make the database portion flexible (i.e. easy to add new paths of questions) without sacrificing too much in terms of performance?\n" }, { ...
We have a whole bunch of DLLs that give us access to our database and other applications and services. We've wrapped these DLLs with a thin WCF service layer which our clients then consume. I'm a little unsure on how to write unit tests that only test the WCF service layer. Should I just write unit tests for the DLLs, ...
It's great that you're thinking critically about your testing strategy! When it comes to testing your WCF service layer and the underlying DLLs, you'll want to distinguish between unit tests and integration tests clearly. Here's a structured approach to guide you through the process: ### Unit Testing the WCF Service L...
1,103
[ { "from": "human", "value": "We have a whole bunch of DLLs that give us access to our database and other applications and services.\nWe've wrapped these DLLs with a thin WCF service layer which our clients then consume.\nI'm a little unsure on how to write unit tests that only test the WCF service layer. Sh...
Other than Notepad++, what text editor do you use to program in Windows?
There are several text editors and Integrated Development Environments (IDEs) that can be used for programming in Windows, aside from Notepad++. Here are some popular options: 1. **Visual Studio Code**: A highly popular and versatile code editor with support for many programming languages, extensions, and features lik...
1,689
[ { "from": "human", "value": "Other than Notepad++, what text editor do you use to program in Windows? \n" }, { "from": "gpt", "value": "There are several text editors and Integrated Development Environments (IDEs) that can be used for programming in Windows, aside from Notepad++. Here are some p...
Is there a way to create a JButton with your own button graphic and not just with an image inside the button? If not, is there another way to create a custom JButton in java?
Yes, you can create a custom `JButton` with your own button graphic in Java by subclassing the `JButton` class and overriding its `paintComponent` method. This allows you to draw whatever graphics you want directly onto the button. Here’s an example of how you can create a custom button with your own graphic: ### Crea...
1,318
[ { "from": "human", "value": "Is there a way to create a JButton with your own button graphic and not just with an image inside the button? \nIf not, is there another way to create a custom JButton in java?\n" }, { "from": "gpt", "value": "Yes, you can create a custom `JButton` with your own butt...
I'm looking to the equivalent of Windows _wfopen() under Mac OS X. Any idea? I need this in order to port a Windows library that uses wchar* for its File interface. As this is intended to be a cross-platform library, I am unable to rely on how the client application will get the file path and give it to the library.
In Mac OS X (and more broadly in Unix-like systems), you don't have a direct equivalent of Windows' `_wfopen()`, which opens files using wide-character strings (`wchar_t`). However, you can achieve similar functionality by converting wide-character strings to narrow-character strings (typically `char*`) and then using ...
502
[ { "from": "human", "value": "I'm looking to the equivalent of Windows _wfopen() under Mac OS X. Any idea?\nI need this in order to port a Windows library that uses wchar* for its File interface. As this is intended to be a cross-platform library, I am unable to rely on how the client application will get th...
A friend of mine is now building a web application with J2EE and Struts, and it's going to be prepared to display pages in several languages. I was told that the best way to support a multi-language site is to use a properties file where you store all the strings of your pages, something like: welcome.english = "Welcom...
Supporting a multi-language web application, particularly for dynamic content such as blog posts, requires careful database design to facilitate easy management of multiple language versions of each content entry. Here’s a general approach you can take to design your database schema to support multi-language content ef...
627
[ { "from": "human", "value": "A friend of mine is now building a web application with J2EE and Struts, and it's going to be prepared to display pages in several languages.\nI was told that the best way to support a multi-language site is to use a properties file where you store all the strings of your pages,...
By default each row of a Gridview maps to each row in a datatable or dataset attached to its datasource. But what if I want to display these rows in multiple columns. For example if it has 10 rows, 5 rows each should be displayed in 2 columns side by side. Also can I do this with the Infragistics grid. Is this possible...
Yes, it is possible to display rows from a DataTable or DataSet in multiple columns side by side in a GridView, but it typically requires a custom approach since standard GridView controls are designed to display data in a tabular format (one row per line). ### Using ASP.NET GridView To achieve a layout where you hav...
1,554
[ { "from": "human", "value": "By default each row of a Gridview maps to each row in a datatable or dataset attached to its datasource. But what if I want to display these rows in multiple columns. For example if it has 10 rows, 5 rows each should be displayed in 2 columns side by side. Also can I do this wit...
(Updated a little) I'm not very experienced with internationalization using PHP, it must be said, and a deal of searching didn't really provide the answers I was looking for. I'm in need of working out a reliable way to convert only 'relevant' text to Unicode to send in an SMS message, using PHP (just temporarily, whil...
Certainly! To handle the requirement of sending SMS messages with a mix of characters efficiently in PHP, you can follow a strategy of detecting whether the message contains characters that are not part of the GSM 03.38 character set and then deciding to send it in either GSM or Unicode encoding based on that detection...
473
[ { "from": "human", "value": "(Updated a little)\nI'm not very experienced with internationalization using PHP, it must be said, and a deal of searching didn't really provide the answers I was looking for.\nI'm in need of working out a reliable way to convert only 'relevant' text to Unicode to send in an SMS...