instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Would it not make sense to support a set of languages (Java, Python, Ruby, etc.) by way of a standardized virtual machine hosted in the browser rather than requiring the use of a specialized language -- really, a specialized paradigm -- for client scripting only? To clarify the suggestion, a web page would contain byte...
Your idea of a standardized virtual machine (VM) for multiple languages hosted in the browser is intriguing and has been a topic of discussion in web development for quite some time. Here are some considerations regarding the feasibility and implications of such a proposal: ### Advantages: 1. **Multi-Language Support...
4,205
[ { "from": "human", "value": "Would it not make sense to support a set of languages (Java, Python, Ruby, etc.) by way of a standardized virtual machine hosted in the browser rather than requiring the use of a specialized language -- really, a specialized paradigm -- for client scripting only?\nTo clarify the...
Recently we got a new server at the office purely for testing purposes. It is set up so that we can access it from any computer. However today our ip got blocked from one of our other sites saying that our ip has been suspected of having a virus that sends spam emails. we learned this from the cbl http://cbl.abuseat.o...
It sounds like you’re dealing with a challenging situation, but you're on the right track by wanting to keep the server running on your LAN while preventing it from connecting to the internet. Here’s how you can proceed: ### Option 1: Disconnect the Server from the Internet 1. **Physically Disconnect the Network Cabl...
5,249
[ { "from": "human", "value": "Recently we got a new server at the office purely for testing purposes. It is set up so that we can access it from any computer. \nHowever today our ip got blocked from one of our other sites saying that our ip has been suspected of having a virus that sends spam emails. we lear...
When I try to create a SQL Server Login by saying CREATE LOGIN [ourdomain\SQLAccessGroup] FROM WINDOWS; I get this error The server principal 'ourdomain\SQLAccessGroup' already exists. However, when I try this code DROP LOGIN [ourdomain\SQLAccessGroup] I get this error Cannot drop the login 'ourdomain\SQLAccessGro...
It looks like you're encountering a situation where SQL Server thinks that the login already exists, but it's not visible in the `sys.server_principals` view, which can happen in some specific scenarios, particularly related to Windows groups or accounts. Here are some steps and checks you can perform to troubleshoot a...
3,494
[ { "from": "human", "value": "When I try to create a SQL Server Login by saying\nCREATE LOGIN [ourdomain\\SQLAccessGroup] FROM WINDOWS;\n\nI get this error\n\nThe server principal 'ourdomain\\SQLAccessGroup' already exists.\n\nHowever, when I try this code\nDROP LOGIN [ourdomain\\SQLAccessGroup]\n\nI get thi...
In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms. Is there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?
Choosing between procedural and object-oriented programming (OOP) paradigms in a language like PHP depends on several factors related to the project’s scope, complexity, maintainability, and team familiarity. Here are some guidelines that can help you make the decision: ### 1. **Project Size and Complexity** - **Sm...
4,217
[ { "from": "human", "value": "In a language such as (since I'm working in it now) PHP, which supports procedural and object-oriented paradigms.\nIs there a good rule of thumb for determining which paradigm best suits a new project? If not, how can you make the decision?\n" }, { "from": "gpt", "va...
A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases. The author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly complex sql statement (~10 joins, >10 sub s...
Refactoring your C# COM object to improve the way it constructs SQL queries can lead to better maintainability, readability, and performance. Here are a few approaches you can consider for constructing your database queries in a more elegant and maintainable way: ### 1. Use an ORM (Object-Relational Mapping) Using an...
2,168
[ { "from": "human", "value": "A project I'm working on at the moment involves refactoring a C# Com Object which serves as a database access layer to some Sql 2005 databases.\nThe author of the existent code has built all the sql queries manually using a string and many if-statements to construct the fairly c...
Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options?
CPAN DBI (Database Interface) is indeed one of the most popular and widely used modules in Perl for interacting with databases. It provides a consistent interface for different databases, allowing developers to write database-agnostic code. The DBI module is very well-documented, has a large community, and supports a w...
5,502
[ { "from": "human", "value": "Is CPAN DBI the best database interface to use in Perl for general database use? Are there some better options?\n" }, { "from": "gpt", "value": "CPAN DBI (Database Interface) is indeed one of the most popular and widely used modules in Perl for interacting with datab...
I'm converting an application to use Java 1.5 and have found the following method: /** * Compare two Comparables, treat nulls as -infinity. * @param o1 * @param o2 * @return -1 if o1<o2, 0 if o1==o2, 1 if o1>o2 */ protected static int nullCompare(Comparable o1, Comparable o2) { if (o1 == nu...
Yes, you can definitely modify your `nullCompare` method to ensure type safety while still allowing for the comparison of two `Comparable` objects of the same type. The warning you're seeing arises because you're using a raw type `Comparable` instead of a parameterized type. Here's how you can properly parameterize th...
7,082
[ { "from": "human", "value": "I'm converting an application to use Java 1.5 and have found the following method:\n /**\n * Compare two Comparables, treat nulls as -infinity.\n * @param o1\n * @param o2\n * @return -1 if o1<o2, 0 if o1==o2, 1 if o1>o2\n */\n protected static int nullCompare(...
Has anyone had any experience in building a 'real world' application with the Smart Client Software Factory, from Microsofts Patterns and Practices group? I'm looking for advice on how difficult it was to master, whether it decreased your time to market and any other general pitfalls.
Yes, many developers have had experience building real-world applications using the Smart Client Software Factory (SCSF) from Microsoft's Patterns and Practices group. Here are some insights based on those experiences: ### Learning Curve - **Initial Investment:** Many developers find the learning curve to be somewhat ...
4,859
[ { "from": "human", "value": "Has anyone had any experience in building a 'real world' application with the Smart Client Software Factory, from Microsofts Patterns and Practices group? I'm looking for advice on how difficult it was to master, whether it decreased your time to market and any other general pi...
I'd like to log the output of a command to stdout as well as to a log file. I've got Cygwin installed and I'm trying to use the tee command to accomplish this. devenv mysolution.sln /build myproject "Release|Win32" | tee build.log Trouble is that tee seems to insist on waiting for the end of file before outputting any...
When using `tee` in Cygwin (or any Unix-like environment), it's important to understand how the commands and their output buffering work. The issue you're encountering with `tee` is often related to the way output buffering is handled by the command generating the output (`devenv` in your case). If `devenv` is buffer...
6,874
[ { "from": "human", "value": "I'd like to log the output of a command to stdout as well as to a log file. I've got Cygwin installed and I'm trying to use the tee command to accomplish this.\ndevenv mysolution.sln /build myproject \"Release|Win32\" | tee build.log\n\nTrouble is that tee seems to insist on wai...
I am using mssql and am having trouble using a subquery. The real query is quite complicated, but it has the same structure as this: select customerName, customerId, ( select count(*) from Purchases where Purchases.customerId=customerData.customerId ) as numberTransactions from customerData And...
In SQL Server (MSSQL), when you use an alias in the `SELECT` clause, you cannot use that alias directly in the `ORDER BY` clause. However, you can reference the column by its expression in the `ORDER BY` clause. In your case, you can either repeat the subquery in the `ORDER BY` clause or use the same subquery express...
5,849
[ { "from": "human", "value": "I am using mssql and am having trouble using a subquery. The real query is quite complicated, but it has the same structure as this:\nselect \n customerName, \n customerId,\n (\n select count(*) \n from Purchases \n where Purchases.customerId=customerData.customerId\...
Here is the deal. $ gem --version 1.1.0 $ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config Bulk updating Gem source index for: http://gems.rubyforge.org/ ERROR: could not find mysql locally or in a repository $ sudo gem update Updating installed gems Bulk updating Gem sourc...
It looks like you're encountering issues with RubyGems when trying to install the MySQL gem and update your gems. There are a couple of steps you can take to troubleshoot and resolve these issues: 1. **Check RubyGems Source**: It seems like the gem source you are trying to access (`http://gems.rubyforge.org/`) is outd...
5,817
[ { "from": "human", "value": "Here is the deal. \n$ gem --version\n\n1.1.0\n\n$ sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config\n\nBulk updating Gem source index for:\n http://gems.rubyforge.org/ ERROR: \n could not find mysql locally or in a\n repository\n\n$ sudo gem upda...
I have a WCF Web Service which is referenced from a class library. After the project is run, when creating the service client object from inside a class library, I receive an InvalidOperationException with message: Could not find default endpoint element that references contract 'MyServiceReference.IMyService' in th...
The `InvalidOperationException` you're encountering typically indicates that the WCF service client configuration is not set up properly in the application where the class library is being used. Here's how you can troubleshoot and resolve this issue: ### Steps to Resolve the Issue 1. **Check Configuration File**: ...
3,166
[ { "from": "human", "value": "I have a WCF Web Service which is referenced from a class library. After the project is run, when creating the service client object from inside a class library, I receive an InvalidOperationException with message:\n\nCould not find default endpoint element that references contr...
In file Atomic.aiml, part of the annotated ALICE AIML files, there are a lot of categories like this: <category> <pattern>ANSWER MY QUESTION</pattern> <template> Please try asking <set name="it">your question</set> another way. </template> </category> This code isn't valid acco...
In AIML, the use of character data within a `<set>` element can indeed lead to validation issues with certain AIML parsers or validators, as the AIML XSD schema expects certain structures. To fix the issue in your AIML code while still capturing the intended meaning, you can restructure the `<template>` to avoid having...
7,409
[ { "from": "human", "value": "In file Atomic.aiml, part of the annotated ALICE AIML files, there are a lot of categories like this:\n<category>\n <pattern>ANSWER MY QUESTION</pattern>\n <template>\n Please try asking \n <set name=\"it\">your question</set> \n another way.\n </te...
I'm trying to use Groovy to create an interactive scripting / macro mode for my application. The application is OSGi and much of the information the scripts may need is not know up front. I figured I could use GroovyShell and call eval() multiple times continually appending to the namespace as OSGi bundles are loaded. ...
To achieve your goal of dynamically creating a base class in Groovy and then deriving from it as OSGi bundles are loaded, you can use a combination of Groovy's metaprogramming capabilities and the `GroovyShell`. Here's a high-level approach on how to set this up: ### Step 1: Set Up the Base Class First, you need to c...
2,707
[ { "from": "human", "value": "I'm trying to use Groovy to create an interactive scripting / macro mode for my application. The application is OSGi and much of the information the scripts may need is not know up front. I figured I could use GroovyShell and call eval() multiple times continually appending to t...
I had data in XML that had line feeds, spaces, and tabs that I wanted to preserve in the output HTML (so I couldn't use <p>) but I also wanted the lines to wrap when the side of the screen was reached (so I couldn't use <pre>).
To preserve whitespace (including line feeds, spaces, and tabs) in HTML while allowing text to wrap at the edge of the screen, you can use the CSS `white-space` property in combination with a suitable HTML element, such as a `<div>`. You can set the `white-space` property to `pre-wrap`, which preserves spaces and lin...
7,261
[ { "from": "human", "value": "I had data in XML that had line feeds, spaces, and tabs that I wanted to preserve in the output HTML (so I couldn't use <p>) but I also wanted the lines to wrap when the side of the screen was reached (so I couldn't use <pre>).\n" }, { "from": "gpt", "value": "To ...
Are there any blogs, guides, checklists, or controls we should be using to ensure our SharePoint implementation is accessible? Preferrably to the W3C double A standard, or as close to that as we can get. We're implementing an extranet solution.
Ensuring your SharePoint implementation is accessible and compliant with the W3C's Web Content Accessibility Guidelines (WCAG) 2.1, specifically Level AA, is crucial for creating an inclusive environment. Below is a list of resources, best practices, and tools that can help guide you through making your SharePoint site...
2,972
[ { "from": "human", "value": "Are there any blogs, guides, checklists, or controls we should be using to ensure our SharePoint implementation is accessible?\nPreferrably to the W3C double A standard, or as close to that as we can get.\nWe're implementing an extranet solution. \n" }, { "from": "gpt", ...
Does anyone know of any resources that talk about best practices or design patterns for shell scripts (sh, bash etc.)?
Yes, there are several resources available that discuss best practices and design patterns for writing shell scripts, specifically for `sh` and `bash`. Here are some recommendations: 1. **Books**: - **"The Linux Command Line" by William E. Shotts, Jr.**: This book is an excellent resource for beginners and intermed...
4,434
[ { "from": "human", "value": "Does anyone know of any resources that talk about best practices or design patterns for shell scripts (sh, bash etc.)?\n" }, { "from": "gpt", "value": "Yes, there are several resources available that discuss best practices and design patterns for writing shell script...
How can my app get a valid "last time connected to domain" timestamp from Windows, even when the app is running offline? Background: I am writing an application that is run on multiple client machines throughout my company. All of these client machines are on one of the AD domains implemented by my company. This appl...
To achieve the goal of determining the last time a client machine connected to an Active Directory (AD) domain, even when your application is running offline, you can leverage the local Windows security policy, which maintains a record of the last logon time for the computer. Here are some approaches to consider: ##...
2,484
[ { "from": "human", "value": "How can my app get a valid \"last time connected to domain\" timestamp from Windows, even when the app is running offline?\nBackground:\nI am writing an application that is run on multiple client machines throughout my company. All of these client machines are on one of the AD ...
Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow.
Yes, it is possible to change the width of a scrollbar on a form, but the approach may vary depending on the programming language and framework you're using to create your application. Here are a few common methods for adjusting scrollbar width in various environments: ### For Windows Forms (C#) In Windows Forms, you ...
2,802
[ { "from": "human", "value": "Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow.\n" }, { "from": "gpt", "value": "Yes, it is possible to change the width of a scrollbar on a form, but the approach may vary depending on the pro...
What are the differences between htmlspecialchars() and htmlentities(). When should I use one or the other?
`htmlspecialchars()` and `htmlentities()` are both PHP functions used to convert special characters to their HTML entities, but they differ in how they handle characters beyond the basic set. ### Key Differences: 1. **Scope of Conversion**: - `htmlspecialchars()`: This function only converts a few predefined chara...
5,852
[ { "from": "human", "value": "What are the differences between htmlspecialchars() and htmlentities(). When should I use one or the other?\n" }, { "from": "gpt", "value": "`htmlspecialchars()` and `htmlentities()` are both PHP functions used to convert special characters to their HTML entities, bu...
How are people unit testing code that uses Linq to SQL?
Unit testing code that uses LINQ to SQL can be challenging due to its reliance on a database context, which can make it difficult to isolate tests and avoid side effects from actual database interactions. However, there are several strategies you can use to effectively unit test code that utilizes LINQ to SQL: ### 1. ...
3,940
[ { "from": "human", "value": "How are people unit testing code that uses Linq to SQL? \n" }, { "from": "gpt", "value": "Unit testing code that uses LINQ to SQL can be challenging due to its reliance on a database context, which can make it difficult to isolate tests and avoid side effects from ac...
Is there a way to enforce/limit the types that are passed to primitives? (bool, int, string, etc.) Now, I know you can limit the generic type parameter to a type or interface implementation via the where clause. However, this doesn't fit the bill for primitives (AFAIK) because they do not all have a common ground (apar...
Your approach to enforcing the use of primitive types (or types you consider as "primitive") in a generic class is a practical one given the constraints of working in .NET Framework 2.0. As you mentioned, generics in C# do not allow you to limit a type parameter to primitives directly, since they don't share a common i...
5,591
[ { "from": "human", "value": "Is there a way to enforce/limit the types that are passed to primitives? (bool, int, string, etc.)\nNow, I know you can limit the generic type parameter to a type or interface implementation via the where clause. However, this doesn't fit the bill for primitives (AFAIK) because ...
can anybody recommend some really good resources for how to get Apache authenticating users with Kerberos. Background reading on Kerberos would also be useful Thanks Peter
Certainly! Setting up Apache with Kerberos authentication can be a bit complex, but there are plenty of resources that can help you through the process. Here are some recommended resources for both understanding Kerberos and implementing it with Apache: ### Background Reading on Kerberos 1. **Official Documentation**...
1,710
[ { "from": "human", "value": "can anybody recommend some really good resources for how to get Apache authenticating users with Kerberos.\nBackground reading on Kerberos would also be useful \nThanks\nPeter\n" }, { "from": "gpt", "value": "Certainly! Setting up Apache with Kerberos authentication ...
Reusing values in CSS (particularly colors) has always been a problem for me when it comes to maintaining that CSS. What are the best tools for creating variables, or generally improving maintainability with CSS?
Maintaining CSS can indeed be challenging, especially when it comes to reusing colors and other values. Fortunately, there are several tools and methodologies that can help you create variables and improve the maintainability of your CSS. Here are some of the best options: ### 1. **CSS Custom Properties (CSS Variables...
5,020
[ { "from": "human", "value": "Reusing values in CSS (particularly colors) has always been a problem for me when it comes to maintaining that CSS. What are the best tools for creating variables, or generally improving maintainability with CSS?\n" }, { "from": "gpt", "value": "Maintaining CSS can i...
We have a build box that uses CruiseControl.Net and has been building VB.Net and C# projects using msbuild. All I have installed on the box as far as .Net is concerned is .Net 2.0 SDK (I'm trying to keep the box as clean as possible). We are now trying to get a C++ app building on this box. The problem we are runnin...
It seems like you've encountered a common issue when trying to build C++ applications on a machine configured primarily for .NET development with a limited installation footprint. In this case, using the Visual Studio installation is a straightforward solution, but it's understandable to want to avoid unnecessary compo...
7,089
[ { "from": "human", "value": "We have a build box that uses CruiseControl.Net and has been building VB.Net and C# projects using msbuild. All I have installed on the box as far as .Net is concerned is .Net 2.0 SDK (I'm trying to keep the box as clean as possible). We are now trying to get a C++ app buildin...
If one Googles for "difference between notify() and notifyAll()" then a lot of explanations will pop up (leaving apart the javadoc paragraphs). It all boils down to the number of waiting threads being waken up: one in notify() and all in notifyAll(). However (if I do understand the difference between these methods righ...
You are correct in identifying that the primary difference between `notify()` and `notifyAll()` in Java’s concurrency mechanisms lies in how many waiting threads are awakened. However, the implications of this difference go beyond just the number of threads being woken up and have significant implications for the desig...
4,698
[ { "from": "human", "value": "If one Googles for \"difference between notify() and notifyAll()\" then a lot of explanations will pop up (leaving apart the javadoc paragraphs). It all boils down to the number of waiting threads being waken up: one in notify() and all in notifyAll().\nHowever (if I do understa...
How do I prevent vim from replacing spaces with tabs when autoindent is on? An example: if I have two tabs and 7 spaces in the beginning of the line, and tabstop=3, and I press Enter, the next line has four tabs and 1 space in the beginning, but I don't want that...
To prevent Vim from replacing spaces with tabs when using autoindent, you can adjust some settings in your Vim configuration. Here's how to do that: 1. **Use Spaces Instead of Tabs**: You want to configure Vim to use spaces for indentation rather than tabs. You can do this by setting the following options in your `.vi...
5,740
[ { "from": "human", "value": "How do I prevent vim from replacing spaces with tabs when autoindent is on?\nAn example: if I have two tabs and 7 spaces in the beginning of the line, and tabstop=3, and I press Enter, the next line has four tabs and 1 space in the beginning, but I don't want that...\n" }, {...
Although I don't have an iPhone to test this out, my colleague told me that embedded media files such as the one in the snippet below, only works when the iphone is connected over the WLAN connection or 3G, and does not work when connecting via GPRS. <html><body> <object data="http://joliclic.free.fr/html/object-tag/en...
When it comes to streaming media on an iPhone using GPRS, the performance and compatibility can vary. GPRS is generally slower than 3G and may lead to buffering issues or failure to load media files altogether, especially larger files. However, if you are looking for media files that may work well over GPRS, consider ...
7,874
[ { "from": "human", "value": "Although I don't have an iPhone to test this out, my colleague told me that embedded\nmedia files such as the one in the snippet below, only works when the iphone is connected over the\nWLAN connection or 3G, and does not work when connecting via GPRS.\n<html><body>\n<object dat...
By default the webjump hotlist has the following which I use quite often: M-x webjump RET Google M-x webjump RET Wikipedia How can I add 'Stackoverflow' to my list?
To add 'Stack Overflow' to your webjump hotlist in Emacs, you need to define a new webjump entry for it. Here's how you can do this: 1. Open your Emacs configuration file, which is usually located at `~/.emacs` or `~/.emacs.d/init.el`. 2. Add the following lines to your configuration file: ```elisp (require 'w...
8,271
[ { "from": "human", "value": "By default the webjump hotlist has the following which I use quite often:\nM-x webjump RET Google\nM-x webjump RET Wikipedia\n\nHow can I add 'Stackoverflow' to my list?\n" }, { "from": "gpt", "value": "To add 'Stack Overflow' to your webjump hotlist in Emacs, you ne...
Are all of these equal? Under what circumstances should I choose each over the others? var.ToString() CStr(var) CType(var, String) DirectCast(var, String) EDIT: Suggestion from NotMyself… TryCast(var, String)
The functions and methods you mentioned (`var.ToString()`, `CStr(var)`, `CType(var, String)`, `DirectCast(var, String)`, and `TryCast(var, String)`) are used in VB.NET to convert or cast variables to strings, but they have different behaviors and use cases. Here's a breakdown of each: ### 1. `var.ToString()` - **Descr...
4,546
[ { "from": "human", "value": "Are all of these equal? Under what circumstances should I choose each over the others?\n\nvar.ToString()\nCStr(var)\nCType(var, String)\nDirectCast(var, String)\n\n\nEDIT: Suggestion from NotMyself…\n\nTryCast(var, String)\n\n" }, { "from": "gpt", "value": "The func...
It's fall of 2008, and I still hear developers say that you should not design a site that requires JavaScript. I understand that you should develop sites that degrade gracefully when JS is not present/on. But at what point do you not include funcitonality that can only be powered by JS? I guess the question comes do...
As of the fall of 2008, the consensus among web developers was evolving regarding the use of JavaScript in web applications. While it was crucial to ensure that sites degraded gracefully without JavaScript, many developers were increasingly recognizing the importance of JavaScript for creating dynamic and interactive w...
1,984
[ { "from": "human", "value": "It's fall of 2008, and I still hear developers say that you should not design a site that requires JavaScript.\nI understand that you should develop sites that degrade gracefully when JS is not present/on. But at what point do you not include funcitonality that can only be powe...
In my web application I include all of my JavaScripts as js files that are embedded resources in the assembly, and add them to the page using ClientScriptManager.GetWebResourceUrl(). However, in some of my js files, I have references to other static assets like image urls. I would like to make those assembly resources ...
Yes, you can achieve a similar functionality to what you described by using a placeholder or token in your JavaScript files that gets replaced with the actual URL of the embedded resource at runtime. However, you need to implement a mechanism to parse and replace those tokens in your JavaScript files, as JavaScript its...
5,977
[ { "from": "human", "value": "In my web application I include all of my JavaScripts as js files that are embedded resources in the assembly, and add them to the page using ClientScriptManager.GetWebResourceUrl(). However, in some of my js files, I have references to other static assets like image urls. I wou...
Does anyone know of a way to declare a date constant that is compatible with international dates? I've tried: ' not international compatible public const ADate as Date = #12/31/04# ' breaking change if you have an optional parameter that defaults to this value ' because it isnt constant. public shared readonly ADate A...
To declare a date constant in a way that is compatible with international date formats, you can avoid using the `#` syntax, which is not universally clear because it depends on the locale settings. Instead, you can use the `DateTime` structure in a way that explicitly specifies the year, month, and day. This approach i...
7,597
[ { "from": "human", "value": "Does anyone know of a way to declare a date constant that is compatible with international dates?\nI've tried:\n' not international compatible\npublic const ADate as Date = #12/31/04#\n\n' breaking change if you have an optional parameter that defaults to this value\n' because i...
I want to use Lucene (in particular, Lucene.NET) to search for email address domains. E.g. I want to search for "@gmail.com" to find all emails sent to a gmail address. Running a Lucene query for "*@gmail.com" results in an error, asterisks cannot be at the start of queries. Running a query for "@gmail.com" doesn't ret...
Searching for specific parts of words, such as domains in email addresses, can be tricky in Lucene, especially given the way it tokenizes and indexes text by default. Here are some strategies you can use to effectively search for email address domains like "@gmail.com" using Lucene.NET: ### 1. Use N-grams You can ind...
2,827
[ { "from": "human", "value": "I want to use Lucene (in particular, Lucene.NET) to search for email address domains.\nE.g. I want to search for \"@gmail.com\" to find all emails sent to a gmail address.\nRunning a Lucene query for \"*@gmail.com\" results in an error, asterisks cannot be at the start of querie...
You write a function and, looking at the resulting assembly, you see it can be improved. You would like to keep the function you wrote, for readability, but you would like to substitute your own assembly for the compiler's. Is there any way to establish a relationship between your high-livel language function and the n...
Yes, there are ways to establish a relationship between your high-level function and the new assembly code you want to use, and this is commonly done through the use of "inline assembly" or "assembly language integration" in your programming language of choice. Here are some common methods to achieve this: 1. **Inline...
6,413
[ { "from": "human", "value": "You write a function and, looking at the resulting assembly, you see it can be improved.\nYou would like to keep the function you wrote, for readability, but you would like to substitute your own assembly for the compiler's. Is there any way to establish a relationship between y...
Using only ANSI C, what is the best way to, with fair certainty, determine if a C style string is either a integer or a real number (i.e float/double)?
To determine if a C-style string represents either an integer or a real number (float/double) using ANSI C, you can implement two functions: one for checking if a string is an integer and another for checking if it is a floating-point number. Here's a simple implementation that demonstrates this approach: ```c #incl...
4,408
[ { "from": "human", "value": "Using only ANSI C, what is the best way to, with fair certainty, determine if a C style string is either a integer or a real number (i.e float/double)?\n" }, { "from": "gpt", "value": "To determine if a C-style string represents either an integer or a real number (fl...
I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually when a user tries to access a resource without proper authorization I want them to be redirected to a login page. FormsAuth does this for me easy enough. Problem: Now I have an action being accessed by a console app. Whats t...
In your ASP.NET MVC application, if you want to return a `401 Unauthorized` status for certain requests (e.g., from a console app) while preserving the default behavior of redirecting to the login page for web requests, you can achieve this by creating a custom `AuthorizeAttribute`. This custom attribute can determine ...
4,073
[ { "from": "human", "value": "I'm writing an app using asp.net-mvc deploying to iis6. I'm using forms authentication. Usually when a user tries to access a resource without proper authorization I want them to be redirected to a login page. FormsAuth does this for me easy enough.\nProblem: Now I have an actio...
I heard about SDL_TFF which I read about here but I don't understand how am I supposed to connect the TrueType2 library. Maybe there is something better out there?
SDL_ttf is an extension library for SDL (Simple DirectMedia Layer) that provides support for rendering TrueType fonts. If you want to use SDL_ttf in your project, you'll need to ensure you have the library installed and properly linked with your application. Here are the steps to connect the SDL_ttf library and use it...
3,223
[ { "from": "human", "value": "I heard about SDL_TFF which I read about here but I don't understand how am I supposed to connect the TrueType2 library.\nMaybe there is something better out there?\n" }, { "from": "gpt", "value": "SDL_ttf is an extension library for SDL (Simple DirectMedia Layer) th...
Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box. What I'd like is for the error message to be dumped to STDOUT, and execution to return the calling process. Popping as a MSGBox just ha...
To handle script errors in a way that avoids the message box popping up, you can utilize the `On Error` statement in VBScript to manage errors programmatically. Instead of allowing the error to cause a pop-up, you can direct the error message to `STDOUT` (or any other logging mechanism you prefer). Here’s an example of...
5,576
[ { "from": "human", "value": "Currently, WScript pops up message box when there is a script error. These scripts are called by other processes, and are ran on a server, so there is nobody to dismiss the error box. \nWhat I'd like is for the error message to be dumped to STDOUT, and execution to return the ca...
Do you use Design by Contract professionally? Is it something you have to do from the beginning of a project, or can you change gears and start to incorporate it into your software development lifecycle? What have you found to be the pros/cons of the design approach? I came across the Design by Contract approach in a g...
Design by Contract (DbC) is a software development approach that emphasizes defining clear specifications for software components through contracts. These contracts consist of preconditions, postconditions, and invariants. While it may not be as widely adopted in the industry as other methodologies, it has its merits a...
5,120
[ { "from": "human", "value": "Do you use Design by Contract professionally? Is it something you have to do from the beginning of a project, or can you change gears and start to incorporate it into your software development lifecycle? What have you found to be the pros/cons of the design approach?\nI came acr...
Now that most of the major browsers support full page zoom (at present, the only notable exception being Google Chrome), are liquid or elastic layouts no longer needed? Is the relative pain of building liquid/elastic layouts worth the effort? Are there any situations where a liquid layout would still be of benefit? Is ...
The landscape of web design has evolved significantly with the introduction of full page zoom capabilities in most major browsers, making it an important consideration when discussing layout approaches such as liquid and elastic layouts. However, there are several factors to take into account when determining whether t...
3,487
[ { "from": "human", "value": "Now that most of the major browsers support full page zoom (at present, the only notable exception being Google Chrome), are liquid or elastic layouts no longer needed? Is the relative pain of building liquid/elastic layouts worth the effort? Are there any situations where a liq...
I was wondering if there is a better way to cope with MS-Access' inability to handle NULL for boolean-values other than change the column-data-type to integer.
Microsoft Access does have some limitations regarding how it handles NULL values in Boolean fields. In Access, Boolean fields can only hold three states: `True`, `False`, and `Null`. However, the default behavior of treating `NULL` as an unknown state can sometimes be problematic for applications expecting only `True` ...
6,114
[ { "from": "human", "value": "I was wondering if there is a better way to cope with MS-Access' inability to handle NULL for boolean-values other than change the column-data-type to integer.\n" }, { "from": "gpt", "value": "Microsoft Access does have some limitations regarding how it handles NULL ...
Let's say I have an aspx page with this calendar control: <asp:Calendar ID="Calendar1" runat="server" SelectedDate="" ></asp:Calendar> Is there anything I can put in for SelectedDate to make it use the current date by default, without having to use the code-behind?
Yes, you can set the `SelectedDate` property of the `asp:Calendar` control to the current date directly in the ASPX markup using an expression in the `SelectedDate` attribute. However, you cannot directly use an expression in the ASPX markup for the `SelectedDate` property to dynamically set it to the current date with...
4,200
[ { "from": "human", "value": "Let's say I have an aspx page with this calendar control:\n<asp:Calendar ID=\"Calendar1\" runat=\"server\" SelectedDate=\"\" ></asp:Calendar>\n\nIs there anything I can put in for SelectedDate to make it use the current date by default, without having to use the code-behind?\n"...
I have a script that renders graphs in gnuplot. The graphs all end up with an ugly white background. How do I change this? (Ideally, with a command that goes into a gnuplot script, as opposed to a command-line option or something in a settings file)
To change the background color of your graphs in Gnuplot from the default white to another color, you can use the `set object` command to add a colored rectangle that covers the entire plot area, effectively changing the background color. Here’s how you can do it within your Gnuplot script: 1. Set the background colo...
7,120
[ { "from": "human", "value": "I have a script that renders graphs in gnuplot. The graphs all end up with an ugly white background. How do I change this? (Ideally, with a command that goes into a gnuplot script, as opposed to a command-line option or something in a settings file)\n" }, { "from": "gpt"...
Is it possible to access the database backend of a sharepoint server? My company uses Sharepoint to store data and pictures of various assets. Ideally I would be able to access the data and display it in my application to allow users both methods of access. Before I go talk to the IT department I would like to find out...
Accessing the database backend of a SharePoint server directly is generally not supported and is discouraged by Microsoft. SharePoint databases are typically managed by SQL Server, and direct access to these databases can lead to data corruption and other issues. Instead, Microsoft provides various APIs and services fo...
6,601
[ { "from": "human", "value": "Is it possible to access the database backend of a sharepoint server? My company uses Sharepoint to store data and pictures of various assets. Ideally I would be able to access the data and display it in my application to allow users both methods of access.\nBefore I go talk to ...
I've developed my own delivery extension for Reporting Services 2005, to integrate this with our SaaS marketing solution. It takes the subscription, and takes a snapshot of the report with a custom set of parameters. It then renders the report, sends an e-mail with a link and the report attached as XLS. Everything work...
There are several potential issues that could be causing the failure to send email using your custom delivery extension in SQL Server Reporting Services (SSRS). Here are some things to consider: ### 1. **Check SMTP Settings**: - Ensure that the SMTP server is correctly configured to accept connections from the SSRS...
972
[ { "from": "human", "value": "I've developed my own delivery extension for Reporting Services 2005, to integrate this with our SaaS marketing solution.\nIt takes the subscription, and takes a snapshot of the report with a custom set of parameters. It then renders the report, sends an e-mail with a link and t...
I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this: using System; using System.Runtime.InteropServices; using BrowseUI; using mshtml; using SHDocVw; using Microsoft.Win32; namespace CTI { public interface CTIActiveXInterfa...
In your ActiveX control, obtaining a reference to the hosting browser is indeed different from how you would do it in a Browser Helper Object (BHO). In an ActiveX control, you can obtain the reference to the hosting environment (in this case, the Internet Explorer instance) using the `IConnectionPoint` interface to acc...
5,939
[ { "from": "human", "value": "I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this:\nusing System;\nusing System.Runtime.InteropServices;\nusing BrowseUI;\nusing mshtml;\nusing SHDocVw;\nusing Microsoft.Win32;\n\n namespace CTI...
The second question is: When do I use what of these two?
It seems like you might be referring to two options or concepts, but I need more context to provide a specific answer. Could you clarify what the two things are that you're asking about? This way, I can help explain when to use each one.
9,848
[ { "from": "human", "value": "The second question is: When do I use what of these two?\n" }, { "from": "gpt", "value": "It seems like you might be referring to two options or concepts, but I need more context to provide a specific answer. Could you clarify what the two things are that you're aski...
Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.) Antiword seems like it might be a reasonable option, but it seems like it might be abandoned. A Python sol...
Yes, there are several ways to extract plain text from a Word file (.doc or .docx) without using COM automation, which works across different platforms, including non-Windows systems. Here are some options, including Python solutions: ### 1. **Python Libraries** #### a. `python-docx` For `.docx` files, you can use the...
3,834
[ { "from": "human", "value": "Is there a reasonable way to extract plain text from a Word file that doesn't depend on COM automation? (This is a a feature for a web app deployed on a non-Windows platform - that's non-negotiable in this case.)\nAntiword seems like it might be a reasonable option, but it seem...
I've seen these words a lot around Subversion (and I guess general repository) discussions. I have been using SVN for my projects for the last few years, but I've never grasped the complete concept of these directories. What do they mean?
In Subversion (SVN) and other version control systems, there are several important directories and concepts that are commonly referred to, especially when talking about the structure of a repository. Here's a breakdown of the key directories you might encounter: ### 1. **`trunk`** - **Description**: The `trunk` direct...
6,656
[ { "from": "human", "value": "I've seen these words a lot around Subversion (and I guess general repository) discussions.\nI have been using SVN for my projects for the last few years, but I've never grasped the complete concept of these directories.\nWhat do they mean?\n" }, { "from": "gpt", "va...
I need to validate an XML string (and not a file) against a DTD description file. How can that be done in python?
To validate an XML string against a DTD in Python, you can use the `xml.dom.minidom` module in combination with the `xml.etree.ElementTree` module for parsing and validation. However, `xml.dom.minidom` does not directly support DTD validation. For more robust validation, you can use the `lxml` library, which supports b...
4,985
[ { "from": "human", "value": "I need to validate an XML string (and not a file)\nagainst a DTD description file. \nHow can that be done in python?\n" }, { "from": "gpt", "value": "To validate an XML string against a DTD in Python, you can use the `xml.dom.minidom` module in combination with the `...
Does ELMAH logged exceptions even when they do not bubble up to the application? I'd like to pop up a message when an exception occurs and still log the exception. Currently I've been putting everything in try catch blocks and spitting out messages, but this gets tedious.
ELMAH (Error Logging Modules and Handlers) is designed to log unhandled exceptions in ASP.NET applications. However, it will only log exceptions that are unhandled and bubble up to the application level. Exceptions that are caught in your `try-catch` blocks will not be logged by ELMAH unless you explicitly log them. I...
7,228
[ { "from": "human", "value": "Does ELMAH logged exceptions even when they do not bubble up to the application? I'd like to pop up a message when an exception occurs and still log the exception. Currently I've been putting everything in try catch blocks and spitting out messages, but this gets tedious.\n" ...
I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++. Here's an example of the equations: -44.3940 = a * 50.0 + b * 37.0 + tx -45.3049 = a * 43.0 + b * 39.0 + tx -44.9594 = a * 52.0 + b * 41.0 + tx From this, I'd like to get the best approximation for a, b, and tx.
To solve a system of linear equations programmatically, you can use the method of least squares to minimize the difference between the observed values and the calculated values. In your case, you have three equations with three unknowns: \( a \), \( b \), and \( tx \). You can rearrange the equations into a standard ...
3,061
[ { "from": "human", "value": "I need to programmatically solve a system of linear equations in C, Objective C, or (if needed) C++.\nHere's an example of the equations:\n-44.3940 = a * 50.0 + b * 37.0 + tx\n-45.3049 = a * 43.0 + b * 39.0 + tx\n-44.9594 = a * 52.0 + b * 41.0 + tx\n\nFrom this, I'd like to get ...
I'm doing some web scraping and sites frequently use HTML entities to represent non ascii characters. Does Python have a utility that takes a string with HTML entities and returns a unicode type? For example: I get back: &#x01ce; which represents an "ǎ" with a tone mark. In binary, this is represented as the 16 bit 0...
Yes, Python provides utilities for converting HTML entities to Unicode characters. You can use the `html` module, specifically the `html.unescape` function, to handle this. Here's an example of how to convert an HTML entity string like `&#x01ce;` to its corresponding Unicode character: ```python import html # Examp...
8,437
[ { "from": "human", "value": "I'm doing some web scraping and sites frequently use HTML entities to represent non ascii characters. Does Python have a utility that takes a string with HTML entities and returns a unicode type?\nFor example:\nI get back:\n&#x01ce;\n\nwhich represents an \"ǎ\" with a tone mark....
In SQL Server, how do I "floor" a DATETIME to the second/minute/hour/day/year? Let's say that I have a date of 2008-09-17 12:56:53.430, then the output of flooring should be: Year: 2008-01-01 00:00:00.000 Month: 2008-09-01 00:00:00.000 Day: 2008-09-17 00:00:00.000 Hour: 2008-09-17 12:00:00.000 Minute: 2008-09-17 12:5...
To "floor" a `DATETIME` value in SQL Server to the different time units (year, month, day, hour, minute, and second), you can use various SQL Server date and time functions. Here’s how to do this for the example date `2008-09-17 12:56:53.430`. ### SQL Queries for Flooring a DATETIME 1. **Floor to Year**: ```sql ...
4,816
[ { "from": "human", "value": "In SQL Server, how do I \"floor\" a DATETIME to the second/minute/hour/day/year?\nLet's say that I have a date of 2008-09-17 12:56:53.430, then the output of flooring should be:\n\nYear: 2008-01-01 00:00:00.000\nMonth: 2008-09-01 00:00:00.000\nDay: 2008-09-17 00:00:00.000\nHour...
I have two elements: <input a> <input b onclick="..."> When b is clicked, I want to access a and manipulate some of its data. A does not have a globally unique name, so document.getElementsByName is out. Looking into the event object, I thought event.target.parentNode would have some function like getElementsByName, b...
To access the `<input>` element `a` from the click event of the `<input>` element `b`, you can traverse the DOM. Since you mentioned that `a` does not have a globally unique name and that both elements are likely within the same parent container, you can use the `closest()` method or other DOM traversal methods. Here'...
6,440
[ { "from": "human", "value": "I have two elements:\n<input a>\n<input b onclick=\"...\">\n\nWhen b is clicked, I want to access a and manipulate some of its data. A does not have a globally unique name, so document.getElementsByName is out. Looking into the event object, I thought event.target.parentNode wou...
I have a list of ranked users, and would like to select the top 50. I also want to make sure one particular user is in this result set, even if they aren't in the top 50. Is there a sensible way to do this in a single mysql query? Or should I just check the results for the particular user and fetch him separately, if n...
You can accomplish this in a single MySQL query using a combination of `UNION` and a `LIMIT` clause. The idea is to select the top 50 users and ensure that the particular user is included in the results if they are not in the top 50. Here’s how you can structure your query: Assuming you have a table named `users` with...
6,690
[ { "from": "human", "value": "I have a list of ranked users, and would like to select the top 50. I also want to make sure one particular user is in this result set, even if they aren't in the top 50. Is there a sensible way to do this in a single mysql query? Or should I just check the results for the parti...
I'm trying to find a way to validate a large XML file against an XSD. I saw the question ...best way to validate an XML... but the answers all pointed to using the Xerces library for validation. The only problem is, when I use that library to validate a 180 MB file then I get an OutOfMemoryException. Are there any othe...
When dealing with large XML files and the need for validation against an XSD, it's important to choose the right strategy to avoid memory issues like `OutOfMemoryException`. Here are a few alternatives and strategies you can consider for validating large XML files: ### 1. **Using SAX Parser in Java** As you mentioned...
3,918
[ { "from": "human", "value": "I'm trying to find a way to validate a large XML file against an XSD. I saw the question ...best way to validate an XML... but the answers all pointed to using the Xerces library for validation. The only problem is, when I use that library to validate a 180 MB file then I get an...
So I'm using an IDataReader to hydrate some business objects, but I don't know at runtime exactly what fields will be in the reader. Any fields that aren't in the reader would be left null on the resulting object. How do you test if a reader contains a specific field without just wrapping it in a try/catch?
To check if a specific field exists in an `IDataReader` without using a try/catch block, you can use the `IDataReader.GetOrdinal` method, which retrieves the column ordinal (index) of a specified field. If the field does not exist, it will throw an `IndexOutOfRangeException`. To avoid this exception, you can create a h...
5,268
[ { "from": "human", "value": "So I'm using an IDataReader to hydrate some business objects, but I don't know at runtime exactly what fields will be in the reader. Any fields that aren't in the reader would be left null on the resulting object. How do you test if a reader contains a specific field without j...
How can I get hierarchy recordset in ms access through select statement?
In Microsoft Access, hierarchical data structures can often be represented using self-joins, where a table relates to itself. If you want to retrieve a hierarchy from a table, you typically have a parent-child relationship. For instance, a common scenario is an organizational structure where each employee has a supervi...
5,793
[ { "from": "human", "value": "How can I get hierarchy recordset in ms access through select statement?\n" }, { "from": "gpt", "value": "In Microsoft Access, hierarchical data structures can often be represented using self-joins, where a table relates to itself. If you want to retrieve a hierarchy...
I've been trying to understand Process.MainWindowHandle. According to MSDN; "The main window is the window that is created when the process is started. After initialization, other windows may be opened, including the Modal and TopLevel windows, but the first window associated with the process remains the main window." ...
The behavior you're observing with `Process.MainWindowHandle` is indeed interesting and can be a bit confusing, especially given the documentation. ### Explanation of MainWindowHandle The `MainWindowHandle` property is supposed to return the handle of the main window of the process. The main window is defined as the ...
5,625
[ { "from": "human", "value": "I've been trying to understand Process.MainWindowHandle.\nAccording to MSDN; \"The main window is the window that is created when the process is started. After initialization, other windows may be opened, including the Modal and TopLevel windows, but the first window associated ...
I've been asked to screen some candidates for a MySQL DBA / Developer position for a role that requires an enterprise level skill set. I myself am a SQL Server person so I know what I would be looking for from that point of view with regards to scalability / design etc but is there anything specific I should be asking ...
When screening candidates for a MySQL DBA/Developer position at an enterprise level, it's essential to focus on both their technical skills and their experience with features that are specific to large-scale, high-performance environments. Here are some topics and specific questions you can consider during the intervie...
3,411
[ { "from": "human", "value": "I've been asked to screen some candidates for a MySQL DBA / Developer position for a role that requires an enterprise level skill set.\nI myself am a SQL Server person so I know what I would be looking for from that point of view with regards to scalability / design etc but is t...
Several times now I've been faced with plans from a team that wants to build their own bug tracking system - Not as a product, but as an internal tool. The arguments I've heard in favous are usually along the lines of : Wanting to 'eat our own dog food' in terms of some internally built web framework Needing some high...
When considering whether to build an internal bug tracking system or buy an existing one, there are several compelling arguments you can present in favor of purchasing a commercial solution. Here are some key points and considerations: ### 1. **Cost of Development and Maintenance** - **Hidden Costs:** While the upf...
3,443
[ { "from": "human", "value": "Several times now I've been faced with plans from a team that wants to build their own bug tracking system - Not as a product, but as an internal tool.\nThe arguments I've heard in favous are usually along the lines of :\n\nWanting to 'eat our own dog food' in terms of some inte...
I am trying to code a flowchart generator for a language using Ruby. I wanted to know if there were any libraries that I could use to draw various shapes for the various flowchart elements and write out text to those shapes. I would really prefer not having to write code for drawing basic shapes, if I can help it. C...
If you're looking to create a flowchart generator in Ruby and want to leverage libraries to draw shapes and handle text without needing to code those from scratch, there are a couple of options you might find helpful. ### 1. **Ruby2D** Ruby2D is a simple and easy-to-use library for creating 2D graphics in Ruby. It pro...
1,208
[ { "from": "human", "value": "I am trying to code a flowchart generator for a language using Ruby. \nI wanted to know if there were any libraries that I could use to draw various shapes for the various flowchart elements and write out text to those shapes. \nI would really prefer not having to write code for...
What are the different ways (programmatically and otherwise) to determine what versions of .NET are running on a system?
Determining what versions of .NET are installed on a system can be achieved through various methods, both programmatically and manually. Here's an overview of these methods: ### Programmatically 1. **Using the Registry (C# Code)**: You can check the Windows Registry to find out the versions of .NET Framework insta...
2,905
[ { "from": "human", "value": "What are the different ways (programmatically and otherwise) to determine what versions of .NET are running on a system?\n" }, { "from": "gpt", "value": "Determining what versions of .NET are installed on a system can be achieved through various methods, both program...
Using WPF, I have a TreeView control that I want to set its ItemTemplate dynamically through procedural code. How do I do this? I assume I need to find the resource somewhere. myTreeViewControl.ItemTemplate = ??
To set the `ItemTemplate` of a `TreeView` control dynamically in WPF through procedural code, you typically need to create a `DataTemplate` and then assign it to the `ItemTemplate` property of the `TreeView`. You can create the `DataTemplate` programmatically or retrieve it from the application resources. Here's a way ...
4,018
[ { "from": "human", "value": "Using WPF, I have a TreeView control that I want to set its ItemTemplate dynamically through procedural code. How do I do this? I assume I need to find the resource somewhere.\nmyTreeViewControl.ItemTemplate = ??\n\n" }, { "from": "gpt", "value": "To set the `Ite...
Now that I know C++ I want to get into desktop application that have a UI instead of Command Prompt stuff, where should I start?, and what are some good online resources?
Great to hear that you want to explore desktop application development with a UI using C++! Here are some popular frameworks and libraries you can consider, along with resources to help you get started: ### Frameworks and Libraries 1. **Qt**: - **Description**: Qt is one of the most popular frameworks for C++ GUI ...
5,633
[ { "from": "human", "value": "Now that I know C++ I want to get into desktop application that have a UI instead of Command Prompt stuff, where should I start?, and what are some good online resources?\n" }, { "from": "gpt", "value": "Great to hear that you want to explore desktop application deve...
I'm currently trying to build a personal website to create a presence on the web for myself. My plan is to include content such as my resume, any projects that I have done on my own and links to open source projects that I have contributed to, and so on. However, I'm not sure which approach would be better from a persp...
Creating a personal website to showcase your skills and projects is an excellent way to establish your online presence as a software developer. When deciding between using an out-of-the-box system (like WordPress, Joomla, or similar platforms) and building a custom website from scratch, consider the following factors: ...
4,084
[ { "from": "human", "value": "I'm currently trying to build a personal website to create a presence on the web for myself. My plan is to include content such as my resume, any projects that I have done on my own and links to open source projects that I have contributed to, and so on. However, I'm not sure wh...
I am trying to get a DataGrid under CE 5.0 / .NET CF 2.0 that a user can edit. The document at http://msdn.microsoft.com/en-us/library/ms838165.aspx indicates that some environments do not support editing - As there is no native support for editing in the DataGrid control, this needs to be implemented manually ...
When working with the DataGrid control in the .NET Compact Framework (CF) 2.0 on Windows CE 5.0, you are indeed correct that there is no built-in support for editing directly within the DataGrid. You'll need to implement editing functionality manually. Here are a few options and tips to implement a more user-friendly ...
4,761
[ { "from": "human", "value": "I am trying to get a DataGrid under CE 5.0 / .NET CF 2.0 that a user can edit. The document at http://msdn.microsoft.com/en-us/library/ms838165.aspx indicates that some environments do not support editing - \n\nAs there is no native support for\n editing in the DataGrid contro...
I'm developing a graphical application to present data (not a game but a real workhorse app). It needs to be cross platform, so I have chosen: python openGL (I need 3D, blending, textures etc) pyopengl wx/pywx - windowing, dialogs etc. The last component - WX - raises the question. I can put together a very nice look...
Developing a cross-platform graphical application using Python and OpenGL is an interesting challenge, especially when it comes to integrating a consistent UI for user interaction. Since you've already chosen Python, OpenGL, and wxPython, here are some suggestions and considerations to help you create a more cohesive u...
3,997
[ { "from": "human", "value": "I'm developing a graphical application to present data (not a game but a real workhorse app). It needs to be cross platform, so I have chosen:\n\npython\nopenGL (I need 3D, blending, textures etc)\npyopengl\nwx/pywx - windowing, dialogs etc.\n\nThe last component - WX - raises t...
I have been asked to lend a hand on a hobby project that a couple friends are working on, they are using SharpDevelop 3.0 (Beta 2 I think, but it might be Beta 1) is there any hassle for me to install and use this IDE given that I have Visual Studio 2008 installed?
SharpDevelop 3.0 is a lightweight IDE for .NET development and can be used alongside Visual Studio 2008 without any significant issues. Here are a few points to consider: 1. **Installation**: SharpDevelop can be installed alongside Visual Studio. They will not interfere with each other, as they are separate applicatio...
7,564
[ { "from": "human", "value": "I have been asked to lend a hand on a hobby project that a couple friends are working on, they are using SharpDevelop 3.0 (Beta 2 I think, but it might be Beta 1) is there any hassle for me to install and use this IDE given that I have Visual Studio 2008 installed?\n" }, { ...
The code private SomeClass<Integer> someClass; someClass = EasyMock.createMock(SomeClass.class); gives me a warning "Type safety: The expression of type SomeClass needs unchecked conversion to conform to SomeClass<Integer>".
The warning you're seeing is due to Java's type erasure and the fact that you're using generics with a mock object created by EasyMock. When you call `EasyMock.createMock(SomeClass.class)`, you're creating a mock object for `SomeClass` without providing the generic type information. As a result, Java sees it as a raw ...
5,839
[ { "from": "human", "value": "The code\nprivate SomeClass<Integer> someClass;\nsomeClass = EasyMock.createMock(SomeClass.class);\n\ngives me a warning \"Type safety: The expression of type SomeClass needs unchecked conversion to conform to SomeClass<Integer>\".\n" }, { "from": "gpt", "value": "Th...
What code do you need to add in PHP to automatically have the browser download a file to the local machine when a link is visited? I am specifically thinking of functionality similar to that of download sites that prompt the user to save a file to disk once you click on the name of the software?
To allow a user to download a file directly through a link in PHP, you can set the appropriate headers to prompt the browser to download the file instead of displaying it. Here's a simple example: ```php <?php // Path to the file you want to download $file = 'path/to/your/file.zip'; // Check if the file exists if (fi...
5,082
[ { "from": "human", "value": "What code do you need to add in PHP to automatically have the browser download a file to the local machine when a link is visited?\nI am specifically thinking of functionality similar to that of download sites that prompt the user to save a file to disk once you click on the nam...
Imagine the scene, you're updating some legacy Sybase code and come across a cursor. The stored procedure builds up a result set in a #temporary table which is all ready to be returned except that one of columns isn't terribly human readable, it's an alphanumeric code. What we need to do, is figure out the possible dis...
To avoid the use of a cursor for processing a large result set and to improve the efficiency of your code, you can use a set-based approach instead of the row-by-row processing that a cursor entails. In Sybase (or any SQL-based database), set-based operations are generally more performant, particularly when dealing wit...
4,496
[ { "from": "human", "value": "Imagine the scene, you're updating some legacy Sybase code and come across a cursor. The stored procedure builds up a result set in a #temporary table which is all ready to be returned except that one of columns isn't terribly human readable, it's an alphanumeric code.\nWhat we ...
I have wondered about the appropriateness of reflection in C# code. For example I have written a function which iterates through the properties of a given source object and creates a new instance of a specified type, then copies the values of properties with the same name from one to the other. I created this to copy d...
Using reflection in C# to dynamically inspect and manipulate types can be a powerful tool, but it comes with its own set of trade-offs and considerations. Let’s explore the appropriateness, risks, and legitimate uses of reflection in your context. ### Appropriateness of Reflection 1. **Performance**: Reflection can b...
3,714
[ { "from": "human", "value": "I have wondered about the appropriateness of reflection in C# code. For example I have written a function which iterates through the properties of a given source object and creates a new instance of a specified type, then copies the values of properties with the same name from o...
I have a build script and as part of that script it copies a jar file to a directory, for ease lets call it the utils jar. the utils jar is built by another build script sitting in another directory. What im trying to do have my build script run the utils build script so that I can ensure the utils jar is up to date....
In Apache Ant, when you use `<antcall>`, it executes the target in the context of the current project, meaning the current `basedir` where your Ant script is running. As you've observed, this can lead to problems when your imported build file (e.g., `utils/build/build.xml`) relies on relative paths. Unfortunately, Ant...
4,716
[ { "from": "human", "value": "I have a build script and as part of that script it copies a jar file to a directory, for ease lets call it the utils jar. the utils jar is built by another build script sitting in another directory. What im trying to do have my build script run the utils build script so that ...
I'm querying a bunch of information from cisco switches using SNMP. For instance, I'm pulling information on neighbors detected using CDP by doing an snmpwalk on .1.3.6.1.4.1.9.9.23 Can I use this OID across different cisco models? What pitfalls should I be aware of? To me, I'm a little uneasy about using numeric OI...
Using SNMP (Simple Network Management Protocol) to query devices like Cisco switches is a common practice, and while you're correct that numeric OIDs (Object Identifiers) can work, there are indeed some considerations to keep in mind regarding their usage across different Cisco models and environments. ### Compatibili...
5,064
[ { "from": "human", "value": "I'm querying a bunch of information from cisco switches using SNMP. For instance, I'm pulling information on neighbors detected using CDP by doing an snmpwalk on .1.3.6.1.4.1.9.9.23\nCan I use this OID across different cisco models? What pitfalls should I be aware of? To me, ...
I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms. Does anybody here know of a 'best' algorithm that I could implement?
When implementing a diff algorithm in VB.NET, the "Longest Common Subsequence" (LCS) algorithm is commonly used for this purpose. This algorithm efficiently identifies changes between two text versions by determining the longest sequence of characters that appears in both versions. The differences can then be derived f...
512
[ { "from": "human", "value": "I need to implement a Diff algorithm in VB.NET to find the changes between two different versions of a piece of text. I've had a scout around the web and have found a couple of different algorithms.\nDoes anybody here know of a 'best' algorithm that I could implement?\n" }, ...
There is previous little on the google on this subject other than people asking this very same question. How would I get started writing my own firewall? I'm looking to write one for the windows platform but I would also be interested in this information for other operating systems too. ­­­­­­­­­­­­­­­­­­
Writing your own firewall can be a complex but rewarding project. Firewalls serve the essential function of monitoring and controlling incoming and outgoing network traffic based on predetermined security rules. Here’s a general approach to getting started on writing a firewall for Windows and other operating systems: ...
504
[ { "from": "human", "value": "There is previous little on the google on this subject other than people asking this very same question.\nHow would I get started writing my own firewall?\nI'm looking to write one for the windows platform but I would also be interested in this information for other operating sy...
I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many characters will fit?
Yes, there is an efficient way to determine how many characters from a string can fit into a byte array, considering that strings may contain multi-byte characters (especially in encodings like UTF-8). Here's how you can do this in a general programming context: 1. **Choose an Encoding**: First, determine the encodin...
4,558
[ { "from": "human", "value": "I would like to put a string into a byte array, but the string may be too big to fit. In the case where it's too large, I would like to put as much of the string as possible into the array. Is there an efficient way to find out how many characters will fit?\n" }, { "fr...
On linux, it's possible to create a tun interface using a tun driver which provides a "network interface psuedo-device" that can be treated as a regular network interface. Is there a way to do this programmatically on windows? Is there a way to do this without writing my own driver?
Yes, on Windows, you can create virtual network interfaces programmatically without writing your own driver by using some existing software frameworks and tools. One of the popular options is to use the **Windows Filtering Platform (WFP)**, which allows for the creation of virtual network interfaces. However, this gene...
3,729
[ { "from": "human", "value": "On linux, it's possible to create a tun interface using a tun driver which provides a \"network interface psuedo-device\" that can be treated as a regular network interface. Is there a way to do this programmatically on windows? Is there a way to do this without writing my own...
I've been looking for this information for my commercial desktop product, with no avail. Specifically, what I'm look for, is deployment statistics of the .NET framework for end-users (both granny "I'm just browsing the internet" XP, and high-end users, if possible), and in the commercial/business sector. Edit: Other th...
Finding specific deployment statistics for the .NET Framework can be challenging, especially as it varies based on region, industry, and the types of applications being developed and used. However, I can provide some general insights and suggest sources that might help you gather more detailed information. ### General...
4,899
[ { "from": "human", "value": "I've been looking for this information for my commercial desktop product, with no avail.\nSpecifically, what I'm look for, is deployment statistics of the .NET framework for end-users (both granny \"I'm just browsing the internet\" XP, and high-end users, if possible), and in th...
Many people use Mock Objects when they are writing unit tests. What is a Mock Object? Why would I ever need one? Do I need a Mock Object Framework?
### What is a Mock Object? A **Mock Object** is a simulated object that mimics the behavior of real objects in controlled ways. It is commonly used in unit testing to isolate the unit being tested and to control the environment in which the test runs. Mock objects can: 1. **Verify Interactions**: You can check that c...
5,522
[ { "from": "human", "value": "Many people use Mock Objects when they are writing unit tests. What is a Mock Object? Why would I ever need one? Do I need a Mock Object Framework?\n" }, { "from": "gpt", "value": "### What is a Mock Object?\n\nA **Mock Object** is a simulated object that mimics the ...
In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class? So I would make a class with the numbers 1 to 5 as the data in it, then make a second class with the same names for section...
You can achieve this in Python by creating a class that holds your data and then using a second class (or even a function) that can modify this data. You can also implement a method to revert the modified data back to the original state. Here's a simple way to do it using the concept of snapshots: ```python class Data...
6,263
[ { "from": "human", "value": "In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class? \nSo I would make a class with the numbers 1 to 5 as the data in it, then make a se...
I'm working on a small templating engine, and I'm using DOMDocument to parse the pages. My test page so far looks like this: <block name="content"> <?php echo 'this is some rendered PHP! <br />' ?> <p>Main column of <span>content</span></p> </block> And part of my class looks like this: private function parse...
The issue you're encountering stems from how you are using `nodeValue` to extract the content of your `<block>` elements. When you use `nodeValue`, it retrieves only the text content of the node, excluding any HTML tags, which is why your output is stripping the HTML elements like `<p>` and `<span>`. To get the inner ...
4,922
[ { "from": "human", "value": "I'm working on a small templating engine, and I'm using DOMDocument to parse the pages. My test page so far looks like this:\n<block name=\"content\">\n\n <?php echo 'this is some rendered PHP! <br />' ?>\n\n <p>Main column of <span>content</span></p>\n\n</block>\n\nAnd part...
What's the best way to clone a control in Silverlight (including it's children)? UPDATE Is there a better way in Silverlight 2?
In Silverlight, cloning a control (including its children) can be a bit tricky since Silverlight does not provide a built-in method for deep copying objects. However, you can achieve this by creating a method that recursively creates a new instance of the control and copies the relevant properties and children. Here’s...
5,956
[ { "from": "human", "value": "What's the best way to clone a control in Silverlight (including it's children)?\nUPDATE\nIs there a better way in Silverlight 2?\n" }, { "from": "gpt", "value": "In Silverlight, cloning a control (including its children) can be a bit tricky since Silverlight does no...
I'm curious about everyones practices when it comes to using or distributing libraries for an application that you write. First of all, when developing your application do you link the debug or release version of the libraries? (For when you run your application in debug mode) Then when you run your app in release mode...
Using and distributing libraries in application development is an essential topic, as it directly affects performance, debugging, and maintenance. Here are some common practices that developers often follow when it comes to linking libraries in both debug and release modes: ### Linking Libraries 1. **Debug vs. Releas...
3,708
[ { "from": "human", "value": "I'm curious about everyones practices when it comes to using or distributing libraries for an application that you write.\nFirst of all, when developing your application do you link the debug or release version of the libraries? (For when you run your application in debug mode)\...
I need to create a 2D int array of size 800x800. But doing so creates a stack overflow (ha ha). I'm new to C++, so should I do something like a vector of vectors? And just encapsulate the 2d array into a class? Specifically, this array is my zbuffer in a graphics program. I need to store a z value for every pixel on...
In C++, creating a large array on the stack can lead to stack overflow errors, especially with large sizes like 800x800. Instead, you can allocate your array on the heap using `std::vector`, which is a safer and more flexible way to handle large data structures. Using `std::vector` also simplifies memory management, as...
3,191
[ { "from": "human", "value": "I need to create a 2D int array of size 800x800. But doing so creates a stack overflow (ha ha).\nI'm new to C++, so should I do something like a vector of vectors? And just encapsulate the 2d array into a class?\nSpecifically, this array is my zbuffer in a graphics program. I...
Alright. So I figure it's about time I get into unit testing, since everyone's been banging on about it for long enough. I've installed NUnit and gone through a few "intro to unit testing" type tutorials. I'm currently putting together a small framework to help with the rebuild of one of our web apps, so I've created ...
Unit testing WebControls can be a bit tricky, especially when dealing with protected and private methods. Here are several strategies you can use to effectively unit test your WebControls in your framework: ### 1. **Use `InternalsVisibleTo` Attribute** If you want to test protected or internal members, you can expose ...
3,450
[ { "from": "human", "value": "Alright.\nSo I figure it's about time I get into unit testing, since everyone's been banging on about it for long enough. I've installed NUnit and gone through a few \"intro to unit testing\" type tutorials.\nI'm currently putting together a small framework to help with the reb...
How have you implemented Internationalization (i18n) in actual projects you've worked on? I took an interest in making software cross-cultural after I read the famous post by Joel, The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!). However, I h...
Internationalization (i18n) can indeed be a complex undertaking, but it’s essential for software that intends to reach a global audience. Here are some tips, best practices, and insights from real-world experiences that might help you in implementing i18n effectively: ### 1. **Plan for i18n from the Start** - **Arc...
3,124
[ { "from": "human", "value": "How have you implemented Internationalization (i18n) in actual projects you've worked on?\nI took an interest in making software cross-cultural after I read the famous post by Joel, The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and ...
What web site structure(s)/architecture(s) would the community swear by, with a narrowing down in the direction towards more of a small facebook style project? I understand the question to be rather broad/subjective; but being relatively new to the area of web development, I find just looking at and learning from examp...
Creating a small social networking site similar to Facebook involves careful consideration of web architecture and structure. While there is a myriad of ways to build such a platform, I'll outline some popular architectures, technologies, and resources that can guide you as you embark on your project. ### Recommended ...
1,274
[ { "from": "human", "value": "What web site structure(s)/architecture(s) would the community swear by, with a narrowing down in the direction towards more of a small facebook style project?\nI understand the question to be rather broad/subjective; but being relatively new to the area of web development, I fi...
I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client "manually".I would like to find a better solution for the browser,so : What is a good browser that I can use as a client to a web application? General functionalities I would like...
Based on your requirements for an internal web application client, here are a few browsers that could suit your needs well: ### 1. **Google Chrome** - **Shortcut to URL**: You can create a shortcut that opens Chrome directly to a specific URL. - **Restrict Navigation**: You can use Chrome Kiosk mode to restrict naviga...
5,686
[ { "from": "human", "value": "I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client \"manually\".I would like to find a better solution for the browser,so :\nWhat is a good browser that I can use as a client to a web appli...
Is there a macro or a way to conditionally copy rows from one worksheet to another in Excel 2003? I'm pulling a list of data from SharePoint via a web query into a blank worksheet in Excel, and then I want to copy the rows for a particular month to a particular worksheet (for example, all July data from a SharePoint wo...
You can achieve the desired functionality in Excel 2003 using a simple VBA macro. The macro will loop through the rows of the worksheet where you pull the SharePoint data, check if the date falls within a specific month, and then copy the relevant rows to their respective monthly worksheets. Here's a sample VBA macro...
4,054
[ { "from": "human", "value": "Is there a macro or a way to conditionally copy rows from one worksheet to another in Excel 2003?\nI'm pulling a list of data from SharePoint via a web query into a blank worksheet in Excel, and then I want to copy the rows for a particular month to a particular worksheet (for e...
I have searched around, and it seems that this is a limitation in MS Access, so I'm wondering what creative solutions other have found to this puzzle. If you have a continuous form and you want a field to be a combo box of options that are specific to that row, Access fails to deliver; the combo box row source is only ...
This is a well-known limitation of MS Access, particularly with continuous forms. While it is true that you can face challenges when trying to use combo boxes that need to dynamically filter based on the current record, there are a few creative workarounds you can consider to address this situation. ### Solution Ideas...
4,056
[ { "from": "human", "value": "I have searched around, and it seems that this is a limitation in MS Access, so I'm wondering what creative solutions other have found to this puzzle.\nIf you have a continuous form and you want a field to be a combo box of options that are specific to that row, Access fails to ...
I'd like to add a method AddDefaultNamespace() to the String class in Java so that I can type "myString".AddDefaultNamespace() instead of DEFAULTNAMESPACE + "myString", to obtain something like "MyDefaultNameSpace.myString". I don't want to add another derived class either (PrefixedString for example). Maybe the approa...
In Java, you cannot add new methods to an existing class like `String` because it is a final class. This means you cannot subclass it or modify it in any way. However, you can achieve similar functionality by using a utility method or by creating an extension method using static methods in a utility class. ### Using a...
7,682
[ { "from": "human", "value": "I'd like to add a method AddDefaultNamespace() to the String class in Java so that I can type \"myString\".AddDefaultNamespace() instead of DEFAULTNAMESPACE + \"myString\", to obtain something like \"MyDefaultNameSpace.myString\". I don't want to add another derived class either...
I'm wondering if there's any way to write CSS specifically for Safari using only CSS. I know there has to be something out there, but I haven't found it yet.
Yes, you can target Safari specifically using CSS, but there are some limitations since CSS does not have a built-in way to detect the browser. However, you can use certain CSS hacks or media queries that exploit WebKit-specific features to apply styles only in Safari. ### Method 1: WebKit-specific CSS You can use th...
6,958
[ { "from": "human", "value": "I'm wondering if there's any way to write CSS specifically for Safari using only CSS. I know there has to be something out there, but I haven't found it yet.\n" }, { "from": "gpt", "value": "Yes, you can target Safari specifically using CSS, but there are some limita...
Specifically, what commands do I run from the terminal?
To provide you with specific terminal commands, I need to know the context or task you are trying to accomplish. Terminal commands can vary widely based on the operating system (Linux, macOS, Windows), the programming environment, or the application you are using. Here are some common examples of terminal commands for...
5,726
[ { "from": "human", "value": "Specifically, what commands do I run from the terminal?\n" }, { "from": "gpt", "value": "To provide you with specific terminal commands, I need to know the context or task you are trying to accomplish. Terminal commands can vary widely based on the operating system (...
Can a Linq query retrieve BLOBs from a Sql Database? And how do they come out?
Yes, a LINQ query can retrieve Binary Large Objects (BLOBs) from a SQL database, provided that you have a suitable Entity Framework (EF) model or LINQ-to-SQL setup that maps to the database structure. BLOBs are typically stored in SQL Server in columns of type `VARBINARY`, `IMAGE`, or similar types. Here's how it work...
5,864
[ { "from": "human", "value": "Can a Linq query retrieve BLOBs from a Sql Database?\nAnd how do they come out?\n" }, { "from": "gpt", "value": "Yes, a LINQ query can retrieve Binary Large Objects (BLOBs) from a SQL database, provided that you have a suitable Entity Framework (EF) model or LINQ-to-...
I would like to compile a DLL under Visual Studio 2008 that depends on msvcr90.dll as a private assembly (basically I'll dump this DLL into the same directory as my application) without needing an external manifest file. I followed the steps outlined in http://msdn.microsoft.com/en-us/library/ms235291.aspx section "Dep...
To create a DLL in Visual Studio 2008 that depends on `msvcr90.dll` without using an external manifest file, you can embed the correct manifest directly into your DLL. However, you need to ensure that the embedded manifest contains the correct dependencies, and it must reference the release version of the C runtime lib...
5,974
[ { "from": "human", "value": "I would like to compile a DLL under Visual Studio 2008 that depends on msvcr90.dll as a private assembly (basically I'll dump this DLL into the same directory as my application) without needing an external manifest file.\nI followed the steps outlined in http://msdn.microsoft.co...
I love the way Mac OS beautifully renders fonts (not just browsers). I was wondering if we could somehow get the same rendering in browsers running on Windows? Someone recommended sIFR but I guess that's useful when I need to use non-standard fonts?
You're correct that Mac OS is known for its beautiful font rendering, particularly with its use of anti-aliasing techniques that make text look smoother and more visually appealing. On Windows, font rendering can be quite different, often perceived as less refined, especially in certain browsers. ### Achieving Mac-lik...
5,377
[ { "from": "human", "value": "I love the way Mac OS beautifully renders fonts (not just browsers). I was wondering if we could somehow get the same rendering in browsers running on Windows?\nSomeone recommended sIFR but I guess that's useful when I need to use non-standard fonts?\n" }, { "from": "gpt...