instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
As we all know numbers can be written either in numerics, or called by their names. While there are a lot of examples to be found that convert 123 into one hundred twenty three, I could not find good examples of how to convert it the other way around. Some of the caveats: cardinal/nominal or ordinal: "one" and "first"...
Creating a robust algorithm for converting number words into numerical values, especially across multiple languages, is a complex task that requires a strong foundation in natural language processing (NLP), linguistics, and even some aspects of computational linguistics. Below are several fields, papers, and concepts y...
7,209
[ { "from": "human", "value": "As we all know numbers can be written either in numerics, or called by their names. While there are a lot of examples to be found that convert 123 into one hundred twenty three, I could not find good examples of how to convert it the other way around.\nSome of the caveats:\n\nca...
I'm planning to start using FxCop in one of our ongoing project. But, when i tried it with selecting all available rules, it looks like I have to make lots of changes in my code. Being a "team member" I can't right away start making these changes, like naming convention change etc. anyway i would like to start using Fx...
Starting with FxCop can indeed be overwhelming due to the large number of rules available. It's wise to adopt a gradual approach to integrate code analysis into your project. Here are some essential rules that are generally recommended for C# projects, which can help improve code quality without requiring a complete ov...
11,437
[ { "from": "human", "value": "I'm planning to start using FxCop in one of our ongoing project. But, when i tried it with selecting all available rules, it looks like I have to make lots of changes in my code. Being a \"team member\" I can't right away start making these changes, like naming convention change...
When using an IoC container, is it considered good design to inject other classes into them? i.e. a persistence class
Inversion of Control (IoC) and Dependency Injection (DI) are both widely used design patterns that help in achieving loose coupling and making code more modular and testable. When it comes to injecting dependencies, such as a persistence class, into other classes, the general approach and best practices can vary depend...
12,559
[ { "from": "human", "value": "When using an IoC container, is it considered good design to inject other classes into them? i.e. a persistence class\n" }, { "from": "gpt", "value": "Inversion of Control (IoC) and Dependency Injection (DI) are both widely used design patterns that help in achieving...
Is any way to tell the solution explorer of Visual Studio 2005 not to expand all projects on the first opening of the solutio after svn-checkout? Edit: Thanks for pointing out the PowerCommands. As I am using Visual Studio 2005 with .Net 2.0 it does not work for me. Are there similar tools available for VS2005?
In Visual Studio 2005, there is no built-in option to prevent the Solution Explorer from expanding all projects automatically when you open a solution. This behavior can be inconvenient, especially when working with solutions that contain many projects. However, there are a few potential workarounds you can consider: ...
13,692
[ { "from": "human", "value": "Is any way to tell the solution explorer of Visual Studio 2005 not to expand all projects on the first opening of the solutio after svn-checkout?\nEdit:\nThanks for pointing out the PowerCommands. As I am using Visual Studio 2005 with .Net 2.0 it does not work for me. Are there ...
I just got Delphi 2009 and have previously read some articles about modifications that might be necessary because of the switch to Unicode strings. Mostly, it is mentioned that sizeof(char) is not guaranteed to be 1 anymore. But why would this be interesting regarding string manipulation? For example, if I use an AnsiS...
In Delphi 2009, the move to Unicode strings fundamentally changes the way strings are represented and manipulated compared to previous versions of Delphi. The core point of confusion often stems from how string types handle character encoding and what the size of a character is in memory. ### Key Concepts of String Re...
10,814
[ { "from": "human", "value": "I just got Delphi 2009 and have previously read some articles about modifications that might be necessary because of the switch to Unicode strings.\nMostly, it is mentioned that sizeof(char) is not guaranteed to be 1 anymore.\nBut why would this be interesting regarding string m...
Can anyone point me to a library for 2D game physics, etc for programming gravity, jumping actions, etc for a 2d platform/sidescrolling game ? Or could you suggest some algorithms for side scroller like mario, sonic etc?
Certainly! There are several libraries and frameworks available for implementing 2D game physics, particularly for gravity and jumping mechanics in platforming games. Here are a few popular ones: ### Libraries and Frameworks 1. **Box2D**: - A widely-used physics engine that provides 2D physics simulations. It's po...
11,484
[ { "from": "human", "value": "Can anyone point me to a library for 2D game physics, etc for programming gravity, jumping actions, etc for a 2d platform/sidescrolling game ?\nOr could you suggest some algorithms for side scroller like mario, sonic etc?\n" }, { "from": "gpt", "value": "Certainly! T...
How to do paging in Pervasive SQL (version 9.1)? I need to do something similar like: //MySQL SELECT foo FROM table LIMIT 10, 10 But I can't find a way to define offset.
Paging in Pervasive SQL (now known as Actian PSQL) is not as straightforward as using `LIMIT` and `OFFSET` like in MySQL. Unfortunately, Pervasive SQL does not directly support these keywords. However, you can achieve a similar result using a combination of `ROW_NUMBER()` and a common table expression (CTE) if your ver...
13,360
[ { "from": "human", "value": "How to do paging in Pervasive SQL (version 9.1)? I need to do something similar like:\n//MySQL\nSELECT foo FROM table LIMIT 10, 10\n\nBut I can't find a way to define offset.\n" }, { "from": "gpt", "value": "Paging in Pervasive SQL (now known as Actian PSQL) is not a...
Which is the best mocking library for C# 3.0/ ASP.NET MVC? Why?
For C# 3.0 and ASP.NET MVC, one of the best mocking libraries is **Moq**. Here are several reasons why Moq stands out as a preferred choice: 1. **Simplicity and Readability**: Moq has a very clean and intuitive syntax. It allows you to create mocks and set up expectations in a way that is easy to understand, making yo...
10,787
[ { "from": "human", "value": "Which is the best mocking library for C# 3.0/ ASP.NET MVC? Why?\n" }, { "from": "gpt", "value": "For C# 3.0 and ASP.NET MVC, one of the best mocking libraries is **Moq**. Here are several reasons why Moq stands out as a preferred choice:\n\n1. **Simplicity and Readab...
How do I write a decorator that restores the current working directory to what it was before the decorated function was called? In other words, if I use the decorator on a function that does an os.chdir(), the cwd will not be changed after the function is called.
To create a decorator that restores the current working directory (cwd) to its original value after a decorated function has been called, you can use Python's `os` module to get and set the working directory. The decorator will capture the original cwd before the function is executed and restore it afterward, regardles...
15,769
[ { "from": "human", "value": "How do I write a decorator that restores the current working directory to what it was before the decorated function was called? In other words, if I use the decorator on a function that does an os.chdir(), the cwd will not be changed after the function is called.\n" }, { ...
CPU Cycles, Memory Usage, Execution Time, etc.? Added: Is there a quantitative way of testing performance in JavaScript besides just perception of how fast the code runs?
Yes, there are several quantitative ways to test performance in JavaScript beyond just the perception of how fast the code runs. Here are some common metrics and tools you can use to measure the performance of your JavaScript code: ### 1. **CPU Cycles** While JavaScript itself doesn't provide direct access to CPU cycl...
11,026
[ { "from": "human", "value": "CPU Cycles, Memory Usage, Execution Time, etc.?\nAdded: Is there a quantitative way of testing performance in JavaScript besides just perception of how fast the code runs?\n" }, { "from": "gpt", "value": "Yes, there are several quantitative ways to test performance i...
I have a table in a RDLC report which is utilized as a subreport, and the first column of this table is a static string. Does anyone know how I can determine if a row is the first in the table. I tried using "=First("My String")" but it didn't work.
In RDLC reports, you can determine if a row is the first in a dataset by using the `RowNumber()` function. The `RowNumber()` function returns the number of the current row in the group or dataset. For example, to check if the current row is the first row, you can use an expression that evaluates to `True` if the row nu...
14,996
[ { "from": "human", "value": "I have a table in a RDLC report which is utilized as a subreport, and the first column of this table is a static string. Does anyone know how I can determine if a row is the first in the table. I tried using \"=First(\"My String\")\" but it didn't work.\n" }, { "from": ...
I'm running MySQL 5 on a linux server on my local network. Running windows XP for my desktop. Had a look at the MySQL GUI Tools but I dont think they help. I cannot install apache on the remote server & use something like PHPmyAdmin.
If you're running MySQL 5 on a Linux server and want to manage your MySQL databases from a Windows XP desktop without using web-based tools like phpMyAdmin, you have several alternatives: ### 1. MySQL Workbench - **Description**: MySQL Workbench is a powerful GUI tool for managing MySQL databases. It allows you to con...
13,130
[ { "from": "human", "value": "I'm running MySQL 5 on a linux server on my local network. Running windows XP for my desktop. Had a look at the MySQL GUI Tools but I dont think they help. I cannot install apache on the remote server & use something like PHPmyAdmin.\n" }, { "from": "gpt", "value":...
So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic :-)
Unit testing in XNA (or any game framework) presents unique challenges due to the nature of game development, where many components are tightly coupled and rely on real-time input, rendering, and state management. However, it is absolutely possible and beneficial to implement unit tests in an XNA game/application. Here...
5,373
[ { "from": "human", "value": "So I'm interested in hearing different thoughts about what is the best way to go about unit testing XNA Game/Applications. Astute googlers can probably figure out why I'm asking, but I didn't want to bias the topic :-)\n" }, { "from": "gpt", "value": "Unit testing i...
Does anyone know how I can achieve the following effect in OpenGL: Change the brightness of the rendered scene Or implementing a Gamma setting in OpenGL I have tried by changing the ambient parameter of the light and the type of light (directional and omnidirectional) but the result was not uniform. TIA. Thanks for y...
To achieve a scene brightness adjustment or gamma correction in OpenGL without relying on window-specific APIs, you can use fragment shaders to manipulate the color output of your rendered scene. Here’s how you can implement both brightness adjustment and gamma correction in a shader: ### Step 1: Render the Scene to a...
10,554
[ { "from": "human", "value": "Does anyone know how I can achieve the following effect in OpenGL:\n\nChange the brightness of the rendered scene\nOr implementing a Gamma setting in OpenGL\n\nI have tried by changing the ambient parameter of the light and the type of light (directional and omnidirectional) but...
We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console.
To trace exceptions in your application logs instead of just sending them to the console, you can use a logging framework like Log4j, SLF4J, or java.util.logging. Below, I'll illustrate how to use Log4j and SLF4J with Logback, which are popular choices for logging in Java applications. ### Using Log4j 1. **Add Log4j ...
9,102
[ { "from": "human", "value": "We'd like a trace in our application logs of these exceptions - by default Java just outputs them to the console.\n" }, { "from": "gpt", "value": "To trace exceptions in your application logs instead of just sending them to the console, you can use a logging framewor...
I've done some research on using tags from social bookmarking sites for web search, but I'd like to learn more about other ways in which users might use tags for information retrieval. Do you use the tags on sites like Stack Overflow for navigation? Do you think of them like filters (narrowing down a large list of q...
Tags play a significant role in information retrieval on sites like Stack Overflow and can serve multiple purposes for users. Here’s a breakdown of how users might use tags for navigation and information retrieval: ### 1. **Filters** Tags are often used as filters to narrow down a large list of questions. Users lookin...
12,308
[ { "from": "human", "value": "I've done some research on using tags from social bookmarking sites for web search, but I'd like to learn more about other ways in which users might use tags for information retrieval. \nDo you use the tags on sites like Stack Overflow for navigation? Do you think of them like...
I am wondering if anyone has any experience using a JQuery plugin that converts a html <select> <option> Blah </option> </select> combo box into something (probably a div) where selecting an item acts the same as clicking a link. I guess you could probably use javascript to handle a selection event (my javascript...
Certainly! Converting a standard `<select>` element into a more stylized dropdown (like a custom combo box) using jQuery or JavaScript can enhance user experience. Instead of creating a complex solution, you can use existing jQuery plugins that handle this effectively. One popular plugin for this purpose is [Select2](...
7,689
[ { "from": "human", "value": "I am wondering if anyone has any experience using a JQuery plugin that converts a html \n<select> \n <option> Blah </option> \n</select>\n\ncombo box into something (probably a div) where selecting an item acts the same as clicking a link.\nI guess you could probably use javasc...
My current employer uses a 3rd party hosted CRM provider and we have a fairly sophisticated integration tier between the two systems. Amongst the capabilities of the CRM provider is for developers to author business logic in a Java like language and on events such as the user clicking a button or submitting a new ac...
Designing a robust development pipeline and environment for APIs consumed by external systems can be challenging, especially when dealing with security constraints and the need for real-time feedback during development and testing. Here are some best practices and strategies that have been employed in similar scenarios...
5,160
[ { "from": "human", "value": "My current employer uses a 3rd party hosted CRM provider and we have a fairly sophisticated integration tier between the two systems. Amongst the capabilities of the CRM provider is for developers to author business logic in a Java like language and on events such as the user...
This may seem like a daft question, but i was wondering about how to use MVC frameworks on hosted servers. I am playing about (albeit slowly) at home with the RoR on Ubuntu and understand that if i want to do a live site then i need hosting with Rails and Ruby. However, what happens about the PHP frameworks. For exampl...
Your question is a common one, and it's great that you're exploring different frameworks and deployment scenarios! Let's break it down into manageable parts. ### Hosting for MVC Frameworks 1. **Ruby on Rails (RoR)**: - **Hosting**: To deploy a Rails application, you typically need a hosting provider that supports ...
11,291
[ { "from": "human", "value": "This may seem like a daft question, but i was wondering about how to use MVC frameworks on hosted servers.\nI am playing about (albeit slowly) at home with the RoR on Ubuntu and understand that if i want to do a live site then i need hosting with Rails and Ruby.\nHowever, what h...
How can I extract the whole line in a row, for example, row 3. These data are saved in my text editor in linux. Here's my data: 1,julz,kath,shiela,angel 2,may,ann,janice,aika 3,christal,justine,kim 4,kris,allan,jc,mine I want output like: 3,christal,justine,kim
You can extract a specific row from your data using various command-line tools available in Linux. Here are a few methods you can use: ### Method 1: Using `sed` You can use the `sed` command to print a specific line. For example, to print row 3, you can run: ```bash sed -n '3p' yourfile.txt ``` ### Method 2: Using `...
15,325
[ { "from": "human", "value": "How can I extract the whole line in a row, for example, row 3.\nThese data are saved in my text editor in linux.\nHere's my data:\n1,julz,kath,shiela,angel\n2,may,ann,janice,aika\n3,christal,justine,kim\n4,kris,allan,jc,mine\n\nI want output like:\n3,christal,justine,kim\n\n" ...
We've been using "Drip" to try and identify why pages with UpdatePanels in them tend to use a lot of client-side memory. With a page with a regular postback, we are seeing 0 leaks detected by Drip. However, when we add an update panel to the mix, every single DOM object that is inside of the update panel appears to l...
It's understandable to have concerns about memory leaks, especially when introducing frameworks like ASP.NET AJAX with UpdatePanels. Here are a few points to consider: 1. **Drip Reliability**: While Drip can be helpful for identifying potential memory leaks in client-side JavaScript applications, it is worth noting th...
10,978
[ { "from": "human", "value": "We've been using \"Drip\" to try and identify why pages with UpdatePanels in them tend to use a lot of client-side memory. With a page with a regular postback, we are seeing 0 leaks detected by Drip. However, when we add an update panel to the mix, every single DOM object that...
This question is a follow up on one of my other questions, Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project? Many of the conditions of the LGPL license are based on the notion of distribution. My company does business as a consultant. We are contracted to create soft...
The LGPL (Lesser General Public License) has specific conditions regarding distribution, and it's important to understand how they apply to your situation. 1. **Definition of Distribution**: Under the LGPL, distribution refers to the act of providing a copy of the software (or a derivative work) to others. This includ...
13,554
[ { "from": "human", "value": "This question is a follow up on one of my other questions, Can I legally Incorporating GPL & LGPL, open-sourced software in a proprietary, closed-source project?\nMany of the conditions of the LGPL license are based on the notion of distribution. My company does business as a co...
I am trying to find all matches in a string that begins with | |. I have tried: if ($line =~ m/^\\\|\s\\\|/) which didn't work. Any ideas?
To match all occurrences in a string that begin with `| |`, you need to correctly format your regular expression. The escape characters you are using seem to be misplaced and unnecessary in this context. If you want to find matches that start with `| |`, you can use the following regex in Perl: ```perl if ($line =~ ...
15,955
[ { "from": "human", "value": "I am trying to find all matches in a string that begins with | |. \nI have tried: if ($line =~ m/^\\\\\\|\\s\\\\\\|/) which didn't work. \nAny ideas?\n" }, { "from": "gpt", "value": "To match all occurrences in a string that begin with `| |`, you need to correctly f...
Is it practical (or possible) to create a Websphere Portlet for a Classic ASP website?
Creating a WebSphere Portlet for a Classic ASP website is theoretically possible, but it comes with a range of practical challenges and considerations. Here are some key points to consider: ### 1. **Understanding WebSphere Portlets:** - WebSphere Portlets are components used in Java-based portal applications (like ...
13,207
[ { "from": "human", "value": "Is it practical (or possible) to create a Websphere Portlet for a Classic ASP website?\n" }, { "from": "gpt", "value": "Creating a WebSphere Portlet for a Classic ASP website is theoretically possible, but it comes with a range of practical challenges and considerati...
I know this is not programming directly, but it's regarding a development workstation I'm setting up. I've got a Windows Server 2003 machine that needs to be on two LAN segments at the same time. One of them is a 10.17.x.x LAN and the other is 10.16.x.x The problem is that I don't want to be using up the bandwidth on ...
To achieve what you're looking for with your Windows Server 2003 setup—ensuring that traffic is correctly routed based on the network segment—you will indeed have to work with routing tables. However, you're right that managing routes can be tricky if you're not familiar with how they work. Here's a step-by-step guide...
7,178
[ { "from": "human", "value": "I know this is not programming directly, but it's regarding a development workstation I'm setting up.\nI've got a Windows Server 2003 machine that needs to be on two LAN segments at the same time. One of them is a 10.17.x.x LAN and the other is 10.16.x.x\nThe problem is that I ...
We needed to monitor all processes Registry calls/File Sytem calls/Process creations in the system (for the antivirus hips module) . Also time by time it will be needed to delay some calls or decline them.
To monitor and control system calls related to registry access, file system operations, and process creations, you can implement various techniques depending on the operating system you are targeting. Here's a general overview of how to approach this for both Windows and Linux platforms, including options for monitorin...
11,080
[ { "from": "human", "value": "We needed to monitor all processes Registry calls/File Sytem calls/Process creations in the system (for the antivirus hips module) .\nAlso time by time it will be needed to delay some calls or decline them.\n" }, { "from": "gpt", "value": "To monitor and control syst...
What is the best way to retire a currently active project? I've been working on this one for a while now and I think its time to let go. Without going into too much detail, there are other projects and technologies that are way ahead now and I don't see much value in investing in it any further. What have you done to r...
Retiring a project is a thoughtful process that involves several steps to ensure a smooth transition and minimal disruption. Here’s a suggested approach you can consider: ### 1. **Assessment and Documentation** - **Evaluate the Project**: Review the goals, outcomes, and performance of the project. Document its curr...
11,679
[ { "from": "human", "value": "What is the best way to retire a currently active project? I've been working on this one for a while now and I think its time to let go. Without going into too much detail, there are other projects and technologies that are way ahead now and I don't see much value in investing i...
I'm developing a Mac App in Java that logs into any one of our client's databases. My users want to have several copies of this program running so they can log into a couple clients at the same time, rather than logging out and logging back in. How can I allow a user to open several copies of my App at once? I'm using...
To allow your Mac application to open multiple instances, you can modify your application’s properties and the code to handle multiple windows (or instances) more effectively. Here’s a guide on how you can achieve this: ### Step 1: Modify Your Application’s Info.plist 1. **Open your `Info.plist` file**: This file con...
10,423
[ { "from": "human", "value": "I'm developing a Mac App in Java that logs into any one of our client's databases. My users want to have several copies of this program running so they can log into a couple clients at the same time, rather than logging out and logging back in.\nHow can I allow a user to open s...
What are some hidden features of SQL Server? For example, undocumented system stored procedures, tricks to do things which are very useful but not documented enough? Answers Thanks to everybody for all the great answers! Stored Procedures sp_msforeachtable: Runs a command with '?' replaced with each table name (v6.5 ...
SQL Server has a rich set of features, some of which are less documented or considered "hidden." Here’s a compilation of some useful but not widely known functionalities, tricks, and undocumented features that can enhance your database management and development experience: ### 1. **Undocumented System Stored Procedur...
9,720
[ { "from": "human", "value": "What are some hidden features of SQL Server?\nFor example, undocumented system stored procedures, tricks to do things which are very useful but not documented enough?\n\nAnswers\nThanks to everybody for all the great answers!\nStored Procedures\n\nsp_msforeachtable: Runs a comma...
I am trying to use forms authentication with Active Directory but I need roles (memberOf) from AD. I am trying to override members of RoleProvider to make this possible (unless someone knows of a better way). I am stuck on an error in the new class that is inheriting from RoleProvider. The error is: ADAuth.ActiveDirect...
In order to create a custom `RoleProvider` that utilizes Active Directory, you will need to implement all the abstract members defined in the `RoleProvider` class. This includes the `ApplicationName` property, which is required for any implementation of the `RoleProvider`. You can either create your own implementations...
9,689
[ { "from": "human", "value": "I am trying to use forms authentication with Active Directory but I need roles (memberOf) from AD. I am trying to override members of RoleProvider to make this possible (unless someone knows of a better way). I am stuck on an error in the new class that is inheriting from RolePr...
I keep hearing that div tags should be used for layout purposes and not table tags. So does that also apply to form layout? I know a form layout is still a layout, but it seems like creating form layouts with divs requires more html and css. So with that in mind, should forms layouts use div tags instead?
The advice you’re hearing about using `<div>` tags for layout instead of `<table>` tags primarily stems from the need to separate content from presentation and to enhance accessibility and responsiveness. This principle applies to various parts of a web page, including form layouts. ### Using `<div>` Tags for Form Lay...
7,753
[ { "from": "human", "value": "I keep hearing that div tags should be used for layout purposes and not table tags. So does that also apply to form layout? I know a form layout is still a layout, but it seems like creating form layouts with divs requires more html and css. So with that in mind, should forms la...
What is the simplest way to interact between a SAP OMS and Websphere Commerce? Would it be using a Websphere Adaptor for SAP or webmethods or something else? Does something else need to be considered while opting for one of these? The final system needs to be synchronous between SAP and the WCS front end. No ques..no d...
When it comes to integrating SAP Order Management System (OMS) with WebSphere Commerce (WCS) in a synchronous manner, there are several integration approaches you can consider. Here are some options, along with considerations for each: ### 1. WebSphere Adapter for SAP **Description:** The WebSphere Adapter for SAP en...
11,235
[ { "from": "human", "value": "What is the simplest way to interact between a SAP OMS and Websphere Commerce?\nWould it be using a Websphere Adaptor for SAP or webmethods or something else?\nDoes something else need to be considered while opting for one of these?\nThe final system needs to be synchronous betw...
I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to Hidden Features of C#; to become a how-to of tips and trick for windows development on a mac. I should clarify that I am aware of boot camp but do not use it (nor do I have any...
It's great to hear that you're enjoying your MacBook Pro and exploring ways to effectively develop in a Windows environment using VMware Fusion! Here are some additional tips and tricks that can enhance your Windows development experience on your Mac: ### General Tips 1. **Shared Folders**: Use VMware Fusion's shared...
12,037
[ { "from": "human", "value": "I have just got a MacBook Pro and have been using it (+Fusion) to develop on for about a month now. The purpose of this question is similar to Hidden Features of C#; to become a how-to of tips and trick for windows development on a mac.\nI should clarify that I am aware of boot...
Part of a new product I have been assigned to work on involves server-side conversion of the 'common' video formats to something that Flash can play. As far as I know, my only option is to convert to FLV. I have been giving ffmpeg a go around, but I'm finding a few WMV files that come out with garbled sound (I've tried...
When it comes to converting video formats for use with Flash, FLV (Flash Video) is indeed a commonly used format. However, Flash Player also supports other video formats, particularly when they are encapsulated in a different container. Here are some points to consider: 1. **Supported Formats for Flash**: - **FLV**...
10,576
[ { "from": "human", "value": "Part of a new product I have been assigned to work on involves server-side conversion of the 'common' video formats to something that Flash can play.\nAs far as I know, my only option is to convert to FLV. I have been giving ffmpeg a go around, but I'm finding a few WMV files th...
I've a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this. template<typename ImplemenationClass> class WrapperClass { // the code goes here } Now, how do I make sure that ImplementationClass can be derived from a set of ...
In C++, you can restrict the template parameter `ImplementationClass` to be derived from a specific base class by using a combination of static assertions and type traits. While C++ does not have a built-in equivalent to Java's `<? extends BaseClass>`, you can achieve similar behavior through template specialization or...
9,405
[ { "from": "human", "value": "I've a class which is a wrapper class(serves as a common interface) around another class implementing the functionality required. So my code looks like this.\ntemplate<typename ImplemenationClass> class WrapperClass {\n// the code goes here\n}\n\nNow, how do I make sure that Imp...
I have a set of XSDs from which I generate data access classes, stored procedures and more. What I don't have is a way to generate database table from these - is there a tool that will generate the DDL statements for me? This is not the same as Create DB table from dataset table, as I do not have dataset tables, but XS...
Generating database table definitions (DDL statements) directly from XSD (XML Schema Definition) files can be accomplished through several tools and approaches. Here are a few options you can consider: ### 1. Custom Scripts If you have programming skills, you can write a custom script in a language like Python or C# t...
12,074
[ { "from": "human", "value": "I have a set of XSDs from which I generate data access classes, stored procedures and more.\nWhat I don't have is a way to generate database table from these - is there a tool that will generate the DDL statements for me?\nThis is not the same as Create DB table from dataset tab...
Is it possible to reset the alternate buffer in a vim session to what it was previously? By alternate buffer, I mean the one that is referred to by #, i.e. the one that is displayed when you enter cntl-^. Say I've got two files open main.c and other.c and :ls gives me: 1 %a "main.c" lines 27 2 # "...
In Vim, the alternate buffer (denoted by `#` in `:ls`) indeed refers to the last buffer you had before the current one. This is a built-in feature of Vim that allows you to easily switch back and forth between two buffers. However, when you delete a buffer (like `refer.c` in your example), that buffer is removed from m...
14,197
[ { "from": "human", "value": "Is it possible to reset the alternate buffer in a vim session to what it was previously?\nBy alternate buffer, I mean the one that is referred to by #, i.e. the one that is displayed when you enter cntl-^.\nSay I've got two files open main.c and other.c and :ls gives me:\n 1 %a...
Is there a way to trigger a garbage collection in a .NET process from another process or from inside WinDBG? There are the Managed Debugging Assistants that force a collection as you move across a native/managed boundary, and AQTime seems to have button that suggests it does this, but I can't find any documentation on ...
In .NET, triggering garbage collection programmatically from one process to another or from a debugging environment like WinDBG isn't straightforward and is not officially supported due to the architecture of the .NET runtime. However, there are some techniques you can explore to achieve this. ### Triggering Garbage C...
11,686
[ { "from": "human", "value": "Is there a way to trigger a garbage collection in a .NET process from another process or from inside WinDBG?\nThere are the Managed Debugging Assistants that force a collection as you move across a native/managed boundary, and AQTime seems to have button that suggests it does th...
I would like to repeatedly capture snippets of audio on a Nokia mobile phone with a Java Midlet. My current experience is that using the code in Sun's documentation (see: http://java.sun.com/javame/reference/apis/jsr135/javax/microedition/media/control/RecordControl.html) and wrapping this in a "while(true)" loop works...
The issue you're experiencing with memory leaks in a Java ME application on Nokia mobile phones is not uncommon, especially when dealing with multimedia components like audio recording. The underlying system resources are not always released properly, leading to gradual memory consumption over time. Below are a few sug...
9,921
[ { "from": "human", "value": "I would like to repeatedly capture snippets of audio on a Nokia mobile phone with a Java Midlet. My current experience is that using the code in Sun's documentation (see: http://java.sun.com/javame/reference/apis/jsr135/javax/microedition/media/control/RecordControl.html) and wr...
In some instances, I prefer working with custom objects instead of strongly typed datasets and data rows. However, it seems like Microsoft Reporting (included with VS2005) requires strongly typed datasets. Is there a way to use my custom objects to design and populate reports?
Yes, you can use your custom objects with Microsoft Reporting Services (such as the version included with Visual Studio 2005) by creating a custom data source. While it is true that the built-in designer for reports often works with strongly typed datasets, you can leverage the flexibility of custom data sources to wor...
11,368
[ { "from": "human", "value": "In some instances, I prefer working with custom objects instead of strongly typed datasets and data rows. However, it seems like Microsoft Reporting (included with VS2005) requires strongly typed datasets.\nIs there a way to use my custom objects to design and populate reports?...
I'm coming from a Rails background and doing some work on a ASP.NET project (not ASP MVC). Newbie question: what's the easiest way to make a custom editor for a table of records? For example: I have a bunch of data rows and want to change the "category" field on each -- maybe a dropdown, maybe a link, maybe the user ty...
Welcome to the world of ASP.NET! In ASP.NET Web Forms (the non-MVC version you mentioned), you can achieve a similar outcome to what you're used to in Rails by leveraging controls such as `GridView`, `Repeater`, or a `ListView`. Below, I’ll outline a straightforward approach using a `GridView`, which is quite commonly ...
3,793
[ { "from": "human", "value": "I'm coming from a Rails background and doing some work on a ASP.NET project (not ASP MVC). Newbie question: what's the easiest way to make a custom editor for a table of records?\nFor example: I have a bunch of data rows and want to change the \"category\" field on each -- maybe...
I've developed a program that extensively uses wxPython - the wxWindow port for python. Even though it is as mature library it is still very primitive and very programming oriented. Which is time consuming and not flexible at all. I would love to see if there is something like Flex/Action Script where all the visual d...
If you’re looking for a more flexible and modern approach to building user interfaces in Python, especially if you want to use stylesheets or a more declarative way of designing your UI, there are several alternatives to wxPython that you might find interesting: 1. **Qt with PyQt or PySide**: - **Qt** is a powerful...
13,788
[ { "from": "human", "value": "I've developed a program that extensively uses wxPython - the wxWindow port for python. \nEven though it is as mature library it is still very primitive and very programming oriented. Which is time consuming and not flexible at all.\nI would love to see if there is something lik...
I'm trying to populate a TDBGrid with the results of the following TQuery against the file Journal.db: select * from Journal where Journal.where = "RainPump" I've tried both Journal."Where" and Journal.[Where] to no avail. I've also tried: select Journal.[Where] as "Location" with the same result. Journal.db is a fil...
In SQL queries, certain keywords can create conflicts, especially when they are reserved words, like "WHERE." Since "where" is a reserved word in SQL, you need to use an appropriate way to escape it in your query to avoid syntax errors. For most SQL implementations, including those you might encounter with the BDE (Bo...
13,858
[ { "from": "human", "value": "I'm trying to populate a TDBGrid with the results of the following TQuery against the file Journal.db:\nselect * from Journal\nwhere Journal.where = \"RainPump\"\n\nI've tried both Journal.\"Where\" and Journal.[Where] to no avail.\nI've also tried: select Journal.[Where] as \"...
In Ruby you can easily set a default value for a variable x ||= "default" The above statement will set the value of x to "default" if x is nil or false Is there a similar shortcut in PHP or do I have to use the longer form: $x = (isset($x))? $x : "default"; Are there any easier ways to handle this in PHP?
Yes, PHP provides a shorthand way to set default values for variables similar to Ruby's `||=` operator. In PHP 7.0 and later, you can use the null coalescing operator `??` to achieve similar functionality. Here's how you can use it: ```php $x = $x ?? "default"; ``` In this case, if `$x` is `null`, it will be set to ...
16,094
[ { "from": "human", "value": "In Ruby you can easily set a default value for a variable \nx ||= \"default\"\n\nThe above statement will set the value of x to \"default\" if x is nil or false\nIs there a similar shortcut in PHP or do I have to use the longer form:\n$x = (isset($x))? $x : \"default\";\n\nAre t...
I have a list of structs and I want to change one element. For example : MyList.Add(new MyStruct("john"); MyList.Add(new MyStruct("peter"); Now I want to change one element: MyList[1].Name = "bob" However, whenever I try and do this I get the following error: Cannot modify the return value of System.Collections.Ge...
You've correctly identified the core issue: structs in C# are value types, while classes are reference types. When you retrieve an element from a list of structs, you're working with a copy of that struct rather than a reference to the original struct in the list. As a result, modifying a property of the struct copy do...
12,031
[ { "from": "human", "value": "I have a list of structs and I want to change one element. For example :\nMyList.Add(new MyStruct(\"john\");\nMyList.Add(new MyStruct(\"peter\");\n\nNow I want to change one element:\nMyList[1].Name = \"bob\"\n\nHowever, whenever I try and do this I get the following error:\n\nC...
Is there any way to see an overview of what kind of queries are spent the most time on every day on MySQL?
Yes, you can get an overview of the queries that consume the most time in MySQL by utilizing various built-in features and tools. Here are some methods to achieve this: ### 1. Slow Query Log MySQL has a slow query log that records queries that take longer than a specified duration to execute. To enable the slow query ...
12,704
[ { "from": "human", "value": "Is there any way to see an overview of what kind of queries are spent the most time on every day on MySQL?\n" }, { "from": "gpt", "value": "Yes, you can get an overview of the queries that consume the most time in MySQL by utilizing various built-in features and tool...
I have a multi-line string that I want to do an operation on each line, like so: inputString = """Line 1 Line 2 Line 3""" I want to iterate on each line: for line in inputString: doStuff()
To iterate over each line in a multi-line string in Python, you can use the `splitlines()` method, which splits the string into a list of lines. Alternatively, you can use the `split('\n')` method. Here's how you can do that using `splitlines()`: ```python inputString = """Line 1 Line 2 Line 3""" # Iterating over eac...
15,695
[ { "from": "human", "value": "I have a multi-line string that I want to do an operation on each line, like so:\ninputString = \"\"\"Line 1\nLine 2\nLine 3\"\"\"\n\nI want to iterate on each line:\nfor line in inputString:\n doStuff()\n\n" }, { "from": "gpt", "value": "To iterate over each line...
I have an object of the type System.Drawing.Image and want to make every pixel which has some specific color, for example black, transparent (that is, set alpha to 0 for this pixel). What is the best way to do this?
To modify an image in C# using the `System.Drawing` namespace, you can loop through each pixel of the image and change its alpha value to 0 (making it transparent) if it matches a specific color (in this case, black). Here's a step-by-step guide to achieve that: 1. Load the image into a `Bitmap` object. 2. Loop throug...
13,808
[ { "from": "human", "value": "I have an object of the type System.Drawing.Image and want to make every pixel which has some specific color, for example black, transparent (that is, set alpha to 0 for this pixel).\nWhat is the best way to do this?\n" }, { "from": "gpt", "value": "To modify an imag...
Ruby's standard popen3 module does not work on Windows. Is there a maintained replacement that allows for separating stdin, stdout, and stderr?
Yes, if you're looking for a maintained replacement to Ruby's standard `popen3` module that works on Windows and allows for separating stdin, stdout, and stderr, you can use the `Open3` module from Ruby's standard library. Starting with Ruby 1.9, the `Open3` module provides methods to manage input and output streams ...
15,216
[ { "from": "human", "value": "Ruby's standard popen3 module does not work on Windows. Is there a maintained replacement that allows for separating stdin, stdout, and stderr?\n" }, { "from": "gpt", "value": "Yes, if you're looking for a maintained replacement to Ruby's standard `popen3` module tha...
This is a followup question of How to encode characters from Oracle to Xml? In my environment here I use Java to serialize the result set to xml. I have no access to the output stream itself, only to a org.xml.sax.ContentHandler. When I try to output characters in a CDATA Section: It happens basically like this: xmlHan...
To properly output a CDATA section using a SAX `ContentHandler`, you cannot simply treat the CDATA content as a string and pass it to `characters()`. The `characters()` method is intended for regular text content, and it escapes characters like `<` and `>`, which is why you're seeing the output as `&lt;` and `&gt;`. I...
13,009
[ { "from": "human", "value": "This is a followup question of How to encode characters from Oracle to Xml?\nIn my environment here I use Java to serialize the result set to xml. I have no access to the output stream itself, only to a org.xml.sax.ContentHandler.\nWhen I try to output characters in a CDATA Sect...
It seems like the methods of Ruby's Net::HTTP are all or nothing when it comes to reading the body of a web page. How can I read, say, the just the first 100 bytes of the body? I am trying to read from a content server that returns a short error message in the body of the response if the file requested isn't available...
In Ruby's `Net::HTTP`, you can read part of the response body by using the `read_body` method with a block, which allows you to process the response in chunks. If you only want to read the first 100 bytes, you can keep track of how many bytes you've read and stop reading once you reach your limit. Here's an example of...
10,262
[ { "from": "human", "value": "It seems like the methods of Ruby's Net::HTTP are all or nothing when it comes to reading the body of a web page. How can I read, say, the just the first 100 bytes of the body? \nI am trying to read from a content server that returns a short error message in the body of the resp...
I'm looking for sources of inspiration and/or design patterns for navigation 'breadcrumbs'. So far I have found the breadcrumb collection on Pattern Tap. Does anyone know of any other sources?
Certainly! Here are some sources of inspiration and design patterns for navigation breadcrumbs that you can explore: 1. **Awwwards** - This site showcases award-winning web designs and often features websites that implement breadcrumbs creatively. You can look for specific designs and filter by categories. 2. **Dribb...
14,262
[ { "from": "human", "value": "I'm looking for sources of inspiration and/or design patterns for navigation 'breadcrumbs'. So far I have found the breadcrumb collection on Pattern Tap. Does anyone know of any other sources?\n" }, { "from": "gpt", "value": "Certainly! Here are some sources of inspi...
I have an Xtext/Xpand (oAW 4.3, Eclipse 3.4) generator plug-in, which I run together with the editor plug-in in a second workbench. There, I'd like to run Xpand workflows programmatically on the model file I create. If I set the model file using the absolute path of the IFile I have, e.g. with: String dslFile = file.ge...
When dealing with Xtext and Xpand in an Eclipse environment, especially when working across multiple workbench instances, there are a few common pitfalls that can lead to issues like the one you're experiencing with file paths. Here are some suggestions to help you resolve the `Resource$IOWrappedException` and successf...
13,462
[ { "from": "human", "value": "I have an Xtext/Xpand (oAW 4.3, Eclipse 3.4) generator plug-in, which I run together with the editor plug-in in a second workbench. There, I'd like to run Xpand workflows programmatically on the model file I create. If I set the model file using the absolute path of the IFile I ...
I often refactor code first by creating an inner class inside the class I'm working on--When I'm done, I move the entire thing into a new class file. This makes refactoring code into the new class extremely easy because A) I'm only dealing with a single file, and B) I don't create new files until I have a pretty good ...
In Eclipse, there is a way to refactor your code and move a top-level class to a new file with relative ease. However, the steps can vary slightly depending on the version of Eclipse you are using. Here’s how you can move your top-level class to a new file in a single step: 1. **Select the Class**: In the editor, plac...
11,418
[ { "from": "human", "value": "I often refactor code first by creating an inner class inside the class I'm working on--When I'm done, I move the entire thing into a new class file. This makes refactoring code into the new class extremely easy because A) I'm only dealing with a single file, and B) I don't cre...
I am trying to fix memory leaks in IE 7. Using Drip for investigations but it is not helping much when most dynamically generated DOM elements do not have unique ids. Tips?
Fixing memory leaks in Internet Explorer 7 can be challenging, especially when dealing with dynamically generated DOM elements that lack unique IDs. Here are some tips that may help you identify and fix memory leaks more effectively: ### 1. **Use Reference Counting** - In IE, objects are reference-counted. If you'r...
9,035
[ { "from": "human", "value": "I am trying to fix memory leaks in IE 7. Using Drip for investigations but it is not helping much when most dynamically generated DOM elements do not have unique ids.\nTips?\n" }, { "from": "gpt", "value": "Fixing memory leaks in Internet Explorer 7 can be challengin...
Is there any python module for rendering a HTML page with javascript and get back a DOM object? I want to parse a page which generates almost all of its content using javascript.
Yes, there are several Python modules that can help you render HTML pages that rely on JavaScript to generate content and allow you to interact with the DOM. Here are some popular options: 1. **Selenium**: - Selenium is a powerful tool for automating web browsers. It allows you to load a web page, execute JavaScrip...
10,851
[ { "from": "human", "value": "Is there any python module for rendering a HTML page with javascript and get back a DOM object?\nI want to parse a page which generates almost all of its content using javascript. \n" }, { "from": "gpt", "value": "Yes, there are several Python modules that can help y...
In our application, we receive text files (.txt, .csv, etc.) from diverse sources. When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage. Is there a way to (automatically) detect the codepage of a text file? The detectEncodingFromByteOrderMarks, on the Str...
Detecting the encoding of text files, especially when they come from various sources and may use different code pages, can be quite challenging. While some encodings can be identified through byte order marks (BOMs) as you mentioned, many files do not include these marks, and as such, manual intervention or heuristic a...
9,465
[ { "from": "human", "value": "In our application, we receive text files (.txt, .csv, etc.) from diverse sources. When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage.\nIs there a way to (automatically) detect the codepage of a text file? \nThe d...
I'm trying to embed a window from my process into the window of an external process using the SetParent function and have encountered a few problems. First off, here is an outline of what I am currently doing to embed my window into the application: HWND myWindow; //Handle to my application window HWND externalWindow; ...
Embedding your window into an external application's window using `SetParent` can be tricky, as it changes the parent-child relationship between windows in a way that might interfere with the normal behavior of the external application. The issues you're encountering (input focus and keyboard shortcuts) are common when...
14,438
[ { "from": "human", "value": "I'm trying to embed a window from my process into the window of an external process using the SetParent function and have encountered a few problems. First off, here is an outline of what I am currently doing to embed my window into the application:\nHWND myWindow; //Handle to m...
Are disabling and enabling foreign key constraints supported in SQL Server? Or is my only option to drop and then re-create the constraints?
Yes, SQL Server does support disabling and enabling foreign key constraints without the need to drop and recreate them. You can use the `ALTER TABLE` statement for this purpose. Here’s how you can do it: ### Disabling a Foreign Key Constraint To disable a foreign key constraint, you can use the following SQL command: ...
16,220
[ { "from": "human", "value": "Are disabling and enabling foreign key constraints supported in SQL Server? Or is my only option to drop and then re-create the constraints?\n" }, { "from": "gpt", "value": "Yes, SQL Server does support disabling and enabling foreign key constraints without the need ...
I have a PHP script that needs to determine if it's been executed via the command-line or via HTTP, primarily for output-formatting purposes. What's the canonical way of doing this? I had thought it was to inspect SERVER['argc'], but it turns out this is populated, even when using the 'Apache 2.0 Handler' server API.
To determine if a PHP script is executed from the command line (CLI) or via a web server (HTTP), you can use the `PHP_SAPI` constant. This constant provides a string that describes the type of interface used to run the script. For command-line execution, `PHP_SAPI` will return `'cli'`, while for HTTP requests, it mig...
15,255
[ { "from": "human", "value": "I have a PHP script that needs to determine if it's been executed via the command-line or via HTTP, primarily for output-formatting purposes. What's the canonical way of doing this? I had thought it was to inspect SERVER['argc'], but it turns out this is populated, even when usi...
I need to specify a date value in a sybase where clause. For example: select * from data where dateVal < [THE DATE]
In Sybase SQL, you can specify date values in your `WHERE` clause using single quotes around the date string. The format for the date should generally be `YYYY-MM-DD`, `MM/DD/YYYY`, or `YYYYMMDD`, depending on the settings for your server. Here is how you can specify a date in your query: ```sql SELECT * FROM data W...
16,066
[ { "from": "human", "value": "I need to specify a date value in a sybase where clause. For example:\nselect * \nfrom data\nwhere dateVal < [THE DATE]\n\n" }, { "from": "gpt", "value": "In Sybase SQL, you can specify date values in your `WHERE` clause using single quotes around the date string. Th...
As a .NET developer I'm asking whether JBoss alternatives exist to be "more suitable for .NET development" as an enterprise application platform. Please do not make any suggestions, such as "make JBoss to expose WebServices"...
If you are looking for enterprise application platforms that are more tailored for .NET development than JBoss, there are several alternatives you can consider: 1. **Microsoft Azure App Services**: This is a fully managed platform for building, deploying, and scaling web apps. It provides built-in integration with oth...
13,928
[ { "from": "human", "value": "As a .NET developer I'm asking whether JBoss alternatives exist to be \"more suitable for .NET development\" as an enterprise application platform.\nPlease do not make any suggestions, such as \"make JBoss to expose WebServices\"...\n" }, { "from": "gpt", "value": "I...
Is there a way to use sql-server like analytic functions in Hibernate? Something like select foo from Foo foo where f.x = max(f.x) over (partition by f.y)
Yes, you can achieve SQL Server-like analytic functions in Hibernate, but the support for window functions (such as `MAX() OVER (PARTITION BY ...)`) is not directly available in HQL (Hibernate Query Language) or Criteria API out of the box. However, there are a few approaches you can take: ### 1. Native SQL Queries If...
12,915
[ { "from": "human", "value": "Is there a way to use sql-server like analytic functions in Hibernate?\nSomething like \nselect foo from Foo foo where f.x = max(f.x) over (partition by f.y)\n\n" }, { "from": "gpt", "value": "Yes, you can achieve SQL Server-like analytic functions in Hibernate, but...
I've tried to develop a GSM modem library for handling SMS built around system.io.ports.serialport. It does'nt handle unsolicited responses very well, in particular incoming calls. I have resorted to sending AT hangup commands for each incoming call, however the unsolicited responses still popup even while you are pe...
Dealing with unsolicited responses from a GSM modem can indeed be tricky, especially when you're handling other tasks in your application. The unsolicited responses can come in at any time, which requires a way to manage these responses asynchronously without interfering with the main flow of your program. Here are so...
8,588
[ { "from": "human", "value": "I've tried to develop a GSM modem library for handling SMS built around system.io.ports.serialport. \nIt does'nt handle unsolicited responses very well, in particular incoming calls. \nI have resorted to sending AT hangup commands for each incoming call, however the unsolicited ...
I am working on a project where the requirement is to have a date calculated as being the last Friday of a given month. I think I have a solution that only uses standard Java, but I was wondering if anyone knew of anything more concise or efficient. Below is what I tested with for this year: for (int month = 0; mo...
Your approach to finding the last Friday of a given month using `GregorianCalendar` is quite good, but there are some improvements that can make it cleaner and more efficient. Below is a more concise method using the same `GregorianCalendar` class while simplifying the logic. Instead of adjusting weeks, we can directly...
8,489
[ { "from": "human", "value": "I am working on a project where the requirement is to have a date calculated as being the last Friday of a given month. I think I have a solution that only uses standard Java, but I was wondering if anyone knew of anything more concise or efficient. Below is what I tested with ...
I've just finished reading Domain Driven Design and I'm enchanted with some of the ideas covered in it. Do you know any companies that implement ubiquitous language in their projects?
Yes, several companies across various industries have embraced the principles of Domain-Driven Design (DDD), including the concept of ubiquitous language. While specific internal practices may not always be publicly disclosed, there are some well-known companies and projects that are often cited as examples of implemen...
10,322
[ { "from": "human", "value": "I've just finished reading Domain Driven Design and I'm enchanted with some of the ideas covered in it. Do you know any companies that implement ubiquitous language in their projects?\n" }, { "from": "gpt", "value": "Yes, several companies across various industries h...
How to obtain Vista Edition programmatically, that is Home Basic, Home Premium, Business or Ultimate ?
To programmatically obtain the Windows Vista edition (Home Basic, Home Premium, Business, or Ultimate), you can utilize the Windows API or the Windows Management Instrumentation (WMI) in a language like C#, PowerShell, or even VBScript. Below are examples in C# and PowerShell. ### C# Example You can use the `Environm...
15,332
[ { "from": "human", "value": "How to obtain Vista Edition programmatically, that is Home Basic, Home Premium, Business or Ultimate ?\n" }, { "from": "gpt", "value": "To programmatically obtain the Windows Vista edition (Home Basic, Home Premium, Business, or Ultimate), you can utilize the Windows...
I've had a serious issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenever I try to uninstall, reinstall or repair Visual Studio 2008 (team system version). If I can't resolve this issue I have no choice bu...
It sounds like you're dealing with a frustrating situation with your Visual Studio 2008 installation. Fortunately, there are a number of steps you can take to try to resolve the issue without having to wipe your entire computer. Here are several potential solutions: ### 1. **Use Microsoft’s Program Install and Uninsta...
10,310
[ { "from": "human", "value": "I've had a serious issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenever I try to uninstall, reinstall or repair Visual Studio 2008 (team system version). If I can...
I've created an IHttpHandler in .NET C# which returns pieces of html to a classic asp page. The classic asp page communicates with the IHttpHandler through basic http requests using ServerXMLHTTP in vbscript or Ajax Calls in JavaScript. Now, I need a way to share a variable which I have in vbscript but not in javascrip...
When dealing with communication between a Classic ASP page and a .NET IHttpHandler, especially when you have a scenario where you want to share a variable from VBScript (ASP) but not have that available in JavaScript, you need to find a reliable way to manage the state or shared data. Here are a few options you can co...
10,002
[ { "from": "human", "value": "I've created an IHttpHandler in .NET C# which returns pieces of html to a classic asp page.\nThe classic asp page communicates with the IHttpHandler through basic http requests using ServerXMLHTTP in vbscript or Ajax Calls in JavaScript.\nNow, I need a way to share a variable wh...
I have been told that there is a performance difference between the following code blocks. foreach (Entity e in entityList) { .... } and for (int i=0; i<entityList.Count; i++) { Entity e = (Entity)entityList[i]; ... } where List<Entity> entityList; I am no CLR expect but from what I can tell they should boil...
You're correct that both `foreach` and `for` loops in your example ultimately iterate over the same collection (`entityList`), and they will generally produce similar results. However, there can be subtle differences in performance and behavior that are worth considering. ### Performance Considerations: 1. **Iterator...
11,835
[ { "from": "human", "value": "I have been told that there is a performance difference between the following code blocks.\nforeach (Entity e in entityList)\n{\n ....\n}\n\nand \nfor (int i=0; i<entityList.Count; i++)\n{\n Entity e = (Entity)entityList[i];\n ...\n}\n\nwhere\nList<Entity> entityList;\n\nI a...
Is there a good reason why there is no Pair<L,R> in Java? What would be the equivalent of this C++ construct? I would rather avoid reimplementing my own. It seems that 1.6 is providing something similar (AbstractMap.SimpleEntry<K,V>), but this looks quite convoluted.
In Java, there isn't a built-in `Pair<L, R>` class like in some other languages (e.g., C++ or Python). However, there are a few reasons for this omission, as well as some alternatives that can be used. ### Reasons for the Absence of `Pair<L, R>` in Java: 1. **Design Philosophy**: Java was designed with strong type sa...
12,683
[ { "from": "human", "value": "Is there a good reason why there is no Pair<L,R> in Java? What would be the equivalent of this C++ construct? I would rather avoid reimplementing my own.\nIt seems that 1.6 is providing something similar (AbstractMap.SimpleEntry<K,V>), but this looks quite convoluted.\n" }, ...
So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. The details: Interestingly enough this code runs fine when called in the context of our regular winforms application -- but I am tasked with writing a web-based versi...
It sounds like you're dealing with a complex and potentially deep stack issue in your web-based application that doesn't occur in the WinForms context. From the `!dumpstack` output you shared, it seems you're indeed seeing a lot of repeated calls to the same methods, which can indicate some form of recursion, but possi...
10,203
[ { "from": "human", "value": "So I have a nasty stack overflow I have been trying to track down / solve for the past 8 hours or so, and I'm at the point where i think i need advice. \nThe details:\nInterestingly enough this code runs fine when called in the context of our regular winforms application -- but...
The workflow is like this: I receive a scan of a coupon with data (firstname, lastname, zip, city + misc information) on it. Before I create a new customer, I have to search the database if the customer might exist already. Now my question: What's the best way to find an existing customer, when there is no unique ID ...
When you have a workflow where you need to search for existing customers based on scanned coupon data without a unique identifier, you can utilize a combination of the information available to increase the chances of a successful match. Here are some strategies to consider: ### 1. **Full Name and Zip Code Search** - *...
13,000
[ { "from": "human", "value": "The workflow is like this:\n\nI receive a scan of a coupon with data (firstname, lastname, zip, city + misc information) on it.\nBefore I create a new customer, I have to search the database if the customer might exist already.\n\nNow my question: What's the best way to find an ...
I have an existing application that is written in C++ for Windows. This application uses the Win32 CryptoAPI to generate a TripleDES session key for encrypting/decrypting data. We're using the exponent of one trick to export the session key out as a blob, which allows the blob to be stored somewhere in a decrypted form...
It sounds like you're dealing with some intricate interoperability issues between your existing C++ application that uses the Win32 CryptoAPI and your new .NET application. When transitioning cryptographic keys between these two environments, it's crucial to ensure that the key formats and any padding or encoding are h...
9,447
[ { "from": "human", "value": "I have an existing application that is written in C++ for Windows. This application uses the Win32 CryptoAPI to generate a TripleDES session key for encrypting/decrypting data. We're using the exponent of one trick to export the session key out as a blob, which allows the blob t...
We have a recurring problem at my company with build breaks in our Flex projects. The problem primarily occurs because the build that the developers do on their local machines is fundamentally different from the build that occurs on the build machine. The devs are building the projects using FlexBuilder/eclipse and the...
The challenge you're facing is common in environments where builds are performed on different platforms or through different tools. Here are a few approaches that other teams have successfully implemented to mitigate these issues: ### 1. **Use a Build Tool that Integrates with IDEs** Consider using a build tool that ...
9,656
[ { "from": "human", "value": "We have a recurring problem at my company with build breaks in our Flex projects. The problem primarily occurs because the build that the developers do on their local machines is fundamentally different from the build that occurs on the build machine. The devs are building the p...
I need to determine the current year in Java as an integer. I could just use java.util.Date(), but it is deprecated.
You can obtain the current year as an integer in Java using the `java.time` package, which was introduced in Java 8. The `java.time` package provides a modern and comprehensive API for date and time handling. Specifically, you can use the `LocalDate` class to achieve this. Here’s how you can do it: ```java import java...
15,701
[ { "from": "human", "value": "I need to determine the current year in Java as an integer. I could just use java.util.Date(), but it is deprecated.\n" }, { "from": "gpt", "value": "You can obtain the current year as an integer in Java using the `java.time` package, which was introduced in Java 8. ...
When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with grep and sed. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the best tools?
When dealing with XML data in shell scripting, you have several command-line tools at your disposal that can help you parse and manipulate XML files effectively. Here are some of the best options: 1. **xmllint**: This is a command-line XML tool that is part of the libxml2 library. It can parse, validate, and format XM...
13,029
[ { "from": "human", "value": "When doing shell scripting, typically data will be in files of single line records like csv. It's really simple to handle this data with grep and sed. But I have to deal with XML often, so I'd really like a way to script access to that XML data via the command line. What are the...
I seem to be getting a strange error when I run my tests in rails, they are all failing for the same reason and none of the online documentation seems particularly helpful in regards to this particular error: SQLite3::SQLException: cannot rollback - no transaction is active This error is crippling my ability to test m...
The error message you're encountering, `SQLite3::SQLException: cannot rollback - no transaction is active`, typically indicates that there is an issue with the database transaction handling in your tests. Here are a few steps you can take to troubleshoot and resolve this issue: 1. **Check Test Database Configuration**...
13,353
[ { "from": "human", "value": "I seem to be getting a strange error when I run my tests in rails, they are all failing for the same reason and none of the online documentation seems particularly helpful in regards to this particular error:\nSQLite3::SQLException: cannot rollback - no transaction is active\n\n...
How do I iterate over a range of numbers in Bash when the range is given by a variable? I know I can do this (called "sequence expression" in the Bash documentation): for i in {1..5}; do echo $i; done Which gives: 1 2 3 4 5 Yet, how can I replace either of the range endpoints with a variable? This doesn't work: ...
In Bash, you cannot directly use variable expansion within the brace expansion `{}`. Instead, you can use a different approach to iterate over a range defined by variables. One common method is to use a C-style `for` loop. Here's how you can do it: ```bash START=1 END=5 for (( i=START; i<=END; i++ )); do echo $i...
17,015
[ { "from": "human", "value": "How do I iterate over a range of numbers in Bash when the range is given by a variable?\nI know I can do this (called \"sequence expression\" in the Bash documentation):\nfor i in {1..5}; do echo $i; done\n\nWhich gives:\n\n1 \n2 \n3 \n4 \n5\n\nYet, how can I replace either of t...
Yup, long title. I've been programming in PHP for the last 6 years or so for work and personal projects, but I've got an idea for a desktop app (which incidentally, uses a web REST api). I'm debating on how to approach this - I've got some experience in Java, C++, Perl and Python, but have never had the chance or oppo...
Given your background and requirements, you have several viable options for developing your desktop app. Here’s a breakdown of some approaches, considering your familiarity with programming languages and frameworks: ### 1. **Electron (JavaScript, HTML, CSS)** - **Pros**: - You can leverage your web development skil...
12,726
[ { "from": "human", "value": "Yup, long title. I've been programming in PHP for the last 6 years or so for work and personal projects, but I've got an idea for a desktop app (which incidentally, uses a web REST api).\nI'm debating on how to approach this - I've got some experience in Java, C++, Perl and Pyt...
We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to "replay" the transaction, we use HTTP codes to forward you to get a new transaction ticket. This works fine for a majority of users....
Download accelerators, also known as download managers, are software applications designed to enhance and optimize the downloading of files from the internet. They achieve faster downloads primarily through a few key techniques: 1. **Multiple Connections**: Download accelerators split files into smaller segments and d...
10,800
[ { "from": "human", "value": "We require all requests for downloads to have a valid login (non-http) and we generate transaction tickets for each download. If you were to go to one of the download links and attempt to \"replay\" the transaction, we use HTTP codes to forward you to get a new transaction ticke...
Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own? To be clear - I don't want to call assembly code from C# - I just want to be able to assemble code from instructions and ge...
There isn’t a widely-known, dedicated x86 assembler library that can be directly invoked from C# to convert x86 assembly instructions into a byte array. However, you have a few options to achieve your goal: ### 1. **Using an Existing Assembler with Process Invocation** You could use an existing assembler like NASM (N...
10,726
[ { "from": "human", "value": "Is there such a thing as an x86 assembler that I can call through C#? I want to be able to pass x86 instructions as a string and get a byte array back. If one doesn't exist, how can I make my own?\nTo be clear - I don't want to call assembly code from C# - I just want to be able...
I'm reading data from a table( from a MySQL Database) with Hibernate SQL Query. The thing is, the table contains a colum that is mapped to a char in Hibernate Model, and sometimes this column is empty. And I suppose this is where my exception comes from. How can I map a colum of char to my hibernate model without getti...
The exception you are encountering (`java.lang.StringIndexOutOfBoundsException: String index out of range: 0`) suggests that the empty string stored in your database is being treated in a way that is causing an issue when trying to access its characters. Specifically, it seems like there might be a code path that is tr...
13,708
[ { "from": "human", "value": "I'm reading data from a table( from a MySQL Database) with Hibernate SQL Query.\nThe thing is, the table contains a colum that is mapped to a char in Hibernate Model, and sometimes this column is empty.\nAnd I suppose this is where my exception comes from.\nHow can I map a colum...
I have a Boost unit test case which causes the object under test to throw an exception (that's the test, to cause an exception). How do I specify in the test to expect that particular exception. I can specify that the test should have a certain number of failures by using BOOST_AUTO_TEST_CASE_EXPECTED_FAILURES but that...
In Boost Test, you can use `BOOST_CHECK_THROW` or `BOOST_REQUIRE_THROW` to specify that you expect a particular exception to be thrown during your test. This approach allows you to explicitly assert that an exception occurs at a specific point in your test and will not be counted as a failure if the exception is thrown...
16,169
[ { "from": "human", "value": "I have a Boost unit test case which causes the object under test to throw an exception (that's the test, to cause an exception). How do I specify in the test to expect that particular exception.\nI can specify that the test should have a certain number of failures by using BOOST...
Can someome provide code or pseudo-code for how the paging links on StackOverflow are generated? I keep racking my brain but can't think of a decent way to build the dynamic links that always show the 2 pages around the current, plus the first and last. Example: 1 ... 5 6 7 ... 593
Certainly! Generating pagination links that show the current page along with surrounding pages, plus the first and last pages, requires some simple logic. Below is a structured way to create a pagination system that fulfills your requirements. ### Key Requirements: 1. Show the first page (1). 2. Show the last page (N)...
12,019
[ { "from": "human", "value": "Can someome provide code or pseudo-code for how the paging links on StackOverflow are generated?\nI keep racking my brain but can't think of a decent way to build the dynamic links that always show the 2 pages around the current, plus the first and last.\nExample: 1 ... 5 6 7 .....
What is the best way to write a Safari extension? I've written a couple XUL extensions for Firefox, and now I'd like to write versions of them for Safari. Is there a way that would allow you to add buttons or forms to the browser UI, since this is not possible with an Input manager or Service menu?
Writing a Safari extension is quite different from developing XUL extensions for Firefox, especially given the architecture changes in both browsers over the years. Since Safari now uses a different model for extensions, here's a step-by-step guide to help you create a Safari extension and add buttons or forms to the b...
10,958
[ { "from": "human", "value": "What is the best way to write a Safari extension? I've written a couple XUL extensions for Firefox, and now I'd like to write versions of them for Safari. Is there a way that would allow you to add buttons or forms to the browser UI, since this is not possible with an Input mana...
I have a repository of files which are unrelated to each other but are common to multiple projects. Each project might only need a subset of these files. For example: /myRepo: /jquery.js /jquery.form.js /jquery.ui.js Project A requires jquery.js and jquery.form.js, whereas Project B requires jquery.js and ...
In SVN (Subversion), the behavior you described—fetching updates for only specific files without introducing new files that are not already checked out in the working copy—is not natively supported. When you run `svn update`, it will bring in all changes for files that are version-controlled, including adding any new f...
10,306
[ { "from": "human", "value": "I have a repository of files which are unrelated to each other but are common to multiple projects. Each project might only need a subset of these files. For example:\n/myRepo:\n /jquery.js\n /jquery.form.js\n /jquery.ui.js\n\nProject A requires jquery.js and jquery.for...
I'm creating a new mail item, in C# VS-2008 outlook 2007, and attaching a file. The first issue is that I don't see an attachment area under the subject line showing the attachment. If I send the e-mail its properties show that there is an attachment and the e-mail size has grown by the attachment amount. I just can...
It sounds like you're facing an issue where the attachment isn't visually represented in the Outlook mail item window, despite it being present and associated correctly. The code you've provided seems generally correct for attaching a file, so the issue might relate to the way you're handling the attachment or how Outl...
12,902
[ { "from": "human", "value": "I'm creating a new mail item, in C# VS-2008 outlook 2007, and attaching a file. The first issue is that I don't see an attachment area under the subject line showing the attachment. If I send the e-mail its properties show that there is an attachment and the e-mail size has gr...
I am trying to optimize some stored procedures on a SQL Server 2000 database and when I try to use SQL Profiler I get an error message "In order to run a trace against SQL Server you have to be a member of sysadmin fixed server role.". It seems that only members of the sysadmin role can run traces on the server (someth...
Optimizing stored procedures on SQL Server 2000 can be challenging, especially when you have limitations on permissions like you do. Since you cannot run SQL Profiler, here are several alternative approaches to profiling and optimizing your SQL code: ### 1. **Use `SET STATISTICS TIME` and `SET STATISTICS IO`** You can...
12,882
[ { "from": "human", "value": "I am trying to optimize some stored procedures on a SQL Server 2000 database and when I try to use SQL Profiler I get an error message \"In order to run a trace against SQL Server you have to be a member of sysadmin fixed server role.\". It seems that only members of the sysadmi...
When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in other programs, too (Help file systems, for example), but I've never programmed something like this myself. Now I'm curious to know what sort of ...
You're on the right track with your initial thoughts! The problem of finding similar questions or documents is a common one in information retrieval and natural language processing. Here are some common methods and algorithms that can be used to achieve this: ### 1. **Tokenization and Preprocessing** - **Tokenizati...
9,523
[ { "from": "human", "value": "When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in other programs, too (Help file systems, for example), but I've never programmed something like this myse...
I know that with mysql you can write SQL statements into a .sql file and run the file from the mysql command line like this: mysql> source script.sql How do I pass a variable to the script? For example, if I want to run a script that retrieves all the employees in a department, I want to be able to pass in the number ...
In MySQL, you cannot directly pass variables into a `.sql` script executed with the `source` command. However, there are a couple of ways to achieve similar functionality. ### Option 1: Use Prepared Statements with User-Defined Variables You can define user variables at the beginning of your script and then use thos...
8,247
[ { "from": "human", "value": "I know that with mysql you can write SQL statements into a .sql file and run the file from the mysql command line like this:\nmysql> source script.sql\n\nHow do I pass a variable to the script? For example, if I want to run a script that retrieves all the employees in a departme...
Is it possible to change the frame title when using \againframe from the Beamer package, in LaTeX? I would like to have a previous frame displayed, at a specific slide inside the frame, but with a different title this time. Thanks.
Yes, it is indeed possible to change the frame title when using the `\againframe` command in the Beamer package. You can achieve this by using a combination of the `\setbeamertemplate` command to redefine the frame title for the specific frame instance you want to show again. Here’s a step-by-step approach on how to ...
15,113
[ { "from": "human", "value": "Is it possible to change the frame title when using \\againframe from the Beamer package, in LaTeX? I would like to have a previous frame displayed, at a specific slide inside the frame, but with a different title this time.\nThanks.\n" }, { "from": "gpt", "value": "...
I just listened to the StackOverflow team's 17th podcast, and they talked so highly of ASP.NET MVC that I decided to check it out. But first, I want to be sure it's worth it. I already created a base web application (for other developers to build on) for a project that's starting in a few days and wanted to know, based...
It sounds like you're at a pivotal moment in your development journey, especially with a new project on the horizon. Let's break down the advantages of ASP.NET MVC and how it differs from traditional Web Forms, which might help you decide whether to dive in and use MVC for your new base web application. ### Key Advant...
11,006
[ { "from": "human", "value": "I just listened to the StackOverflow team's 17th podcast, and they talked so highly of ASP.NET MVC that I decided to check it out.\nBut first, I want to be sure it's worth it. I already created a base web application (for other developers to build on) for a project that's starti...
How do I have a Python script that can accept user input and how do I make it read in arguments if run from the command line?
In Python, you can accept user input in several ways, including using the `input()` function for interactive input and the `argparse` module for reading command-line arguments. Below are examples demonstrating both methods. ### Accepting User Input with `input()` You can use the `input()` function to prompt the user ...
11,644
[ { "from": "human", "value": "How do I have a Python script that can accept user input and how do I make it read in arguments if run from the command line?\n" }, { "from": "gpt", "value": "In Python, you can accept user input in several ways, including using the `input()` function for interactive...
When creating an auto updating feature for a .NET WinForms application, how does it update the DLLs and not affect the currently running application? Since the application is running during the update process, won't there be a lock on the DLLs (because those DLLs will have to be overwritten during the update).
Updating a .NET WinForms application while it's running can indeed be challenging due to file locks on DLLs and executables. When an application is running, the operating system locks the files that are currently in use, which prevents them from being overwritten. However, there are several strategies to perform update...
12,105
[ { "from": "human", "value": "When creating an auto updating feature for a .NET WinForms application, how does it update the DLLs and not affect the currently running application?\nSince the application is running during the update process, won't there be a lock on the DLLs (because those DLLs will have to b...
I need to create and add custom headers to an ASP.NET 2.0 application. The case is simulation of an SSO-login in our dev/test environment. When I try to add headers I run into the "Not supported on this platform." error. BigJim has a nice post on the subject here: http://bigjimindc.blogspot.com/2007/07/ms-kb928365-as...
Creating and adding custom headers in an ASP.NET 2.0 application can be tricky, especially when you encounter platform limitations. In your case, since you're trying to simulate a Single Sign-On (SSO) login process with custom headers, there are a few approaches you could consider. ### 1. Custom HTTP Handler One way ...
12,576
[ { "from": "human", "value": "I need to create and add custom headers to an ASP.NET 2.0 application.\nThe case is simulation of an SSO-login in our dev/test environment.\nWhen I try to add headers I run into the \"Not supported on this platform.\" \nerror. BigJim has a nice post on the subject here: \nhttp:/...
Am I missing something or is there truly no alternative (yet, I hope) to SVCUTIL.EXE for generating WCF Web service proxies?
As of my last knowledge update in October 2023, `svcutil.exe` is indeed one of the primary tools for generating WCF (Windows Communication Foundation) service proxies in .NET. However, there are alternative approaches and tools that you can use depending on your scenario: 1. **WCF Connected Services**: In Visual Studi...
15,618
[ { "from": "human", "value": "Am I missing something or is there truly no alternative (yet, I hope) to SVCUTIL.EXE for generating WCF Web service proxies? \n" }, { "from": "gpt", "value": "As of my last knowledge update in October 2023, `svcutil.exe` is indeed one of the primary tools for generat...
I was wondering if it is possible to not attach Excel sheet if it is empty, and maybe write a different comment in the email if empty. When I go to report delivery options, there's no such configuration. Edit: I'm running SQL Server Reporting Services 2005. Some possible workarounds as mentioned below: MSDN: Reporting ...
Yes, in SQL Server Reporting Services (SSRS) 2005, there isn't a built-in feature that allows you to automatically prevent sending an Excel attachment if it is empty, or change the email body conditionally based on the presence of data. However, you can implement some workarounds to achieve your goal. ### Workaround S...
13,895
[ { "from": "human", "value": "I was wondering if it is possible to not attach Excel sheet if it is empty, and maybe write a different comment in the email if empty.\nWhen I go to report delivery options, there's no such configuration.\nEdit: I'm running SQL Server Reporting Services 2005.\nSome possible work...
I have a MS Visual Studio 2005 application solution. All the code is in C. I want to measure the number of cycles taken for execution by particular functions. Is there any Win32 API which I can use to get the cycle count? I have used gettimeofday() to get time in micro seconds, but I want to know the cycles consumed.
To measure the number of CPU cycles taken by a function in a C application, you can use the `__rdtsc` intrinsic in Microsoft Visual Studio, which reads the current value of the CPU's time-stamp counter. The `RDTSC` instruction returns the number of clock cycles since the last reset of the processor, which gives you a f...
9,446
[ { "from": "human", "value": "I have a MS Visual Studio 2005 application solution. All the code is in C. I want to measure the number of cycles taken for execution by particular functions. Is there any Win32 API which I can use to get the cycle count?\nI have used gettimeofday() to get time in micro seconds,...
I am calling a WSDL web service from Python using SOAPpy. The call I need to make is to the method Auth_login. This has 2 arguments - the first, a string being the API key; the second, a custom type containing username and password. The custom type is called Auth_credentialsData which contains 2 values as stings - one ...
To call a SOAP web service that requires a custom complex type in Python using SOAPpy, you need to create an instance of that custom type rather than using a list or dictionary. In your case, the `Auth_credentialsData` is a custom type that contains the `username` and `password`. Here's how you can create and pass tha...
11,605
[ { "from": "human", "value": "I am calling a WSDL web service from Python using SOAPpy. The call I need to make is to the method Auth_login. This has 2 arguments - the first, a string being the API key; the second, a custom type containing username and password. The custom type is called Auth_credentialsData...