instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
In using our TeamCity Continuous Integration server we have uncovered some issues that we are unsure as to the best way to handle. Namely how to reference external applications that our application requires on the CI server. This was initially uncovered with a dependency on Crystal Reports, so we went and installed Cr...
When it comes to managing dependencies for applications in a Continuous Integration (CI) environment like TeamCity, there are several strategies you can consider. The goal is to create a stable and maintainable environment that minimizes issues with external dependencies. Here are some approaches you might find useful:...
12,446
[ { "from": "human", "value": "In using our TeamCity Continuous Integration server we have uncovered some issues that we are unsure as to the best way to handle. Namely how to reference external applications that our application requires on the CI server. \nThis was initially uncovered with a dependency on Cr...
Currently I run an classic (old) ASP webpage with recordset object used directly in bad old spagethi code fasion. I'm thinking of implementing a data layer in asp.net as web serivce to improve manageability. This is also a first step towards upgrading the website to asp.net. The site itself remains ASP for the moment.....
Your approach to creating a data access layer using ASP.NET Web Services is a good strategy for improving maintainability and security. By abstracting the database interactions into a separate layer, you not only enhance the manageability of your existing ASP code, but you also lay the groundwork for an eventual migrat...
7,515
[ { "from": "human", "value": "Currently I run an classic (old) ASP webpage with recordset object used directly in bad old spagethi code fasion.\nI'm thinking of implementing a data layer in asp.net as web serivce to improve manageability. This is also a first step towards upgrading the website to asp.net.\nT...
I have an ASP.NET page which has a script manager on it. <form id="form1" runat="server"> <div> <asp:ScriptManager EnablePageMethods="true" ID="scriptManager2" runat="server"> </asp:ScriptManager> </div> </form> The page overrides an abstract property to return the ScriptManager in order to ena...
The parser error you're encountering suggests that there's a mismatch between the expected type of the `ScriptManager` control and the type defined in the designer file. Specifically, the designer is generating a field for `scriptManager` that has a different type than the one you're defining in your page. ### Trouble...
13,165
[ { "from": "human", "value": "I have an ASP.NET page which has a script manager on it.\n<form id=\"form1\" runat=\"server\">\n <div>\n <asp:ScriptManager EnablePageMethods=\"true\" ID=\"scriptManager2\" runat=\"server\">\n </asp:ScriptManager>\n </div>\n</form>\n\nThe page overrides an ab...
I've found that on some occasions I can edit the source while debugging. Are there any other advantages of using the Visual Studio built-in webserver instead of a virtual directory in IIS? I'm using Windows XP on my development environment, and a local instance of IIS 5. I work on several projects, so I use multiple vi...
Using the Visual Studio built-in web server (also known as ASP.NET Development Server, or Cassini) has several advantages and disadvantages compared to using a virtual directory in IIS. Here are some key points to consider: ### Advantages of Using Visual Studio Built-in Web Server: 1. **Ease of Use**: The built-in se...
8,629
[ { "from": "human", "value": "I've found that on some occasions I can edit the source while debugging. Are there any other advantages of using the Visual Studio built-in webserver instead of a virtual directory in IIS?\nI'm using Windows XP on my development environment, and a local instance of IIS 5. I work...
I have this line in a useful Bash script that I haven't managed to translate into Python, where 'a' is a user-input number of days' worth of files to archive: find ~/podcasts/current -mindepth 2 -mtime '+`a`+' -exec mv {} ~/podcasts/old \; I am familiar with the os.name and getpass.getuser for the most general cross-p...
You're on the right track with your function to generate the list of files. However, you can simplify the process significantly in Python using the `os` and `shutil` libraries along with `pathlib`, which offers a more modern and easier-to-read approach to file system paths. To replicate the functionality of your Bash ...
11,865
[ { "from": "human", "value": "I have this line in a useful Bash script that I haven't managed to translate into Python, where 'a' is a user-input number of days' worth of files to archive:\nfind ~/podcasts/current -mindepth 2 -mtime '+`a`+' -exec mv {} ~/podcasts/old \\;\n\nI am familiar with the os.name and...
I'm looking for some insight into XNA on Xbox 360, mainly if its possible to run vector-based float mathematics on its GPU? If there's a way, can you point me into the right direction?
XNA is a framework that was developed by Microsoft for game development on Windows and Xbox 360. While XNA primarily targets high-level game development and provides a range of features to facilitate game creation, it does have some capability to utilize the GPU for more complex mathematical operations, such as vector-...
10,301
[ { "from": "human", "value": "I'm looking for some insight into XNA on Xbox 360, mainly if its possible to run vector-based float mathematics on its GPU?\nIf there's a way, can you point me into the right direction?\n" }, { "from": "gpt", "value": "XNA is a framework that was developed by Microso...
I'm working on a project using the ANTLR parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that my try/catch block won't catch it and ins...
It sounds like you're dealing with a perplexing issue related to exception handling in your ANTLR-powered parser implementation. There are a few factors that could contribute to your situation, and I'll suggest some approaches to investigate and potentially resolve the problem. ### Potential Causes and Solutions 1. *...
9,893
[ { "from": "human", "value": "I'm working on a project using the ANTLR parser library for C#. I've built a grammar to parse some text and it works well. However, when the parser comes across an illegal or unexpected token, it throws one of many exceptions. The problem is that in some cases (not all) that ...
I'm dealing with huge glassfish log files (in windows, eek!) and well ... Wordpad isn't cutting it. Are there any tools out there that can handle these log files in a more intelligent manner? Functionality that would be welcome: View all lines of a certain log level (info, warning, severe) Show logs between two times...
Dealing with large log files can indeed be a challenge, especially with simple text editors like WordPad. Here are some tools that can help you analyze and manage your GlassFish log files more effectively: 1. **LogViewer**: - LogViewer is a dedicated log file viewer that supports large files and offers functionalit...
14,200
[ { "from": "human", "value": "I'm dealing with huge glassfish log files (in windows, eek!) and well ... Wordpad isn't cutting it. \nAre there any tools out there that can handle these log files in a more intelligent manner? Functionality that would be welcome:\n\nView all lines of a certain log level (info, ...
Is it possible to find the foreach index? in a for loop as follows: for ($i = 0; $i < 10; ++$i) { echo $i . ' '; } $i will give you the index. Do I have to use the for loop or is there some way to get the index in the foreach loop?
Yes, in PHP, you can obtain the index while using a `foreach` loop. There are two common ways to achieve this: ### Method 1: Using a reference variable You can use a reference variable to capture the key (index) of the current element while iterating through the array. Here's an example: ```php $array = ['a', 'b', '...
16,369
[ { "from": "human", "value": "Is it possible to find the foreach index?\nin a for loop as follows:\nfor ($i = 0; $i < 10; ++$i) {\n echo $i . ' ';\n}\n\n$i will give you the index.\nDo I have to use the for loop or is there some way to get the index in the foreach loop?\n" }, { "from": "gpt", "...
I'm trying to get an expect script to work, and when I use the -re flag (to invoke regular expression parsing), the 'timeout' keyword seems to no longer work. When the following script is run, I get the message 'timed out at step 1', then 'starting step 2' and then it times out but does NOT print the 'timed out at step...
The issue you're encountering with the `expect -re` construct in your script is due to how `expect` handles regular expressions. When using `-re`, it expects a regular expression and handles the matching differently. Specifically, the `timeout` keyword does not work as you might expect in that context. When you're usi...
16,402
[ { "from": "human", "value": "I'm trying to get an expect script to work, and when I use the -re flag (to invoke regular expression parsing), the 'timeout' keyword seems to no longer work. When the following script is run, I get the message 'timed out at step 1', then 'starting step 2' and then it times out ...
How to print line numbers to the log. Say when outputting some information to the log, I also want to print the line number where that output is in the source code. As we can see in the stack trace, it displays the line number where the exception has occurred. Stack trace is available on the exception object. Other alt...
To print line numbers to your log output in Python, you can use the `logging` module, which provides a flexible framework for emitting log messages from your Python programs. By customizing the log formatting, you can include the current line number alongside the log messages. Here are a few ways you can accomplish th...
14,057
[ { "from": "human", "value": "How to print line numbers to the log. Say when outputting some information to the log, I also want to print the line number where that output is in the source code. As we can see in the stack trace, it displays the line number where the exception has occurred. Stack trace is ava...
When java was young, people were excited about writing applets. They were cool and popular, for a little while. Now, I never see them anymore. Instead we have flash, javascript, and a plethora of other web app-building technologies. Why don't sites use java applets anymore? I'm also curious: historically, why do you...
Java applets were indeed once a popular technology for building interactive applications on the web, but several factors contributed to their decline and eventual disappearance from mainstream web development. Here are some key reasons why Java applets are no longer used widely, along with historical context and potent...
10,791
[ { "from": "human", "value": "When java was young, people were excited about writing applets. They were cool and popular, for a little while. Now, I never see them anymore. Instead we have flash, javascript, and a plethora of other web app-building technologies.\nWhy don't sites use java applets anymore?\...
Could Silverlight be used for the same things as jQuery, or are they intended for different things? For example, vb.net could be used for the same stuff as C# while C# is intended for different things than what JavaScript is. Is Silverlight and jQuery like vb.net and C#, or more like C# and JavaScript?
Silverlight and jQuery are intended for different purposes, much like the relationship between C# and JavaScript, rather than between VB.NET and C#. ### Overview of Silverlight and jQuery: 1. **Silverlight**: - Silverlight was a framework developed by Microsoft for building rich internet applications (RIAs) that ...
13,457
[ { "from": "human", "value": "Could Silverlight be used for the same things as jQuery, or are they intended for different things?\nFor example, vb.net could be used for the same stuff as C# while C# is intended for different things than what JavaScript is. Is Silverlight and jQuery like vb.net and C#, or mor...
I have Eclipse setup with PyDev and love being able to debug my scripts/apps. I've just started playing around with Pylons and was wondering if there is a way to start up the paster server through Eclipse so I can debug my webapp?
Yes, you can set up Eclipse with PyDev to debug your Pylons application by running the Paster server in debug mode. Here's a step-by-step guide to help you achieve this: ### Step 1: Configure Your Pylons Project Make sure your Pylons application is correctly set up and that you can run it using Paster from the command...
14,405
[ { "from": "human", "value": "I have Eclipse setup with PyDev and love being able to debug my scripts/apps. I've just started playing around with Pylons and was wondering if there is a way to start up the paster server through Eclipse so I can debug my webapp?\n" }, { "from": "gpt", "value": "Ye...
When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am touching a live scary server. How can I make it automatically detect that I have ssh'ed somewhere, and if that somewhere is on a specific list, ch...
To automatically change the color scheme of Terminal.app when you SSH into a specific list of remote servers, you can create a function in your shell configuration file (like `.bashrc`, `.bash_profile`, or `.zshrc`) that checks if the SSH connection is to one of those servers, and then set the appropriate color scheme....
13,619
[ { "from": "human", "value": "When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am touching a live scary server. \nHow can I make it automatically detect that I have ssh'ed somewhere, and i...
I have a question about loops in flash.... In a tile game I'm making a have a mini map of the whole level. The way it renders the map is a function with a for loop in another for loop. It cycles through each tile position and attaches a map piece (basically a 3x3 pixel square) which is colored according to what the til...
Hi Matt, Rendering a mini-map in a tile-based game using nested loops can indeed become slow as the size of the level increases. Here are several approaches you can consider to optimize the performance of your mini-map rendering: 1. **Use BitmapData for Rendering**: Instead of creating individual map pieces as separa...
12,737
[ { "from": "human", "value": "I have a question about loops in flash....\nIn a tile game I'm making a have a mini map of the whole level. The way it renders the map is a function with a for loop in another for loop. It cycles through each tile position and attaches a map piece (basically a 3x3 pixel square) ...
This is not specific to any language, it´s just about best practices. I am using JPA/Hibernate (but it could be any other ORM solution) and I would like to know how do you guys deal with this situation: Let´s suppose that you have a query returning something that is not represented by any of your domain classes. Do you...
When working with JPA/Hibernate (or any other ORM), there are several strategies you can consider for handling queries that return data not directly mapped to your domain classes. Here’s a breakdown of the most common approaches along with best practices: ### 1. **DTO (Data Transfer Objects)** Creating specific DTOs ...
13,080
[ { "from": "human", "value": "This is not specific to any language, it´s just about best practices. I am using JPA/Hibernate (but it could be any other ORM solution) and I would like to know how do you guys deal with this situation:\nLet´s suppose that you have a query returning something that is not represe...
I am looking into internationalizing a Flex application I am working on and I am curious if there are any best practices or recommendations for doing so. Googling for such information results in a handful of small articles and blog posts, each about doing it differently, and the advantages and disadvantages are not exa...
Internationalizing a Flex application to support multiple languages (specifically English and French for Canadian audiences) is a great way to enhance user experience. Below are best practices and recommendations to help you achieve this effectively: ### 1. Resource Bundles Use resource bundles to manage the text in y...
12,574
[ { "from": "human", "value": "I am looking into internationalizing a Flex application I am working on and I am curious if there are any best practices or recommendations for doing so.\nGoogling for such information results in a handful of small articles and blog posts, each about doing it differently, and th...
I need to create and copy to the clipboard some RichText with standard "formatting" like bold/italics, indents and the like. The way I'm doing it now seems kind of inelegant... I'm creating a RichTextBox item and applying my formatting through that like so: RichTextBox rtb = new RichTextBox(); Font boldfont = new Font...
Using a `RichTextBox` to format text in memory without displaying it on a form is a common approach, but there are certainly ways to make the code more elegant and efficient. One alternative is to use the `Selection` property of the `RichTextBox` directly to apply formatting without needing to set and select text multi...
14,535
[ { "from": "human", "value": "I need to create and copy to the clipboard some RichText with standard \"formatting\" like bold/italics, indents and the like. The way I'm doing it now seems kind of inelegant... I'm creating a RichTextBox item and applying my formatting through that like so:\nRichTextBox rtb =...
Is there a way to check if the user has a different version of the CSS cached by their browser and if so force their browser to pull the new version?
Yes, there are several methods to ensure that users receive the latest version of your CSS file instead of a cached version. Here are some common approaches: ### 1. Versioning/Caching Query String One of the simplest methods is to append a version number or a timestamp to the CSS file URL. When you update the CSS, si...
11,268
[ { "from": "human", "value": "Is there a way to check if the user has a different version of the CSS cached by their browser and if so force their browser to pull the new version?\n" }, { "from": "gpt", "value": "Yes, there are several methods to ensure that users receive the latest version of yo...
I'm developing a restful Web service that runs as a servlet (using blocking IO) in Jetty. Figuring out the optimal setting for max threads seems hard. Is there a researched formula for deciding the max number of threads from some easily measurable characteristics of the rest of the setup?
Determining the optimal number of threads for a servlet container like Jetty can indeed be a challenging task, but there are some well-established principles and guidelines to help you make an informed decision. Here’s a step-by-step approach to arrive at an optimal setting for the maximum number of threads. ### Key F...
10,407
[ { "from": "human", "value": "I'm developing a restful Web service that runs as a servlet (using blocking IO) in Jetty. Figuring out the optimal setting for max threads seems hard.\nIs there a researched formula for deciding the max number of threads from some easily measurable characteristics of the rest of...
In Cocoa, if I want to loop through an NSMutableArray and remove multiple objects that fit a certain criteria, what's the best way to do this without restarting the loop each time I remove an object? Thanks, Edit: Just to clarify - I was looking for the best way, e.g. something more elegant than manually updating the i...
In Objective-C, when you want to loop through an `NSMutableArray` and remove multiple objects based on a certain criterion without restarting the loop each time an object is removed, one of the best ways to achieve this is to use a reverse loop. By iterating backward through the array, you can safely remove objects wit...
15,240
[ { "from": "human", "value": "In Cocoa, if I want to loop through an NSMutableArray and remove multiple objects that fit a certain criteria, what's the best way to do this without restarting the loop each time I remove an object?\nThanks,\nEdit: Just to clarify - I was looking for the best way, e.g. somethin...
Is it possible to integrate SSRS reports to the webforms..an example will be enough to keep me moving.
Yes, it is possible to integrate SQL Server Reporting Services (SSRS) reports into ASP.NET Web Forms applications. You can do this in several ways, but one common approach is to use the SSRS Report Viewer control or to embed reports using URL access. ### Example Using the SSRS Report Viewer Control 1. **Set Up Your S...
11,776
[ { "from": "human", "value": "Is it possible to integrate SSRS reports to the webforms..an example will be enough to keep me moving. \n" }, { "from": "gpt", "value": "Yes, it is possible to integrate SQL Server Reporting Services (SSRS) reports into ASP.NET Web Forms applications. You can do this...
I have a large classic ASP app that I have to maintain, and I repeatedly find myself thwarted by the lack of short-circuit evaluation capability. E.g., VBScript won't let you get away with: if not isNull(Rs("myField")) and Rs("myField") <> 0 then ... ...because if Rs("myField") is null, you get an error in the second...
VBScript indeed lacks short-circuit evaluation for `and` and `or` conditions, which can make it cumbersome to work with null checks and conditions in certain scenarios, as you've experienced. Unfortunately, there's no built-in support for short-circuiting in VBScript that would allow you to avoid the problem you're fac...
8,674
[ { "from": "human", "value": "I have a large classic ASP app that I have to maintain, and I repeatedly find myself thwarted by the lack of short-circuit evaluation capability. E.g., VBScript won't let you get away with:\nif not isNull(Rs(\"myField\")) and Rs(\"myField\") <> 0 then\n...\n\n...because if Rs(\...
How does one start development in Silverlight? Does one need a new IDE? or Visual studio will support?
To start development in Silverlight, you will primarily use Visual Studio, which fully supports Silverlight development. Here's a step-by-step guide to get you started: ### 1. Install the Required Tools: - **Visual Studio**: Ensure you have a version of Visual Studio that supports Silverlight development. Silverlight ...
13,655
[ { "from": "human", "value": "How does one start development in Silverlight?\nDoes one need a new IDE? or Visual studio will support?\n" }, { "from": "gpt", "value": "To start development in Silverlight, you will primarily use Visual Studio, which fully supports Silverlight development. Here's a ...
My Outlook add-in handles NewInspector event of the Inspector object, in order to display a custom form for the mail item. I can get EntryID of the CurrentItem of the Inspector object which is passed as a parameter of the event. But, the problem is that the EntryID of the current mail item is shorter than it should be,...
The issue you're experiencing with the EntryID of the mail item being shorter than expected could be due to several reasons: 1. **Context of EntryID**: The EntryID of an Outlook item can vary depending on how the item was created and the context in which it is being accessed. For example, if the mail item is being acc...
13,890
[ { "from": "human", "value": "My Outlook add-in handles NewInspector event of the Inspector object, in order to display a custom form for the mail item.\nI can get EntryID of the CurrentItem of the Inspector object which is passed as a parameter of the event. But, the problem is that the EntryID of the curre...
the mylyn plugin in Eclipse (Trac connector) contains the option to attach and then retrive the "context" of an issue. Attaching the context results in attaching a zipped XML file to the issue entry in the Trac system. However, I don't quite understand what is this context is. Initially I thought that this was all the ...
In the context of the Mylyn plugin for Eclipse, the "context" refers to a snapshot of your development environment at a specific point in time, which includes more than just open files and cursor positions. Mylyn is designed to manage task-focused programming, and the context feature is essential for providing a comple...
15,993
[ { "from": "human", "value": "the mylyn plugin in Eclipse (Trac connector) contains the option to attach and then retrive the \"context\" of an issue. Attaching the context results in attaching a zipped XML file to the issue entry in the Trac system. However, I don't quite understand what is this context is....
Our server application is listening on a port, and after a period of time it no longer accepts incoming connections. (And while I'd love to solve this issue, it's not what I'm asking about here;) The strange this is that when our app stops accepting connections on port 44044, so does IIS (on port 8080). Killing our a...
Yes, an application can potentially cause issues that affect the entire TCP/IP stack, but it's usually due to mismanagement of network resources, system resources, or kernel-level issues. Here are some common scenarios that could lead to the behavior you described: 1. **Port Exhaustion**: If your application is not pr...
14,151
[ { "from": "human", "value": "Our server application is listening on a port, and after a period of time it no longer accepts incoming connections. (And while I'd love to solve this issue, it's not what I'm asking about here;)\nThe strange this is that when our app stops accepting connections on port 44044, ...
I have a little program that I want to make open automatically when my mac is started up. Because this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there... From google, I read that I can create a .profile file in my user's home folder, and t...
Using a `.profile` file to execute commands at startup is not the right approach for launching applications with command line arguments when your Mac starts. The `.profile` file is executed for interactive shells (like Terminal sessions) but not at system startup. To achieve what you want, you can create a simple scri...
13,888
[ { "from": "human", "value": "I have a little program that I want to make open automatically when my mac is started up.\nBecause this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there...\nFrom google, I read that I can create a .p...
It is mentioned on the Systems Development Life Cycle page on Wikipedia: To manage this, a number of system development life cycle (SDLC) models have been created: waterfall, fountain, spiral, build and fix, rapid prototyping, incremental, and synchronize and stabilize. I found a few things on Google, but I felt that...
Sure! The Systems Development Life Cycle (SDLC) consists of various models that guide the process of developing software systems. Each model has its own approach to project management and software development. Here’s a brief overview of the key SDLC models you mentioned: 1. **Waterfall Model**: - The waterfall mode...
11,179
[ { "from": "human", "value": "It is mentioned on the Systems Development Life Cycle page on Wikipedia:\n\nTo manage this, a number of system development life cycle (SDLC) models have been created: waterfall, fountain, spiral, build and fix, rapid prototyping, incremental, and synchronize and stabilize.\n\nI ...
How do you do your own fonts? I don't want a heavyweight algorithm (freetype, truetype, adobe, etc) and would be fine with pre-rendered bitmap fonts. I do want anti-aliasing, and would like proportional fonts if possible. I've heard I can use Gimp to do the rendering (with some post processing?) I'm developing for an ...
Creating your own bitmap fonts for an embedded device is a great approach, especially if you're aiming for lightweight solutions without the overhead of complex font rendering libraries. Here's a step-by-step guide to creating bitmap fonts, including anti-aliasing and proportional support. ### Step 1: Design Your Font...
11,751
[ { "from": "human", "value": "How do you do your own fonts? I don't want a heavyweight algorithm (freetype, truetype, adobe, etc) and would be fine with pre-rendered bitmap fonts.\nI do want anti-aliasing, and would like proportional fonts if possible.\nI've heard I can use Gimp to do the rendering (with so...
Does anyone know how to modify an existing import specification in Microsoft Access 2007 or 2010? In older versions there used to be an Advanced button presented during the import wizard that allowed you to select and edit an existing specification. I no longer see this feature but hope that it still exists and has j...
In Microsoft Access 2007 and 2010, the process of managing import specifications has changed from previous versions. Although the "Advanced" button from older versions is no longer present during the import wizard, you can still modify existing import specifications. Here’s how you can do it: ### Modifying an Existing...
11,588
[ { "from": "human", "value": "Does anyone know how to modify an existing import specification in Microsoft Access 2007 or 2010? In older versions there used to be an Advanced button presented during the import wizard that allowed you to select and edit an existing specification. I no longer see this featur...
I am trying to get some XML data with LINQ, but running into a problem. I am using a schema, which is set in the attribute xmlns ... <CarsForSale xmlns="http://schemas.sharplogic.net/CarSales.xsd"> <CarForSale> There are many CarForSale elements. When the schema is set and I do this... XElement doc = XElement.Load(H...
The issue you're facing is due to the presence of an XML namespace in your XML document. When an XML element is defined within a namespace (as is the case in your XML), you need to account for that namespace when querying with LINQ to XML. To resolve this, you will need to create a `XNamespace` object that represents ...
16,690
[ { "from": "human", "value": "I am trying to get some XML data with LINQ, but running into a problem.\nI am using a schema, which is set in the attribute xmlns ...\n<CarsForSale xmlns=\"http://schemas.sharplogic.net/CarSales.xsd\">\n <CarForSale>\n\nThere are many CarForSale elements.\nWhen the schema is se...
I would like to be able to render a view and send it as an email, similar to what can be done with Ruby on Rails. What is the best way to do this? EDIT: My solution so far is to use a templating engine (NHaml, StringTemplate.net). It works but I would prefer not to have a second template engine in my site.
To render a view and send it as an email in a C# web application, you have several options without introducing a second templating engine. Below are some effective strategies to achieve this using standard ASP.NET features: ### 1. Use Razor Views If you're using ASP.NET Core or ASP.NET MVC, you can leverage Razor vie...
11,772
[ { "from": "human", "value": "I would like to be able to render a view and send it as an email, similar to what can be done with Ruby on Rails. What is the best way to do this?\nEDIT: My solution so far is to use a templating engine (NHaml, StringTemplate.net). It works but I would prefer not to have a secon...
This is about when a .NET remoting exception is thrown. If you take a look at MSDN, it will mention that a remoting exception is thrown when something goes wrong with remoting. If my server is not running, I get a socket exception which is fine. What I am trying to figure out is: does getting a remoting exception indic...
In .NET Remoting, a `RemotingException` can occur for several reasons, and while it often indicates a problem with the remoting communication, it does not guarantee that the server is down or unreachable. Instead, it suggests that there was an issue in the process of handling the remote call. Here are some key points t...
11,654
[ { "from": "human", "value": "This is about when a .NET remoting exception is thrown. If you take a look at MSDN, it will mention that a remoting exception is thrown when something goes wrong with remoting. If my server is not running, I get a socket exception which is fine.\nWhat I am trying to figure out i...
I am interested to know what strategies people have to keep their code AND work versioned across multiple machines. For example I have a desktop PC running XP, a macbook running OSX and VMWare running XP as well as a sales laptop for running product demos. I want to know how I can always have these in sync. Subversi...
Maintaining code and project files across multiple machines can be challenging, especially when dealing with different operating systems and the need for offline access. Here are several strategies and tools that you can use to keep your work synchronized across your various devices: 1. **Version Control Systems (VCS)...
13,389
[ { "from": "human", "value": "I am interested to know what strategies people have to keep their code AND work versioned across multiple machines. For example I have a desktop PC running XP, a macbook running OSX and VMWare running XP as well as a sales laptop for running product demos. I want to know how I...
I want to implement a two-pass cache system: The first pass generates a PHP file, with all of the common stuff (e.g. news items), hardcoded. The database then has a cache table to link these with the pages (eg "index.php page=1 style=default"), the database also stores an uptodate field, which if false causes the firs...
Implementing an efficient two-pass cache system in PHP is a great approach to reducing the server load while ensuring that dynamic content is still served appropriately. Here’s a structured way to approach this: ### 1. Basic Structure of the Cache System You can implement the two-pass system by breaking it down as fo...
12,834
[ { "from": "human", "value": "I want to implement a two-pass cache system:\n\nThe first pass generates a PHP file, with all of the common stuff (e.g. news items), hardcoded. The database then has a cache table to link these with the pages (eg \"index.php page=1 style=default\"), the database also stores an u...
I am adding a webpart to the webpart gallery as part of a feature within a solution. When the webpart is added to the gallery, the webparts Description field is being overwritten by an empty string. I have added a description to everywhere I can think of, including: The webpart itself. myWebpart.webpart <property nam...
It sounds like you've covered a lot of the key areas where descriptions can be defined for a SharePoint web part, but let's go through a few additional steps and considerations that might help resolve your issue with the description being overwritten or not displaying correctly. 1. **Check the WebPart Class**: Ensure ...
13,529
[ { "from": "human", "value": "I am adding a webpart to the webpart gallery as part of a feature within a solution.\nWhen the webpart is added to the gallery, the webparts Description field is being overwritten by an empty string. \nI have added a description to everywhere I can think of, including:\n\nThe we...
In any language really, im looking for a simple (very simple) way to control the position of a shortcut on the users desktop. I already make the assumption that Auto Arrange and Align to Grid are unchecked. Ex: The program creates the shortcut to the desktop than places it at position (450,302) on the desktop. I know ...
Controlling the exact position of a shortcut on a user's desktop can be tricky, as desktop environments (especially on Windows) can handle icons in various ways. However, if you are working on a Windows system and want to programmatically control the position of a desktop shortcut, you can use a simple approach by mani...
13,233
[ { "from": "human", "value": "In any language really, im looking for a simple (very simple) way to control the position of a shortcut on the users desktop. I already make the assumption that Auto Arrange and Align to Grid are unchecked.\nEx: The program creates the shortcut to the desktop than places it at p...
Here's the code that I'm attempting to do: public IList<IOperator> GetAll() { using (var c = new MyDataContext()) { return c.Operators.ToList(); } } Operator implements IOperator, but I'm getting the following compilation error: Cannot implicitly convert type 'System.Collections.Generic.Lis...
The error you're encountering is due to the fact that `List<Operator>` (the type returned by `c.Operators.ToList()`) cannot be implicitly converted to `IList<IOperator>`, even though `Operator` implements `IOperator`. This is a classic example of a covariance issue in C#. To resolve this, you need to project your `Ope...
15,182
[ { "from": "human", "value": "Here's the code that I'm attempting to do:\npublic IList<IOperator> GetAll()\n{\n using (var c = new MyDataContext())\n {\n return c.Operators.ToList();\n }\n}\n\nOperator implements IOperator, but I'm getting the following compilation error:\nCannot impl...
The .net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What is this function really doing? I dont understand the negative numbers that this produces. Example: Math.IEEERemainder(0, 2) = 0 Math.IEEERemainder(1, 2) = 1 Math.IEEERemainder(2, 2) = 0 Math.IEEERemainder(3, 2) = -1
The `Math.IEEERemainder(x, y)` method in the .NET Framework (as well as in other programming environments) computes the remainder of the division of `x` by `y` in a way that is consistent with IEEE floating-point arithmetic standards. The key feature of `Math.IEEERemainder(x, y)` is that it returns a result that has t...
13,662
[ { "from": "human", "value": "The .net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What is this function really doing? I dont understand the negative numbers that this produces.\nExample:\nMath.IEEERemainder(0, 2) = 0\nMath.IEEERemainder(1, 2) = 1\nMath.IEEERemaind...
I want to bind my UI against a collection of XElements and their properties on a webpage. Hypothetically, this could be for any object that represents an XML tree. I'm hoping that there might be a better way of doing this. Should I use an XPath query to get out the elements of the collection and the attribute values ...
To bind your UI against a collection of `XElement` objects in a more structured and maintainable way, you can consider a few approaches that will help you achieve better data binding without the need for complex inline code or XPath queries. ### 1. Use a Model Class Instead of working directly with `XElement`, create...
12,564
[ { "from": "human", "value": "I want to bind my UI against a collection of XElements and their properties on a webpage. Hypothetically, this could be for any object that represents an XML tree. I'm hoping that there might be a better way of doing this.\nShould I use an XPath query to get out the elements o...
I'm struggling to implement ACL in CakePHP. After reading the documentation in the cake manual as well as several other tutorials, blog posts etc, I found Aran Johnson's excellent tutorial which has helped fill in many of the gaps. His examples seem to conflict with others I've seen though in a few places - specifica...
Implementing Access Control Lists (ACL) in CakePHP can be a bit challenging at first, especially when it comes to understanding the structure of Access Request Objects (AROs) and Access Control Objects (ACOs). Here are some tips to help clarify the structure and implementation of AROs and ACOs in CakePHP: ### Understa...
8,915
[ { "from": "human", "value": "I'm struggling to implement ACL in CakePHP. After reading the documentation in the cake manual as well as several other tutorials, blog posts etc, I found Aran Johnson's excellent tutorial which has helped fill in many of the gaps. His examples seem to conflict with others I'v...
I need to consume an external web service from my VB6 program. I want to be able to deploy my program without the SOAP toolkit, if possible, but that's not a requirement. I do not have the web service source and I didn't create it. It is a vendor-provided service. So outside of the SOAP toolkit, what is the best way to...
Consuming a web service from a VB6 application without relying on the SOAP toolkit can be achieved by utilizing various approaches. Below are some options you can consider: ### 1. Using Microsoft XMLHTTP You can use the `MSXML2.ServerXMLHTTP` or `MSXML2.XMLHTTP` object to make HTTP requests directly to the web servic...
11,589
[ { "from": "human", "value": "I need to consume an external web service from my VB6 program. I want to be able to deploy my program without the SOAP toolkit, if possible, but that's not a requirement. I do not have the web service source and I didn't create it. It is a vendor-provided service.\nSo outside of...
I have two tables, Book and Tag, and books are tagged using the association table BookTag. I want to create a report that contains a list of books, and for each book a list of the book's tags. Tag IDs will suffice, tag names are not necessary. Example: Book table: Book ID | Book Name 28 | Dracula BookTag table: B...
In SQL Server 2005, you can achieve your desired output without using user-defined functions or stored procedures by utilizing the `FOR XML PATH` trick. This technique allows you to aggregate the tag IDs into a single string for each book. Below is an example SQL query that illustrates how to do this: ```sql SELECT ...
15,624
[ { "from": "human", "value": "I have two tables, Book and Tag, and books are tagged using the association table BookTag. I want to create a report that contains a list of books, and for each book a list of the book's tags. Tag IDs will suffice, tag names are not necessary.\nExample:\nBook table:\nBook ID | B...
I'm trying to setup a new computer to synchronize with my SVN repository that's hosted with cvsdude.com. I get this error: ![SVN Error][1] - removed image shack image that had been replaced by an advert Here's what I did (these have worked in the past): Downloaded and installed TortoiseSVN Created a new folder C:\aspw...
It sounds like you're experiencing an issue with TortoiseSVN connecting to your Subversion repository hosted on cvsdude.com, even though you can access the repository via a web browser. Here are some steps you can take to troubleshoot and resolve the issue: 1. **Check SVN URL Format**: Make sure the SVN URL is correct...
12,955
[ { "from": "human", "value": "I'm trying to setup a new computer to synchronize with my SVN repository that's hosted with cvsdude.com.\nI get this error:\n![SVN Error][1] - removed image shack image that had been replaced by an advert\nHere's what I did (these have worked in the past):\n\nDownloaded and inst...
I'm working on some code for a loosely coupled cluster. To achieve optimal performance during jobs, I have the cluster remap its data each time a child enters or exits. This will eventually be made optional, but for now it performs its data balancing by default. My balancing is basically just making sure that each chil...
Your current approach is indeed \( O(n^2) \), as you've correctly identified. This means that it will scale quadratically with the number of children, which could lead to performance issues if the number of children becomes large. Fortunately, there's a more efficient way to redistribute data that can bring your comple...
13,640
[ { "from": "human", "value": "I'm working on some code for a loosely coupled cluster. To achieve optimal performance during jobs, I have the cluster remap its data each time a child enters or exits. This will eventually be made optional, but for now it performs its data balancing by default. My balancing is ...
Do you know of any compilers that only requires one or two clicks on the source code to compile? Having to configure it to do it doesn't count, nor does having to go to a terminal and write a word or two. Extra points are given if you can give your own view as to why so few compilers have a gui included, or just a send...
There are several compilers and integrated development environments (IDEs) that allow for quick compilation with minimal clicks, usually targeting specific programming languages. Here are a few that might fit your requirements: 1. **Code::Blocks**: - This is a free, open-source IDE that supports multiple compilers....
10,426
[ { "from": "human", "value": "Do you know of any compilers that only requires one or two clicks on the source code to compile? Having to configure it to do it doesn't count, nor does having to go to a terminal and write a word or two.\nExtra points are given if you can give your own view as to why so few com...
This is my first real question of need for any of those Gridview experts out there in the .NET world. I an creating a Gridview from codebehind and I am holding a bunch of numerical data in the columns. Although, I do add the comma in the number fields from codebehind. When I load it to the Gridview, I have the sortin...
When dealing with numerical data in a GridView in ASP.NET, and especially when sorting is enabled, it's important to ensure that the data is treated as numeric types rather than strings. Since you're adding commas for formatting, the GridView sees the values as strings, which leads to alphabetical sorting instead of nu...
9,159
[ { "from": "human", "value": "This is my first real question of need for any of those Gridview experts out there in the .NET world.\nI an creating a Gridview from codebehind and I am holding a bunch of numerical data in the columns. Although, I do add the comma in the number fields from codebehind. When I ...
I would like to have information about the icons which are displayed alongside the site URLs on a web browser. Is this some browser specific feature? Where do we specify the icon source, ie, is it in some tag on the web page itself ?
The icons displayed alongside site URLs in web browsers are commonly referred to as "favicons." Favicons are small images that represent a website and are typically shown in the browser tab, bookmark list, or address bar, depending on the browser. ### Favicon Specifications: 1. **Basic Implementation:** - To spec...
13,492
[ { "from": "human", "value": "I would like to have information about the icons which are displayed alongside the site URLs on a web browser. Is this some browser specific feature? Where do we specify the icon source, ie, is it in some tag on the web page itself ?\n" }, { "from": "gpt", "value": "...
I am trying to find a way to disable Design / Split views from appearing in Visual Studio. I figure there's no way to completely disable it, but I still can't seem to find a way to remove the shortcut (F7), or remove the buttons from the bottom bar.
In Visual Studio, while you cannot completely disable the Design or Split views for Windows Forms or WPF applications, you can modify your settings to prevent accidental switching to these views. Here are a few options you can try to minimize the likelihood of using the Design or Split views: ### 1. Remove or Remap Sh...
11,788
[ { "from": "human", "value": "I am trying to find a way to disable Design / Split views from appearing in Visual Studio. I figure there's no way to completely disable it, but I still can't seem to find a way to remove the shortcut (F7), or remove the buttons from the bottom bar.\n" }, { "from": "gpt"...
Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?
Learning Python, especially with a focus on the Django framework, can be highly beneficial for several reasons, even if you're currently developing in the .NET environment with C#. Here are some factors to consider: ### 1. **Versatility of Python:** - **General-Purpose Language:** Python is widely used in various f...
13,772
[ { "from": "human", "value": "Currently I am developing in the .Net environment using C# but I want to know whether it is worth learning python. I'm thinking of learning the Django framework. What is better?\n" }, { "from": "gpt", "value": "Learning Python, especially with a focus on the Django f...
What WPF Calendar control would you recommend? I am looking for something that will let me display a variable amount of weeks potentially spanning multiple months.
For a WPF application where you need a calendar control that can display a variable amount of weeks potentially spanning multiple months, you might consider the following options: 1. **WPF Toolkit**: The WPF Toolkit includes a `Calendar` control that can be customized to display a range of weeks. You can manipulate th...
14,903
[ { "from": "human", "value": "What WPF Calendar control would you recommend? I am looking for something that will let me display a variable amount of weeks potentially spanning multiple months.\n" }, { "from": "gpt", "value": "For a WPF application where you need a calendar control that can disp...
Does anyone know whether there's a way to mock Entity Data Provider so Unit Tests don't hit the live data? I found this blog but it seems the project hasn't been released: http://www.chrisdoesdev.com/index.php/archives/62 Thanks
To mock the Entity Data Provider (EDP) in your unit tests and avoid hitting the live database, you can use various mocking frameworks. Here are some approaches you can consider: ### 1. **Use a Mocking Framework** You can use a mocking framework like Moq, NSubstitute, or FakeItEasy to create mock instances of your data...
9,043
[ { "from": "human", "value": "Does anyone know whether there's a way to mock Entity Data Provider so Unit Tests don't hit the live data? I found this blog but it seems the project hasn't been released: \nhttp://www.chrisdoesdev.com/index.php/archives/62\nThanks\n" }, { "from": "gpt", "value": "To...
I've been given the task of doing some work customizing an artist's space in MySpace. It seems that you sort of hack the HTML you want into your edit profile page (which has several empty boxes). The MySpace page, it seems, is already HTML so you can only hack into that. Suggested "tweaks" include incomplete HTML code ...
Customizing MySpace pages was indeed a unique challenge, particularly because of the way MySpace allowed users to add HTML and CSS to their profiles. Here's some insight and information about customizing MySpace pages and what you might expect: ### Understanding MySpace Customization 1. **HTML and CSS Customization**...
10,956
[ { "from": "human", "value": "I've been given the task of doing some work customizing an artist's space in MySpace. It seems that you sort of hack the HTML you want into your edit profile page (which has several empty boxes). The MySpace page, it seems, is already HTML so you can only hack into that. Suggest...
I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup. Any suggestions when taking this approach? when I implemented this technique and step into my app, just before the server returns my list it hits the get of each property that ...
When implementing lazy loading in a WCF Service API, you face several challenges due to the way WCF serializes objects. By default, WCF serializes the entire object graph, which can inadvertently trigger lazy loading, resulting in performance issues and unintended data retrieval. Here’s a deeper dive into the concerns ...
5,597
[ { "from": "human", "value": "I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup.\nAny suggestions when taking this approach?\n\nwhen I implemented this technique and step into my app, just before the server returns my...
Has anyone tried the ActiveRecord Intro Sample with C# 3.5? I somehow have the feeling that the sample is completely wrong or just out of date. The XML configuration is just plain wrong: <add key="connection.connection_string" value="xxx" /> should be : <add key="hibernate.connection.connection_string" value="xxx" /> ...
It seems you're running into a few issues with the ActiveRecord sample and NHibernate configuration in a C# 3.5 environment. Here are a few suggestions that might help you troubleshoot and resolve these problems: 1. **Configuration Key Naming**: You are correct that the naming conventions for configuration keys in NHi...
13,382
[ { "from": "human", "value": "Has anyone tried the ActiveRecord Intro Sample with C# 3.5?\nI somehow have the feeling that the sample is completely wrong or just out of date. The XML configuration is just plain wrong:\n<add key=\"connection.connection_string\" value=\"xxx\" />\n\nshould be :\n<add key=\"hibe...
I'm working on a Windows Forms (.NET 3.5) application that has a built-in exception handler to catch any (heaven forbid) exceptions that may arise. I'd like the exception handler to be able to prompt the user to click a Send Error Report button, which would then cause the app to send an email to my FogBugz email addres...
To implement an exception handler that can prompt users to send an error report via email in a Windows Forms (.NET 3.5) application, you can follow these steps. Below, I will outline how to catch exceptions, display a prompt for sending an error report, and send an email using SMTP. ### Step 1: Implement a Global Exce...
9,507
[ { "from": "human", "value": "I'm working on a Windows Forms (.NET 3.5) application that has a built-in exception handler to catch any (heaven forbid) exceptions that may arise. I'd like the exception handler to be able to prompt the user to click a Send Error Report button, which would then cause the app to...
We are using standard items such as Hard Disk and CPU ID to lock our software licenses to physical hardware. How can we reduce the risk of customers installing onto a virtual machine and then cloning the virtual machine, bypassing our licensing?
To mitigate the risk of customers installing your software on a virtual machine (VM) and then cloning it, you can implement a multi-faceted approach to licensing that focuses on unique system characteristics and incorporates validation mechanisms. Here are several strategies: 1. **Hardware Fingerprinting**: - Combi...
11,411
[ { "from": "human", "value": "We are using standard items such as Hard Disk and CPU ID to lock our software licenses to physical hardware. How can we reduce the risk of customers installing onto a virtual machine and then cloning the virtual machine, bypassing our licensing?\n" }, { "from": "gpt", ...
Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A "vanilla" Django 1.0 appliance where postgresql can be installed manually would also do.
Finding a specific VMware appliance for Django 1.0 with PostgreSQL, Apache, and mod_python may be challenging, especially considering that Django 1.0 is quite old and no longer supported. However, you can create your own customized VMware appliance by following these steps: 1. **Install a Base Operating System**: Star...
14,136
[ { "from": "human", "value": "Does anyone know of a Django 1.0 + postgresql + apache + mod_python VMware appliance? A \"vanilla\" Django 1.0 appliance where postgresql can be installed manually would also do.\n" }, { "from": "gpt", "value": "Finding a specific VMware appliance for Django 1.0 with...
We have a 4 server cluster running ASP.NET web application using ASP.NET State Server Service for session. On one of the 4 servers ASP.NET State Server Service is running and other servers are configured to look at this. Very often we have to patch the servers, and applying patch on the State Server requires few minute...
ASP.NET State Server Service does not inherently support clustering or built-in failover capabilities. It's designed for single-instance session state management, and it doesn't provide redundancy or automatic failover features like you might find in a full-fledged database or distributed cache system. However, there ...
13,285
[ { "from": "human", "value": "We have a 4 server cluster running ASP.NET web application using ASP.NET State Server Service for session. On one of the 4 servers ASP.NET State Server Service is running and other servers are configured to look at this. Very often we have to patch the servers, and applying patc...
Take the following two lines of code: for (int i = 0; i < some_vector.size(); i++) { //do stuff } And this: for (some_iterator = some_vector.begin(); some_iterator != some_vector.end(); some_iterator++) { //do stuff } I'm told that the second way is preferred. Why exactly is this?
The second method of iterating over a container (like a vector) using iterators is often preferred for several reasons: 1. **Abstraction of Underlying Container**: Using iterators allows you to abstract away the underlying structure of the container. Whether you’re iterating over a `std::vector`, `std::list`, or any o...
14,597
[ { "from": "human", "value": "Take the following two lines of code:\nfor (int i = 0; i < some_vector.size(); i++)\n{\n //do stuff\n}\n\nAnd this:\nfor (some_iterator = some_vector.begin(); some_iterator != some_vector.end();\n some_iterator++)\n{\n //do stuff\n}\n\nI'm told that the second way is pr...
I have an application in which a gecko browser is embedded. The application is crashing when I try to access any https url's because nss is not properly initialised at this point. The crash is in PK11_TokenExists(). I want to block my browser from rendering https sites. If a user clicks on a https link I can block that...
To block HTTPS URLs in your embedded Gecko browser application, you'll need to implement a more comprehensive check when a user navigates to any URL. Since you want to prevent the application from attempting to load any HTTPS URLs at all, you can do this by intercepting the URL before it gets processed. Here's a gener...
10,162
[ { "from": "human", "value": "I have an application in which a gecko browser is embedded. The application is crashing when I try to access any https url's because nss is not properly initialised at this point. The crash is in PK11_TokenExists(). I want to block my browser from rendering https sites. If a use...
I'm trying to create a new Excel file using jxl, but am having a hard time finding examples in their API documentation and online.
Creating a new Excel file using the jxl (Java Excel API) library is relatively straightforward. Below is a simple example that demonstrates how to create a new Excel file and write some data into it. ### Step-by-step Example: 1. **Add jxl Library to Your Project:** Ensure you have the jxl library in your project's...
13,411
[ { "from": "human", "value": "I'm trying to create a new Excel file using jxl, but am having a hard time finding examples in their API documentation and online.\n" }, { "from": "gpt", "value": "Creating a new Excel file using the jxl (Java Excel API) library is relatively straightforward. Below i...
It's gotta be free. It's hobby, after all, not a business!. Creating for-profit software isn't an issue, but anything that requires a hardware mod is out.
It sounds like you're looking for free software tools or resources that support hobby projects without the need for hardware modifications. Here are a few suggestions that might suit your needs: ### Software Development 1. **Visual Studio Code**: A powerful and free code editor that supports a wide range of programmin...
14,668
[ { "from": "human", "value": "It's gotta be free. It's hobby, after all, not a business!. Creating for-profit software isn't an issue, but anything that requires a hardware mod is out.\n" }, { "from": "gpt", "value": "It sounds like you're looking for free software tools or resources that suppor...
Is it possible to do something like this? var pattern = /some regex segment/ + /* comment here */ /another segment/; Or do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.
In JavaScript, you cannot directly concatenate regular expression literals using the `+` operator. The syntax you've proposed will result in a syntax error because comments cannot be used in that context with the regex literal. If you want to construct a regex in multiple parts and include comments, you'll need to use...
17,233
[ { "from": "human", "value": "Is it possible to do something like this?\nvar pattern = /some regex segment/ + /* comment here */\n /another segment/;\n\nOr do I have to use new RegExp() syntax and concatenate a string? I'd prefer to use the literal as the code is both more self-evident and concise.\n" }...
In my browsings amongst the Internet, I came across this post, which includes this "(Well written) C++ goes to great lengths to make stack automatic objects work "just like" primitives, as reflected in Stroustrup's advice to "do as the ints do". This requires a much greater adherence to the principles of O...
The passage you encountered discusses a fundamental principle in C++ related to how user-defined types (classes) should behave similarly to built-in types (like `int`, `float`, etc.) when they are used as stack-allocated objects. This principle is often referred to as the "Rule of Three," which states that if your clas...
11,144
[ { "from": "human", "value": "In my browsings amongst the Internet, I came across this post, which includes this\n\n\"(Well written) C++ goes to great\n lengths to make stack automatic\n objects work \"just like\" primitives,\n as reflected in Stroustrup's advice to\n \"do as the ints do\". This requires...
I'm trying to wrap my head around creating a toolbar (a tool band in a rebar) in MFC for Internet Explorer using COM. Is it possible to get the address of the currently viewed page (i.e., https://stackoverflow.com/questions/ask in my case :-) ) from the toolbar? If so, what should I look in to? Thanks!
Creating a toolbar for Internet Explorer (IE) using MFC and COM is indeed possible, and you can access the currently viewed page through the appropriate interfaces provided by COM. To get the address of the currently viewed page from your toolbar, you will generally work with the `IWebBrowser2` interface, which is par...
11,959
[ { "from": "human", "value": "I'm trying to wrap my head around creating a toolbar (a tool band in a rebar) in MFC for Internet Explorer using COM.\nIs it possible to get the address of the currently viewed page (i.e., https://stackoverflow.com/questions/ask in my case :-) ) from the toolbar?\nIf so, what sh...
Is it doable to set up a non-domain-based (standalone) Windows Server 2008 as an SSTP VPN (Secure Socket Layer Tunneling Protocol VPN)? I'd like to enable remote users to access a network via SSL-based VPN (currently using PPTP) by making an SSTP VPN connection via a Win2k8 server. Most of the docs seem to include run...
Yes, it is possible to set up a standalone Windows Server 2008 as an SSTP (Secure Socket Tunneling Protocol) VPN server, but it involves some steps and requirements, especially regarding certificates and configuration. Below are the general steps you can follow to set up SSTP on a standalone Windows Server 2008: ### P...
9,792
[ { "from": "human", "value": "Is it doable to set up a non-domain-based (standalone) Windows Server 2008 as an SSTP VPN (Secure Socket Layer Tunneling Protocol VPN)?\nI'd like to enable remote users to access a network via SSL-based VPN (currently using PPTP) by making an SSTP VPN connection via a Win2k8 ser...
What would be a good offline alternative of the online Lipsum generator? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs.
If you're looking for an offline alternative to the online Lorem Ipsum generators, there are several command-line utilities that can help you generate placeholder text. Here are a few options: ### 1. **Lorem Ipsum Generator (CLI Tool)** You can create a simple script using Python to generate Lorem Ipsum text. Here’s a...
13,762
[ { "from": "human", "value": "What would be a good offline alternative of the online Lipsum generator? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs.\n" }, { "from": "gpt", "va...
What is the difference between const and readonly in C#? When would you use one over the other?
In C#, `const` and `readonly` are both used to define immutable data, but they have different uses and behaviors. ### `const` - **Definition**: A `const` (constant) is a compile-time constant. Its value is set at compile time and cannot change after that. - **Scope**: `const` members are implicitly `static`. They belo...
13,588
[ { "from": "human", "value": "What is the difference between const and readonly in C#? \nWhen would you use one over the other?\n" }, { "from": "gpt", "value": "In C#, `const` and `readonly` are both used to define immutable data, but they have different uses and behaviors.\n\n### `const`\n- **De...
Let's suppose you deploy a network-attached appliances (small form factor PCs) in the field. You want to allow these to call home after being powered on, then be identified and activated by end users. Our current plan involves the user entering the MAC address into an activation page on our web site. Later our software...
Your proposed approach of using the MAC address for activating and identifying network-attached appliances has its benefits and drawbacks. Here are several potential issues and considerations to keep in mind: ### 1. **MAC Address Spoofing** - **Issue:** MAC addresses can be spoofed relatively easily. If a malicious...
11,554
[ { "from": "human", "value": "Let's suppose you deploy a network-attached appliances (small form factor PCs) in the field. You want to allow these to call home after being powered on, then be identified and activated by end users.\nOur current plan involves the user entering the MAC address into an activatio...
I want to parse a web page in Groovy and extract all of the href links and the associated text with it. If the page contained these links: <a href="http://www.google.com">Google</a><br /> <a href="http://www.apple.com">Apple</a> the output would be: Google, http://www.google.com<br /> Apple, http://www.apple.com I'm ...
You can use Groovy's built-in HTML parsing capabilities along with the `Jsoup` library to easily extract the `href` links and their associated text from a web page. Here’s a simple example of how to achieve that. First, you'll need to include the Jsoup library in your project. If you are using Gradle, add the followin...
14,517
[ { "from": "human", "value": "I want to parse a web page in Groovy and extract all of the href links and the associated text with it.\nIf the page contained these links:\n<a href=\"http://www.google.com\">Google</a><br />\n<a href=\"http://www.apple.com\">Apple</a>\n\nthe output would be:\nGoogle, http://www...
Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide? I'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types, I get eleven different flavors of said RT...
The challenge you're facing with NSPasteboard is a common one when dealing with the wide variety of data types that applications provide. Unfortunately, NSPasteboard doesn't expose a straightforward way to distinguish between the original data types provided by the source application and the transformed types that may ...
12,262
[ { "from": "human", "value": "Is there a way to unfilter an NSPasteboard for what the source application specifically declared it would provide?\nI'm attempting to serialize pasteboard data in my application. When another application places an RTF file on a pasteboard and then I ask for the available types,...
What are the advantages and disadvantages of DTOs from a website performance perspective? (I'm talking in the case where the database is accessed on a different app server to the web server - and the web server could access the database directly.)
Data Transfer Objects (DTOs) are often used in applications where data is transferred between different layers or systems, such as between a web server and a database server. They can provide benefits as well as challenges from a website performance perspective, especially when dealing with a web server that could dire...
9,928
[ { "from": "human", "value": "What are the advantages and disadvantages of DTOs from a website performance perspective? (I'm talking in the case where the database is accessed on a different app server to the web server - and the web server could access the database directly.)\n" }, { "from": "gpt", ...
Can there be buffer overflow/overrun vulnerabilities in completely managed asp.net web portal.If yes how can this be tested.
In a completely managed environment such as an ASP.NET web portal, traditional buffer overflow vulnerabilities that occur in unmanaged code (like C or C++) are generally not a concern. This is because managed code runs within the .NET framework's Common Language Runtime (CLR), which provides automatic memory management...
12,775
[ { "from": "human", "value": "Can there be buffer overflow/overrun vulnerabilities in completely managed asp.net web portal.If yes how can this be tested.\n" }, { "from": "gpt", "value": "In a completely managed environment such as an ASP.NET web portal, traditional buffer overflow vulnerabilitie...
Or is it now the other way around? From what I've heard there are some areas in which C# proves to be faster than C++, but I've never had the guts to test it by myself. Thought any of you could explain these differences in detail or point me to the right place for information on this.
The performance comparison between C# and C++ is an interesting topic and can depend significantly on the context of how each language is used. Both languages have their strengths and weaknesses, and performance can vary based on many factors such as the nature of the application, the specific use case, and how well ea...
11,782
[ { "from": "human", "value": "Or is it now the other way around?\nFrom what I've heard there are some areas in which C# proves to be faster than C++, but I've never had the guts to test it by myself.\nThought any of you could explain these differences in detail or point me to the right place for information ...
In C++, I'm trying to catch all types of exceptions in one catch (like catch(Exception) in C#). How is it done? And what's more, how can one catch divide-by-zero exceptions?
In C++, you can catch exceptions of any type using a catch block with `...`, which is known as a catch-all handler. Here's how it looks: ```cpp try { // Code that may throw exceptions } catch (...) { // Handle all exceptions std::cout << "An exception occurred." << std::endl; } ``` This catch block will c...
12,803
[ { "from": "human", "value": "In C++, I'm trying to catch all types of exceptions in one catch (like catch(Exception) in C#). How is it done? And what's more, how can one catch divide-by-zero exceptions?\n" }, { "from": "gpt", "value": "In C++, you can catch exceptions of any type using a catch b...
Within an XSLT document, is it possible to loop over a set of files in the current directory? I have a situation where I have a directory full of xml files that need some analysis done to generate a report. I have my stylesheet operating on a single document fine, but I'd like to extend that without going to another t...
In XSLT, especially in its standard form, you cannot directly loop over files in the current directory or dynamically select files from the filesystem. XSLT is designed to transform XML documents and doesn't have built-in functionality for file system operations or direct I/O management. However, there are a few appro...
10,725
[ { "from": "human", "value": "Within an XSLT document, is it possible to loop over a set of files in the current directory?\nI have a situation where I have a directory full of xml files that need some analysis done to generate a report. I have my stylesheet operating on a single document fine, but I'd like...
In postgresql you have a wealth of optimizations at hand to configure it for your performance needs. The settings for memory usage are still easy enough, but with other options like the cost factors for CPU and IO which are used for the query optimizer are quite a mystery for me. I wonder if there is a program availabl...
As of my last knowledge update in October 2023, there isn't a single tool that comprehensively benchmarks your hardware, analyzes your database, and automatically generates optimal PostgreSQL configuration settings tailored to your specific environment. However, there are several approaches and tools you can utilize to...
13,075
[ { "from": "human", "value": "In postgresql you have a wealth of optimizations at hand to configure it for your performance needs. The settings for memory usage are still easy enough, but with other options like the cost factors for CPU and IO which are used for the query optimizer are quite a mystery for me...
Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP. I have a project under Git control. I'd like to add a submodule: git submodule add http://github.com/jscruggs/metric_fu.git vendor/plugins/metric_fu But I get ... got 1b0313...
The issue you're experiencing seems to be related to the way Git interacts with HTTP proxies, especially when trying to clone submodules. The error message indicates that Git is unable to retrieve a specific commit from the submodule repository, which could stem from several potential issues. Here are some steps to tro...
11,192
[ { "from": "human", "value": "Note: while the use-case described is about using submodules within a project, the same applies to a normal git clone of a repository over HTTP.\nI have a project under Git control. I'd like to add a submodule:\ngit submodule add http://github.com/jscruggs/metric_fu.git vendor/...
When is it appropriate to use a class in Visual Basic for Applications (VBA)? I'm assuming the accelerated development and reduction of introducing bugs is a common benefit for most languages that support OOP. But with VBA, is there a specific criterion?
Using classes in Visual Basic for Applications (VBA) can bring several benefits and can enhance your development process, especially as the complexity of your application increases. Here are some specific criteria and situations where using classes in VBA is appropriate: ### 1. **Encapsulation of Data and Functionalit...
12,807
[ { "from": "human", "value": "When is it appropriate to use a class in Visual Basic for Applications (VBA)?\nI'm assuming the accelerated development and reduction of introducing bugs is a common benefit for most languages that support OOP. But with VBA, is there a specific criterion? \n" }, { "from"...
I have a query form that I would like to submit as a GET request so the result page may be bookmarked and otherwise RESTful. It's your classical text field with a submit button. How do I induce Seam/JSF to use GET and include the query expression as a parameter rather than POST, the default?
To use a GET request in JSF (JavaServer Faces) and include the query string parameters, you'll need to make a few adjustments in your JSF form. JSF typically uses POST as the default method for forms, but you can modify your form to use GET instead. Here’s how you can do it: ### Steps to Use GET in JSF: 1. **Add the ...
12,605
[ { "from": "human", "value": "I have a query form that I would like to submit as a GET request so the result page may be bookmarked and otherwise RESTful. It's your classical text field with a submit button. How do I induce Seam/JSF to use GET and include the query expression as a parameter rather than POST,...
I have a Flex application where I'm using a Canvas to contain several other components. On that Canvas there is a Button which is used to invoke a particular flow through the system. Clicking anywhere else on the Canvas should cause cause a details pane to appear showing more information about the record represented ...
In Adobe Flex, when a button is clicked, it triggers the click event on both the button and the canvas because the button is a child of the canvas. To prevent the click event from propagating to the canvas when you click the button, you can use the `stopPropagation()` method within the button's click event handler. He...
15,700
[ { "from": "human", "value": "I have a Flex application where I'm using a Canvas to contain several other components. On that Canvas there is a Button which is used to invoke a particular flow through the system. Clicking anywhere else on the Canvas should cause cause a details pane to appear showing more ...
Does anyone know an easy way to draw arbitrary text in a Cocoa NSOpenGLView? I have a couple of constraints. The text on screen may change from frame to frame (for example, a framerate display in the corner) I would like to be able to select any font installed on the system at any size
Drawing text in an `NSOpenGLView` can be a bit challenging since OpenGL itself doesn't have native support for text rendering. However, you can achieve your goal using Core Text or NSAttributedString to render the text to a bitmap image and then display that texture in your OpenGL view. Here's how you can do it: 1. **...
6,496
[ { "from": "human", "value": "Does anyone know an easy way to draw arbitrary text in a Cocoa NSOpenGLView? I have a couple of constraints.\n\nThe text on screen may change from frame to frame (for example, a framerate display in the corner)\nI would like to be able to select any font installed on the system ...
In Team Foundation Server, I know that you can use the Annotate feature to see who last edited each line in a particular file (equivalent to "Blame" in CVS). What I'd like to do is akin to running Annotate on every file in a project, and get a summary report of all the developers who have edited a file in the project, ...
To efficiently generate a summary report of code ownership in a project using Team Foundation Server (TFS), while avoiding the manual task of running the Annotate feature on every file, you can consider the following approaches: ### 1. Use TFS Command-Line Tools or API You can leverage the TFS command-line tools or th...
13,648
[ { "from": "human", "value": "In Team Foundation Server, I know that you can use the Annotate feature to see who last edited each line in a particular file (equivalent to \"Blame\" in CVS). What I'd like to do is akin to running Annotate on every file in a project, and get a summary report of all the develop...
Specifically what I am looking to do is make the icons for the Nodes in my System.Windows.Forms.TreeView control to throb while a long loading operation is taking place.
To achieve a "throbbing" effect for the icons in a `TreeView` control during a long operation in a Windows Forms application, you can use a `Timer` to periodically change the image of the nodes. Here’s a step-by-step guide to help you implement this: 1. **Create the TreeView and Nodes**: First, set up your `TreeView` ...
9,440
[ { "from": "human", "value": "Specifically what I am looking to do is make the icons for the Nodes in my System.Windows.Forms.TreeView control to throb while a long loading operation is taking place.\n" }, { "from": "gpt", "value": "To achieve a \"throbbing\" effect for the icons in a `TreeView` ...
I have two (UNIX) programs A and B that read and write from stdin/stdout. My first problem is how to connect the stdout of A to stdin of B and the stdout of B to the stdin of A. I.e., something like A | B but a bidirectional pipe. I suspect I could solve this by using exec to redirect but I could not get it to work. Th...
Your approach using named pipes (FIFOs) and `nc` for bidirectional communication between two processes is a clever solution, but as you've noticed, it can indeed lead to deadlocks or other synchronization issues under certain circumstances. A more robust way to manage bidirectional communication between programs A and ...
13,254
[ { "from": "human", "value": "I have two (UNIX) programs A and B that read and write from stdin/stdout.\nMy first problem is how to connect the stdout of A to stdin of B and the stdout of B to the stdin of A. I.e., something like A | B but a bidirectional pipe. I suspect I could solve this by using exec to r...
Let's say I have a container (std::vector) of pointers used by a multi-threaded application. When adding new pointers to the container, the code is protected using a critical section (boost::mutex). All well and good. The code should be able to return one of these pointers to a thread for processing, but another sep...
Yes, your understanding of `boost::shared_ptr` is correct, and the approach you're considering will prevent the issues associated with deleting a pointer while it's still in use by another thread. Here's how `boost::shared_ptr` works in the context of your code example: 1. **Reference Counting**: `boost::shared_ptr` ...
9,505
[ { "from": "human", "value": "Let's say I have a container (std::vector) of pointers used by a multi-threaded application. When adding new pointers to the container, the code is protected using a critical section (boost::mutex). All well and good. The code should be able to return one of these pointers to...
I have a self built JSP webapp and at the moment I'm using tomcats built in admin pannel to manage user accounts (that are stored in tomcats config xml files) but this is limited because i can not create new accounts from within the web-app (eg. I can not have a sign up website) and need to manually create the accounts...
Implementing user accounts in a JSP web application running on Tomcat can be done in several ways. Given that you want more flexibility, such as allowing users to sign up directly from your web application, you’ll likely want to implement your own user management system instead of relying on Tomcat's built-in user mana...
13,329
[ { "from": "human", "value": "I have a self built JSP webapp and at the moment I'm using tomcats built in admin pannel to manage user accounts (that are stored in tomcats config xml files) but this is limited because i can not create new accounts from within the web-app (eg. I can not have a sign up website)...
This is more a thought experiment than anything. I'm wondering what it would take to detect everything I legally can about the laptops in a hotspot. My first thought was to grab every MAC address I can and extract the maker from the first 24bit. The question is would this be illegal and what else could I legally scaven...
Your thought experiment raises important questions about legality, ethics, and technical feasibility when it comes to network scanning and data collection in a hotspot environment. Here are some points to consider: ### Legal and Ethical Considerations 1. **Laws and Regulations**: - In many jurisdictions, actively...
12,591
[ { "from": "human", "value": "This is more a thought experiment than anything.\nI'm wondering what it would take to detect everything I legally can about the laptops in a hotspot. My first thought was to grab every MAC address I can and extract the maker from the first 24bit.\nThe question is would this be i...
There are lots of people out there asking "why shouldn't we use tables for structuring our HTML" and while a lot of answers come in, I rarely see anyone being converted to the world of semantics. That said, I've yet to see any convincing rebuttals to support the rationale for why we should (or might) use tables. Anyone...
Your frustration with the misuse of tables for layout purposes is shared by many in the web development community. The consensus today is that tables should be used exclusively for tabular data, not for layout. Here's a breakdown of the rationale against using tables for structural markup, along with a few scenarios wh...
9,293
[ { "from": "human", "value": "There are lots of people out there asking \"why shouldn't we use tables for structuring our HTML\" and while a lot of answers come in, I rarely see anyone being converted to the world of semantics. That said, I've yet to see any convincing rebuttals to support the rationale for ...
Developing a .NET WinForms application: how can I check if the window is in Help mode (i.e. after clicking the "?" button in the title bar)? The problem I have is that my System.Windows.Forms.ToolStripItem objects do not have a HelpRequested event (because they do not inherit from Control) so in the Click event handler...
In a WinForms application, you can determine if the window is in Help mode (i.e., the user has clicked the Help button in the title bar) by handling the `HelpRequested` event of the form. While your `ToolStripItem` objects do not have a `HelpRequested` event, you can listen for the Help mode globally at the form level....
13,521
[ { "from": "human", "value": "Developing a .NET WinForms application: how can I check if the window is in Help mode (i.e. after clicking the \"?\" button in the title bar)?\nThe problem I have is that my System.Windows.Forms.ToolStripItem objects do not have a HelpRequested event (because they do not inherit...
I would like to use client-side Javascript to perform a DNS lookup (hostname to IP address) as seen from the client's computer. Is that possible?
Performing a DNS lookup directly in client-side JavaScript (e.g., in a web browser) to convert a hostname to an IP address is not possible due to security and privacy restrictions in modern web environments. Browsers do not expose DNS resolution APIs for client-side scripts because it would raise concerns about potenti...
11,060
[ { "from": "human", "value": "I would like to use client-side Javascript to perform a DNS lookup (hostname to IP address) as seen from the client's computer. Is that possible?\n" }, { "from": "gpt", "value": "Performing a DNS lookup directly in client-side JavaScript (e.g., in a web browser) to c...
You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution: # THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE # # ^ ^ # There's ...
To achieve a fluid menu layout where the first menu item is left-aligned, the last menu item is right-aligned, and all intermediate items are evenly distributed, you can use CSS Flexbox. This method allows you to create a responsive layout without pre-calculating widths or using a table. Here’s a simple example: ### ...
13,769
[ { "from": "human", "value": "You find plenty of tutorials on menu bars in HTML, but for this specific (though IMHO generic) case, I haven't found any decent solution:\n# THE MENU ITEMS SHOULD BE JUSTIFIED JUST AS PLAIN TEXT WOULD BE #\n# ^ ...
I'm new to Ruby, so I'm having some trouble understanding this weird exception problem I'm having. I'm using the ruby-aaws gem to access Amazon ECS: http://www.caliban.org/ruby/ruby-aws/. This defines a class Amazon::AWS:Error: module Amazon module AWS # All dynamically generated exceptions occur within this name...
It's great to see you diving into Ruby and exploring exception handling! Let's clarify your questions step by step. ### 1. Why is `NameError`, a Ruby built-in exception, a `kind_of?(Amazon::AWS::Error)`? As you discovered, the reason `NameError` (and any other class) is considered a kind of `Amazon::AWS::Error` is th...
6,123
[ { "from": "human", "value": "I'm new to Ruby, so I'm having some trouble understanding this weird exception problem I'm having. I'm using the ruby-aaws gem to access Amazon ECS: http://www.caliban.org/ruby/ruby-aws/. This defines a class Amazon::AWS:Error:\nmodule Amazon\n module AWS\n # All dynamically...
What are some resources in use for marketing downloadable desktop software online? AdWords, certainly, and "organic" search engine results but is anyone having any luck making sales through sites like Tucows and/or Download.com anymorE?
When it comes to marketing downloadable desktop software online, there are several resources and strategies that can be effective. Here are some key options to consider: 1. **Search Engine Marketing (SEM)**: - **Google Ads (AdWords)**: As you mentioned, SEM is a powerful tool to drive targeted traffic to your softw...
10,388
[ { "from": "human", "value": "What are some resources in use for marketing downloadable desktop software online? AdWords, certainly, and \"organic\" search engine results but is anyone having any luck making sales through sites like Tucows and/or Download.com anymorE?\n" }, { "from": "gpt", "valu...
After downloading files from a remote UNIX FTP server, you want to verify that you have downloaded all the files correctly. Minimal you will get information similar to "dir /s" command in Windows command prompt. The FTP client runs on Windows.
To verify that you've downloaded all files correctly from a remote UNIX FTP server using an FTP client on Windows, you can follow these steps: 1. **Download the File List from the FTP Server**: Use your FTP client to connect to the UNIX FTP server and retrieve a directory listing of the files. You can typically ach...
11,755
[ { "from": "human", "value": "After downloading files from a remote UNIX FTP server, you want to verify that you have downloaded all the files correctly. Minimal you will get information similar to \"dir /s\" command in Windows command prompt. The FTP client runs on Windows.\n" }, { "from": "gpt", ...
I've got a Subversion repository, backed by the berkeley DB. Occasionally it breaks down due to some locks and such not being released, but this morning it was impossible to recover it using the 'svnadmin recover' command. Instead it failed with the following error: svnadmin: Berkeley DB error for filesystem 'db' while...
It looks like you are dealing with a corrupted Berkeley DB used by your Subversion repository. Corruption in the database files can often be tricky to resolve, especially when typical recovery tools like `svnadmin recover` and `db_recover` fail to help. Here are some approaches you can try in addition to restoring from...
12,488
[ { "from": "human", "value": "I've got a Subversion repository, backed by the berkeley DB. Occasionally it breaks down due to some locks and such not being released, but this morning it was impossible to recover it using the 'svnadmin recover' command. Instead it failed with the following error:\nsvnadmin: B...
Has anybody tried programming on the EEE Pc in Visual Studio? I'm considering buying one so I can show some apps on the fly, but also make small changes to them if necessary, without the inconvenience of a large laptop. Some key points I'm after: How fast it is Would it suit the needs of a developer making small chang...
The ASUS Eee PC is a line of netbooks that was quite popular when it first launched, particularly for its portability and relatively low price. However, there are some important considerations to keep in mind regarding its capabilities, especially for programming and development tasks. ### Performance 1. **Hardware Li...
14,704
[ { "from": "human", "value": "Has anybody tried programming on the EEE Pc in Visual Studio?\nI'm considering buying one so I can show some apps on the fly, but also make small changes to them if necessary, without the inconvenience of a large laptop.\nSome key points I'm after:\n\nHow fast it is\nWould it su...