instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. Major is changed when the "developers" want to show that there is a big change in the software and backward compatibility cannot be assumed. Maybe a major rewrite of the code is done. Minor number represents a s...
Versioning projects is a crucial aspect of software development, as it helps manage changes, maintain compatibility, and communicate the nature of updates to users and other stakeholders. While different organizations and projects may adopt different versioning strategies, a common approach is to follow Semantic Versio...
18,255
[ { "from": "human", "value": "I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. \nMajor is changed when the \"developers\" want to show that there is a big change in the software and backward compatibility cannot be assumed. Maybe a major rewrite of th...
I need to standardize on how I classify and handle errors/exceptions 'gracefully'. I currently use a process by which I report the errors to a function passing an error-number, severity-code, location-info and extra-info-string. This function returns boolean true if the error is fatal and the app should die, false othe...
Standardizing error handling across your applications is a crucial step in maintaining code quality, making it easier to debug, and providing a better user experience. Given your current approach, here are some recommendations and considerations that could help you improve and standardize error handling in a library: ...
16,529
[ { "from": "human", "value": "I need to standardize on how I classify and handle errors/exceptions 'gracefully'.\nI currently use a process by which I report the errors to a function passing an error-number, severity-code, location-info and extra-info-string. This function returns boolean true if the error i...
Does anyone have a good resource on dlls and how they are used / generated in Visual Studio? A few questions I'm rather hazy on specifically are: How refresh files work How dll version numbers are generated The difference between adding a reference by project vs browsing for the specific dll Any other tips are welco...
Certainly! Dynamic Link Libraries (DLLs) are a fundamental part of the Windows operating system and .NET development. Here’s an overview of the topics you mentioned along with some tips. ### 1. **Understanding DLLs** - **What is a DLL?** - A DLL is a library that contains code and data that can be used by multiple p...
16,496
[ { "from": "human", "value": "Does anyone have a good resource on dlls and how they are used / generated in Visual Studio? A few questions I'm rather hazy on specifically are:\n\nHow refresh files work\nHow dll version numbers are generated\nThe difference between adding a reference by project vs browsing f...
I am developing a Windows .NET application (WinForms) and I need to simulate a stress test of the database and the application ( more than 100 conections). What tools do you recommend?
When simulating stress tests for a database and a Windows .NET WinForms application, there are several tools and approaches you can consider. Here are some recommended tools and techniques: ### Database Stress Testing Tools 1. **Apache JMeter** - JMeter is an open-source tool that can simulate a large number of da...
14,357
[ { "from": "human", "value": "I am developing a Windows .NET application (WinForms) and I need to simulate a stress test of the database and the application ( more than 100 conections). \nWhat tools do you recommend?\n" }, { "from": "gpt", "value": "When simulating stress tests for a database and...
I need lucene to search for synonyms as well as the actual keyword. that is if I search for "CI", I want it to search for CI OR "continues integration". at the moment I search for keywords I have the synonyms for and replace them with the "OR-ed" version, but I suspect there should be a better way to do this. my method...
To effectively handle synonyms in queries using Apache Lucene, especially when dealing with more complex queries involving logical operators, there are several approaches you can consider. Here are some methods that can help you implement synonym handling in a more robust way: ### 1. Synonym Filters in Tokenization U...
17,851
[ { "from": "human", "value": "I need lucene to search for synonyms as well as the actual keyword. that is if I search for \"CI\", I want it to search for CI OR \"continues integration\". at the moment I search for keywords I have the synonyms for and replace them with the \"OR-ed\" version, but I suspect the...
What tools are available for metamodelling? Especially for developing diagram editors, at the moment trying out Eclipse GMF Wondering what other options are out there? Any comparison available?
Metamodelling is an essential aspect of software engineering, particularly in model-driven development. There are several tools and frameworks available for metamodelling and developing diagram editors. Here’s a list of popular options, including Eclipse GMF, along with brief descriptions and comparisons: ### 1. **Ecl...
13,157
[ { "from": "human", "value": "What tools are available for metamodelling? \nEspecially for developing diagram editors, at the moment trying out Eclipse GMF\nWondering what other options are out there? \nAny comparison available?\n" }, { "from": "gpt", "value": "Metamodelling is an essential aspec...
Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work. The Mono Project Roadmap indicates ASP.NET 3.5 for Mono 2.4 (next year). Any...
Getting ASP.NET MVC Preview 5 to work on Mono 2.0 can be quite challenging, especially considering that Mono at that time was not fully compatible with ASP.NET MVC, particularly for newer versions of MVC that relied on features not present in earlier versions of the .NET Framework. Here are a few suggestions that migh...
18,978
[ { "from": "human", "value": "Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work.\nThe Mono Project Roadmap indicates...
How would you, as a developer with little (or no) artistic inclination, design a GUI for an application? In particular, I'm thinking about desktop apps but anything that relates to Web apps is welcome as well. I find it extremely hard to design something that both I and potential users find pleasing. I can look up co...
Designing a graphical user interface (GUI) can indeed be challenging, especially if you feel that you lack artistic inclination. However, there are established guidelines and best practices that you can follow to help create a user-friendly and visually pleasing interface. Here are some key points to consider when desi...
15,770
[ { "from": "human", "value": "How would you, as a developer with little (or no) artistic inclination, design a GUI for an application? In particular, I'm thinking about desktop apps but anything that relates to Web apps is welcome as well.\nI find it extremely hard to design something that both I and potent...
I have a simple lambda expression which runs fine as a UNIT test and also runs fine when I copy the code into the Main method of my application. However, when I run the same piece of code within a callback method (via JMS courier) I get the above error. Has anyone encountered this? Example code failing: Expression<Func...
It seems like you're experiencing an issue when trying to compile a lambda expression within a JMS (Java Message Service) callback method, while it works fine in a unit test and in your application's `Main` method. The problem you're facing with `expr.Compile()` could be related to the execution context in which the JM...
19,678
[ { "from": "human", "value": "I have a simple lambda expression which runs fine as a UNIT test and also runs fine when I copy the code into the Main method of my application. However, when I run the same piece of code within a callback method (via JMS courier) I get the above error. Has anyone encountered th...
I use a custom-built asp.net control that renders to a DIV and has "height='0'" hard-coded into the element (I know.. stupid). But I need to reset it - get rid of the height assignment somehow. Is this doable with CSS? I can set the height to 100px for example, and it works. But that's not what I want - I want the h...
When dealing with inline styles that are hard-coded in the HTML, CSS alone cannot remove those styles due to their higher specificity. Inline styles take precedence over styles defined in external stylesheets or within `<style>` tags. However, you can work around this limitation using JavaScript or jQuery to clear the ...
20,567
[ { "from": "human", "value": "I use a custom-built asp.net control that renders to a DIV and has \"height='0'\" hard-coded into the element (I know.. stupid). But I need to reset it - get rid of the height assignment somehow. Is this doable with CSS?\nI can set the height to 100px for example, and it works...
I have a large 2d array that I serialize and base64_encode and throw into a database. On a different page I pull the array out and when I base64_decode the serialized array I can echo it out and it definitely looks valid. However, if I try to unserialize(base64_decode($serializedArray)) it just throws the same error t...
The error message you're encountering, "Node no longer exists," during the unserialization of a base64-encoded serialized array can occur for a few reasons. Here are some steps you can take to troubleshoot and resolve the issue: 1. **Check Data Integrity**: Ensure that the data you are retrieving from the database is ...
13,798
[ { "from": "human", "value": "I have a large 2d array that I serialize and base64_encode and throw into a database. On a different page I pull the array out and when I base64_decode the serialized array I can echo it out and it definitely looks valid.\nHowever, if I try to unserialize(base64_decode($seriali...
Is it possible to check what version of BPL (ie Rtl70.BPL, Indy70.bpl etc) are installed on a clients computer when the program starts? I have had some programs crash because the BPL on there computer is different to the ones on the build machine. If i have to add each BPL used into the installer on each update, i thin...
When working with packages in Delphi 7 (BPL files), ensuring that the correct versions are deployed is crucial to avoid runtime issues like the crashes you are experiencing. Since you noticed that a slight difference in file attributes led to problems, it's clear that simply relying on version numbers may not suffice. ...
13,938
[ { "from": "human", "value": "Is it possible to check what version of BPL (ie Rtl70.BPL, Indy70.bpl etc) are installed on a clients computer when the program starts?\nI have had some programs crash because the BPL on there computer is different to the ones on the build machine.\nIf i have to add each BPL use...
I'm having problems when trying to mock objects with __get and __set methods (using simpletest). Writing mock responses for __get doesn't smell right - the tests seem too tightly tied to implementation. Any recommendations for testing, or should I just avoid the magic methods completely?
When you're working with magic methods like `__get` and `__set` in Python, it can indeed lead to tests that are overly dependent on the internal implementation of your classes. This can make your tests fragile, as changes to your implementation might require changes to your tests, even if the public interface remains t...
18,620
[ { "from": "human", "value": "I'm having problems when trying to mock objects with __get and __set methods (using simpletest). \nWriting mock responses for __get doesn't smell right - the tests seem too tightly tied to implementation. Any recommendations for testing, or should I just avoid the magic methods ...
We are using Zabbix for services monitoring. There are some essential monitoring configured. I want to have timeline of version strings of my service along with this monitorings. That would give me opportunity to see that upgrading to this version altered overall error-count. Is it possible?
Yes, it is possible to create a timeline of version strings of your services alongside your monitoring data in Zabbix. Here’s a general approach on how to achieve this: ### 1. Version String Storage You need to store your version strings in a way that Zabbix can access and visualize them. There are a couple of method...
14,763
[ { "from": "human", "value": "We are using Zabbix for services monitoring.\nThere are some essential monitoring configured.\nI want to have timeline of version strings of my service along with this monitorings. That would give me opportunity to see that upgrading to this version altered overall error-count.\...
I've got a (poorly written) base class that I want to wrap in a proxy object. The base class resembles the following: public class BaseClass : SomeOtherBase { public BaseClass() {} public BaseClass(int someValue) {} //...more code, not important here } and, my proxy resembles: public BaseClassProxy : BaseC...
To create a proxy that wraps around your `BaseClass` without invoking its constructors, you can consider using composition instead of inheritance. By having your proxy class contain an instance of `BaseClass`, you can control the behavior without being forced to call base class constructors. Here's how you can do this:...
17,430
[ { "from": "human", "value": "I've got a (poorly written) base class that I want to wrap in a proxy object. The base class resembles the following:\npublic class BaseClass : SomeOtherBase \n{\n public BaseClass() {}\n\n public BaseClass(int someValue) {}\n\n //...more code, not important here\n}\n\nand...
I have a method running in a seperate thread. The thread is created and started from a form in a windows application. If an exception is thrown from inside the thread, what is the best way to pass it back to the main application. Right now, I'm passing a reference to the main form into the thread, then invoking the ...
In a Windows Forms application, handling exceptions thrown from a background thread (like one created using `Thread`) can be tricky, as UI updates must be marshaled back to the main thread. However, your current approach can be improved to follow best practices. Instead of passing a reference to the form into the thr...
17,420
[ { "from": "human", "value": "I have a method running in a seperate thread. The thread is created and started from a form in a windows application. If an exception is thrown from inside the thread, what is the best way to pass it back to the main application. Right now, I'm passing a reference to the main...
I'm developing an application for an internal customer. One of the requirements is that it be developed in such a way that it could potentially be sold to other organizations. The application is a tracking application for a fund-raising organization that will manage their donations, donors, participants, and events. ...
It's great to hear that you're planning to develop an application with the potential for broader distribution. Here are some considerations you can take into account to ensure flexibility, maintainability, and scalability in your ASP.NET/C#/SQL Server application: ### 1. **Plugin Architecture** - **Modular Design**: E...
16,860
[ { "from": "human", "value": "I'm developing an application for an internal customer. One of the requirements is that it be developed in such a way that it could potentially be sold to other organizations. The application is a tracking application for a fund-raising organization that will manage their dona...
I'm currently working with Groovy and Grails. While Groovy is pretty straight-forward since it's basically Java, I can't say I grok Grails. I read that Groovy is to Grails as Ruby is to Ruby on Rails, but what does that mean?
Your comparison between Groovy and Grails to Ruby and Ruby on Rails is quite apt and helps to highlight the relationship between a programming language and a web framework built upon it. ### Groovy and Grails - **Groovy**: This is a dynamic language for the Java platform that simplifies Java programming by providing f...
16,500
[ { "from": "human", "value": "I'm currently working with Groovy and Grails. While Groovy is pretty straight-forward since it's basically Java, I can't say I grok Grails. I read that Groovy is to Grails as Ruby is to Ruby on Rails, but what does that mean?\n" }, { "from": "gpt", "value": "Your com...
I am trying to use WebClient to download a file from web using a WinForms application. However, I really only want to download HTML file. Any other type I will want to ignore. I checked the WebResponse.ContentType, but its value is always null. Anyone have any idea what could be the cause?
When using `WebClient` to download a file in a WinForms application, it's important to remember that `WebClient` does not automatically fill in the `ContentType` property of the response. However, you can still check the content type after making the request by using the `WebRequest` class to perform a HEAD request bef...
16,919
[ { "from": "human", "value": "I am trying to use WebClient to download a file from web using a WinForms application. However, I really only want to download HTML file. Any other type I will want to ignore.\nI checked the WebResponse.ContentType, but its value is always null. \nAnyone have any idea what could...
Why do I get compiler errors with this Java code? 1 public List<? extends Foo> getFoos() 2 { 3 List<? extends Foo> foos = new ArrayList<? extends Foo>(); 4 foos.add(new SubFoo()); 5 return foos; 6 } Where 'SubFoo' is a concrete class that implements Foo, and Foo is an interface. Errors I get with this code:...
You're encountering issues with your Java code due to the way wildcard types work in generics. Let's break down your code and the errors you're seeing. ### Analysis of the Code 1. **Line 3: Cannot instantiate ArrayList<? extends Foo>** - This error occurs because you cannot create an instance of `ArrayList` with a...
19,326
[ { "from": "human", "value": "Why do I get compiler errors with this Java code?\n1 public List<? extends Foo> getFoos()\n2 {\n3 List<? extends Foo> foos = new ArrayList<? extends Foo>();\n4 foos.add(new SubFoo());\n5 return foos;\n6 }\nWhere 'SubFoo' is a concrete class that implements Foo, and F...
I use ASP.Net with NHibernate accessing a Pgsql database. For some of our Objects, we use NHibernate bags, which map to List objects in our application. Sometimes we have issues with needing to refresh the objects through NHibernate when we update anything to do with the lists in the database. <bag name="Objects" inve...
When using NHibernate with bags, you may encounter issues where the state of the collection (like `List<T>`) is not always in sync with the database. This is especially common when you're modifying data outside of the NHibernate session or using separate sessions. Here are some common approaches and workarounds for thi...
15,039
[ { "from": "human", "value": "I use ASP.Net with NHibernate accessing a Pgsql database. \nFor some of our Objects, we use NHibernate bags, which map to List objects in our application. Sometimes we have issues with needing to refresh the objects through NHibernate when we update anything to do with the lists...
I don't see what all this fuss is about Microsoft's decision to support JQuery within ASP.NET MVC. There were signs that open-minded people are starting to have some say in the matters of marketing for a while now. And even the way MS does business has started to change. But at it's core it's still acting in response t...
Your observation about Microsoft's decision to support jQuery within ASP.NET MVC reflects a broader trend in the tech industry towards openness and collaboration. Here are a few points to consider regarding this development: 1. **Embracing Open Source**: Microsoft's support for jQuery and other open-source technologie...
16,961
[ { "from": "human", "value": "I don't see what all this fuss is about Microsoft's decision to support JQuery within ASP.NET MVC.\nThere were signs that open-minded people are starting to have some say in the matters of marketing for a while now. And even the way MS does business has started to change. But at...
When I build XML up from scratch with XmlDocument, the OuterXml property already has everything nicely indented with line breaks. However, if I call LoadXml on some very "compressed" XML (no line breaks or indention) then the output of OuterXml stays that way. So ... What is the simplest way to get beautified XML out...
To beautify the output of an `XmlDocument` in C#, you can use the `XmlWriter` class with specific settings that control indentation and formatting. Here’s a straightforward approach to achieve nicely formatted XML output: 1. Create an `XmlWriterSettings` object. 2. Set the `Indent` property to `true`. 3. Use an `XmlWr...
20,004
[ { "from": "human", "value": "When I build XML up from scratch with XmlDocument, the OuterXml property already has everything nicely indented with line breaks. However, if I call LoadXml on some very \"compressed\" XML (no line breaks or indention) then the output of OuterXml stays that way. So ...\nWhat i...
In this particular situation, there are 9 automated steps in a process that take varying lengths of time. We currently have a number showing percentage in the center of a progress bar, but it suffers from the common stop-and-go problem of racing up to 33%, waiting a long time, racing up to 55%, waiting an even longer t...
In situations where automated processes involve steps with significantly varying durations, presenting progress in a way that communicates the overall experience effectively is crucial. Here are several options you might consider, along with the pros and cons of each: ### 1. **Descriptive Text with Progress Indicators...
16,499
[ { "from": "human", "value": "In this particular situation, there are 9 automated steps in a process that take varying lengths of time. We currently have a number showing percentage in the center of a progress bar, but it suffers from the common stop-and-go problem of racing up to 33%, waiting a long time, r...
I have a generated HTML page with flash content in it. I am trying to reposition the flash content and make it "absolute". I have tried to wrap the object tags with a div tag, but to no avail. Can anyone tell me how to do this? Removing the generated positioning attributes does not work. See relevant code below (it is...
To make the Flash content absolutely positioned on your HTML page, you can indeed wrap the object tags in a div with the appropriate CSS styles. However, there are a couple of things to consider to ensure that it works correctly. Here’s a step-by-step approach to make the Flash content absolutely positioned: 1. **Wra...
14,963
[ { "from": "human", "value": "I have a generated HTML page with flash content in it. I am trying to reposition the flash content and make it \"absolute\". I have tried to wrap the object tags with a div tag, but to no avail. Can anyone tell me how to do this? Removing the generated positioning attributes doe...
The classic "Design Patterns: Elements of Reusable Object-Oriented Software" actually introduced most of us to the idea of design patterns. However these days I find a book such as "Patterns of Enterprise Application Architecture" (POEA) by Martin Fowler, much more useful in my day to day work. In discussions with fe...
You raise an important point regarding the different categories of design patterns, each applicable at various levels of software architecture and development. While the "Gang of Four" (GoF) patterns are primarily focused on object-oriented design at a relatively low level, patterns such as those described in Martin Fo...
10,546
[ { "from": "human", "value": "The classic \"Design Patterns: Elements of Reusable Object-Oriented Software\" actually introduced most of us to the idea of design patterns.\nHowever these days I find a book such as \"Patterns of Enterprise Application Architecture\" (POEA) by Martin Fowler, much more useful i...
Say I have an array that represents a set of points: x = [2, 5, 8, 33, 58] How do I generate an array of all the pairwise distances?
To generate an array of all the pairwise distances from the array of points \( x = [2, 5, 8, 33, 58] \), you can use the following steps in Python, making use of NumPy: 1. Import NumPy. 2. Create the array of points. 3. Use broadcasting to compute pairwise distances. Here's how you can do it: ```python import numpy ...
20,262
[ { "from": "human", "value": "Say I have an array that represents a set of points:\nx = [2, 5, 8, 33, 58]\n\nHow do I generate an array of all the pairwise distances? \n" }, { "from": "gpt", "value": "To generate an array of all the pairwise distances from the array of points \\( x = [2, 5, 8, 33...
What's the shortest Perl one-liner that print out the first 9 powers of a hard-coded 2 digit decimal (say, for example, .37), each on its own line? The output would look something like: 1 0.37 0.1369 [etc.] Official Perl golf rules: Smallest number of (key)strokes wins Your stroke count includes the command line
Here’s a compact Perl one-liner that prints out the first 9 powers of a hard-coded decimal (0.37 in this case): ```perl perl -E 'say 0.37**$_ for 0..8' ``` This one-liner has a stroke count of 31 and works as follows: - `-E`: Tells Perl to execute the code provided. - `say`: Prints each result followed by a newline....
22,511
[ { "from": "human", "value": "What's the shortest Perl one-liner that print out the first 9 powers of a hard-coded 2 digit decimal (say, for example, .37), each on its own line? \nThe output would look something like:\n1\n0.37\n0.1369\n[etc.]\n\nOfficial Perl golf rules:\n\nSmallest number of (key)strokes w...
With a view to avoiding the construction of further barriers to migration whilst enhancing an existing vb6 program. Is there a way to achieve the same functionality as control arrays in vb6 without using them?
Yes, you can achieve similar functionality to control arrays in VB6 without actually using control arrays. Control arrays in VB6 are a way to manage multiple controls of the same type, allowing you to loop through them easily. However, if you want to avoid using control arrays while maintaining similar functionality, y...
17,848
[ { "from": "human", "value": "With a view to avoiding the construction of further barriers to migration whilst\nenhancing an existing vb6 program.\nIs there a way to achieve the same functionality as control arrays in vb6 without using them?\n" }, { "from": "gpt", "value": "Yes, you can achieve s...
Can anyone explain the difference between the "name" property of a display object and the value found by getChildByName("XXX") function? They're the same 90% of the time, until they aren't, and things fall apart. For example, in the code below, I find an object by instance name only by directly examining the child's n...
In ActionScript, there are subtle but important differences between the `name` property of a display object and the functionality of `getChildByName("XXX")`. Let's break down these differences to clarify why you are experiencing the issue. 1. **`name` Property**: - The `name` property is a string identifier that yo...
14,305
[ { "from": "human", "value": "Can anyone explain the difference between the \"name\" property of a display object and the value found by getChildByName(\"XXX\") function? They're the same 90% of the time, until they aren't, and things fall apart.\nFor example, in the code below, I find an object by instance...
I've got an issue when accessing a web site, I can access it by using the NetBIOS name, but when accessing with the FQDN i get an error. Any ideas on how to troubleshoot this? (There is no DNS configured yet, we have modified the Hosts file to enter the related names and IP.)
If you can access a website using its NetBIOS name but not via its Fully Qualified Domain Name (FQDN), and you're using a modified Hosts file for name resolution, there are several troubleshooting steps you can take: ### 1. Verify the Hosts File Entry Make sure that the entry in the Hosts file is correctly formatted. ...
15,900
[ { "from": "human", "value": "I've got an issue when accessing a web site, I can access it by using the NetBIOS name, but when accessing with the FQDN i get an error. \nAny ideas on how to troubleshoot this?\n(There is no DNS configured yet, we have modified the Hosts file to enter the related names and IP.)...
Some friends and colleagues of mine have a little running contest to find or write the longest class/variable/property/method names possible. Keep in mind, we try to be good boys and girls and keep the naming intelligible and concise, while still explaining what the thing does via its name. Sometimes it just doesn't h...
It's definitely a fun challenge to come up with long but intelligible names for classes, variables, properties, or methods in programming! Here are a few examples of longer names that still maintain clarity and meaning: 1. **Class Names:** - `UserAuthenticationAndAuthorizationService` - `ReportGenerationAndDataE...
20,138
[ { "from": "human", "value": "Some friends and colleagues of mine have a little running contest to find or write the longest class/variable/property/method names possible. Keep in mind, we try to be good boys and girls and keep the naming intelligible and concise, while still explaining what the thing does ...
Is there any easy web application or user control that allows math equations to be easily created and stored as a text string? Update: An ASP.NET control would be ideal.
Yes, there are several options for creating and storing math equations as text strings in an ASP.NET application. Here are a few suggestions: ### 1. **MathJax**: MathJax is a JavaScript library that can render mathematical notation written in LaTeX, MathML, or AsciiMath. While it’s primarily for rendering, you can cre...
18,188
[ { "from": "human", "value": "Is there any easy web application or user control that allows math equations to be easily created and stored as a text string?\nUpdate: An ASP.NET control would be ideal.\n" }, { "from": "gpt", "value": "Yes, there are several options for creating and storing math eq...
I have a strange requirement to ship an application without bundling .Net framework (to save memory footprint and bandwidth). Is this possible? Customers may or may not have .Net runtime installed on their systems. Will doing Ngen take care of this problem? I was looking for something like the good old ways of releasi...
Shipping a .NET application without bundling the .NET framework is a challenging scenario since .NET applications typically depend on the runtime being present on the target system. Here are some key points to consider: ### 1. **.NET Framework vs. .NET Core / .NET 5+**: - If you are working with **.NET Framework**,...
15,517
[ { "from": "human", "value": "I have a strange requirement to ship an application without bundling .Net framework (to save memory footprint and bandwidth). \nIs this possible? Customers may or may not have .Net runtime installed on their systems.\nWill doing Ngen take care of this problem? I was looking for ...
I have a .NET 2.0 WebBrowser control used to navigate some pages with no user interaction (don't ask...long story). Because of the user-less nature of this application, I have set the WebBrowser control's ScriptErrorsSuppressed property to true, which the documentation included with VS 2005 states will [...]"hide all ...
In a .NET Windows Forms application, the `WebBrowser` control utilizes an instance of Internet Explorer to render web pages and execute JavaScript. While you've already suppressed script errors and handled new windows, blocking specific JavaScript dialogs like `alert()` requires a different approach, as the `WebBrowser...
16,679
[ { "from": "human", "value": "I have a .NET 2.0 WebBrowser control used to navigate some pages with no user interaction (don't ask...long story). Because of the user-less nature of this application, I have set the WebBrowser control's ScriptErrorsSuppressed property to true, which the documentation included...
I have a string that I would like to print . Is it possible to center it when printing ?
Yes, you can center a string when printing it in Python. One common approach is to use the `str.center()` method, which centers the string within a specified width by padding it with spaces (or another specified character) on both sides. Here's an example: ```python # Define your string my_string = "Hello, World!" #...
21,385
[ { "from": "human", "value": "I have a string that I would like to print . Is it possible to center it when printing ?\n" }, { "from": "gpt", "value": "Yes, you can center a string when printing it in Python. One common approach is to use the `str.center()` method, which centers the string within...
Looking for an answer for C# and C++. (in C#, replace 'destructor' with 'finalizer')
Certainly! Below are explanations of destructors in C++ and finalizers in C#. ### C++ In C++, a destructor is a special member function that is executed when an object of a class goes out of scope or is explicitly deleted. The destructor has the same name as the class but is prefixed with a tilde (`~`). Destructors a...
17,171
[ { "from": "human", "value": "Looking for an answer for C# and C++. (in C#, replace 'destructor' with 'finalizer')\n" }, { "from": "gpt", "value": "Certainly! Below are explanations of destructors in C++ and finalizers in C#.\n\n### C++\n\nIn C++, a destructor is a special member function that is...
Is there a library or acceptable method for sanitizing the input to an html page? In this case I have a form with just a name, phone number, and email address. Code must be C#. For example: "<script src='bobs.js'>John Doe</script>" should become "John Doe"
When dealing with user input for an HTML page, it's crucial to sanitize the data to prevent XSS (Cross-Site Scripting) attacks and other security vulnerabilities. In C#, you can use libraries or methods to sanitize input. ### Using the `HtmlEncode` Method One common way to sanitize input is to use the `System.Net.Web...
17,338
[ { "from": "human", "value": "Is there a library or acceptable method for sanitizing the input to an html page?\nIn this case I have a form with just a name, phone number, and email address. \nCode must be C#.\nFor example:\n\"<script src='bobs.js'>John Doe</script>\" should become \"John Doe\"\n" }, { ...
If i have a complex XML file, is there a cheap or free way to get a rough approximation of an XSD from it?
Yes, there are several free or inexpensive tools and methods you can use to generate a rough approximation of an XML Schema Definition (XSD) from a complex XML file. Here are some popular options: 1. **Online Tools**: - **Trang**: This tool can convert XML to XSD and is available for download. You can run it locall...
18,283
[ { "from": "human", "value": "If i have a complex XML file, is there a cheap or free way to get a rough approximation of an XSD from it?\n" }, { "from": "gpt", "value": "Yes, there are several free or inexpensive tools and methods you can use to generate a rough approximation of an XML Schema Def...
I'm creating a invoice crystal report for sage mas 500 AR module. In it, I'm attempting to add the tarinvoice.balance field with the following formula: if {tarPrintInvcHdrWrk.Posted} = 1 then ToText({tarInvoice.Balance}) I'm assuming that when the {tarPrintInvcHdrWrk.Posted} = 1 conditional statement holds FALSE...
It sounds like you're encountering a problem with the behavior of the `tarInvoice.Balance` field when `tarPrintInvcHdrWrk.Posted` is not equal to 1. Here are several approaches to troubleshoot and possibly resolve your issue: ### 1. **Use a Suppression Formula:** If the report bombs when `tarInvoice.Balance` is includ...
19,357
[ { "from": "human", "value": "I'm creating a invoice crystal report for sage mas 500 AR module. In it, I'm attempting to add the tarinvoice.balance field with the following formula: \nif {tarPrintInvcHdrWrk.Posted} = 1 then \n ToText({tarInvoice.Balance})\n\nI'm assuming that when the {tarPrintInvcHdrWrk....
We have implmented a REST-style get service Using WCF in .Net 3.5. This service retrieves research documents. The string 'synopsis' indicated in the code bolow contains non-english characteres which the browser deliveres as "????????". private void ReturnSynopsisInfo(IApiWebOperationContext context, OutgoingWebRespons...
The issue you're encountering with non-English characters being displayed as "???" is likely due to character encoding problems in your WCF service. The code you've shown uses `Encoding.ASCII.GetBytes(synopsis)`, which will not be able to handle non-ASCII characters (those outside the range of 0-127). Instead, you shou...
19,150
[ { "from": "human", "value": "We have implmented a REST-style get service Using WCF in .Net 3.5. This service retrieves research documents. The string 'synopsis' indicated in the code bolow contains non-english characteres which the browser deliveres as \"????????\". \nprivate void ReturnSynopsisInfo(IApiWeb...
I am working on a project that requires a number of icons generated from a set of source images. I have a script that generates all the required images with judicious use of ImageMagick, although I have not found a suitable tool to package the images as icons. I have a set of png files (from dimensions of 16x16 up to ...
There are several tools available that can help you convert PNG images to Windows ICO format while preserving transparency and supporting larger icon sizes. Here are some recommendations: 1. **ImageMagick**: You can use ImageMagick itself to create ICO files with proper transparency. The command would look something l...
20,414
[ { "from": "human", "value": "I am working on a project that requires a number of icons generated from a set of source images. I have a script that generates all the required images with judicious use of ImageMagick, although I have not found a suitable tool to package the images as icons.\nI have a set of ...
I have an ASP.Net 3.5 platform and windows 2003 server with all the updates. There is a limit with .Net that it cannot handle more than 260 characters. Moreover if you look it up on web, you will find that IE 6 fails to work if it is not patched at above 100 charcters. I want to have the rewrite path module to be sup...
When working with URL lengths and compatibility across browsers and web servers, there are a few considerations to keep in mind, especially given your setup with ASP.NET 3.5 and Windows Server 2003. ### General URL Length Limitations: 1. **IIS (Internet Information Services)**: The default maximum URL length in IIS ...
18,696
[ { "from": "human", "value": "I have an ASP.Net 3.5 platform and windows 2003 server with all the updates. \nThere is a limit with .Net that it cannot handle more than 260 characters. Moreover if you look it up on web, you will find that IE 6 fails to work if it is not patched at above 100 charcters. \nI wan...
How should I run another program from within my C program? I need to be able to write data into STDIN of the launched program (and maybe read from it's STDOUT) I am not sure if this is a standard C function. I need the solution that should work under Linux.
To run another program from within your C program on a Linux system, and manage input and output between the two processes, you can use the `fork` and `exec` functions to create a new process, along with pipes to handle communication. Here's a basic outline of the steps you'll need to follow: 1. Create two pipes: one...
11,925
[ { "from": "human", "value": "How should I run another program from within my C program? I need to be able to write data into STDIN of the launched program (and maybe read from it's STDOUT)\nI am not sure if this is a standard C function. I need the solution that should work under Linux.\n" }, { "fro...
When I navigate on a website utilizing MasterPages, does the application know what page I am on? If so, does it store it in an object I can access? The reason I am asking is so I can replace this: //masterpage <div id="nav_main"> <ul><asp:ContentPlaceHolder ID="navigation" runat="server"> </...
Yes, when using MasterPages in ASP.NET, the application knows which content page is currently being accessed. You can access the `Request` object to determine the current page, and based on that, you can set the "current" navigation item dynamically instead of hardcoding it in each content page. Here's an example of h...
17,487
[ { "from": "human", "value": "When I navigate on a website utilizing MasterPages, does the application know what page I am on? If so, does it store it in an object I can access?\nThe reason I am asking is so I can replace this:\n//masterpage \n<div id=\"nav_main\">\n <ul><asp:ContentPlaceHolder ID=\"navig...
Using jQuery, how do you check if there is an option selected in a select menu, and if not, assign one of the options as selected. (The select is generated with a maze of PHP functions in an app I just inherited, so this is a quick fix while I get my head around those :)
You can use jQuery to check if an option is selected in a `<select>` menu. If no option is selected, you can set one of the options as selected using the `.val()` method. Here's a simple way to achieve that: ```html <!-- Example select menu --> <select id="mySelect"> <option value="">-- Please Select --</option> ...
19,294
[ { "from": "human", "value": "Using jQuery, how do you check if there is an option selected in a select menu, and if not, assign one of the options as selected.\n(The select is generated with a maze of PHP functions in an app I just inherited, so this is a quick fix while I get my head around those :)\n" }...
How do I limit the types of HTML that a user can input into a textbox? I'm running a small forum using some custom software that I'm beta testing, but I need to know how to limit the HTML input. Any suggestions?
Limiting the types of HTML that a user can input into a textbox is crucial for preventing security issues like Cross-Site Scripting (XSS) and ensuring that your forum maintains a clean and readable format. Here are some strategies you can implement: ### 1. **Whitelisting HTML Tags and Attributes:** Implement a whit...
14,175
[ { "from": "human", "value": "How do I limit the types of HTML that a user can input into a textbox? I'm running a small forum using some custom software that I'm beta testing, but I need to know how to limit the HTML input. Any suggestions?\n" }, { "from": "gpt", "value": "Limiting the types of ...
I've got an iPhone app with icon file Icon.png. This icon shows up properly when the app is on the phone itself, but it doesn't show up in the applications pane in iTunes. What do I need to do to get it to show up properly?
If your app icon is showing correctly on the iPhone but not in the applications pane in iTunes, there could be a few things to check to resolve the issue. Here’s a checklist to help ensure that your app icon is displayed correctly: 1. **Icon Sizes**: Make sure you have provided all the required icon sizes in your app'...
16,657
[ { "from": "human", "value": "I've got an iPhone app with icon file Icon.png.\nThis icon shows up properly when the app is on the phone itself, but it doesn't show up in the applications pane in iTunes.\nWhat do I need to do to get it to show up properly?\n" }, { "from": "gpt", "value": "If your ...
It seems import Queue Queue.Queue().get(timeout=10) is keyboard interruptible (ctrl-c) whereas import Queue Queue.Queue().get() is not. I could always create a loop; import Queue q = Queue() while True: try: q.get(timeout=1000) except Queue.Empty: pass but this seems like a strange thing t...
In Python, when using the `Queue` module (in Python 2) or the `queue` module (in Python 3), the `get()` method will block indefinitely when called without a timeout. This means it will not return control to the program until an item is available or the queue is terminated. However, during this blocking state, a keyboar...
20,758
[ { "from": "human", "value": "It seems\nimport Queue\n\nQueue.Queue().get(timeout=10)\n\nis keyboard interruptible (ctrl-c) whereas\nimport Queue\n\nQueue.Queue().get()\n\nis not. I could always create a loop;\nimport Queue\nq = Queue()\n\nwhile True:\n try:\n q.get(timeout=1000)\n except Queue....
Vista displays the dialog "Close programs to prevent information loss" when the system is low on virtual memory. In this dialog it names programs you should close. People have reported to me that it sometimes names the program I develop. How does Vista decide which programs should be closed? I'm wondering if this dialo...
The "Close programs to prevent information loss" dialog in Windows Vista is displayed when the system is low on virtual memory and is attempting to manage resources to maintain stability. When it comes to which programs are listed for closure, Vista uses certain criteria to determine which applications may be consuming...
20,791
[ { "from": "human", "value": "Vista displays the dialog \"Close programs to prevent information loss\" when the system is low on virtual memory.\nIn this dialog it names programs you should close. People have reported to me that it sometimes names the program I develop.\nHow does Vista decide which programs ...
I'm writing an app which for various reasons involves Internet Explorer (IE7, for the record), ActiveX controls, and a heroic amount of JavaScript, which is spread across multiple .js includes. One of our remote testers is experiencing an error message and IE's error message says something to the effect of: Line: 719 ...
Debugging JavaScript errors in Internet Explorer, especially in older versions like IE7, can indeed be quite challenging. Given the context and the specifics of the error message you're encountering, here are some troubleshooting steps and considerations you might find helpful: ### Steps to Diagnose the Issue 1. **Ch...
18,460
[ { "from": "human", "value": "I'm writing an app which for various reasons involves Internet Explorer (IE7, for the record), ActiveX controls, and a heroic amount of JavaScript, which is spread across multiple .js includes. \nOne of our remote testers is experiencing an error message and IE's error message s...
I use a structure of function pointers to implement an interface for different backends. The signatures are very different, but the return values are almost all void, void * or int. struct my_interface { void (*func_a)(int i); void *(*func_b)(const char *bla); ... int (*func_z)(char foo); }; But it...
Using a single dummy function with different signatures through casting can lead to undefined behavior, particularly regarding the function's return type and how arguments are passed, due to differences in calling conventions and return value expectations. In your example, you're using a `nothing` function that retur...
17,314
[ { "from": "human", "value": "I use a structure of function pointers to implement an interface for different backends. The signatures are very different, but the return values are almost all void, void * or int.\n\nstruct my_interface {\n void (*func_a)(int i);\n void *(*func_b)(const char *bla);\n ...
Many times I've seen links like these in HTML pages: <a href='#' onclick='someFunc(3.1415926); return false;'>Click here !</a> What's the effect of the return false in there? Also, I don't usually see that in buttons. Is this specified anywhere? In some spec in w3.org?
The `return false;` statement in the `onclick` event handler of an anchor (`<a>`) tag serves a specific purpose. When an anchor tag is clicked, the browser attempts to navigate to the URL specified in the `href` attribute. In this case, the `href` is `'#'`, which usually scrolls the page to the top (the top of the curr...
20,587
[ { "from": "human", "value": "Many times I've seen links like these in HTML pages:\n<a href='#' onclick='someFunc(3.1415926); return false;'>Click here !</a>\n\nWhat's the effect of the return false in there?\nAlso, I don't usually see that in buttons.\nIs this specified anywhere? In some spec in w3.org?\n" ...
Compared to most people on this site I am admittedly a novice. I wanted to get some advice from the pros on how to avoid making stupid errors in your code. Is there anyone else who had the problem when they were first starting out of missing some detail that causes big problems? Are there any habits or behaviors that ...
It's completely normal to feel like a novice when you're starting out in programming. Everyone makes mistakes, and even seasoned developers encounter issues from time to time. Here are some tips and habits that can help you avoid common pitfalls and improve your coding skills: 1. **Practice, Practice, Practice**: The ...
16,957
[ { "from": "human", "value": "Compared to most people on this site I am admittedly a novice. I wanted to get some advice from the pros on how to avoid making stupid errors in your code. \nIs there anyone else who had the problem when they were first starting out of missing some detail that causes big problem...
Is there a way to encrypt the data file that mysql uses? I have a mysql server on an open machine, and I would like to encrypt the data file so even if someone copies the data files, they cannot read the data. Thanks
Yes, there are several ways to encrypt the data files used by MySQL to enhance the security of your data. Here are a few options: ### 1. **MySQL Data-at-Rest Encryption** (Transparent Data Encryption - TDE) Starting from MySQL 5.7 and later versions, MySQL provides built-in support for data-at-rest encryption. This f...
11,757
[ { "from": "human", "value": "Is there a way to encrypt the data file that mysql uses? I have a mysql server on an open machine, and I would like to encrypt the data file so even if someone copies the data files, they cannot read the data.\nThanks\n" }, { "from": "gpt", "value": "Yes, there are s...
I'm trying to determine the asymptotic run-time of one of my algorithms, which uses exponents, but I'm not sure of how exponents are calculated programmatically. I'm specifically looking for the pow() algorithm used for double-precision, floating point numbers.
When it comes to calculating exponentiation programmatically, especially for double-precision floating-point numbers, the algorithm used can significantly affect both accuracy and performance. One common implementation of the exponentiation function (like `pow()` in C, C++, or Python) is based on the following strateg...
17,329
[ { "from": "human", "value": "I'm trying to determine the asymptotic run-time of one of my algorithms, which uses exponents, but I'm not sure of how exponents are calculated programmatically.\nI'm specifically looking for the pow() algorithm used for double-precision, floating point numbers.\n" }, { ...
Let say that I have a website with some information that could be access externally. Those information need to be only change by the respected client. Example: Google Analytic or WordPress API key. How can I create a system that work like that (no matter the programming language)?
Creating a system where specific information (like API keys) can be accessed and modified only by the respective clients can be accomplished by following a structured approach. Here’s a high-level overview of the process, with some example implementations: ### Step 1: Define Your Requirements 1. **Data Security**: En...
14,280
[ { "from": "human", "value": "Let say that I have a website with some information that could be access externally. Those information need to be only change by the respected client. Example: Google Analytic or WordPress API key. How can I create a system that work like that (no matter the programming language...
We have been using GenuineChannels in our product for the last 4 years. GenuineChannels now appears to have become unsupported and the main developer guy Dmitri has I think joined Microsoft. I have the source as part of the product but not the networking / .net knowledge to support it. Has anyone found a good alternati...
If you're looking for alternatives to GenuineChannels for .NET remoting, there are several modern technologies and libraries that you can consider. Here are some popular options: 1. **gRPC**: - gRPC is a high-performance, open-source framework developed by Google. It uses HTTP/2 for transport and protocol buffers a...
18,844
[ { "from": "human", "value": "We have been using GenuineChannels in our product for the last 4 years. GenuineChannels now appears to have become unsupported and the main developer guy Dmitri has I think joined Microsoft. I have the source as part of the product but not the networking / .net knowledge to supp...
What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like to setup dynamic Dynamic DNS solution.
If you're logged into another computer using SSH and want to download files to your local hard drive, you can use the `scp` (Secure Copy Protocol) command. `scp` allows you to securely transfer files between hosts on a network, and it can be more convenient than SFTP for certain tasks, especially since you can run it d...
13,043
[ { "from": "human", "value": "What is the best way to download files to local hard drive when logged in to another computer using ssh in bash. I'm aware of sftp, but it is not convienent, e.g. it lacks tab completion of directory names. I'm using Ubuntu 8.04.1 . I don't have a public IP and would not like to...
I'm having a problem running a VS 2005 app on some machines and not others. I looked up the error message on google and found a post by someone who had the same error and fixed it by uninstalling and reinstalling the .NET framework. When I try to do that, Windows won't let me because it is in use. Am I expected to un...
Uninstalling and reinstalling the .NET Framework can be tricky, especially if other applications are currently using it. Here are some steps you can follow to address this issue more efficiently: 1. **Identify Running Applications**: Check if any applications are actively using the .NET Framework. You can do this by c...
18,134
[ { "from": "human", "value": "I'm having a problem running a VS 2005 app on some machines and not others. I looked up the error message on google and found a post by someone who had the same error and fixed it by uninstalling and reinstalling the .NET framework. When I try to do that, Windows won't let me ...
I often use the execv() function in C++, but if some of the arguments are in C++ strings, it annoys me that I cannot do this: const char *args[4]; args[0] = "/usr/bin/whatever"; args[1] = filename.c_str(); args[2] = someparameter.c_str(); args[3] = 0; execv(args[0], args); This doesn't compile because execv() takes ...
The issue you're encountering stems from the way C and C++ handle string types. The `execv()` function is defined in C and expects an array of `char *`, which are modifiable character pointers. Your C++ `std::string` objects return `const char *` when you call `.c_str()`, which is why you cannot directly assign them to...
17,357
[ { "from": "human", "value": "I often use the execv() function in C++, but if some of the arguments are in C++ strings, it annoys me that I cannot do this:\nconst char *args[4];\n\nargs[0] = \"/usr/bin/whatever\";\nargs[1] = filename.c_str();\nargs[2] = someparameter.c_str();\nargs[3] = 0;\n\nexecv(args[0], ...
I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to regenerating the data layer?
Yes, there is a more efficient way to update your LINQ to SQL classes without having to delete and re-add tables every time you make changes to your underlying database schema. Here are a few methods you can use to regenerate your data layer: ### 1. **Update the .dbml File:** If you're using a `.dbml` (LINQ to SQL ma...
18,923
[ { "from": "human", "value": "I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to...
I'm developing a website. I'm using a single-page web-app style, so all of the different parts of the site are AJAX'd into index.php. When a user logs in and tells Firefox to remember his username and password, all input boxes on the site get auto-filled with that username and password. This is a problem on the form to...
To prevent Firefox (and other browsers) from auto-filling username and password fields in your password change form, you can use a combination of attributes on your input elements. Here are several methods you can try: 1. **Use `autocomplete` attribute**: Setting the `autocomplete` attribute to "off" can help prevent ...
19,276
[ { "from": "human", "value": "I'm developing a website. I'm using a single-page web-app style, so all of the different parts of the site are AJAX'd into index.php. When a user logs in and tells Firefox to remember his username and password, all input boxes on the site get auto-filled with that username and p...
Just updated build server with rc0 and surprise no chiron. Wondering how you package up a xap file without chiron.
If you are using a newer build server version and no longer have access to Chiron for packaging a `.xap` file, you can consider the following methods to create a `.xap` package for your Silverlight application: 1. **Using Visual Studio:** - If you have Visual Studio installed, you can build your Silverlight applica...
18,323
[ { "from": "human", "value": "Just updated build server with rc0 and surprise no chiron. Wondering how you package up a xap file without chiron.\n" }, { "from": "gpt", "value": "If you are using a newer build server version and no longer have access to Chiron for packaging a `.xap` file, you can...
What's the best way to access WSE 2.0 web services from .NET 2.0? Using VS2005's web references is not working, because generated classes are using System.Web.Services as their base (instead of Microsoft.Web.Services2).
Accessing WSE 2.0 (Web Services Enhancements) web services from .NET 2.0 can be a bit tricky since .NET 2.0 web services by default rely on `System.Web.Services`, while WSE 2.0 requires the use of the `Microsoft.Web.Services2` namespace for enhanced features like security and message routing. Here are the steps to acc...
15,850
[ { "from": "human", "value": "What's the best way to access WSE 2.0 web services from .NET 2.0?\nUsing VS2005's web references is not working, because generated classes are using System.Web.Services as their base (instead of Microsoft.Web.Services2).\n" }, { "from": "gpt", "value": "Accessing WSE...
When running all my tests in Eclipse (Eclipse 3.4 'Ganymede'), one test is listed under "Unrooted Tests". I'm using Junit 3.8 and this particular test extends TestCase. I do not see any difference between this test and the other tests. I don't remember seeing this occur in Eclipse 3.3 (Europa). Clarification: We haven'...
It sounds like you're experiencing an issue with Eclipse's test runner recognizing one of your JUnit 3 tests as "Unrooted." This can sometimes happen due to various reasons, especially in older versions of Eclipse, and it might not always indicate a problem with the test itself. Here are some possible reasons and solu...
16,612
[ { "from": "human", "value": "When running all my tests in Eclipse (Eclipse 3.4 'Ganymede'), one test is listed under \"Unrooted Tests\". I'm using Junit 3.8 and this particular test extends TestCase. I do not see any difference between this test and the other tests. I don't remember seeing this occur in Ecl...
An application currently in development has the requirements for using MS Word to perform spell check on certain textareas within the application. I currently have Office 2007 (which is the Office 12 com objects). My question is, if I add in the Office 12 objects what will happen on boxes which have Office 2003? This ...
When developing an application that utilizes Office COM objects for functionalities such as spell checking, compatibility between different versions of Microsoft Office becomes an important consideration. 1. **Using Office 12 (Office 2007) Objects:** - If you add references to the Office 12 COM objects in your app...
19,740
[ { "from": "human", "value": "An application currently in development has the requirements for using MS Word to perform spell check on certain textareas within the application.\nI currently have Office 2007 (which is the Office 12 com objects).\nMy question is, if I add in the Office 12 objects what will hap...
I have a simple Python script that I want to stop executing if a condition is met. For example: done = True if done: # quit/stop/exit else: # do other stuff Essentially, I am looking for something that behaves equivalently to the 'return' keyword in the body of a function which allows the flow of the code to e...
In Python, if you want to stop the execution of a script or to exit out of the current flow when a condition is met, you have a few options. Since you're looking for something similar to the `return` keyword (which exits a function), you can either use the `exit()` or `sys.exit()` functions to stop the execution of the...
19,870
[ { "from": "human", "value": "I have a simple Python script that I want to stop executing if a condition is met.\nFor example:\ndone = True\nif done:\n # quit/stop/exit\nelse:\n # do other stuff\n\nEssentially, I am looking for something that behaves equivalently to the 'return' keyword in the body of ...
I have parsed XML using both of the following two methods... Parsing the XmlDocument using the object model and XPath queries. XSL/T But I have never used... The Linq Xml object model that was new to .Net 3.5 Can anyone tell me the comparative efficiency between the three alternatives? I realise that the particular...
When comparing the three methods for parsing XML—using the `XmlDocument` object model with XPath, XSLT, and LINQ to XML—there are several factors to consider regarding efficiency. Each method has its strengths and weaknesses, and the best choice depends on your specific use case. Here's a rough comparison: ### 1. **Xm...
16,146
[ { "from": "human", "value": "I have parsed XML using both of the following two methods...\n\nParsing the XmlDocument using the object model and XPath queries.\nXSL/T\n\nBut I have never used...\n\nThe Linq Xml object model that was new to .Net 3.5\n\nCan anyone tell me the comparative efficiency between the...
Suppose that the ApplicationSettings class is a general repository of settings that apply to my application such as TimeoutPeriod, DefaultUnitOfMeasure, HistoryWindowSize, etc... And let's say MyClass makes use of one of those settings - DefaultUnitOfMeasure. My reading of proper use of Inversion of Control Containers...
Your question touches on some fundamental principles of software design, particularly around Dependency Injection (DI), the Inversion of Control (IoC) pattern, and the broader objectives of maintainability, testability, and code decoupling. ### Constructor Dependency Injection The approach you are using in the first ...
14,229
[ { "from": "human", "value": "Suppose that the ApplicationSettings class is a general repository of settings that apply to my application such as TimeoutPeriod, DefaultUnitOfMeasure, HistoryWindowSize, etc... And let's say MyClass makes use of one of those settings - DefaultUnitOfMeasure.\nMy reading of pro...
I'm currently working on the Tips.js from mootools library and my code breaks on the line that has those el.$tmp, and console says it's undefined Can anybody help me?
It looks like you're encountering an issue with the `el.$tmp` property in your code using the MooTools library. Without seeing the specific context of your code, I can provide some general guidance on how to troubleshoot this issue. ### Possible Causes and Solutions 1. **Check Initialization of `el`:** Make sure t...
16,478
[ { "from": "human", "value": "I'm currently working on the Tips.js from mootools library and my code breaks on the line that has those el.$tmp, and console says it's undefined\nCan anybody help me?\n" }, { "from": "gpt", "value": "It looks like you're encountering an issue with the `el.$tmp` prop...
I could probably write this myself, but the specific way I'm trying to accomplish it is throwing me off. I'm trying to write a generic extension method similar to the others introduced in .NET 3.5 that will take a nested IEnumerable of IEnumerables (and so on) and flatten it into one IEnumerable. Anyone have any idea...
Creating a generic extension method to flatten a nested structure of `IEnumerable<IEnumerable<T>>` can be accomplished using recursion or an iterative approach. Below is a way to define such an extension method using recursion. Here's how you can implement a generic extension method that flattens nested `IEnumerable` ...
19,036
[ { "from": "human", "value": "I could probably write this myself, but the specific way I'm trying to accomplish it is throwing me off. I'm trying to write a generic extension method similar to the others introduced in .NET 3.5 that will take a nested IEnumerable of IEnumerables (and so on) and flatten it in...
Per this Adobe KB tech note is there any way around having to place the FLVPlayback skin SWF in same directory as HTML file the container SWF is loaded from? It pains me to have to put a SWF in my site's root directory. I think loading the Flash video in an iframe would solve this problem, but is that a good practice?...
To address your concern about placing the FLVPlayback skin SWF in the same directory as your HTML file, there are a couple of potential workarounds, but they come with considerations. 1. **Modify the Path in ActionScript**: If you have control over the ActionScript used to load the FLVPlayback component, you can speci...
18,657
[ { "from": "human", "value": "Per this Adobe KB tech note is there any way around having to place the FLVPlayback skin SWF in same directory as HTML file the container SWF is loaded from? It pains me to have to put a SWF in my site's root directory.\nI think loading the Flash video in an iframe would solve ...
I recently began using BIRT and have developed a report to use with my xulrunner application. What I haven't yet figured out is how I should deploy the viewer. It seems like BIRT mostly targets Java applications, so there are instructions for deploying on J2EE, JBoss, and other technologies -- with which I am not fam...
Deploying BIRT (Business Intelligence and Reporting Tools) in a non-Java application environment can be challenging, especially if you're looking to integrate it into a XULRunner application without relying on Java server technologies like J2EE or Tomcat. Here are some options you can explore to achieve your goal: ###...
17,016
[ { "from": "human", "value": "I recently began using BIRT and have developed a report to use with my xulrunner application. What I haven't yet figured out is how I should deploy the viewer. It seems like BIRT mostly targets Java applications, so there are instructions for deploying on J2EE, JBoss, and othe...
python's time module seems a little haphazard. For example, here is a list of methods in there, from the docstring: time() -- return current time in seconds since the Epoch as a float clock() -- return CPU time since process start as a float sleep() -- delay for a number of seconds given as a float gmtime() -- convert...
The Python `time` module does provide a way to convert a time tuple in UTC format back into seconds since the Epoch (which is what `gmtime()` does when you call it). However, there isn't a specific function like `mktime()` that directly maps to `gmtime()`; hence, this is why it may seem like there's no inverse for `gmt...
12,791
[ { "from": "human", "value": "python's time module seems a little haphazard. For example, here is a list of methods in there, from the docstring:\ntime() -- return current time in seconds since the Epoch as a float\nclock() -- return CPU time since process start as a float\nsleep() -- delay for a number of ...
I am trying to create a web application using Pylons and the resources on the web point to the PylonsBook page which isn't of much help. I want authentication and authorisation and is there anyway to setup Authkit to work easily with Pylons? I tried downloading the SimpleSiteTemplate from the cheeseshop but wasn't able...
It looks like you're encountering a couple of issues while trying to set up your web application using Pylons, SQLAlchemy, and Authkit. Let’s break down the issues and provide some guidance on how to set up authentication and authorization using Authkit with Pylons. ### 1. Setup Errors with SimpleSiteTemplate The err...
14,770
[ { "from": "human", "value": "I am trying to create a web application using Pylons and the resources on the web point to the PylonsBook page which isn't of much help. I want authentication and authorisation and is there anyway to setup Authkit to work easily with Pylons?\nI tried downloading the SimpleSiteTe...
experimenting with Cockburn use cases in code I was writing some complicated UI code. I decided to employ Cockburn use cases with fish,kite,and sea levels (discussed by Martin Fowler in his book 'UML Distilled'). I wrapped Cockburn use cases in static C# objects so that I could test logical conditions against static...
Your approach to employing Cockburn use cases within your C# ASP.NET application is innovative and has several benefits. By encapsulating the use cases within static classes or enums, you are indeed creating a clearer mapping between the user actions and the underlying code logic. This can improve both the readability ...
18,116
[ { "from": "human", "value": "experimenting with Cockburn use cases in code\nI was writing some complicated UI code. I decided to employ Cockburn use cases with fish,kite,and sea levels (discussed by Martin Fowler in his book 'UML Distilled'). I wrapped Cockburn use cases in static C# objects so that I co...
Is there a way to catch a click on a cell in VBA with Excel? I am not referring to the Worksheet_SelectionChange event, as that will not trigger multiple times if the cell is clicked multiple times. BeforeDoubleClick does not solve my problem either, as I do not want to require the user to double click that frequently....
In Excel VBA, there is no built-in event specifically for detecting single clicks on a cell that will fire every time the cell is clicked, without relying on the `SelectionChange` event. However, you can simulate this behavior by combining the `SelectionChange` event with a few tricks to ensure that it responds to clic...
18,152
[ { "from": "human", "value": "Is there a way to catch a click on a cell in VBA with Excel? I am not referring to the Worksheet_SelectionChange event, as that will not trigger multiple times if the cell is clicked multiple times. BeforeDoubleClick does not solve my problem either, as I do not want to require ...
What tools do you use for Automated Builds / Automated Deployments? Why? What tools do you recommend?
Automated builds and deployments are essential practices in modern software development, and there are numerous tools available that can help streamline these processes. The choice of tools often depends on the specific requirements of a project, team preferences, and the technology stack in use. Here are some popular ...
15,148
[ { "from": "human", "value": "What tools do you use for Automated Builds / Automated Deployments? Why?\nWhat tools do you recommend?\n" }, { "from": "gpt", "value": "Automated builds and deployments are essential practices in modern software development, and there are numerous tools available tha...
Pretty simple scenario. I have a web service that receives a byte array that is to be saved as a particular file type on disk. What is the most efficient way to do this in C#?
To efficiently save a byte array to disk as a particular file type in C#, you can use the `File.WriteAllBytes` method from the `System.IO` namespace. This method is simple and efficient for writing a byte array directly to a file. Here’s an example of how you can do this: ```csharp using System; using System.IO; publ...
18,969
[ { "from": "human", "value": "Pretty simple scenario. I have a web service that receives a byte array that is to be saved as a particular file type on disk. What is the most efficient way to do this in C#?\n" }, { "from": "gpt", "value": "To efficiently save a byte array to disk as a particular f...
For those who haven't read Code Complete 2, the Pseudocode Programming Process is basically a way to design a routine by describing it in plain English first, then gradually revise it to more detailed pseudocode, and finally to code. The main benefit of this is to help you stay at the right level of abstraction by buil...
Your observation about the Pseudocode Programming Process (PPP) and Test-Driven Development (TDD) highlights some common debates in software development practices. Each approach has its own advantages and drawbacks, and preferences often come down to individual styles, project requirements, and team dynamics. ### Pseu...
15,451
[ { "from": "human", "value": "For those who haven't read Code Complete 2, the Pseudocode Programming Process is basically a way to design a routine by describing it in plain English first, then gradually revise it to more detailed pseudocode, and finally to code. The main benefit of this is to help you stay ...
How can I tell Activerecord to not load blob columns unless explicitly asked for? There are some pretty large blobs in my legacy DB that must be excluded for 'normal' Objects.
In ActiveRecord, you can avoid loading large blob columns (like images, files, etc.) unless explicitly requested by using a few techniques. Here are some methods to achieve that: ### 1. Use `select` to Exclude Blob Columns When you query your records, you can use the `select` method to explicitly choose the columns y...
15,908
[ { "from": "human", "value": "How can I tell Activerecord to not load blob columns unless explicitly asked for? There are some pretty large blobs in my legacy DB that must be excluded for 'normal' Objects.\n" }, { "from": "gpt", "value": "In ActiveRecord, you can avoid loading large blob columns ...
What alternatives are there to GAE, given that I already have a good bit of code working that I would like to keep. In other words, I'm digging python. However, my use case is more of a low number of requests, higher CPU usage type use case, and I'm worried that I may not be able to stay with App Engine forever. I h...
If you’re looking for alternatives to Google App Engine (GAE) while sticking to Python and your existing codebase, there are several cloud platforms and services that you might consider. Here are some options that align with your requirements of handling a lower number of requests with higher CPU usage and provide vari...
18,155
[ { "from": "human", "value": "What alternatives are there to GAE, given that I already have a good bit of code working that I would like to keep. In other words, I'm digging python. However, my use case is more of a low number of requests, higher CPU usage type use case, and I'm worried that I may not be a...
I tried doing this: root.addEventListener("click", function () { navigateToURL(ClickURLRequest,"_self"); }); And it does add the event listener. I like using closures because they work well in this situation, however, removing the event listener requires a reference to the original function, and sin...
You're correct that using anonymous functions for event listeners can be limiting when it comes to removing those listeners because you do not have a reference to the original function. In JavaScript (and similar languages), when you define an anonymous function, a new instance of that function is created each time, me...
21,300
[ { "from": "human", "value": "I tried doing this:\nroot.addEventListener(\"click\", \n function () \n { \n navigateToURL(ClickURLRequest,\"_self\"); \n });\n\nAnd it does add the event listener. I like using closures because they work well in this situation,\nhowever, removing the event listener r...
Is there a tool to integrate Mercurial into Visual Studio? I am just curious. Mercurial is pretty nice, even with 'just' TortoiseHG, but integration with Visual Studio would be better.
Yes, there are tools and extensions that can help integrate Mercurial into Visual Studio, although they might not be as widely used as Git integrations. Here are a couple of options you might consider: 1. **VisualHG**: This is a Visual Studio extension that provides Mercurial integration. It allows you to perform comm...
19,743
[ { "from": "human", "value": "Is there a tool to integrate Mercurial into Visual Studio?\nI am just curious. Mercurial is pretty nice, even with 'just' TortoiseHG, but integration with Visual Studio would be better.\n" }, { "from": "gpt", "value": "Yes, there are tools and extensions that can hel...
As part of a project at work I have to calculate the centroid of a set of points in 3D space. Right now I'm doing it in a way that seems simple but naive -- by taking the average of each set of points, as in: centroid = average(x), average(y), average(z) where x, y and z are arrays of floating-point numbers. I seem to...
The method you're using to calculate the centroid of a set of points in 3D space is indeed the standard and correct approach. The centroid (or geometric center) of a set of points is computed as the average of their coordinates. This means that for a set of points \( P_1, P_2, ..., P_n \) represented as \( (x_1, y_1, z...
18,686
[ { "from": "human", "value": "As part of a project at work I have to calculate the centroid of a set of points in 3D space. Right now I'm doing it in a way that seems simple but naive -- by taking the average of each set of points, as in:\ncentroid = average(x), average(y), average(z)\n\nwhere x, y and z are...
In Moss 2007 you have the ability to set the target audience for each individual web part within a page. Is there a way to preview how the page will look to another user without logging in as that user? What I am looking for is a way for someone with full control/design permissions on a site to be able to preview how...
In SharePoint 2007 (MOSS), the audience targeting feature allows you to display content to specific groups of users based on their membership in SharePoint groups or Active Directory groups. However, the limitation you mentioned regarding the ability of users with full control to preview how a page appears to different...
19,414
[ { "from": "human", "value": "In Moss 2007 you have the ability to set the target audience for each individual web part within a page. Is there a way to preview how the page will look to another user without logging in as that user? What I am looking for is a way for someone with full control/design permis...
Is there any way of obtaining a list of registered COM interfaces on a windows machine, with GUIDs? Before anybody thinks this isn't related to programming, I need this data in order to reference a COM interface in F# (or C#) for interfaces that tlbimp isn't exposing.
Yes, you can obtain a list of registered COM interfaces (along with their GUIDs) on a Windows machine using several methods. Here are a couple of approaches that you can take: ### Method 1: Using the Windows Registry COM interfaces are registered in the Windows Registry, specifically under the following key: ``` HKE...
19,656
[ { "from": "human", "value": "Is there any way of obtaining a list of registered COM interfaces on a windows machine, with GUIDs?\nBefore anybody thinks this isn't related to programming, I need this data in order to reference a COM interface in F# (or C#) for interfaces that tlbimp isn't exposing.\n" }, ...
How can we produce the effect of the red line under a bad spelling word like the image below : alt text http://img505.imageshack.us/img505/7253/options285x395rg9.th.png Update I do not want to use Google or whatever spell program. I would like to know how to create the effect of the red line.
To create the effect of a red line under misspelled words (like the one you described), you can use a combination of HTML and CSS. Here's a simple example demonstrating how to achieve this effect: ### HTML ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="wid...
20,040
[ { "from": "human", "value": "How can we produce the effect of the red line under a bad spelling word like the image below :\nalt text http://img505.imageshack.us/img505/7253/options285x395rg9.th.png\nUpdate\nI do not want to use Google or whatever spell program. I would like to know how to create the effect...
I've made some unit tests (in test class). The tutorial I've read said that I should make a TestSuite for the unittests. Odd is that when I'm running the unit test directly (selecting the test class - Run as jUnit test) everything is working fine, altough when I'm trying the same thing with the test suite there's alway...
The exception `java.lang.Exception: No runnable methods` indicates that the test suite is not able to find any runnable test methods in the test class you're trying to include. This issue can occur for several reasons. Here are some things you can check and potential solutions to help resolve the issue: 1. **Check Tes...
17,383
[ { "from": "human", "value": "I've made some unit tests (in test class). The tutorial I've read said that I should make a TestSuite for the unittests.\nOdd is that when I'm running the unit test directly (selecting the test class - Run as jUnit test) everything is working fine, altough when I'm trying the sa...
At run time I want to dynamically build grid columns (or another display layout) in a WPF ListView. I do not know the number and names of the columns before hand. I want to be able to do: MyListView.ItemSource = MyDataset; MyListView.CreateColumns();
To dynamically create columns in a WPF `ListView` at runtime based on the structure of your data source, you can follow these steps: 1. **Define your data source**: In this example, I'll assume you are using a `DataTable` as your data source, which allows for dynamic columns. 2. **Create a method to generate columns*...
10,472
[ { "from": "human", "value": "At run time I want to dynamically build grid columns (or another display layout) in a WPF ListView. I do not know the number and names of the columns before hand.\nI want to be able to do:\n MyListView.ItemSource = MyDataset;\n MyListView.CreateColumns();\n" }, { "from...
I believe several of us have already worked on a project where not only the UI, but also data has to be supported in different languages. Such as - being able to provide and store a translation for what I'm writing here, for instance. What's more, I also believe several of us have some time-triggered events (such as w...
Your observations about the complexities of building multi-language and multi-cultural applications are absolutely on point. Here are some structured insights and strategies based on the challenges you’ve highlighted: ### 1. **Localization Strategy:** - **Database Structure for Translations:** Instead of having all...
18,970
[ { "from": "human", "value": "I believe several of us have already worked on a project where not only the UI, but also data has to be supported in different languages. Such as - being able to provide and store a translation for what I'm writing here, for instance. \nWhat's more, I also believe several of us ...
It's clear that a search performance of the generic HashSet<T> class is higher than of the generic List<T> class. Just compare the hash-based key with the linear approach in the List<T> class. However calculating a hash key may itself take some CPU cycles, so for a small amount of items the linear search can be a real ...
The question of where the break-even point lies between using a `HashSet<T>` and a `List<T>` for small collections is an interesting one. To answer this, we can consider the time complexity of both data structures and the overhead involved in hashing. ### Time Complexity 1. **HashSet<T>**: - Insertion: O(1) on ave...
14,003
[ { "from": "human", "value": "It's clear that a search performance of the generic HashSet<T> class is higher than of the generic List<T> class. Just compare the hash-based key with the linear approach in the List<T> class.\nHowever calculating a hash key may itself take some CPU cycles, so for a small amount...
i need to compress my css as part of my ant build. i noticed that csstidy does this, but it would not be easy to include this in my ant build because i would need to use a different binary on different platforms. so, is there a java css compressor that people use?
Yes, there are several Java-based CSS compressors that you can use in your Ant build process. One popular choice is the **YUI Compressor**, which can be used for both CSS and JavaScript files. While it’s originally a command-line tool, you can integrate it into your Ant build using the appropriate Ant tasks. ### Steps...
16,487
[ { "from": "human", "value": "i need to compress my css as part of my ant build. i noticed that csstidy does this, but it would not be easy to include this in my ant build because i would need to use a different binary on different platforms.\nso, is there a java css compressor that people use?\n" }, { ...
Is there a an event for ListViews that are activated when one of the column headers are clicked on? The plan was to add some text to the user's clipboard when they click on the column header. Is there any easy way to do this?
In a ListView control in a Windows Forms application, there isn't a built-in event specifically for clicking on the column headers. However, you can handle this functionality by using the `ColumnClick` event of the ListView. This event is triggered when the user clicks on a column header. Here's a simple example of ho...
19,059
[ { "from": "human", "value": "Is there a an event for ListViews that are activated when one of the column headers are clicked on? The plan was to add some text to the user's clipboard when they click on the column header. Is there any easy way to do this?\n" }, { "from": "gpt", "value": "In a L...
When using a file attachment control on a InfoPath form as part of a SharePoint workflow I get the error "The selected files was not found".
The error message "The selected file was not found" when using a file attachment control in an InfoPath form as part of a SharePoint workflow can be caused by a few different issues. Here are some troubleshooting steps and potential solutions: 1. **Check File Attachment Control Configuration**: - Ensure that the fi...
17,592
[ { "from": "human", "value": "When using a file attachment control on a InfoPath form as part of a SharePoint workflow I get the error \"The selected files was not found\".\n" }, { "from": "gpt", "value": "The error message \"The selected file was not found\" when using a file attachment control ...
How does Windows determine the last modified date of a folder?
Windows determines the last modified date of a folder based on the timestamps associated with the files and subfolders contained within that folder. Here's how it works: 1. **Timestamps**: Each file and folder in a Windows filesystem has three primary timestamps: - **Creation Time**: When the file or folder was cr...
18,668
[ { "from": "human", "value": "How does Windows determine the last modified date of a folder?\n" }, { "from": "gpt", "value": "Windows determines the last modified date of a folder based on the timestamps associated with the files and subfolders contained within that folder. Here's how it works:\n...
Currently Tomcat's login support redirects users back to where they initially were when the application figured out they weren't logged in. For this particular application I need to force them to always go back to index.jsp. I'm pretty sure this is a simple configuration option in the WAR's web.xml, but I haven't found...
In a Java web application deployed on Apache Tomcat, to force users to always redirect to a specific page (like `index.jsp`) after they log in instead of returning to the originally requested page, you can modify the `web.xml` file and the authentication filter setup. Unfortunately, there isn't a direct configuration o...
15,895
[ { "from": "human", "value": "Currently Tomcat's login support redirects users back to where they initially were when the application figured out they weren't logged in.\nFor this particular application I need to force them to always go back to index.jsp.\nI'm pretty sure this is a simple configuration optio...
I am looking for a template engine to use client side. I have been trying a few like jsRepeater and jQuery Templates. While they seem to work OK in FireFox they all seem to break down in IE7 when it comes down to rendering HTML tables. I also took a look at MicrosoftAjaxTemplates.js (from http://www.codeplex.com/aspnet...
If you're looking for a client-side templating engine that works well across different browsers, including Internet Explorer 7, you might want to consider a few alternatives: 1. **Mustache.js**: This is a logic-less templating engine that works well in various environments. It supports simple templates that can render...
19,704
[ { "from": "human", "value": "I am looking for a template engine to use client side. I have been trying a few like jsRepeater and jQuery Templates. While they seem to work OK in FireFox they all seem to break down in IE7 when it comes down to rendering HTML tables.\nI also took a look at MicrosoftAjaxTemplat...
I need to customize an open-source project. The changes are for a specific organization and will not be useful to the public project. The code changes include disabling features not needed by the organization (affecting 5% of the code), customizing other features for the organization (affecting 20% of the code), and ad...
Customizing an open-source project while keeping it maintainable as the original project evolves can be challenging, but with a systematic approach, you can manage this effectively. Here are some steps to guide you through the process: ### 1. **Set Up Your Local Repository:** - **Checkout the Original Project:** Us...
15,099
[ { "from": "human", "value": "I need to customize an open-source project. The changes are for a specific organization and will not be useful to the public project. The code changes include disabling features not needed by the organization (affecting 5% of the code), customizing other features for the organiz...