instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
In git, it is up to each user to specify the correct author in their local git config file. When they push to a centralized bare repository, the commit messages on the repository will have the author names that they used when committing to their own repository. Is there a way enforce that a set of known authors for co...
Enforcing a specific set of authors for commits in a Git repository can be a challenging task, especially when considering that users might push commits made by others. However, there are ways to mitigate this issue using Git hooks and server-side validations. Here are some approaches: ### 1. Pre-receive Hook You can...
14,709
[ { "from": "human", "value": "In git, it is up to each user to specify the correct author in their local git config file. When they push to a centralized bare repository, the commit messages on the repository will have the author names that they used when committing to their own repository.\nIs there a way ...
How to I get the Fixnum returned by the following: "abc"[2] Back into a character?
In Ruby, when you access a character from a string using an index (like `"abc"[2]`), it returns a string containing that character. The index `2` refers to the third character of the string (since indexing starts at 0), which in this case is `"c"`. If you want to convert that character back into its corresponding char...
14,716
[ { "from": "human", "value": "How to I get the Fixnum returned by the following:\n\"abc\"[2] \n\nBack into a character?\n" }, { "from": "gpt", "value": "In Ruby, when you access a character from a string using an index (like `\"abc\"[2]`), it returns a string containing that character. The index ...
I'm writing a small tool in C# which will need to send and receive data to/from a website using POST and json formatting. I've never done anything like this before in C# (or any language really) so I'm struggling to find some useful information to get me started. I've found some information on the WebRequest class in ...
Using the `WebRequest` class in C# for sending and receiving data via HTTP is a possible approach, but there are more modern and easier-to-use alternatives. A great choice is to use `HttpClient`, which is part of the `System.Net.Http` namespace. It provides a simple and efficient way to make HTTP requests, including PO...
10,812
[ { "from": "human", "value": "I'm writing a small tool in C# which will need to send and receive data to/from a website using POST and json formatting. I've never done anything like this before in C# (or any language really) so I'm struggling to find some useful information to get me started.\nI've found so...
I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more? For example, using the Collections API to store an integer I would do the following: LinkedList <Integer...
In a standard linked list implementation, each node typically holds a single piece of data. If you want to store multiple data items at a single index, you can modify the structure of your node to hold a collection (like a list) rather than a single value. This way, each node can contain a list of items. Here’s how yo...
17,511
[ { "from": "human", "value": "I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more?\nFor example, using the Collections API to store an integer I w...
Is C drive treated as the root folder in Windows, when one says /folder1/folder2/ in linux and C:\folder1\folder2\ in Windows?
Yes, in Windows, the C drive is often treated as the root directory for the file system, similar to how the root directory is represented by a single forward slash (/) in Linux. In Linux, the path `/folder1/folder2/` indicates that `folder1` and `folder2` are subdirectories starting from the root of the file system. T...
19,843
[ { "from": "human", "value": "Is C drive treated as the root folder in Windows, when one says /folder1/folder2/ in linux and C:\\folder1\\folder2\\ in Windows?\n" }, { "from": "gpt", "value": "Yes, in Windows, the C drive is often treated as the root directory for the file system, similar to how ...
I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3. A page refresh will always fix the problem. There are 3 CSS files loaded, all within the same style block using @import: <STYLE type="text/css"> @imp...
It sounds like you're experiencing an intermittent issue with CSS not loading correctly on certain browsers. Given that the problem appears across multiple browsers and involves all CSS files, here are several potential causes and solutions: ### Possible Causes and Solutions: 1. **Caching Issues**: - Browsers migh...
10,057
[ { "from": "human", "value": "I'm working on a webapp, and every so often we run into situations where pages will load without applying CSS. This problem has shown up in IE6, IE7, Safari 3, and FF3.\nA page refresh will always fix the problem.\nThere are 3 CSS files loaded, all within the same style block us...
There are two popular naming conventions: vc90/win64/debug/foo.dll foo-vc90-win64-debug.dll Please discuss the problems/benefits associated with either approach. I am also wondering if it is possible to expose meta-data (i.e. compiler, platform, build-type) in approach #1 in an easy to use, cross-platform manner.
Both naming conventions you’ve presented have their own advantages and disadvantages, and the choice largely depends on the specific needs and context of the project. Let's discuss each approach: ### Approach 1: `vc90/win64/debug/foo.dll` #### Benefits: 1. **Directory Structure**: This approach uses a clear directory...
9,885
[ { "from": "human", "value": "There are two popular naming conventions:\n\nvc90/win64/debug/foo.dll\nfoo-vc90-win64-debug.dll\n\nPlease discuss the problems/benefits associated with either approach.\nI am also wondering if it is possible to expose meta-data (i.e. compiler, platform, build-type) in approach #...
Say I have a table in a SQL 2005 database with 2,000,000+ records and a few indexes. What advantage is there to using index hints in my queries? Are there ever disadvantages to using index hints in queries?
Using index hints in SQL queries can provide certain advantages as well as potential disadvantages. Here's a breakdown of both: ### Advantages of Using Index Hints 1. **Control Over Query Execution**: Index hints allow you to specify which index the SQL Server Query Optimizer should use for executing a query. This ca...
17,252
[ { "from": "human", "value": "Say I have a table in a SQL 2005 database with 2,000,000+ records and a few indexes. What advantage is there to using index hints in my queries? Are there ever disadvantages to using index hints in queries?\n" }, { "from": "gpt", "value": "Using index hints in SQL ...
I get the following error when attempting to install RubyGems. I've tried Googling but have had no luck there. Has anybody encountered and resolved this issue before? C:\rubygems-1.3.0> ruby setup.rb . . install -c -m 0644 rubygems/validator.rb C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/validator.rb install -c -m 0644 ru...
The error you are encountering during the installation of RubyGems appears to be due to an issue in the RubyGems code that is trying to access a method that doesn't exist for a `nil` object, specifically `uid`. This issue could arise from various factors, including compatibility problems between RubyGems version 1.3.0 ...
15,381
[ { "from": "human", "value": "I get the following error when attempting to install RubyGems. I've tried Googling but have had no luck there. Has anybody encountered and resolved this issue before?\n\nC:\\rubygems-1.3.0> ruby setup.rb\n.\n.\ninstall -c -m 0644 rubygems/validator.rb C:/Ruby/lib/ruby/site_ruby/...
I'm using Eclipse 3.4 (on Mac) and I've got an annoyance with the text comparison having the files I'm comparing in a specific order which is not what I want. When I compare two files it always seems to put the first file (alphabetically) on the left, and the latter one on the right, but I want to be able to change thi...
In Eclipse 3.4, the behavior you've encountered regarding file comparison can indeed be frustrating, especially when trying to organize comparisons in a specific way. Unfortunately, the order of files in the comparison editors is dictated by how you open them, and Eclipse does tend to default to an alphabetical orderin...
16,299
[ { "from": "human", "value": "I'm using Eclipse 3.4 (on Mac) and I've got an annoyance with the text comparison having the files I'm comparing in a specific order which is not what I want.\nWhen I compare two files it always seems to put the first file (alphabetically) on the left, and the latter one on the ...
I am creating a gridView that allows adding new rows by adding the controls necessary for the insert into the FooterTemplate, but when the ObjectDataSource has no records, I add a dummy row as the FooterTemplate is only displayed when there is data. How can I hide this dummy row? I have tried setting e.row.visible = fa...
To hide a dummy row in your GridView when there are no records, you need to consider the behavior of the GridView control along with the `FooterTemplate`. If the GridView has no records, the footer is not displayed, and you might still want to manage the visibility of that dummy row effectively. Here’s a general appro...
11,115
[ { "from": "human", "value": "I am creating a gridView that allows adding new rows by adding the controls necessary for the insert into the FooterTemplate, but when the ObjectDataSource has no records, I add a dummy row as the FooterTemplate is only displayed when there is data.\nHow can I hide this dummy ro...
In ActionScript 3.0, is there an automatic way to calculate the number of days, hours, minutes and seconds between two specified dates? Basicly, what I need is the ActionScript equivalent of the .NET Timespan class. Any idea?
In ActionScript 3.0, you can calculate the difference between two dates by using the `Date` class. While there isn't a built-in class equivalent to .NET's `TimeSpan`, you can easily compute the difference between two `Date` objects to obtain the total difference in milliseconds and then convert that into days, hours, m...
16,218
[ { "from": "human", "value": "In ActionScript 3.0, is there an automatic way to calculate the number of days, hours, minutes and seconds between two specified dates?\nBasicly, what I need is the ActionScript equivalent of the .NET Timespan class.\nAny idea?\n" }, { "from": "gpt", "value": "In Act...
I have two databases with the same structure. The tables have an integer as a primary key as used in Rails. If I have a patients table, I will have one patient using primary key 123 in one database and another patient using the same primary key in the other database. What would you suggest for merging the data from bot...
Merging data from two databases that have the same structure but overlapping primary keys can be a challenging task, especially in scenarios like yours where each database has unique records with the same primary key values. Here are several approaches to handle this situation effectively: ### 1. Adjust Primary Keys ...
16,345
[ { "from": "human", "value": "I have two databases with the same structure. The tables have an integer as a primary key as used in Rails.\nIf I have a patients table, I will have one patient using primary key 123 in one database and another patient using the same primary key in the other database.\nWhat woul...
Syntax Shorthand for the ready-event by roosteronacid Line breaks and chainability by roosteronacid Nesting filters by Nathan Long Cache a collection and execute commands on the same line by roosteronacid Contains selector by roosteronacid Defining properties at element creation by roosteronacid Access jQuery function...
It looks like you've provided a list of jQuery enhancements, techniques, and best practices from various contributors. Here's a brief summary of each section along with their possible uses: ### Syntax - **Ready-event**: Simplifies the process of executing code when the DOM is fully loaded. - **Line breaks and chainabi...
15,954
[ { "from": "human", "value": "Syntax\n\nShorthand for the ready-event by roosteronacid\nLine breaks and chainability by roosteronacid\nNesting filters by Nathan Long\nCache a collection and execute commands on the same line by roosteronacid\nContains selector by roosteronacid\nDefining properties at element ...
I want to recreate the the update panel postback without using an update panel to do the postback. What is the generic method for doing this? For example, on Stackoverflow, when you vote up or down on a question it does a postback to update the database and I would bet they didn't use an update panel. What do I have? ...
To recreate the functionality of an UpdatePanel without actually using one, you can leverage AJAX (Asynchronous JavaScript and XML) along with a server-side method (like ASP.NET Web API, MVC, or a web form handler) to perform asynchronous updates to your database and refresh parts of your page. Here's a generic method...
14,590
[ { "from": "human", "value": "I want to recreate the the update panel postback without using an update panel to do the postback. What is the generic method for doing this?\nFor example, on Stackoverflow, when you vote up or down on a question it does a postback to update the database and I would bet they di...
I have a helper class pulling a string from an XML file. That string is a file path (so it has backslashes in it). I need to use that string as it is... How can I use it like I would with the literal command? Instead of this: string filePath = @"C:\somepath\file.txt"; I want to do this: string filePath = @helper.getFi...
In C#, string literals prefixed with `@` (known as verbatim string literals) allow you to include backslashes without needing to escape them. However, if you're retrieving a string from an external source (like an XML file) using a helper class, you typically do not have the `@` syntax available because you're not defi...
16,488
[ { "from": "human", "value": "I have a helper class pulling a string from an XML file. That string is a file path (so it has backslashes in it). I need to use that string as it is... How can I use it like I would with the literal command?\nInstead of this:\nstring filePath = @\"C:\\somepath\\file.txt\";\n\nI...
During an ASP.NET page load I'm opening and closing multiple System.Data.SqlClient.SqlConnections inside multiple controls contained in the page. I thought it would be a good idea instead to create a "pool" of connections and when opening a connection check to see if the connection string matches that of an open connec...
In ASP.NET, the behavior regarding SQL connections is somewhat different compared to PHP. In .NET, when you create a `SqlConnection` object, it does not automatically share connections in the way that you might be expecting based on PHP's behavior. However, .NET does provide connection pooling, which can improve perfor...
16,863
[ { "from": "human", "value": "During an ASP.NET page load I'm opening and closing multiple System.Data.SqlClient.SqlConnections inside multiple controls contained in the page. I thought it would be a good idea instead to create a \"pool\" of connections and when opening a connection check to see if the conne...
I have been looking at the new Objective-J / Cappuccino javascript framework from 280North. They provide plug-ins for SubEthaEdit and TextMate to handle syntax highlighting, but I primarily use vi. Does anyone know of a way to get Objective-J syntax highlighting in vi, or a good way to convert whatever format the oth...
To get Objective-J syntax highlighting in `vi` (or `vim`), you can create a custom syntax file based on the syntax definitions provided by SubEthaEdit or TextMate. Here's a step-by-step guide to set it up: 1. **Download or Create a Syntax File:** You can try to find an existing Objective-J syntax file for Vim. If n...
14,397
[ { "from": "human", "value": "I have been looking at the new Objective-J / Cappuccino javascript framework from 280North. They provide plug-ins for SubEthaEdit and TextMate to handle syntax highlighting, but I primarily use vi. Does anyone know of a way to get Objective-J syntax highlighting in vi, or a go...
I still very new using Subversion. Is it possible to have a working copy on a network available share (c:\svn\projects\website) that everyone (in this case 3 of use) can checkout and commit files to? We don't need a build server because it is an asp site and the designers are used to having immediate results when they ...
Yes, it's possible to set up a shared working copy on a network share, but there are some important considerations and potential issues with that approach. Let's go through your questions and outline the best practices for using Subversion in your scenario. ### Shared Working Copy on a Network Share 1. **Single Worki...
13,210
[ { "from": "human", "value": "I still very new using Subversion.\nIs it possible to have a working copy on a network available share (c:\\svn\\projects\\website) that everyone (in this case 3 of use) can checkout and commit files to? We don't need a build server because it is an asp site and the designers ar...
Is there a built-in/custom script available?
Could you please provide more context about what type of built-in or custom script you're referring to? Are you asking about a specific programming language, software, or platform? This will help me give you a more accurate and helpful answer.
21,026
[ { "from": "human", "value": "Is there a built-in/custom script available?\n" }, { "from": "gpt", "value": "Could you please provide more context about what type of built-in or custom script you're referring to? Are you asking about a specific programming language, software, or platform? This wil...
Do you need to use some kind of provider? Can you setup your own SMS server? Does any open source solutions exist? I am an SMS newbie so any insight on how this is accomplished would be great. I am partial to Java but any language is fine.
Setting up SMS services can be quite complex, but I’ll break down the options for you, including providers, self-hosting solutions, and open-source options. ### 1. Using an SMS Provider This is the easiest and most common way to send and receive SMS messages. SMS providers offer APIs that you can integrate into your a...
4,022
[ { "from": "human", "value": "\nDo you need to use some kind of provider? \nCan you setup your own SMS server?\nDoes any open source solutions exist?\n\nI am an SMS newbie so any insight on how this is accomplished would be great. I am partial to Java but any language is fine.\n" }, { "from": "gpt",...
I've read JRM's Syntax-rules Primer for the Merely Eccentric and it has helped me understand syntax-rules and how it's different from common-lisp's define-macro. syntax-rules is only one way of implementing a syntax transformer within define-syntax. I'm looking for two things, the first is more examples and explanatio...
It's great to hear that you've been exploring the nuances of syntax-rules and the broader syntax system in Scheme! Here are some resources and examples to help deepen your understanding: ### More Examples of `syntax-rules` 1. **Simple Macro Example**: ```scheme (define-syntax unless (syntax-rules () ...
15,792
[ { "from": "human", "value": "I've read JRM's Syntax-rules Primer for the Merely Eccentric and it has helped me understand syntax-rules and how it's different from common-lisp's define-macro. syntax-rules is only one way of implementing a syntax transformer within define-syntax.\nI'm looking for two things,...
Everyone (at least everyone who uses a compiled language) has faced compilation errors but how many times do you get to actually crash the compiler? I've had my fair share of "internal compiler errors" but most went away just by re-compiling. Do you have a (minimal) piece of code that crashes the compiler?
Indeed, internal compiler errors (ICEs) can occur when a compiler encounters an unexpected situation that it isn't programmed to handle. While they are typically bugs in the compiler itself, certain complex or unconventional code patterns can trigger these errors. However, it's important to note that what triggers an I...
18,299
[ { "from": "human", "value": "Everyone (at least everyone who uses a compiled language) has faced compilation errors but how many times do you get to actually crash the compiler? \nI've had my fair share of \"internal compiler errors\" but most went away just by re-compiling. Do you have a (minimal) piece of...
Is there a tool out there that can automatically convert Python to Java? Can Jython do this?
There is no tool that can automatically convert Python code to Java with perfect accuracy, but there are some tools that can assist in the process. Jython is one such tool, but it does not convert Python code to Java; instead, it allows you to run Python code on the Java platform by compiling it to Java bytecode. ### ...
17,032
[ { "from": "human", "value": "Is there a tool out there that can automatically convert Python to Java? \nCan Jython do this?\n" }, { "from": "gpt", "value": "There is no tool that can automatically convert Python code to Java with perfect accuracy, but there are some tools that can assist in the ...
One of my nasty (?) programming habits in C++ and Java is to always precede calls or accesses to members with a this. For example: this.process(this.event). A few of my students commented on this, and I'm wondering if I am teaching bad habits. My rationale is: Makes code more readable — Easier to distinguish fields f...
Using `this` to qualify member variables and methods in C++ and Java is a stylistic choice and, while it can have benefits, it can also lead to some potential downsides. Let's explore both sides to help you assess whether this habit is beneficial or detrimental to your coding style and your students' learning. ### Pro...
12,766
[ { "from": "human", "value": "One of my nasty (?) programming habits in C++ and Java is to always precede calls or accesses to members with a this. For example: this.process(this.event).\nA few of my students commented on this, and I'm wondering if I am teaching bad habits. \nMy rationale is:\n\nMakes code m...
Is there any sort of free control which does what the Occupation field does on http://monster.ca? That is allow for grouping of the options in a drop down box with expandable sections? I just learned about the optgroup tag which is close to what I want, but not quite.
If you're looking for a way to create a dropdown with grouped options that can expand/collapse (similar to what you've described from Monster.ca), the `<optgroup>` tag in HTML can help with basic grouping. However, it does not provide an expandable/collapsible interface by itself. To achieve a more interactive dropdow...
12,349
[ { "from": "human", "value": "Is there any sort of free control which does what the Occupation field does on http://monster.ca? That is allow for grouping of the options in a drop down box with expandable sections? I just learned about the optgroup tag which is close to what I want, but not quite. \n" ...
Some members of the team are having problems programming together. Different gender, different culture, different age. How to deal with those problems? - Do not pair them together, or - Pair them together and let them come to a "golden middle"
Navigating a diverse team with varying backgrounds, including gender, culture, and age, can indeed pose challenges, but it also presents opportunities for growth and innovation. Here are some strategies to consider when addressing programming challenges within such a team: ### 1. **Foster Open Communication** - **E...
16,748
[ { "from": "human", "value": "Some members of the team are having problems programming together. \nDifferent gender, different culture, different age. How to deal with those problems?\n - Do not pair them together, or\n - Pair them together and let them come to a \"golden middle\"\n" }, { "from": "...
Is there a way to test if an object is a dictionary? In a method I'm trying to get a value from a selected item in a list box. In some circumstances, the list box might be bound to a dictionary, but this isn't known at compile time. I would like to do something similar to this: if (listBox.ItemsSource is Dictionary<??...
Yes, you can check if an object is a dictionary and retrieve the key-value pair using reflection in C#. You can dynamically inspect the type of the items in the `ItemsSource` and determine if it's a dictionary. Here’s how you can achieve that: 1. Use reflection to check if the `ItemsSource` is a dictionary. 2. If it i...
13,986
[ { "from": "human", "value": "Is there a way to test if an object is a dictionary?\nIn a method I'm trying to get a value from a selected item in a list box. In some circumstances, the list box might be bound to a dictionary, but this isn't known at compile time.\nI would like to do something similar to thi...
I don't have a Rails environment set up and this is actually quite hard to find a quick answer for, so I'll ask the experts. When Rails creates a table based on your "model" that you have set up, does Rails create a table that mirrors this model exactly, or does it add in more fields to the table to help it work its ma...
When you create a model in Ruby on Rails and run the corresponding migration to create a database table, Rails will create a table that mirrors the attributes defined in the model. However, it doesn't add extra fields automatically; rather, you need to explicitly define any fields you want in your migration. Here's a ...
16,721
[ { "from": "human", "value": "I don't have a Rails environment set up and this is actually quite hard to find a quick answer for, so I'll ask the experts.\nWhen Rails creates a table based on your \"model\" that you have set up, does Rails create a table that mirrors this model exactly, or does it add in mor...
I'm binding a query to a WinForms DataGridView. I want the column headers to have spaces when needed. For example, I would want a column header to be First Name instead of FirstName. How do you create your own custom column names in LINQ? For example: Dim query = From u In db.Users _ Select u.FirstName AS '...
To create custom column names with spaces in a LINQ query in VB.NET, you can use an anonymous type or create a new class to represent your data structure. However, when binding to a `DataGridView`, the easiest way to achieve column names with spaces is to set the `HeaderText` property of the `DataGridViewColumn` after ...
16,741
[ { "from": "human", "value": "I'm binding a query to a WinForms DataGridView. I want the column headers to have spaces when needed. For example, I would want a column header to be First Name instead of FirstName.\nHow do you create your own custom column names in LINQ?\nFor example:\nDim query = From u In db...
I am using the example on the AJAX website for the DropDownExtender. I'm looking to make the target control (the label) have the DropDown image appear always, instead of just when I hover over it. Is there any way to do this?
Yes, you can achieve this by modifying the CSS and potentially some JavaScript/jQuery to ensure that the dropdown image appears on the label at all times, rather than just on hover. Here's a general approach to make the dropdown image always visible next to your label when using the AJAX `DropDownExtender`. ### Step ...
11,985
[ { "from": "human", "value": "I am using the example on the AJAX website for the DropDownExtender. I'm looking to make the target control (the label) have the DropDown image appear always, instead of just when I hover over it. \nIs there any way to do this?\n" }, { "from": "gpt", "value": "Yes,...
I setup my own open id provider on my personal server, and added a redirect to https in my apache config file. When not using a secure connection (when I disable the redirect) I can log in fine, but with the redirect I can't log in with this error message: The underlying connection was closed: Could not establish trus...
Yes, the issue you are experiencing is likely due to the use of a self-signed SSL certificate. When your Apache server is configured to use HTTPS with a self-signed certificate, clients (like web browsers or other applications) will not inherently trust the certificate, leading to the error message: "Could not establis...
15,755
[ { "from": "human", "value": "I setup my own open id provider on my personal server, and added a redirect to https in my apache config file. When not using a secure connection (when I disable the redirect) I can log in fine, but with the redirect I can't log in with this error message:\nThe underlying conne...
More than about LINQ to [insert your favorite provider here], this question is about searching or filtering in-memory collections. I know LINQ (or searching/filtering extension methods) works in objects implementing IEnumerable or IEnumerable<T>. The question is: because of the nature of enumeration, is every query co...
You're correct in your understanding that when using LINQ or any extension method that enumerates over an `IEnumerable<T>`, the query will generally take at least O(n) time complexity because it involves examining each element in the collection until it finds a match (or exhausts the collection). ### Searching with LI...
12,041
[ { "from": "human", "value": "More than about LINQ to [insert your favorite provider here], this question is about searching or filtering in-memory collections. \nI know LINQ (or searching/filtering extension methods) works in objects implementing IEnumerable or IEnumerable<T>. The question is: because of th...
Inno Setup is a nice easy to use installer. It is rated high in this stackoverflow question. I have a need to install a plugin to a folder relative to the installation folder of a 3rd Party application. It isn't obvious from the docs how to do this.
In Inno Setup, if you want to install a plugin to a folder relative to the installation folder of a third-party application, you can achieve this by using the `ExpandConstant` function along with a special constant called `{app}`. The `{app}` constant represents the root directory of your application being installed. ...
12,754
[ { "from": "human", "value": "Inno Setup is a nice easy to use installer. It is rated high in this stackoverflow question. I have a need to install a plugin to a folder relative to the installation folder of a 3rd Party application. It isn't obvious from the docs how to do this.\n" }, { "from": "gp...
After reading "What’s your/a good limit for cyclomatic complexity?", I realize many of my colleagues were quite annoyed with this new QA policy on our project: no more 10 cyclomatic complexity per function. Meaning: no more than 10 'if', 'else', 'try', 'catch' and other code workflow branching statement. Right. As I ex...
It sounds like you're navigating a complex situation where both logging requirements and cyclomatic complexity constraints are impacting your team's ability to write clean and maintainable code. Here are a few approaches to address the challenges you're facing: ### 1. **Refactor Logging into a Separate Method** One wa...
15,117
[ { "from": "human", "value": "After reading \"What’s your/a good limit for cyclomatic complexity?\", I realize many of my colleagues were quite annoyed with this new QA policy on our project: no more 10 cyclomatic complexity per function.\nMeaning: no more than 10 'if', 'else', 'try', 'catch' and other code ...
The single timing column in the weblog naturally includes client transmission timing. For anamoly analysis, I want to differentiate pages that took excessive construction time from requests that simply had a slow client. For buffered pages, I've looked at the ASP.NET page lifecycle model and do not see where I can tap...
To achieve your goal of measuring the server-side processing time for ASP.NET pages while minimizing the impact of client transmission delays, you'll want to focus on specific points in the ASP.NET page lifecycle to capture the timing information effectively. Here’s a suggested approach: ### Using `HttpApplication` Ev...
16,281
[ { "from": "human", "value": "The single timing column in the weblog naturally includes client transmission timing. For anamoly analysis, I want to differentiate pages that took excessive construction time from requests that simply had a slow client.\nFor buffered pages, I've looked at the ASP.NET page life...
I work on relatively sensitive code that we wouldn't want falling into the wrong hands. Up until now, all the code has been keep in house so it hasn't been an issue. I am moving to working from home a day or two a week and we want to secure the code on my laptop. We have looked at a few alternatives, but Windows EFS an...
Using Windows EFS (Encrypting File System) is a viable option for encrypting your source code, especially if you want to secure it on a laptop that does not have TPM (Trusted Platform Module) hardware and is not connected to an Active Directory environment. However, there are some considerations and alternative methods...
13,736
[ { "from": "human", "value": "I work on relatively sensitive code that we wouldn't want falling into the wrong hands. Up until now, all the code has been keep in house so it hasn't been an issue. I am moving to working from home a day or two a week and we want to secure the code on my laptop.\nWe have looked...
We're in the process of setting up a new framework and way of doing business for our new internal apps. Our current design dictates that all security logic should be handled by our database, and all information (and I mean all) will be going in and out of the database via stored procedures. The theory is, the data acce...
Your approach to designing your internal applications raises several important considerations, particularly around performance, maintainability, and security. Let's break down the key points: ### Performance vs. Maintainability 1. **Single Database Call**: - As you mentioned, by handling both authentication and t...
12,732
[ { "from": "human", "value": "We're in the process of setting up a new framework and way of doing business for our new internal apps. Our current design dictates that all security logic should be handled by our database, and all information (and I mean all) will be going in and out of the database via stored...
What are the best SNMP libraries to use with .NET? Specifically for listening for traps or sending set or get requests.
When working with SNMP (Simple Network Management Protocol) in .NET, there are several libraries available that can help you with both listening for traps and sending/getting SNMP requests. Here are some of the best libraries: 1. **SnmpSharpNet**: - **Description**: A popular and well-maintained SNMP library for .N...
12,472
[ { "from": "human", "value": "What are the best SNMP libraries to use with .NET? Specifically for listening for traps or sending set or get requests.\n" }, { "from": "gpt", "value": "When working with SNMP (Simple Network Management Protocol) in .NET, there are several libraries available that c...
This is a question for anyone who has the pleasure to work in both Java and C#. Do you find that you have to make a mental context switch of some kind when you move from one to the other? I'm working in both at the moment and because the syntax and libraries are so similar and yet subtly different I'm finding it frustr...
It's quite common for developers who work with both Java and C# to experience a mental context switch. While they are indeed similar in many ways—both being object-oriented languages that share syntactical roots—there are subtle differences in libraries, conventions, and language features that can create confusion. Her...
16,021
[ { "from": "human", "value": "This is a question for anyone who has the pleasure to work in both Java and C#.\nDo you find that you have to make a mental context switch of some kind when you move from one to the other?\nI'm working in both at the moment and because the syntax and libraries are so similar and...
I've written a control in C# that overrides the built-in DropDownList control. For this I need a javascript resource included, which I'm including as an embedded resource then adding the WebResource attribute, which works fine. However, I also need to reference a webservice, which I would normally include in the scri...
Yes, you can programmatically add a `ServiceReference` to the `ScriptManager` from your custom control in C#. You can do this in the `OnInit` or `CreateChildControls` methods of your control. Here’s a step-by-step guide on how to achieve this: 1. **Override `OnInit` or `CreateChildControls`:** You can override one of...
17,773
[ { "from": "human", "value": "I've written a control in C# that overrides the built-in DropDownList control. For this I need a javascript resource included, which I'm including as an embedded resource then adding the WebResource attribute, which works fine.\nHowever, I also need to reference a webservice, ...
I have a basic C# console application that reads a text file (CSV format) line by line and puts the data into a HashTable. The first CSV item in the line is the key (id num) and the rest of the line is the value. However I've discovered that my import file has a few duplicate keys that it shouldn't have. When I try to ...
To handle duplicate keys in your `importFile` method, you can modify your code to check if the key already exists in the `Hashtable` before attempting to add it. If a duplicate key is found, you can store that key in an `ArrayList` instead of causing an error. Here’s how you can modify your existing code: ```csharp pr...
15,871
[ { "from": "human", "value": "I have a basic C# console application that reads a text file (CSV format) line by line and puts the data into a HashTable. The first CSV item in the line is the key (id num) and the rest of the line is the value. However I've discovered that my import file has a few duplicate ke...
In .NET, what is the difference between String.Empty and "", and are they interchangeable, or is there some underlying reference or Localization issues around equality that String.Empty will ensure are not a problem?
In .NET, `String.Empty` and `""` (an empty string literal) are functionally equivalent; both represent an empty string. However, there are a few subtle differences between the two, and understanding them can clarify when to use one over the other. ### Differences 1. **Representation**: - `String.Empty` is a static...
18,303
[ { "from": "human", "value": "In .NET, what is the difference between String.Empty and \"\", and are they interchangeable, or is there some underlying reference or Localization issues around equality that String.Empty will ensure are not a problem?\n" }, { "from": "gpt", "value": "In .NET, `Strin...
If the user of my winforms application resizes the main form, I want the 2 panels to stretch out also, along with the child controls. How can I achieve this?
To ensure that your panels and their child controls stretch and resize along with the main form in a WinForms application, you can make use of the Dock and Anchor properties for the panels and the controls within them. Here’s how you can achieve this: ### Step-by-Step Guide 1. **Set Dock Properties**: - For the p...
15,540
[ { "from": "human", "value": "If the user of my winforms application resizes the main form, I want the 2 panels to stretch out also, along with the child controls.\nHow can I achieve this?\n" }, { "from": "gpt", "value": "To ensure that your panels and their child controls stretch and resize alon...
I've tried to override WndProc, but no message show up on paste event. Then I tried to create custom filter and using method PreFilterMessage I was able to catch message with value 257 (KEYUP event), but that's not enough...
It sounds like you're trying to handle the paste event in a Windows Forms application (WinForms) and facing challenges using the `WndProc` method and `PreFilterMessage`. The paste event is typically triggered by the keyboard shortcut (Ctrl + V) or by context menu actions. Here’s a simple approach to capture the paste ...
15,020
[ { "from": "human", "value": "I've tried to override WndProc, but no message show up on paste event.\nThen I tried to create custom filter and using method PreFilterMessage I was able to catch message with value 257 (KEYUP event), but that's not enough...\n" }, { "from": "gpt", "value": "It sound...
A brief search shows that all available (uUnix command line) tools that convert from xsd (XML Schema) to rng (RelaxNG) or rnc (compact RelaxNG) have problems of some sort. First, if I use rngconv: $ wget https://msv.dev.java.net/files/documents/61/31333/rngconv.20060319.zip $ unzip rngconv.20060319.zip $ cd rngconv-200...
Your experience highlights a significant challenge in the ecosystem of XML tools, particularly when it comes to converting between different schema languages. Here are some thoughts and insights that might help you navigate this landscape: 1. **Historical Context**: XML and its associated technologies have been around...
15,035
[ { "from": "human", "value": "A brief search shows that all available (uUnix command line) tools that convert from xsd (XML Schema) to rng (RelaxNG) or rnc (compact RelaxNG) have problems of some sort.\nFirst, if I use rngconv:\n$ wget https://msv.dev.java.net/files/documents/61/31333/rngconv.20060319.zip\n$...
My application is preparing a cover-sheet for submitting documents by fax. I identify the batch by printing a Code39 on it. The incoming faxes are received as tif files and my small c# service is polling for new faxes and calling a decoding function. Currently I use a Win32 dll to recognize the barcode (QSbar39) and ...
If you're looking to switch from a Win32 DLL for barcode recognition to a more integrated solution within your C# application, there are several .NET libraries you could consider. Here are some recommendations: ### .NET Libraries for Barcode Recognition 1. **ZXing.Net** - **Description**: ZXing (Zebra Crossing) is...
13,333
[ { "from": "human", "value": "My application is preparing a cover-sheet for submitting documents by fax. I identify the batch by printing a Code39 on it. \nThe incoming faxes are received as tif files and my small c# service is polling for new faxes and calling a decoding function. \nCurrently I use a Win32 ...
I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant: dir1/dir2/**/SVN/* --> Matches all files in SVN directories that are located anywhere in the directory tree under dir1/dir2 **/test/** --> Matches all files that have a test element in their...
For complex file and directory pattern matching similar to the Ant-style patterns you've described, there isn't a built-in C# library that directly supports this out of the box, but there are a few options you can consider that might help you achieve your goal. ### 1. Use **Glob** libraries The Glob pattern matching i...
13,914
[ { "from": "human", "value": "I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant:\n\ndir1/dir2/**/SVN/* --> Matches all files in SVN directories that are located anywhere in the directory tree under dir1/dir2\n**/test/** --> Matches ...
I have a database full of customer data. It's so big that it's really cumbersome to operate on, and I'd rather just slim it down to 10% of the customers, which is plenty for development. I have an awful lot of tables and I don't want to alter them all with "ON DELETE CASCADE", especially because this is a one-time de...
If you're looking to reduce your customer database by deleting 90% of the customers and their related data across multiple tables without setting up foreign key constraints with "ON DELETE CASCADE", you'll need to take a manual approach since cascading deletes depend on those constraints being set. Here are a few opti...
14,190
[ { "from": "human", "value": "I have a database full of customer data. It's so big that it's really cumbersome to operate on, and I'd rather just slim it down to 10% of the customers, which is plenty for development. I have an awful lot of tables and I don't want to alter them all with \"ON DELETE CASCADE\...
I've heard that SELECT * is generally bad practice to use when writing SQL commands because it is more efficient to SELECT columns you specifically need. If I need to SELECT every column in a table, should I use SELECT * FROM TABLE or SELECT column1, colum2, column3, etc. FROM TABLE Does the efficiency really matter ...
Using `SELECT *` in SQL queries has been a topic of debate among database developers and administrators for several reasons. Here’s a breakdown of why it is generally considered a bad practice and some considerations regarding your specific use case. ### Reasons to Avoid SELECT * 1. **Performance**: - When you us...
15,641
[ { "from": "human", "value": "I've heard that SELECT * is generally bad practice to use when writing SQL commands because it is more efficient to SELECT columns you specifically need.\nIf I need to SELECT every column in a table, should I use\nSELECT * FROM TABLE\n\nor\nSELECT column1, colum2, column3, etc. ...
I want to make a small app that displays a PDF, presenting zoom-able single pages with a previous-next page function.
Creating a small app that displays a PDF with zoomable single pages and navigation (previous and next buttons) can be accomplished using various technologies. Below is a simple implementation using HTML, CSS, and JavaScript, along with a popular JavaScript library called PDF.js, developed by Mozilla. ### Step 1: Set U...
10,204
[ { "from": "human", "value": "I want to make a small app that displays a PDF, presenting zoom-able single pages with a previous-next page function.\n" }, { "from": "gpt", "value": "Creating a small app that displays a PDF with zoomable single pages and navigation (previous and next buttons) can b...
How do I get a list of all files (and directories) in a given directory in Python?
You can get a list of all files and directories in a given directory in Python using several methods. Here are a couple of common approaches: ### Method 1: Using `os` module You can use the `os.listdir()` function from the `os` module: ```python import os def list_files_and_directories(path): try: # Lis...
15,806
[ { "from": "human", "value": "How do I get a list of all files (and directories) in a given directory in Python?\n" }, { "from": "gpt", "value": "You can get a list of all files and directories in a given directory in Python using several methods. Here are a couple of common approaches:\n\n### Me...
I am making numerous, minute changes to .php files in Eclipse PDT then committing them and testing on the server. The repetitive six-step commit process is getting tedious: right-click team Commit... click "choose previously selected comment" select in list click OK Does anyone know of a hotkey or other process to exp...
To streamline your commit process in Eclipse PDT, you can explore a few options, including Eclipse shortcuts, keyboard customization, and third-party macro tools. ### Eclipse Shortcuts 1. **Use the Commit Shortcut**: - You can access the commit dialogue directly using the keyboard shortcut. The default key combina...
16,250
[ { "from": "human", "value": "I am making numerous, minute changes to .php files in Eclipse PDT then committing them and testing on the server.\nThe repetitive six-step commit process is getting tedious:\nright-click\nteam\nCommit...\nclick \"choose previously selected comment\"\nselect in list\nclick OK\n\n...
I'm having some trouble with plain old JavaScript (no frameworks) in referencing my object in a callback function. function foo(id) { this.dom = document.getElementById(id); this.bar = 5; var self = this; this.dom.addEventListener("click", self.onclick, false); } foo.prototype = { onclick : functio...
In JavaScript, the value of `this` inside a function depends on how the function is called. In your code, when the `onclick` function is invoked by the event listener, `this` refers to the DOM element that triggered the event (in this case, `span#test`), not the `foo` object. To preserve the context of `foo` inside the...
16,366
[ { "from": "human", "value": "I'm having some trouble with plain old JavaScript (no frameworks) in referencing my object in a callback function.\nfunction foo(id) {\n this.dom = document.getElementById(id);\n this.bar = 5;\n var self = this;\n this.dom.addEventListener(\"click\", self.onclick, fa...
I have two functions, f and g, which call each other recursively. Unfortunately, when f calls g, it has not yet been declared, so I get an "unbound variable" error. How can I prototype (or whatever the equivalent vocabulary is) this function in SML/NJ?
In Standard ML (SML), you can address the issue of mutually recursive functions (where two functions call each other) by using a `let` binding that includes a `val` binding for both functions before defining them. To create mutually recursive functions `f` and `g`, you can use a `let` expression along with `fun` decl...
16,901
[ { "from": "human", "value": "I have two functions, f and g, which call each other recursively. Unfortunately, when f calls g, it has not yet been declared, so I get an \"unbound variable\" error. How can I prototype (or whatever the equivalent vocabulary is) this function in SML/NJ?\n" }, { "from":...
I would like to be able to trap Ctrl+C in a C# console application so that I can carry out some cleanups before exiting. What is the best way of doing this?
To handle the `Ctrl+C` signal in a C# console application, you can use the `Console.CancelKeyPress` event. This event is triggered when the user presses `Ctrl+C` or `Ctrl+Break`, allowing you to perform cleanup operations before the application exits. Here's an example of how to properly set up this event: ```csharp ...
16,922
[ { "from": "human", "value": "I would like to be able to trap Ctrl+C in a C# console application so that I can carry out some cleanups before exiting. What is the best way of doing this?\n" }, { "from": "gpt", "value": "To handle the `Ctrl+C` signal in a C# console application, you can use the `C...
Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, "Copyright 2008" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.
In Visual Studio 2008, you can use code snippets or custom file templates to automatically insert header information into new files. However, the IDE does not have a built-in feature to automatically append header comments to existing files. Here's how you can achieve this using templates or snippets: ### Option 1: Cr...
12,884
[ { "from": "human", "value": "Is there a way to have Visual Studio 2008 automatically add heading information to files? For example, \"Copyright 2008\" or something along those lines. I've been digging through the options, but nothing seems to be jumping out at me.\n" }, { "from": "gpt", "value":...
I am trying to use VBScript to do an XSLT transform on an XML object. The XSL file I'm translating includes the <xsl:import href="script.xsl"/> directive. If I use the absolute URL (http://localhost/mysite/script.xsl), it imports the style sheet fine; however, if I use the relative path (script.xsl) it reports "resourc...
You're encountering a common issue with relative paths in XSLT transformations, particularly in scenarios where the stylesheets are loaded in a context (like a web browser) that doesn't recognize the base URL of your XML. When you include a stylesheet using `<xsl:import>`, the processor uses the base URI of the stylesh...
15,204
[ { "from": "human", "value": "I am trying to use VBScript to do an XSLT transform on an XML object.\nThe XSL file I'm translating includes the <xsl:import href=\"script.xsl\"/> directive. If I use the absolute URL (http://localhost/mysite/script.xsl), it imports the style sheet fine; however, if I use the re...
Is there any difference between having 4 .5GB memcache servers running or one 2GB instance? Does running multiple instances offer any benifits?
Yes, there are differences between having multiple smaller Memcached servers versus a single larger instance. Here are some factors to consider when deciding between them: ### Benefits of Multiple Instances 1. **Scalability**: - Multiple servers can handle a larger number of connections and requests simultaneously...
16,870
[ { "from": "human", "value": "Is there any difference between having 4 .5GB memcache servers running or one 2GB instance? \nDoes running multiple instances offer any benifits?\n" }, { "from": "gpt", "value": "Yes, there are differences between having multiple smaller Memcached servers versus a si...
I have an Image control with it's source bound to a property on an object(string url to an image). After making a service call, i update the data object with a new URL. The exception is thrown after it leaves my code, after invoking the PropertyChanged event. The data structure and the service logic are all done in a...
When dealing with cross-thread operations in a UI application, particularly with WPF or similar frameworks, you often encounter issues when updating UI-bound properties from a background thread. Since your core DLL has no knowledge of the UI and you can't directly access the UI's dispatcher, you'll need to find a way t...
14,379
[ { "from": "human", "value": "I have an Image control with it's source bound to a property on an object(string url to an image). After making a service call, i update the data object with a new URL. The exception is thrown after it leaves my code, after invoking the PropertyChanged event.\nThe data structu...
Like many others on this site I am considering a move to ASP.NET MVC for future projects. Currently my sites are running the traditional ASP.NET 2.0 Web Forms, and it works OK for us, so my other option is just to stick with what I know and make the move to ASP.NET 3.5 with the integrated AJAX stuff. I'm wondering abo...
Switching from ASP.NET Web Forms to ASP.NET MVC is a significant change, and it's great that you're considering the implications for user controls and how they can be integrated into your development workflow. ### User Controls in ASP.NET MVC In ASP.NET MVC, the concept of user controls (like ASCX) is replaced with *...
7,474
[ { "from": "human", "value": "Like many others on this site I am considering a move to ASP.NET MVC for future projects. Currently my sites are running the traditional ASP.NET 2.0 Web Forms, and it works OK for us, so my other option is just to stick with what I know and make the move to ASP.NET 3.5 with the...
I'm evaluating Server 2008. My C++ executable is getting this error. I've seen this error on MSDN that seems to have required a hot-fix for several previous OSes. Anyone else seen this? I get the same results for the 32 & 64 bit OS. Code snippet: HRESULT GroupStart([in] short iClientId, [in] VARIANT GroupDataArray, ...
The error you are encountering when invoking your C++ function may arise from several potential sources, especially given that you're working with COM objects, variants, and SAFEARRAYs. Without knowing the specific error message, I'll outline some common issues that could lead to problems in this context, particularly ...
12,207
[ { "from": "human", "value": "I'm evaluating Server 2008. My C++ executable is getting this error. I've seen this error on MSDN that seems to have required a hot-fix for several previous OSes. Anyone else seen this? I get the same results for the 32 & 64 bit OS.\nCode snippet:\nHRESULT GroupStart([in] short ...
Are there any decent tutorials for setting up F# in Visual Studio 2005? Everything I have found points at VS2008. ie: 'F# projects' under projects, etc.
Setting up F# in Visual Studio 2005 can be a bit challenging since F# was officially introduced as part of Visual Studio 2008. However, there are still some options for working with F# in an earlier version. ### Here are some steps to help you get started with F# in Visual Studio 2005: 1. **Install F# Compiler**: ...
16,354
[ { "from": "human", "value": "Are there any decent tutorials for setting up F# in Visual Studio 2005? Everything I have found points at VS2008.\nie: 'F# projects' under projects, etc.\n" }, { "from": "gpt", "value": "Setting up F# in Visual Studio 2005 can be a bit challenging since F# was offici...
I want to create a Java program that can be extended with plugins. How can I do that and where should I look for? I have a set of interfaces that the plugin must implement, and it should be in a jar. The program should watch for new jars in a relative (to the program) folder and registered them somehow. Although I do ...
Creating a simple Java application that supports plugins can be accomplished by defining a clear plugin interface and using the Java Reflection API to load the plugins at runtime. Below, I outline a basic approach to help you get started: ### Step 1: Define the Plugin Interface Start by defining an interface that all...
4,439
[ { "from": "human", "value": "I want to create a Java program that can be extended with plugins. How can I do that and where should I look for?\nI have a set of interfaces that the plugin must implement, and it should be in a jar. The program should watch for new jars in a relative (to the program) folder an...
I have a java app (not running in any application container) which listens on a ServerSocket for connections. I would like it to only accept connections which come from localhost. Currently, after a connection is accepted, it checks the peer IP and rejects it if it is not the loopback address, but I know that peer IP...
It's great to hear that you were able to identify the issue with your application. Binding your `ServerSocket` to the loopback address (127.0.0.1) is indeed the correct approach to restrict connections to only those originating from the same machine. Here’s a brief summary of how you can create a `ServerSocket` that ...
13,780
[ { "from": "human", "value": "I have a java app (not running in any application container) which listens on a ServerSocket for connections. I would like it to only accept connections which come from localhost. Currently, after a connection is accepted, it checks the peer IP and rejects it if it is not the ...
I am using the next class (simplified for the sake of understandability) to download images in a struts web application. It is working fine in every browser but firefox, which cuts names containing spaces. That it is to say: file with spaces.pdf gets downloaded in firefox as: file while in chrome, IE7 IE6 is downloade...
The issue you are encountering with Firefox cutting off spaces in filenames when downloading files is due to the way the `Content-Disposition` header is constructed. Different browsers handle the parsing of filenames in the `Content-Disposition` header differently, particularly when it comes to spaces. To ensure consi...
16,924
[ { "from": "human", "value": "I am using the next class (simplified for the sake of understandability) to download images in a struts web application. \nIt is working fine in every browser but firefox, which cuts names containing spaces. That it is to say: file with spaces.pdf gets downloaded in firefox as: ...
I've got my brand new VS2008 and decided to convert my main solution from VS2005. One of the projects is a SQL2005 reporting services project. Now that I've converted I cannot load it in VS2008. Is there anyway around this? My problem is that my solution is a hybrid and has websites libraries and reports in there. Sep...
When converting a Visual Studio 2005 solution to Visual Studio 2008, you might encounter issues, especially with SQL Server Reporting Services (SSRS) projects, because the project types and file formats can change between versions. Here are some steps and workarounds you can try: ### 1. **Update Reporting Services Pro...
15,501
[ { "from": "human", "value": "I've got my brand new VS2008 and decided to convert my main solution from VS2005. One of the projects is a SQL2005 reporting services project. Now that I've converted I cannot load it in VS2008. Is there anyway around this? \nMy problem is that my solution is a hybrid and has we...
Having integrated merb_auth_password_slice as per the README, I can successfully login as redirect_after_login is being triggered, although session.authenticated? returns false. Just trying the basic auth strategy for now (password form), can't seem to get it working, any ideas? My init file: require 'dm-validations' ...
It seems like you're having trouble with the session not registering as authenticated even though the `redirect_after_login` is triggered successfully. Here are a few steps and checks you can perform to troubleshoot and potentially resolve the issue: ### 1. Ensure User is being Authenticated First, check whether the u...
14,717
[ { "from": "human", "value": "Having integrated merb_auth_password_slice as per the README, I can successfully login as redirect_after_login is being triggered, although session.authenticated? returns false.\nJust trying the basic auth strategy for now (password form), can't seem to get it working, any ideas...
We have an application that has to be flexible in how it displays it's main form to the user - depending on the user, the form should be slightly different, maybe an extra button here or there, or some other nuance. In order to stop writing code to explicitly remove or add controls etc, I turned to visual inheritance ...
Visual inheritance can indeed be a powerful tool in object-oriented programming, particularly when you want to create a base form that can be easily extended with variations for different user roles or conditions. However, it's true that many developers have encountered challenges when working with visual inheritance i...
12,305
[ { "from": "human", "value": "We have an application that has to be flexible in how it displays it's main form to the user - depending on the user, the form should be slightly different, maybe an extra button here or there, or some other nuance. In order to stop writing code to explicitly remove or add cont...
Does .NET Compact Framework 3.5 work on Windows Mobile 2003 SE without limitations?
The .NET Compact Framework 3.5 does not work on Windows Mobile 2003 SE without limitations. While .NET Compact Framework 3.5 is compatible with Windows Mobile 5.0 and later versions, it is not officially supported on Windows Mobile 2003 SE. If you attempt to run applications built with .NET Compact Framework 3.5 on Wi...
20,918
[ { "from": "human", "value": "Does .NET Compact Framework 3.5 work on Windows Mobile 2003 SE without limitations?\n" }, { "from": "gpt", "value": "The .NET Compact Framework 3.5 does not work on Windows Mobile 2003 SE without limitations. While .NET Compact Framework 3.5 is compatible with Window...
public void PublicMethod(FooBar fooBar) { if (fooBar == null) throw new ArgumentNullException("fooBar", "fooBar cannot be null"); // log the call [added: Thanks S.Lott] _logger.Log("PublicMethod called with fooBar class " + fooBar.Classification); int action = DetermineAction(); PrivateMe...
This is a good question and touches on a topic that often comes up in the context of defensive programming. Let's break it down a bit. ### General Principles 1. **Defensive Programming**: One of the goals of defensive programming is to ensure that your methods can handle unexpected input gracefully, even if the input...
16,344
[ { "from": "human", "value": "public void PublicMethod(FooBar fooBar)\n{\n if (fooBar == null)\n throw new ArgumentNullException(\"fooBar\", \"fooBar cannot be null\");\n\n // log the call [added: Thanks S.Lott]\n _logger.Log(\"PublicMethod called with fooBar class \" + fooBar.Classification...
I am looking to use Cocoon for a couple of sites I am creating. I will make heavy use of xml, xsl and conversion to html, pdf and excel on the sites. I am attracted to coccon as it implements these functions quite well. I guess I am just wondering if anyone has used it and like it, or if they found it was more troubl...
Apache Cocoon is a powerful framework for building web applications that use XML, XSLT, and various formats like HTML, PDF, and Excel. It has been around for a long time and is known for its ability to separate concerns (content, presentation, and logic) through a pipeline architecture, making it a good fit for project...
16,965
[ { "from": "human", "value": "I am looking to use Cocoon for a couple of sites I am creating. I will make heavy use of xml, xsl and conversion to html, pdf and excel on the sites. I am attracted to coccon as it implements these functions quite well.\nI guess I am just wondering if anyone has used it and li...
Had anybody found a way to migrate MediaWiki pages over to WSS Wikis? We just put up Sharepoint 2007 and while it appears to meet our needs, it doesn't appear to be any tool provided by Microsoft to migrate MediaWiki pages over to WSS wikis.
Migrating from MediaWiki to SharePoint (WSS) can be a bit challenging due to the different structures and formats of the two systems. Here are some general steps and considerations you could take into account for the migration process: 1. **Export MediaWiki Content**: You can use the MediaWiki export functionality to ...
16,812
[ { "from": "human", "value": "Had anybody found a way to migrate MediaWiki pages over to WSS Wikis? We just put up Sharepoint 2007 and while it appears to meet our needs, it doesn't appear to be any tool provided by Microsoft to migrate MediaWiki pages over to WSS wikis.\n" }, { "from": "gpt", "v...
In a web interface, I've got a text field. When user enters text and accepts with enter, application performs an action. I wanted to test the behavior with Selenium. Unfortunately, invoking 'keypress' with chr(13) insert representation of the character into the field. Is there a way other then submitting the form? I'd ...
Yes, you can use Selenium to simulate a user pressing the "Enter" key without inserting the character itself into the text field. Instead of using `send_keys(chr(13))`, you can use the `Keys` class provided by Selenium. The `Keys` class includes a representation of the Enter key as `Keys.ENTER`. Here’s how you can do ...
18,579
[ { "from": "human", "value": "In a web interface, I've got a text field. When user enters text and accepts with enter, application performs an action.\nI wanted to test the behavior with Selenium. Unfortunately, invoking 'keypress' with chr(13) insert representation of the character into the field.\nIs there...
What's the best javascript framework for drawing (lines, curves whatnot) on images?
When it comes to drawing on images in JavaScript, several frameworks can facilitate this task effectively. Here are some of the best options: 1. **HTML5 Canvas API**: - **Description**: The Canvas API is built into HTML5 and allows for rendering graphics, including lines and curves, directly within an HTML documen...
10,568
[ { "from": "human", "value": "What's the best javascript framework for drawing (lines, curves whatnot) on images?\n" }, { "from": "gpt", "value": "When it comes to drawing on images in JavaScript, several frameworks can facilitate this task effectively. Here are some of the best options:\n\n1. **...
I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? I use attributes at the class and method level all the time, but have never used them on method parameters. What are some real-world examples, and the reasons for the usage? I'm not interested in seeing a tex...
Using attributes on method parameters can be a powerful tool in certain situations, especially when dealing with aspects like validation, serialization, or aspect-oriented programming. While you mentioned you're interested in real-world examples rather than theoretical ones, I'll share a few scenarios where using attri...
15,510
[ { "from": "human", "value": "I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? \nI use attributes at the class and method level all the time, but have never used them on method parameters. What are some real-world examples, and the reasons for the...
Is there a way with SVN to check out from a remote repository to another remote location rather than my local file system? Something like: svn co http://myrepository/svn/project ssh me@otherlocation.net:/var/www/project
No, SVN (Subversion) does not support checking out directly to a remote location over SSH or any other protocol. When you perform an SVN checkout (`svn co`), the files are always checked out to the local file system of the machine where the command is executed. However, you can achieve the desired effect with a two-st...
16,761
[ { "from": "human", "value": "Is there a way with SVN to check out from a remote repository to another remote location rather than my local file system? Something like:\nsvn co http://myrepository/svn/project ssh me@otherlocation.net:/var/www/project\n\n" }, { "from": "gpt", "value": "No, SVN (Su...
I am current writing an application that will require multiple inserts, updates and deletes for my business entity. I am using the TransactionScope class to guarantee all the stored procedures can commit or roll back as a single unit of work. My question is, I am required to also use COMMIT TRAN and ROLLBACK TRAN is e...
When using the `TransactionScope` class in your .NET application, you generally do **not** need to use `COMMIT TRAN` or `ROLLBACK TRAN` in your stored procedures. The `TransactionScope` handles transaction management at the application level and will manage the commit or rollback of the entire transaction for you. Her...
16,783
[ { "from": "human", "value": "I am current writing an application that will require multiple inserts, updates and deletes for my business entity. I am using the TransactionScope class to guarantee all the stored procedures can commit or roll back as a single unit of work.\nMy question is, I am required to a...
What do I need to add to my .spec file to create the desktop shortcut and assign an icon to the shortcut during install of my .rpm? If a script is required, an example would be very helpful.
To create a desktop shortcut and assign an icon to that shortcut during the installation of an RPM package, you will need to edit your `.spec` file to include the necessary files and scripts. Below, I'll outline the steps needed to accomplish this, including an example. ### Step 1: Include the Desktop Entry First, yo...
12,035
[ { "from": "human", "value": "What do I need to add to my .spec file to create the desktop shortcut and assign an icon to the shortcut during install of my .rpm? If a script is required, an example would be very helpful.\n" }, { "from": "gpt", "value": "To create a desktop shortcut and assign an...
System Description A plotting component that uses OOXML to generate a document. Plotting component consists of several parts. All parts are written in C++ as exe + dll's, with the exception of the interface to the OOXML document. The latter component is a COM component that was created in C#/.NET. The main reason for...
The issue you're encountering with writing large binary segments to the OOXML document using isolated storage stems from the security features implemented in .NET, particularly regarding the trust level of the AppDomain in which your COM component is executing. Given your description, it sounds like you are hitting a c...
15,596
[ { "from": "human", "value": "System Description \nA plotting component that uses OOXML to generate a document.\nPlotting component consists of several parts. \nAll parts are written in C++ as exe + dll's, with the exception of the interface to the OOXML document.\nThe latter component is a COM component tha...
Is there a way to track which window currently has keyboard focus. I could handle WM_SETFOCUS for every window but I'm wondering if there's an alternative, simpler method (i.e. a single message handler somewhere). I could use OnIdle() in MFC and call GetFocus() but that seems a little hacky.
In Windows applications, tracking which window currently has keyboard focus can be done in a more straightforward manner than handling the `WM_SETFOCUS` message for each window. ### Method 1: Global Focus Tracking Using `GetFocus` Instead of using `OnIdle()` or handling `WM_SETFOCUS`, you can set up a global hook. Th...
11,889
[ { "from": "human", "value": "Is there a way to track which window currently has keyboard focus. I could handle WM_SETFOCUS for every window but I'm wondering if there's an alternative, simpler method (i.e. a single message handler somewhere).\nI could use OnIdle() in MFC and call GetFocus() but that seems a...
What is a .snk file for? I know it stands for Strongly Named Key, but all explanations of what it is and how it works goes over my head. Is there any simple explanation on how a strongly named key is used and how it works?
A `.snk` file stands for "Strongly Named Key" file, which is used in the context of .NET assemblies. It provides a way to uniquely identify and secure a .NET assembly. Here's a simple explanation of what it is, how it works, and why it's used: ### What is a Strongly Named Assembly? 1. **Uniqueness**: A strongly named...
16,437
[ { "from": "human", "value": "What is a .snk file for? I know it stands for Strongly Named Key, but all explanations of what it is and how it works goes over my head.\nIs there any simple explanation on how a strongly named key is used and how it works?\n" }, { "from": "gpt", "value": "A `.snk` ...
I'm looking for a subversion web client ala SVN::Web but with a very specific feature I've always thought would be quite useful. What I want is the ability to find which revision was responsible for a certain line (or lines) in a text file. A way to do this via the web would be fantastic. Anybody know of such a tool?
For your requirement of finding which revision was responsible for a certain line (or lines) in a text file using a web interface, there are a couple of tools that can help you achieve that functionality: 1. **WebSVN**: This is a popular web-based Subversion (SVN) client that provides a user-friendly interface. It inc...
18,835
[ { "from": "human", "value": "I'm looking for a subversion web client ala SVN::Web but with a very specific feature I've always thought would be quite useful.\nWhat I want is the ability to find which revision was responsible for a certain line (or lines) in a text file. A way to do this via the web would b...
How do you manage revisions of stored procedures? We have a BI solution on SQL Server 2005 with hundreds of stored procedures. What would be a good way to get these into Subversion? What are your recommended tools to script stored procedures to files?
Managing revisions of stored procedures, especially in a SQL Server environment, can be critical for maintaining the integrity of your BI solution. Here's a structured approach to get started with versioning your stored procedures in Subversion: ### Steps to Manage Revisions of Stored Procedures 1. **Scripting Stored...
16,340
[ { "from": "human", "value": "How do you manage revisions of stored procedures?\nWe have a BI solution on SQL Server 2005 with hundreds of stored procedures. \nWhat would be a good way to get these into Subversion? What are your recommended tools to script stored procedures to files?\n" }, { "from": ...
If you were to write an GUI application that runs locally and calls a webservice, to be cross platform, can you do it with .Net, what tools would you recommend? I was considering Java as it would be relatively easy to pick up due to its C# similarity and then I could use the JVM.
Yes, you can definitely create a cross-platform GUI application using .NET. With the introduction of .NET Core (now part of .NET 5/6/7 and onwards) and frameworks like MAUI (Multi-platform App UI) and Avalonia, you have excellent tools at your disposal to build cross-platform applications. ### Recommended Tools and Fr...
13,696
[ { "from": "human", "value": "If you were to write an GUI application that runs locally and calls a webservice, to be cross platform, can you do it with .Net, what tools would you recommend?\nI was considering Java as it would be relatively easy to pick up due to its C# similarity and then I could use the JV...
This is the code: unsigned int number; FILE* urandom = fopen("/dev/urandom", "r"); if (urandom) { size_t bytes_read = fread(&number, 1, sizeof(number), urandom); DCHECK(bytes_read == sizeof(number)); fclose(urandom); } else { NOTREACHED(); } If not, how do I make it thread-safe?
The code you've provided reads random data from `/dev/urandom` into an `unsigned int` variable. While the operation itself reads data from a system file that is generally thread-safe (as `/dev/urandom` can be accessed concurrently by multiple threads), the code snippet can be made more thread-safe by ensuring that the ...
14,410
[ { "from": "human", "value": "This is the code:\n\n unsigned int number;\n FILE* urandom = fopen(\"/dev/urandom\", \"r\");\n if (urandom) {\n size_t bytes_read = fread(&number, 1, sizeof(number), urandom);\n DCHECK(bytes_read == sizeof(number));\n fclose(urandom);\n } else {\n NOTREACHED();\n...
In Visual Studio if I define a class to implement an interface e.g. class MyObject : ISerializable {} I am able to right click on ISerializable, select "Implement Interface" from the context menu and see the appropriate methods appear in my class definition. class MyObject : ISerializable { #region ISerializable M...
Yes, Xcode provides functionality similar to what you described in Visual Studio for implementing protocols. While it doesn't have a dedicated right-click option to automatically implement methods from a protocol, there are a couple of ways to help streamline the process. ### Option 1: Using Code Snippets 1. **Create ...
18,126
[ { "from": "human", "value": "In Visual Studio if I define a class to implement an interface e.g.\nclass MyObject : ISerializable {}\n\nI am able to right click on ISerializable, select \"Implement Interface\" from the context menu and see the appropriate methods appear in my class definition.\nclass MyObjec...
We are migrating our works repository so I want to do a cull of all the unreferenced files that exist in the source tree before moving it into the nice fresh (empty) repository. So far I have gone through by hand and found all the unreferenced files that I know about but I want to find out if I have caught them all. On...
To help you identify unreferenced or unused files in your C++ repository, you can leverage a combination of static analysis tools and scripting. Here are some suggestions for automated approaches you can take: ### 1. **C++ Static Analysis Tools** Although you mentioned that lint cannot find unused files, there are oth...
12,334
[ { "from": "human", "value": "We are migrating our works repository so I want to do a cull of all the unreferenced files that exist in the source tree before moving it into the nice fresh (empty) repository.\nSo far I have gone through by hand and found all the unreferenced files that I know about but I want...
We don't exactly comply with the XML-RPC spec, but the concepts are nearly identical. A client comes in over HTTP/HTTPS with an XML payload. We respond with an XML payload answering the request. This is primarily machine to machine, so no human to type a username/password. Our construct runs within apache tomcat. ...
To implement a system that authenticates, authorizes, and logs requests over XML-RPC (or a similar protocol) in a machine-to-machine context, here are some recommendations for both the server and client sides, considering that you are running within Apache Tomcat. ### Server-Side Recommendations 1. **Authentication**...
14,801
[ { "from": "human", "value": "We don't exactly comply with the XML-RPC spec, but the concepts are nearly identical. A client comes in over HTTP/HTTPS with an XML payload. We respond with an XML payload answering the request. This is primarily machine to machine, so no human to type a username/password. O...
Is there a best practice when it comes to setting client side "onclick" events when using ASP.Net controls? Simply adding the onclick attribute results in a Visual Studio warning that onclick is not a valid attribute of that control. Adding it during the Page_Load event through codebehind works, but is less clear tha...
When it comes to setting client-side `onclick` events for ASP.NET controls, there are indeed a few best practices and common approaches. As you've noted, directly adding the `onclick` attribute in the ASP.NET markup can lead to warnings in Visual Studio since it’s not a recognized attribute for many controls. Here are ...
15,926
[ { "from": "human", "value": "Is there a best practice when it comes to setting client side \"onclick\" events when using ASP.Net controls? Simply adding the onclick attribute results in a Visual Studio warning that onclick is not a valid attribute of that control. Adding it during the Page_Load event thro...
Say I have two tables I want to join. Categories: id name ---------- 1 Cars 2 Games 3 Pencils And items: id categoryid itemname --------------------------- 1 1 Ford 2 1 BMW 3 1 VW 4 2 Tetris 5 2 Pong 6 3 Foobar Pencil Fa...
Certainly! You can achieve this with SQL queries. Here’s how you can structure your queries to get both the first item for each category and a random item for each category. ### 1. Query for the First Item in Each Category To get the first item for each category based on the `id` in the `items` table, you can use a `...
15,928
[ { "from": "human", "value": "Say I have two tables I want to join.\nCategories:\nid name\n----------\n1 Cars\n2 Games\n3 Pencils\n\nAnd items:\nid categoryid itemname\n---------------------------\n1 1 Ford\n2 1 BMW\n3 1 VW\n4 2 Tetris\n5...
While running through the cheat sheet "create a navigation rule" for the Eclipse JavaServer Faces tooling it says "select the page control from the palette and ...". But where's this "palette"?
In Eclipse, the "palette" is typically found in the context of graphical editors, such as when working with JavaServer Faces (JSF) or other visual web development tools. Here’s how you can find the palette in Eclipse: 1. **Open the JSF Page**: Make sure you have your JSF page opened in the appropriate editor. This cou...
19,100
[ { "from": "human", "value": "While running through the cheat sheet \"create a navigation rule\" for the Eclipse JavaServer Faces tooling it says \"select the page control from the palette and ...\". But where's this \"palette\"?\n" }, { "from": "gpt", "value": "In Eclipse, the \"palette\" is typ...
Very simply put: I have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions. Anyway, I have defined two static unsigned char variables in my class public scope, when I try to modify these values in the same class' con...
The error you're encountering, "unresolved external symbol," typically indicates that you've declared static members in your class but haven't defined them outside the class. In C++, static members need to be defined in a source file (usually the `.cpp` file) after the class definition. When you declare a static membe...
18,903
[ { "from": "human", "value": "Very simply put:\nI have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions.\nAnyway, I have defined two static unsigned char variables in my class public scope, when I try to...
Using any member of the Windows Server family, I can set up an active directory, and have a single pool of users for a large scale of computers; access can be given / removed for any shared resources in the given domain (including access to client computers, etc). What similar (and widespread) solutions exist for manag...
In the Linux ecosystem, there are several solutions for managing a multi-user, multi-computer environment, analogous to Active Directory (AD) in the Windows Server family. Below are some notable solutions, along with their advantages and disadvantages, and information on their interoperability with Windows. ### 1. **O...
13,518
[ { "from": "human", "value": "Using any member of the Windows Server family, I can set up an active directory, and have a single pool of users for a large scale of computers; access can be given / removed for any shared resources in the given domain (including access to client computers, etc).\nWhat similar ...
What is the use of a Dispatcher Object in WPF?
In Windows Presentation Foundation (WPF), a `Dispatcher` object plays a crucial role in managing the execution of code on the UI thread. Here are the main uses and functionalities of the `Dispatcher`: 1. **Thread Management**: WPF uses a single-threaded apartment (STA) model for its UI. This means that the UI elements...
16,107
[ { "from": "human", "value": "What is the use of a Dispatcher Object in WPF?\n" }, { "from": "gpt", "value": "In Windows Presentation Foundation (WPF), a `Dispatcher` object plays a crucial role in managing the execution of code on the UI thread. Here are the main uses and functionalities of the ...
Bearing in mind that I'll be performing calculations on lat / long pairs, what datatype is best suited for use with a MySQL database?
When working with latitude and longitude pairs in a MySQL database, the best data type to use is the `POINT` data type, which is part of the Spatial Data Types in MySQL. The `POINT` type allows you to store a pair of coordinates in a single column and perform spatial queries and calculations efficiently. Here's how yo...
17,071
[ { "from": "human", "value": "Bearing in mind that I'll be performing calculations on lat / long pairs, what datatype is best suited for use with a MySQL database?\n" }, { "from": "gpt", "value": "When working with latitude and longitude pairs in a MySQL database, the best data type to use is the...
Does anyone know of any sample code for restoring a window's position and size in wxRuby?
Certainly! Restoring a window's position and size in wxRuby can be done using the `wxConfig` class to store and retrieve the window's dimensions and position when the application starts and closes. Below is a simple example to demonstrate how you can achieve this: ```ruby require 'wx' class MyFrame < Wx::Frame def ...
15,018
[ { "from": "human", "value": "Does anyone know of any sample code for restoring a window's position and size in wxRuby? \n" }, { "from": "gpt", "value": "Certainly! Restoring a window's position and size in wxRuby can be done using the `wxConfig` class to store and retrieve the window's dimension...
I notice that modern C and C++ code seems to use size_t instead of int/unsigned int pretty much everywhere - from parameters for C string functions to the STL. I am curious as to the reason for this and the benefits it brings.
The use of `size_t` in modern C and C++ code, especially in functions and data structures related to sizes and memory allocation, is primarily motivated by several important reasons: 1. **Portability**: `size_t` is an unsigned integer type that is defined to be capable of representing the size of any object in memory....
18,221
[ { "from": "human", "value": "I notice that modern C and C++ code seems to use size_t instead of int/unsigned int pretty much everywhere - from parameters for C string functions to the STL. I am curious as to the reason for this and the benefits it brings.\n" }, { "from": "gpt", "value": "The us...
I have already extracted the tag from the source document using grep but, now I cant seem to figure out how to easily extract the properties from the string. Also I want to avoid having to use any programs that would not usually be present on a standard installation. $tag='<img src="http://imgs.xkcd.com/comics/barre...
You can achieve this using basic tools that are typically present in a standard Unix-like installation, such as `sed` or `awk`. Here are two approaches using both `sed` and `awk`. ### Using `sed` You can use `sed` to extract the desired attributes directly from the tag string. Here's how you can do it: ```bash tag='...
16,769
[ { "from": "human", "value": "I have already extracted the tag from the source document using grep but, now I cant seem to figure out how to easily extract the properties from the string. Also I want to avoid having to use any programs that would not usually be present on a standard installation. \n$tag='<...
So a column will hold some text that beforehand I won't know how long the length of this string can be. Realistically 95% of the time, it will probably be between 100-500 chars, but there can be that one case where it will 10000 chars long. I have no control over the size of this string and never does the user. Besides...
When dealing with text data in SQL databases where the length can be highly variable and sometimes quite large, you have a few strategies to consider. Here are some options beyond using `VARCHAR(MAX)`: ### 1. Use `TEXT` or `NTEXT` Data Types (Deprecated) - **Description**: In some databases (like SQL Server), there us...
13,731
[ { "from": "human", "value": "So a column will hold some text that beforehand I won't know how long the length of this string can be. Realistically 95% of the time, it will probably be between 100-500 chars, but there can be that one case where it will 10000 chars long. I have no control over the size of thi...