instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
var i : integer; i := 1234567; Given the above, I want the string "1,234,567" as output (assuming UK locale). IntToStr just gives me "1234567". I'm sure there's a one-liner for this, but I can't find it...
In Delphi, you can format an integer as a string with thousands separators using the `Format` function. Since you're specifically looking for UK locale formatting, you can achieve the desired output with a one-liner. Here’s how you can do it: ```delphi var i: Integer; formattedString: string; i := 1234567; format...
41,217
[ { "from": "human", "value": "var i : integer;\n\ni := 1234567;\n\nGiven the above, I want the string \"1,234,567\" as output (assuming UK locale). IntToStr just gives me \"1234567\". I'm sure there's a one-liner for this, but I can't find it...\n" }, { "from": "gpt", "value": "In Delphi, you can...
Is there a place I can find Backus–Naur Form or BNF grammars for popular languages? Whenever I do a search I don't turn up much, but I figure they must be published somewhere. I'm most interested in seeing one for Objective-C and maybe MySQL.
Yes, you can find Backus-Naur Form (BNF) grammars for various programming languages, including Objective-C and MySQL, although they might not always be in the most straightforward locations. Here are some resources where you can look: 1. **Objective-C Grammar**: - The official Apple documentation for Objective-C pr...
43,148
[ { "from": "human", "value": "Is there a place I can find Backus–Naur Form or BNF grammars for popular languages? Whenever I do a search I don't turn up much, but I figure they must be published somewhere. I'm most interested in seeing one for Objective-C and maybe MySQL.\n" }, { "from": "gpt", ...
We have a netbeans project that has an xsd that we use to create a wsdl and we use the wsdl to create a webservice. Since we are using types in our xsd jaxb is used and one of our webservice methods looks like this: public void someMethod( org.netbeans.xml.schema.line.Line x )... So that leaves us a problem with ...
To manage your JAXB-generated classes and avoid issues with version control like Subversion (SVN), you have a few options. Here’s a step-by-step guide for both approaches you mentioned: ### Option 1: Generate JAXB Classes Inside Your Project Structure 1. **Change Output Directory in NetBeans:** - Open the project ...
38,545
[ { "from": "human", "value": "We have a netbeans project that has an xsd that we use to create a wsdl and we use the wsdl to create a webservice. Since we are using types in our xsd jaxb is used and one of our webservice methods looks like this: \npublic void someMethod( org.netbeans.xml.schema.line.Line...
I have been working on a project that has 2 interfaces - windows forms and web. Over the past 8 months, we have faced more issues with maintenance of our web apps (works in IE not in FF, ajax breaks in some weird ways that is not easy to debug... ) and so on. On the other hand, the winform app is easy to install. We ha...
It sounds like you've encountered a common scenario in software development where the advantages of each platform (web vs. smart clients) reveal their respective trade-offs, especially when it comes to maintenance and deployment. ### Smart Clients vs. Web Applications 1. **Ease of Deployment**: - Smart clients, es...
41,868
[ { "from": "human", "value": "I have been working on a project that has 2 interfaces - windows forms and web. Over the past 8 months, we have faced more issues with maintenance of our web apps (works in IE not in FF, ajax breaks in some weird ways that is not easy to debug... ) and so on.\nOn the other hand,...
I'm relatively familiar with the concepts of DI/IOC containers having worked on projects previously where their use were already in place. However, for this new project, there is no existing framework and I'm having to pick one. Long story short, there are some scenarios where we'll be configuring several implementati...
Yes, several mainstream Inversion of Control (IoC) containers provide mechanisms to resolve multiple implementations of a given interface. Here's a brief overview of how you can achieve this using popular IoC containers: ### 1. **Autofac** Autofac is a popular IoC container that allows for the registration and resolu...
41,799
[ { "from": "human", "value": "I'm relatively familiar with the concepts of DI/IOC containers having worked on projects previously where their use were already in place. However, for this new project, there is no existing framework and I'm having to pick one.\nLong story short, there are some scenarios where...
I have a asp.net web application which has a number of versions deployed on different customer servers inside their networks. One practice that we have is to have clients email screenshots when they have issues. In the old asp.net 1.1 days, we could grab details of the build DLL, using reflection, and show info about ...
To achieve the functionality of displaying the build date and version number in an ASP.NET application on the 3.5 framework, you can use a combination of assembly attributes and a custom build process. Here's a simple approach: ### Step 1: Update the AssemblyInfo.cs You can set the build number and the build date in ...
39,134
[ { "from": "human", "value": "I have a asp.net web application which has a number of versions deployed on different customer servers inside their networks. One practice that we have is to have clients email screenshots when they have issues.\nIn the old asp.net 1.1 days, we could grab details of the build D...
I'm trying to use alien to call Win32 functions. I tried this code, but it crashes and I don't understand why. require( "alien" ) local f = alien.Kernel32.ExpandEnvironmentStringsA f:types( "int", "string", "pointer", "int" ) local buffer = alien.buffer( 512 ) f( "%USERPROFILE%", 0, 512 )
When using the Alien library to call Windows API functions like `ExpandEnvironmentStringsA`, there are a few important details to consider regarding argument types and calling conventions. Here’s a breakdown of the issues and how to fix them: 1. **Function Definition**: The `ExpandEnvironmentStringsA` function takes ...
42,693
[ { "from": "human", "value": "I'm trying to use alien to call Win32 functions. I tried this code, but it crashes and I don't understand why.\nrequire( \"alien\" )\n\nlocal f = alien.Kernel32.ExpandEnvironmentStringsA\nf:types( \"int\", \"string\", \"pointer\", \"int\" )\nlocal buffer = alien.buffer( 512 )\nf...
I have a method to return a group of objects as a generic list which I then bind to a Repeater. I want to implement paging on the repeater using the PagedDataSource class but I'm not sure that this is possible as it doesn't seem to work. Will I have to change the return type of my method or is it possible to bind the P...
Yes, you can use the `PagedDataSource` class to implement paging for a generic list without changing the return type of your method. The `PagedDataSource` class is designed to work with a collection of items, and you can certainly wrap your generic list in a `PagedDataSource` to provide the paging functionality. Here’...
40,885
[ { "from": "human", "value": "I have a method to return a group of objects as a generic list which I then bind to a Repeater. I want to implement paging on the repeater using the PagedDataSource class but I'm not sure that this is possible as it doesn't seem to work.\nWill I have to change the return type of...
I need to edit an xml file using javascript. Now I'm involved in a project of online testing. The question.xml file is already in the project folder. In that i want to add or edit the questions(only using javascript). I'm able to bring the particular content through ajax, but I am not able to edit the file.
Editing an XML file directly from JavaScript running in a web browser is not possible due to security restrictions. The browser does not have direct access to the file system to modify files. However, you can achieve your goal by using a few different methods, depending on your application's architecture. Here are som...
40,950
[ { "from": "human", "value": "I need to edit an xml file using javascript. Now I'm involved in a project of online testing. \nThe question.xml file is already in the project folder.\nIn that i want to add or edit the questions(only using javascript). I'm able to bring the particular content through ajax, bu...
As I use the web, I regularly get runtime errors (usually javascript) being reported via popups. This can make for a really unsatisfying user experience on many otherwise excellent websites and also makes me wonder what functionality I am not getting access to. Why is this such a common issue? Is this down to a lack of...
Runtime errors in JavaScript can occur for various reasons, and they can indeed lead to frustrating user experiences. Here are some of the main factors contributing to the prevalence of these issues, along with suggestions for minimizing them: ### Common Causes of JavaScript Runtime Errors 1. **Browser Compatibility*...
39,402
[ { "from": "human", "value": "As I use the web, I regularly get runtime errors (usually javascript) being reported via popups. This can make for a really unsatisfying user experience on many otherwise excellent websites and also makes me wonder what functionality I am not getting access to.\nWhy is this such...
Could not find this term very easily on google. I assume it's the ability to patch a DBMS with an update without stopping service. Is this correct? If not, please guide me. Thanks in advance. jbu
The term you are referring to is often called "online patching" or "hot patching." This capability allows a database management system (DBMS) to be updated or patched without requiring downtime, meaning the service remains available and operational while updates are applied. Online patching is particularly important ...
43,630
[ { "from": "human", "value": "Could not find this term very easily on google. \nI assume it's the ability to patch a DBMS with an update without stopping service.\nIs this correct? If not, please guide me.\nThanks in advance.\njbu\n" }, { "from": "gpt", "value": "The term you are referring to i...
We are trying to upgrade to iBatis.Net DataMapper 1.6.1 (from 1.5.1). I am getting an error on this line: ( ( SqlMapDaoSession ) daoManager.GetDaoSession() ).SqlMap.BeforeQuery += new BeforeQueryDelegate ( SqlMap_BeforeQuery ); I cannot even find a reference to this BeforeQuery event anywhere. 0 matches on Google! Any...
It looks like you're encountering an issue related to the upgrade of iBatis.Net DataMapper from version 1.5.1 to 1.6.1. In this case, the `BeforeQuery` event that you were using in version 1.5.1 may have been removed or renamed in version 1.6.1. Here are a few steps you can take to troubleshoot and resolve this issue:...
38,591
[ { "from": "human", "value": "We are trying to upgrade to iBatis.Net DataMapper 1.6.1 (from 1.5.1). I am getting an error on this line:\n( ( SqlMapDaoSession ) daoManager.GetDaoSession() ).SqlMap.BeforeQuery += new BeforeQueryDelegate ( SqlMap_BeforeQuery );\n\nI cannot even find a reference to this BeforeQu...
Sam Ruby, author of "RESTful Web Services" seems to come out against the use of HTTP PUT for partial updates: http://intertwingly.net/blog/2008/02/15/Embrace-Extend-then-Innovate What isn't clear is how partial updates should take place. As I commented near the bottom of his blog, it isn't clear how using HTTP PATCH is...
The topic of partial updates in RESTful web services is indeed nuanced, and there are several approaches to consider, each with its own implications. Let's clarify a few concepts and then outline some approaches to implementing partial updates. ### Understanding HTTP Methods 1. **HTTP PUT**: This method is typically ...
41,054
[ { "from": "human", "value": "Sam Ruby, author of \"RESTful Web Services\" seems to come out against the use of HTTP PUT for partial updates: http://intertwingly.net/blog/2008/02/15/Embrace-Extend-then-Innovate\nWhat isn't clear is how partial updates should take place. As I commented near the bottom of his ...
I'm writing a function for an installer DLL to verify the Authenticode signature of EXE files already installed on the system. The function needs to: A) verify that the signature is valid. B) verify that the signer is our organization. Because this is in an installer, and because this needs to run on older Win2k in...
To accomplish the task of verifying the Authenticode signature of an EXE file and validating the signer against a known certificate without relying on CAPICOM.dll, you can use the Windows CryptoAPI alongside the WinVerifyTrust API. Below is a step-by-step guide to achieve both parts of your function: 1. **Verify the S...
37,127
[ { "from": "human", "value": "I'm writing a function for an installer DLL to verify the Authenticode signature of EXE files already installed on the system.\nThe function needs to:\n\nA) verify that the signature is valid.\n B) verify that the signer is our organization.\n\nBecause this is in an installer, ...
Is "business intelligence" a buzzword that has no real meaning to software developers, or does the term carry some implied meaning in terms of what the software does or how the software does it (in a general sense)? It appears to be a real business term, but does it mean anything in particular to software that performs...
"Business intelligence" (BI) is a term that does carry specific meaning within the context of software and data analysis, although it can sometimes be perceived as a buzzword. In general, BI refers to a set of technologies, processes, and tools that help organizations collect, analyze, and present business data to supp...
40,799
[ { "from": "human", "value": "Is \"business intelligence\" a buzzword that has no real meaning to software developers, or does the term carry some implied meaning in terms of what the software does or how the software does it (in a general sense)? It appears to be a real business term, but does it mean anyth...
I got a core that looks very different from the ones I usually get - most of the threads are in __kernel_vsyscall() : 9 process 11334 0xffffe410 in __kernel_vsyscall () 8 process 11453 0xffffe410 in __kernel_vsyscall () 7 process 11454 0xffffe410 in __kernel_vsyscall () 6 process 11455 0xffffe410 in __kerne...
The situation you described, where most of the threads in a core dump are showing up in `__kernel_vsyscall()`, suggests that the threads are currently blocked on a system call or waiting for a signal. This can happen for several reasons, and it is especially notable that you're observing this behavior instead of the mo...
41,711
[ { "from": "human", "value": "I got a core that looks very different from the ones I usually get - most of the threads are in __kernel_vsyscall() :\n 9 process 11334 0xffffe410 in __kernel_vsyscall ()\n 8 process 11453 0xffffe410 in __kernel_vsyscall ()\n 7 process 11454 0xffffe410 in __kernel_vsyscall...
Why does this code fail to display the category name "Apples" using the current WordPress taxonomy system? The Category names are stored in the $wpdb->terms table (wp_terms). <?php $ra_category_id = 3; $ra_category = $wpdb->get_results("SELECT name FROM $wpdb->terms WHERE term_id = '3'"); $ra_category_name = $ra_cat...
The code fails to display the category name "Apples" because of how the data returned by the `$wpdb->get_results` method is being handled. The `get_results` method returns an array of objects, even if there is only one result. In your code, you are trying to access the `name` property directly on the result set, which ...
43,402
[ { "from": "human", "value": "Why does this code fail to display the category name \"Apples\" using the current WordPress taxonomy system? The Category names are stored in the $wpdb->terms table (wp_terms). \n<?php\n\n$ra_category_id = 3; \n$ra_category = $wpdb->get_results(\"SELECT name FROM $wpdb->terms WH...
I need to create an application that when a user copies a file into an specific folder, my application will be activated and the file will be changed, also, when the user reads back any file in the folder, changes will also be made to the file. Is it possible? I'll use .net for this. I think the folder C:\WINDOWS\assem...
Yes, it's possible to create an application in .NET that monitors a specific folder for file changes (like file creation, modification, or deletion) and makes modifications to files accordingly. You can use the `FileSystemWatcher` class provided by .NET to monitor changes in the directory. ### Steps to Create the Appl...
40,103
[ { "from": "human", "value": "I need to create an application that when a user copies a file into an specific folder, my application will be activated and the file will be changed, also, when the user reads back any file in the folder, changes will also be made to the file.\nIs it possible?\nI'll use .net fo...
We're creating a web system using Java and Servlet technology (actually Wicket for the presentation layer) and we need our system to be available nearly always as our customers will be quite dependent on it. This has lead us to look for a good book focusing on the subject or another resource which explains how to set u...
Creating a redundant and fail-safe architecture for your web system is critical for ensuring high availability, especially when your customers are dependent on your service. Here are detailed answers to your questions, along with recommendations for resources: ### 1. **Load Balancing and Domain Name Resolution** To se...
37,785
[ { "from": "human", "value": "We're creating a web system using Java and Servlet technology (actually Wicket for the presentation layer) and we need our system to be available nearly always as our customers will be quite dependent on it.\nThis has lead us to look for a good book focusing on the subject or an...
I'm looking for an implementation of the LOGO programming language that supports 'dynaturtles' - animated turtles that can programmatically change shape, speed and direction as well as detect collisions with each other or other objects in the environment. Back in the mists of time when the earth was new and 8 bit micro...
If you are looking for a LOGO implementation that supports dynamic turtles with the ability to change shape, speed, and direction, as well as detect collisions, there are a few options that you might explore. While Atari LOGO is a classic, there are more modern alternatives that can provide similar capabilities. 1. **...
40,920
[ { "from": "human", "value": "I'm looking for an implementation of the LOGO programming language that supports 'dynaturtles' - animated turtles that can programmatically change shape, speed and direction as well as detect collisions with each other or other objects in the environment.\nBack in the mists of t...
I'm writing a tool to report information about .NET applications deployed across environments and regions within my client's systems. I'd like to read the values of assembly attributes in these assemblies. This can be achieved using Assembly.ReflectionOnlyLoad, however even this approach keeps the assembly loaded. The...
To load assemblies in separate AppDomains and read their attributes without conflicting with existing loaded assemblies, you can follow these general steps: 1. **Create a new AppDomain**: This will isolate your assembly loading. 2. **Load the assembly in that AppDomain**: Use `Assembly.LoadFrom` to load the assembly f...
36,412
[ { "from": "human", "value": "I'm writing a tool to report information about .NET applications deployed across environments and regions within my client's systems.\nI'd like to read the values of assembly attributes in these assemblies.\nThis can be achieved using Assembly.ReflectionOnlyLoad, however even th...
In writing the code that throws the exception I asked about here, I came to the end of my message, and paused at the punctuation. I realized that nearly every exception message I've ever thrown probably has a ! somewhere. throw new InvalidOperationException("I'm not configured correctly!"); throw new ArgumentNullExcep...
When it comes to writing exception messages, it's important to strike a balance between clarity, professionalism, and providing enough information to help the developer debug the issue. Here are some key considerations regarding tone and style in exception messages: ### Tone 1. **Professional and Respectful**: While h...
40,761
[ { "from": "human", "value": "In writing the code that throws the exception I asked about here, I came to the end of my message, and paused at the punctuation. I realized that nearly every exception message I've ever thrown probably has a ! somewhere.\nthrow new InvalidOperationException(\"I'm not configure...
We need to start adding internationalisation to our program. Thankfully not the whole thing yet, just a few bits, but I want the way we do it to scale up to potentially cover the whole program. The thing is, our program is based on plugins, so not all strings belong in the same place. As far as I understand it, Java's ...
Your approach to internationalization (i18n) with a plugin architecture sounds promising, and leveraging interfaces to return appropriate resource bundles is a solid design choice. Here are some additional thoughts and strategies to consider for your i18n implementation, especially regarding overriding strings and scal...
40,047
[ { "from": "human", "value": "We need to start adding internationalisation to our program. Thankfully not the whole thing yet, just a few bits, but I want the way we do it to scale up to potentially cover the whole program. The thing is, our program is based on plugins, so not all strings belong in the same ...
My understanding of a baseless merge in TFS was that it was a one-time deal, and merges afterwards could be made without having to be baseless: from http://msdn.microsoft.com/en-us/library/bd6dxhfy(VS.80).aspx /baseless - Performs a merge without a basis version. That is, allows the user to merge files and folders tha...
Your understanding of baseless merges in Team Foundation Server (TFS) is generally correct. A baseless merge is indeed intended for situations where two branches do not have a direct merge relationship. After performing a baseless merge, TFS should recognize that a merge relationship has been established, which would a...
42,064
[ { "from": "human", "value": "My understanding of a baseless merge in TFS was that it was a one-time deal, and merges afterwards could be made without having to be baseless:\nfrom http://msdn.microsoft.com/en-us/library/bd6dxhfy(VS.80).aspx\n\n/baseless - Performs a merge without a basis version. That is, al...
I am building a graphic board like project where i am facing a design issue. Main Class is Board which is a canvas responsible for handling mouse events when drawing shapes. It also has context variables such as currentShape or snapFlag to activate grid magnetism. To handle the moving / resizing / rotating of the shape...
In your scenario, you want your shapes to be aware of the `snapFlag` from the `Board` class, so they can adjust their positions accordingly during moving, resizing, or rotating. Here are a couple of approaches to achieve this, each with its pros and cons: ### Option 1: Pass the Board as a Parameter You could pass the...
40,223
[ { "from": "human", "value": "I am building a graphic board like project where i am facing a design issue.\nMain Class is Board which is a canvas responsible for handling mouse events when drawing shapes. It also has context variables such as currentShape or snapFlag to activate grid magnetism.\nTo handle th...
What I am trying to do when the user is in a textbox (in silverlight 2.0): When user presses the decimal point (.) on the numeric pad, I want to have it replaced by the correct decimal separator (which is comma (,) in a lot of countries) I can track that the user typed a decimal point by checking in the keydown event...
In Silverlight 2.0, you can't directly replace the input of a key event because the `KeyEventArgs` is read-only and doesn't allow you to modify the key that was pressed. However, you can handle the `KeyDown` event and prevent the default behavior when the decimal key is pressed, then manually insert the desired charact...
43,779
[ { "from": "human", "value": "What I am trying to do when the user is in a textbox (in silverlight 2.0):\n\nWhen user presses the decimal point\n(.) on the numeric pad, I want to\nhave it replaced by the correct\ndecimal separator (which is comma\n(,) in a lot of countries)\n\nI can track that the user typed...
I have a multithreaded server C++ program that uses MSXML6 and continuously parses XML messages, then applies a prepared XSLT transform to produce text. I am running this on a server with 4 CPUs. Each thread is completely independent and uses its own transform object. There is no sharing of any COM objects among the th...
It sounds like you're experiencing a common issue with multithreading and scalability, especially when using libraries like MSXML that may not be designed with high-concurrency environments in mind. Here are several possible areas to investigate and optimize: ### 1. **COM Initialization**: Ensure that each thread call...
40,669
[ { "from": "human", "value": "I have a multithreaded server C++ program that uses MSXML6 and continuously parses XML messages, then applies a prepared XSLT transform to produce text. I am running this on a server with 4 CPUs. Each thread is completely independent and uses its own transform object. There is n...
I am attempting to write a component in C# to be consumed by classic ASP that allows me to access the indexer of the component (aka default property). For example: C# component: public class MyCollection { public string this[string key] { get { /* return the value associated with key */ } } public ...
To expose an indexer (also known as a default property) from a C# class for use in classic ASP (VBScript), there are several considerations and limitations you need to be aware of. ### 1. COM Interop and Default Properties Unfortunately, C# indexers do not directly translate into default properties that are accessib...
40,562
[ { "from": "human", "value": "I am attempting to write a component in C# to be consumed by classic ASP that allows me to access the indexer of the component (aka default property).\nFor example:\nC# component:\npublic class MyCollection {\n public string this[string key] {\n get { /* return the val...
My team is responsible for the development of an API for a large system that we also write. We need to provide example code so that other developers using our API can learn how to use it. We have been documenting the code using the xml document comments. eg. /// <summary>Summary here</summary> /// <example>Here is an e...
Yes, it's definitely possible to incorporate unit tests to validate the example code provided in your documentation. This can be a great way to ensure that your examples stay up-to-date with the current implementation and avoid embarrassing situations where the example code is incorrect. Here’s a general approach to ho...
40,576
[ { "from": "human", "value": "My team is responsible for the development of an API for a large system that we also write. We need to provide example code so that other developers using our API can learn how to use it. We have been documenting the code using the xml document comments.\neg.\n/// <summary>Summa...
I'm relatively new to NHibernate, but have been using it for the last few programs and I'm in love. I've come to a situation where I need to aggregate data from 4-5 databases into a single database. Specifically it is serial number data. Each database will have its own mapping file, but ultimately the entities all s...
It's great to hear you're enjoying NHibernate! It sounds like you're trying to implement a fairly common use case involving inheritance and polymorphism with NHibernate. Let's clarify a few points regarding your approach and how you can achieve your goal of aggregating data from multiple databases while using NHibernat...
37,161
[ { "from": "human", "value": "I'm relatively new to NHibernate, but have been using it for the last few programs and I'm in love. I've come to a situation where I need to aggregate data from 4-5 databases into a single database. Specifically it is serial number data. Each database will have its own mappin...
Python is installed in a local directory. My directory tree looks like this: (local directory)/site-packages/toolkit/interface.py My code is in here: (local directory)/site-packages/toolkit/examples/mountain.py To run the example, I write python mountain.py, and in the code I have: from toolkit.interface import int...
The issue you're facing is not likely related to permissions or execution rights, but rather to how Python determines the module import paths. Here are a few key points to help you troubleshoot and resolve the `ImportError`: 1. **Check the Directory Structure**: Make sure your directory structure is correct. Given th...
40,137
[ { "from": "human", "value": "Python is installed in a local directory. \nMy directory tree looks like this:\n(local directory)/site-packages/toolkit/interface.py\n\nMy code is in here:\n(local directory)/site-packages/toolkit/examples/mountain.py\n\nTo run the example, I write python mountain.py, and in th...
What limits exist on the amount of data one can publish to a custom Windows performance counter category? I understand there is no hard limit on the number of counters or the number of instances, but rather there is a memory limit for the entire category. What is that limit? Is there a limit on the total number or size...
When dealing with Windows performance counters, it's essential to be aware of various limits and best practices, especially when planning to publish a significant amount of data, such as 50,000 counter-instance values. ### Memory Limits and Recommendations 1. **Total Memory for Performance Counters**: - Although t...
41,039
[ { "from": "human", "value": "What limits exist on the amount of data one can publish to a custom Windows performance counter category?\nI understand there is no hard limit on the number of counters or the number of instances, but rather there is a memory limit for the entire category. What is that limit?\nI...
If you have a WPF control library which you wanted to license to developers, how do enforce license restrictions such that the library could be used and distributed in their own applications and yet prevent the end-users from reusing that .dll? I'm approaching this from a strict business perspective, so I'm trying to f...
Licensing a WPF control library in a way that protects your intellectual property and prevents unauthorized redistribution can be challenging, but there are several strategies and techniques you can consider. Here’s a comprehensive overview: ### 1. **License Keys and Activation** - **License Keys**: Generate unique...
37,821
[ { "from": "human", "value": "If you have a WPF control library which you wanted to license to developers, how do enforce license restrictions such that the library could be used and distributed in their own applications and yet prevent the end-users from reusing that .dll?\nI'm approaching this from a stric...
I am trying to use an XML-RPC server on my Drupal (PHP) backend to make it easier for my Perl backend to talk to it. However, I've run into an issue and I'm not sure which parts, if any, are bugs. Essentially, some of the variables I need to pass to Drupal are strings that sometimes are strings full of numbers and th...
The issue you're encountering is related to how XML-RPC types are defined and expected by the server. In XML-RPC, the distinction between types is crucial for the server to correctly interpret the data being passed. In your case, the Perl code is sending the number `9876352345` as an `i4` (which is a 32-bit integer),...
42,833
[ { "from": "human", "value": "I am trying to use an XML-RPC server on my Drupal (PHP) backend to make it easier for my Perl backend to talk to it. However, I've run into an issue and I'm not sure which parts, if any, are bugs. Essentially, some of the variables I need to pass to Drupal are strings that som...
Does anyone have some sample code or can direct me to which class I can modify to add more information to the alert messages in Dynamics AX (DAX). I want to for instance add a vendor number and userid when a name of a vendor has been changed. EDIT: I have been told by someone that HTML code must be entered in the descr...
In Microsoft Dynamics AX (DAX), alerts can be set up to notify users about certain events, such as changes to vendor information. To add more information (like vendor number and user ID) to alert messages, you typically need to customize the alert framework, which might involve modifying the classes that handle alert c...
41,067
[ { "from": "human", "value": "Does anyone have some sample code or can direct me to which class I can modify to add more information to the alert messages in Dynamics AX (DAX). I want to for instance add a vendor number and userid when a name of a vendor has been changed.\nEDIT: I have been told by someone t...
UPDATE: Thank you all for your input. Some additional information. It's really just a small chunk of markup (20 lines) I'm working with and had aimed to to leverage a regex to do the work. I also do have the ability to hack up the script (an ecommerce one) to insert the classes as the navigation is built. I wanted to ...
Adding CSS classes to the first and last list items in an unordered list using regular expressions can be tricky because regex isn't inherently designed to handle nested or hierarchical structures like HTML. However, since you're dealing with a small chunk of markup, it can be feasible. Here's a revised approach that ...
39,199
[ { "from": "human", "value": "UPDATE: \nThank you all for your input. Some additional information.\nIt's really just a small chunk of markup (20 lines) I'm working with and had aimed to to leverage a regex to do the work.\nI also do have the ability to hack up the script (an ecommerce one) to insert the clas...
For this WCF service I have developed, I have to set MaxReceivedMessageSize to 5MB. My current problem is figuring out whether it is better to have a larger MaxBufferPoolSize value, like 5MB, or retain the original 512KB value. Does anyone knows what is the recommended setting for this scenario? In short, should I set ...
In WCF (Windows Communication Foundation), `MaxReceivedMessageSize` defines the maximum size of a message that can be received by the service. When you're working with larger messages, such as when you're uploading customer records along with scanned documents, it's crucial to set the `MaxReceivedMessageSize` and `MaxB...
42,199
[ { "from": "human", "value": "For this WCF service I have developed, I have to set MaxReceivedMessageSize to 5MB. My current problem is figuring out whether it is better to have a larger MaxBufferPoolSize value, like 5MB, or retain the original 512KB value.\nDoes anyone knows what is the recommended setting ...
I'm trying to understand the event system of Kohana. The only thing i don't understand is, where to place the Event::add code. It should be in a place where it is executed before any events are fired. Or am I missing something? What i want to achieve is to construct a class that is available everywhere, but don't rea...
In Kohana, the event system allows you to hook into different parts of the framework and execute custom code in response to specific events. To set up your own events using `Event::add`, you should indeed place your event registration code in a location that ensures it is executed before the events you want to listen t...
43,406
[ { "from": "human", "value": "I'm trying to understand the event system of Kohana. The only thing i don't understand is, where to place the Event::add code. \nIt should be in a place where it is executed before any events are fired. Or am I missing something? \nWhat i want to achieve is to construct a class ...
Although I know how to build a DOM the long, arduous way using the DOM API, I'd like to do something a bit better than that. Is there a nice, tidy way to build hierarchical documents with, say, an API that works something like Hibernate's Criteria API? So that I can chain calls together like this, for example: Docume...
Yes, there are libraries in Java that facilitate building XML documents in a more succinct and intuitive way than using the standard DOM API directly. One such library is **JDOM**. It provides a more user-friendly API for constructing and manipulating XML documents, making your code shorter and more readable. Here's a...
42,477
[ { "from": "human", "value": "Although I know how to build a DOM the long, arduous way using the DOM API, I'd like to do something a bit better than that. Is there a nice, tidy way to build hierarchical documents with, say, an API that works something like Hibernate's Criteria API? So that I can chain call...
Is there any persistence solution for Common Lisp, such as Elephant, that allows function persistence? Currently my app stores an identifier on the db and later searches in a function table which it is, but this method does not allow dynamically created functions to be stored.
In Common Lisp, the topic of persistence for functions (including dynamically created ones) is less straightforward than for data. Most persistence libraries, like Elephant or others, primarily focus on data types (like lists, arrays, and objects) rather than functions, which are first-class citizens in Lisp but not ea...
42,210
[ { "from": "human", "value": "Is there any persistence solution for Common Lisp, such as Elephant, that allows function persistence? Currently my app stores an identifier on the db and later searches in a function table which it is, but this method does not allow dynamically created functions to be stored.\n...
Sometimes, when we're doing small changes to our web apps, e.g. bug fixes, we don't build a whole new WAR-file each time, but merely replace just the affected class files in the exploded web app directory under WEB-INF/classes and restart the app. Is that okay?
Yes, it's generally acceptable to replace only the affected class files in the exploded web application directory under `WEB-INF/classes` and restart the application, especially for small changes like bug fixes. This approach is often referred to as "hot-swapping" or "hot-deploying." However, there are a few considera...
43,111
[ { "from": "human", "value": "Sometimes, when we're doing small changes to our web apps, e.g. bug fixes, we don't build a whole new WAR-file each time, but merely replace just the affected class files in the exploded web app directory under WEB-INF/classes and restart the app.\nIs that okay?\n" }, { ...
Consider: char *p=NULL; free(p) // or delete p; What will happen if I use free and delete on p? If a program takes a long time to execute, say 10 minutes, is there any way to reduce its running time to 5 minutes?
When you use `free(p)` or `delete p` on a pointer that is `NULL`, here's what happens: 1. **`free(p)`**: According to the C standard, calling `free()` with a `NULL` pointer has no effect. It safely does nothing, so there won't be any issues or crashes in this case. 2. **`delete p`**: In C++, the behavior of `delete` ...
41,024
[ { "from": "human", "value": "\nConsider:\nchar *p=NULL;\nfree(p) // or\ndelete p;\n\nWhat will happen if I use free and delete on p?\nIf a program takes a long time to execute, say 10 minutes, is there any way to reduce its running time to 5 minutes?\n\n" }, { "from": "gpt", "value": "When you u...
I have a query in which I am pulling the runtime of an executable. The database contains its start time and its end time. I would like to get the total time for the run. So far I have: SELECT startTime, endTime, cast(datediff(hh,starttime,endtime) as varchar) +':' +cast(datediff(mi,starttime,endtime)-60*datediff(hh,sta...
To calculate the runtime correctly, you need to ensure that you account for the total difference in hours and minutes without going negative. In your current SQL query, the calculation for minutes can result in negative values if the total minutes exceed the number of minutes in the calculated hours. To fix this issue,...
43,069
[ { "from": "human", "value": "I have a query in which I am pulling the runtime of an executable. The database contains its start time and its end time. I would like to get the total time for the run.\nSo far I have:\nSELECT startTime, endTime,\ncast(datediff(hh,starttime,endtime) as varchar)\n+':'\n+cast(dat...
Does anyone know how to unit test SiteMapNode? We’re building some custom navigation controls, which renders unordered html lists from Site Maps with custom attributes. I’m trying to follow a test first approach but am finding that SiteMapNode has internal dependencies on HttpContext. To traverse the site map file it i...
Unit testing components that rely on `HttpContext` and other internal dependencies can be challenging, especially when dealing with `SiteMapNode`. However, there are ways to handle this by using mocking frameworks and dependency injection. Here are some suggestions for your testing approach: ### 1. Abstracting SiteMap...
41,687
[ { "from": "human", "value": "Does anyone know how to unit test SiteMapNode? We’re building some custom navigation controls, which renders unordered html lists from Site Maps with custom attributes.\nI’m trying to follow a test first approach but am finding that SiteMapNode has internal dependencies on HttpC...
I am trying to dynamically load the contents of a div tag with a .cfm page that contains a cfchart in png format. When the user clicks on a link, I am using the load function to put the .cfm page into the div. $("#bank").bind("click", function(){ $("#chartx").load("bank.cfm"); }); I can get this to come up perfect...
When dealing with Internet Explorer 6, you may run into several issues that can cause the `load` function to not work as expected. Here are some troubleshooting steps and potential solutions: 1. **Check Compatibility**: Ensure that the jQuery version you are using is compatible with IE6. Generally, jQuery versions up ...
41,748
[ { "from": "human", "value": "I am trying to dynamically load the contents of a div tag with a .cfm page that contains a cfchart in png format. When the user clicks on a link, I am using the load function to put the .cfm page into the div.\n$(\"#bank\").bind(\"click\", function(){\n $(\"#chartx\").load(\"...
I have a number of heroshot images, that have a modal popup when clicked. I'm trying to get my cursor to turn into magnifying glass whenever it is moved over the image. The following CSS does not appear to work even though my magnify.cur is present in the right location. a.heroshot img { cursor:url(/img/magnify.cur...
The issue you're experiencing with the custom cursor in Firefox may be related to the way Firefox handles custom cursor files. Here are a few potential solutions you can try to ensure that your custom cursor works across different browsers, including Firefox. ### Solution 1: Check the Cursor File Format Make sure tha...
42,431
[ { "from": "human", "value": "I have a number of heroshot images, that have a modal popup when clicked. \nI'm trying to get my cursor to turn into magnifying glass whenever it is moved over the image. The following CSS does not appear to work even though my magnify.cur is present in the right location.\na.h...
When creating links for an an html based email, how critical is it to use absolute links? Also, What are the benefits in using relative links in general?
When creating links for an HTML-based email, it is crucial to use **absolute links** rather than relative links. Here’s why: ### Importance of Absolute Links in HTML Emails: 1. **Accessibility:** Absolute links specify the complete URL (including the protocol like `http://` or `https://`), ensuring that the links wor...
43,580
[ { "from": "human", "value": "When creating links for an an html based email, how critical is it to use absolute links? Also, What are the benefits in using relative links in general?\n" }, { "from": "gpt", "value": "When creating links for an HTML-based email, it is crucial to use **absolute lin...
I'd like to write a plugin that does something with the currently edited file in Eclipse. But I'm not sure how to properly get the file's full path. This is what I do now: IFile file = (IFile) window.getActivePage().getActiveEditor.getEditorInput(). getAdapter(IFile.class); Now I have an IFile object, and I can re...
To obtain the absolute path of an `IFile` in Eclipse, you can convert the workspace-relative path to an absolute file system path. You can achieve this by using the `IWorkspaceRoot` to get the absolute location of the file in the filesystem. Here's how you can modify your code to get the absolute path: ```java import...
43,395
[ { "from": "human", "value": "I'd like to write a plugin that does something with the currently edited file in Eclipse. But I'm not sure how to properly get the file's full path.\nThis is what I do now:\nIFile file = (IFile) window.getActivePage().getActiveEditor.getEditorInput().\n getAdapter(IFile.class...
I'm a fairly novice programmer working on my first Windows Mobile application. I see that there is no button control available for my program. I've never created a custom control before, and I understand that is the only way that I can get a button for my application (it is a requirement as per my client). I was won...
Creating a custom button control in Visual Studio 2005 for a Windows Mobile application is a great way to learn about custom controls and enhance your application. Below is a step-by-step guide to create a simple button control, and then I’ll show you how to make the label of the button changeable through the propertie...
35,893
[ { "from": "human", "value": "I'm a fairly novice programmer working on my first Windows Mobile application. I see that there is no button control available for my program. I've never created a custom control before, and I understand that is the only way that I can get a button for my application (it is a ...
I have a text box and need to validate that it is plain text does not contain html tags. What is the best way to do it in .net Bonus Question: How to do the same with javascript.
To validate that a text box contains only plain text (i.e., it does not contain HTML tags) in .NET, you can use a regular expression to check for HTML tags. Below is a simple example of how to perform this validation in both ASP.NET and JavaScript. ### .NET Example In a .NET application (for instance, an ASP.NET web ...
41,622
[ { "from": "human", "value": "I have a text box and need to validate that it is plain text does not contain html tags.\nWhat is the best way to do it in .net\nBonus Question: How to do the same with javascript.\n" }, { "from": "gpt", "value": "To validate that a text box contains only plain text ...
Has anyone converted a large (ours is 550,000 lines) program of Fortran 77 code to C++ ? What pitfalls did you run into ? Was the conversion a success ? Did you use a tool like for_c ( http://www.cobalt-blue.com/fc/fcmain.htm ) ? Was the resulting C++ code significantly faster or slower ?
Converting a large Fortran 77 codebase to C++ can be a significant undertaking, and while many have attempted such conversions, the process often presents various challenges and pitfalls. Here are some insights based on experiences shared by developers who have undertaken similar conversions: ### Common Pitfalls 1. *...
37,950
[ { "from": "human", "value": "Has anyone converted a large (ours is 550,000 lines) program of Fortran 77 code to C++ ? What pitfalls did you run into ? Was the conversion a success ? Did you use a tool like for_c ( http://www.cobalt-blue.com/fc/fcmain.htm ) ? Was the resulting C++ code significantly fast...
I am not sure what optparse's metavar parameter is used for. I see it is used all around, but I can't see its use. Can someone make it clear to me? Thanks.
The `metavar` parameter in the `optparse` module (which is part of Python's standard library for parsing command-line options) is used to specify a name for the command-line argument that appears in the usage message. It allows you to customize the name that is displayed in the help documentation for the command-line o...
42,600
[ { "from": "human", "value": "I am not sure what optparse's metavar parameter is used for. I see it is used all around, but I can't see its use.\nCan someone make it clear to me? Thanks.\n" }, { "from": "gpt", "value": "The `metavar` parameter in the `optparse` module (which is part of Python's s...
Nearly all programming languages used are Turing Complete, and while this affords the language to represent any computable algorithm, it also comes with its own set of problems. Seeing as all the algorithms I write are intended to halt, I would like to be able to represent them in a language that guarantees they will h...
You're exploring an interesting area in the intersection of computability theory and programming language design. Indeed, while Turing completeness allows for a broad range of computable functions, it also leads to the inherent risk of non-termination. Here's a deeper dive into your inquiry about languages that guarant...
38,470
[ { "from": "human", "value": "Nearly all programming languages used are Turing Complete, and while this affords the language to represent any computable algorithm, it also comes with its own set of problems. Seeing as all the algorithms I write are intended to halt, I would like to be able to represent them ...
I looked it up in Wikipedia, and there is only one line there. Anyone have a more detailed description for it? Ubuntu releases their OS with this notation, but I was unable to find a detailed description over what it means/includes. I've already read the Ubuntu notation but need a more general description, not how Ubun...
It sounds like you're looking for a detailed understanding of the versioning notation used in software releases, especially as it relates to operating systems like Ubuntu. The notation often follows a specific format that can vary by project, but here’s a general breakdown of commonly used versioning schemes, particula...
40,158
[ { "from": "human", "value": "I looked it up in Wikipedia, and there is only one line there. Anyone have a more detailed description for it? Ubuntu releases their OS with this notation, but I was unable to find a detailed description over what it means/includes. I've already read the Ubuntu notation but need...
I have a COM interop assembly, and I would like to check from a .NET application whether the component I'm about to create is installed on the machine. I would like to provide a nice error message if it is not installed. Put the instantiation into try-catch is not a good solution for me, as I would like to distingwish...
To check whether a COM component is installed on a machine from a .NET application, checking the registry is indeed one approach, but there are some nuances and better practices to consider. 1. **Using the Registry**: The registry is a common way to check for COM components. However, you should be looking for the CLSI...
40,527
[ { "from": "human", "value": "I have a COM interop assembly, and I would like to check from a .NET application whether the component I'm about to create is installed on the machine. \nI would like to provide a nice error message if it is not installed.\nPut the instantiation into try-catch is not a good solu...
I am interested in writing a simplistic navigation application as a pet project. After searching around for free map-data I have settled on the US Census Bureau TIGER 2007 Line/Shapefile map data. The data is split up into zip files for individual counties and I've downloaded a single counties map-data for my area. W...
Creating a simplistic navigation application from scratch using the US Census Bureau TIGER data is an interesting project that can give you great insights into working with geographic data. Here’s a step-by-step approach to help you with reading, parsing, loading, and rendering the shapefiles: ### Reading the Shapefil...
37,147
[ { "from": "human", "value": "I am interested in writing a simplistic navigation application as a pet project. After searching around for free map-data I have settled on the US Census Bureau TIGER 2007 Line/Shapefile map data. The data is split up into zip files for individual counties and I've downloaded ...
On occasion I've heard people discuss the benefits of keeping track of programming mistakes, if for no other reason than it increases awareness of common errors. I've started to keep a list of bugs that I find in my code, along with what could have led to them. The main question I have is this: What information rela...
Keeping track of programming mistakes can indeed be highly beneficial for improving your skills and becoming a more effective programmer. Here’s a structured approach to what information you should track, how to use that information, and the benefits of this practice. ### What Information to Track 1. **Description of...
37,262
[ { "from": "human", "value": "On occasion I've heard people discuss the benefits of keeping track of programming mistakes, if for no other reason than it increases awareness of common errors. I've started to keep a list of bugs that I find in my code, along with what could have led to them. The main questi...
I have a table where I'm recording if a user has viewed an object at least once, hence: HasViewed ObjectID number (FK to Object table) UserId number (FK to Users table) Both fields are NOT NULL and together form the Primary Key. My question is, since I don't care how many times someone has viewed an obj...
Choosing between these two approaches has implications in terms of performance and complexity. Let's explore the trade-offs associated with each option. ### Option 1: SELECT followed by INSERT - **Pros:** - If there are very few concurrent inserts happening, this method can be efficient as it prevents unnecessary e...
43,613
[ { "from": "human", "value": "I have a table where I'm recording if a user has viewed an object at least once, hence:\n HasViewed\n ObjectID number (FK to Object table)\n UserId number (FK to Users table)\n\nBoth fields are NOT NULL and together form the Primary Key.\nMy question is, since I don'...
In a web-based application that uses the Model-View-Controller design pattern, the logic relating to processing form submissions seems to belong somewhere in between the Model layer and the Controller layer. This is especially true in the case of a complex form (i.e. where form processing goes well beyond simple CRUD o...
In an MVC (Model-View-Controller) architecture, the processing of forms typically resides in the Controller layer, but the lines can get blurred depending on the complexity of the form and the business logic involved. Here's how you can conceptualize this: ### 1. **Controller's Role** The Controller is primarily respo...
41,797
[ { "from": "human", "value": "In a web-based application that uses the Model-View-Controller design pattern, the logic relating to processing form submissions seems to belong somewhere in between the Model layer and the Controller layer. This is especially true in the case of a complex form (i.e. where form ...
I am trying to set the change the INSTALLDIR programatically in InstallShield v8.02 (cannot do anything about the version). My code crashes with an exception "Unknown error" on the third line of this code (C#) String originalInstallDir = testProject.get_INSTALLDIR(); String installDir = originalInstallDir.Replace("Comp...
It sounds like you're attempting to modify the `INSTALLDIR` property in InstallShield programmatically using C#. However, you're encountering an "Unknown error" when trying to set the property. This could be due to several factors, such as the way the property is being accessed or modified. Here are some suggestions t...
41,310
[ { "from": "human", "value": "I am trying to set the change the INSTALLDIR programatically in InstallShield v8.02 (cannot do anything about the version).\nMy code crashes with an exception \"Unknown error\" on the third line of this code (C#)\nString originalInstallDir = testProject.get_INSTALLDIR();\nString...
I am trying to get a specific colour used by Windows XP in my .NET application. In Windows XP, if you go the Control Panel in 'category view', on the left hand side you have some 'See Also' options (Windows Update, Help and Support, Other Control Panel Options). The colour I'm trying to get is the light blue backgroun...
To programmatically retrieve the color used by the Windows XP Control Panel 'See Also' options in your .NET application, you can utilize the Windows API to access the theme and drawing services. In Windows XP, the colors used in themed controls are not directly accessible through the `SystemColors` class. However, you...
38,500
[ { "from": "human", "value": "I am trying to get a specific colour used by Windows XP in my .NET application. \nIn Windows XP, if you go the Control Panel in 'category view', on the left hand side you have some 'See Also' options (Windows Update, Help and Support, Other Control Panel Options). The colour I'm...
I've got a dialog with several largeish combo boxes in it (maybe several hundred items apiece). There's a noticeable delay at construction while these are populated (confirmed that it's them by profiling). My initial thought was that sorting was killing it's performance, but disabling sort and using InsertString instea...
When dealing with large combo boxes in MFC (Microsoft Foundation Classes), there are several strategies you can employ to optimize performance and reduce the noticeable delay during the construction of the dialog. Here are some recommendations: 1. **Virtual ComboBox**: Consider implementing a virtual combo box. In a v...
40,985
[ { "from": "human", "value": "I've got a dialog with several largeish combo boxes in it (maybe several hundred items apiece). There's a noticeable delay at construction while these are populated (confirmed that it's them by profiling).\nMy initial thought was that sorting was killing it's performance, but di...
Does any one know of a free tool or library to convert multi page tiffs to pdf in Asp.Net 1.1?
For ASP.NET 1.1, there are limited options available as most modern libraries and tools have moved on to support newer versions of the framework. However, you can use a couple of approaches to convert multi-page TIFF files to PDF. ### 1. **Gnostice’s `ReportBuilder` / `ReportBuilder` (Note: Check if compatible)** Gnos...
41,460
[ { "from": "human", "value": "Does any one know of a free tool or library to convert multi page tiffs to pdf in Asp.Net 1.1?\n" }, { "from": "gpt", "value": "For ASP.NET 1.1, there are limited options available as most modern libraries and tools have moved on to support newer versions of the fram...
I realized the solution to this problem while I was creating the documentation to ASK this question...so I am posting the answer if for no other reason than to keep me from wasting time on this in the future
That's great to hear that you found the solution while documenting your problem! Writing things out can often lead to insights that we might overlook when just thinking through a problem. If you’d like to share the solution or the problem itself, it might help others who come across a similar issue in the future. Plus,...
45,979
[ { "from": "human", "value": "I realized the solution to this problem while I was creating the documentation to ASK this question...so I am posting the answer if for no other reason than to keep me from wasting time on this in the future\n" }, { "from": "gpt", "value": "That's great to hear that ...
Some time ago I wrote a piece of code to update multiple rows in a database table. The code was like this var db = new MyDataContext(); db.Execute("UPDATE Details SET IsActive = 0 WHERE MasterId = 1"); Then the other day when I got the latest version of the file I saw that somebody changed the code to something like t...
The two approaches you've shown for updating multiple rows in a database table each have their pros and cons. Here's a breakdown of both methods: ### 1. Direct SQL Update ```csharp var db = new MyDataContext(); db.Execute("UPDATE Details SET IsActive = 0 WHERE MasterId = 1"); ``` **Pros:** - **Performance**: Direct S...
42,489
[ { "from": "human", "value": "Some time ago I wrote a piece of code to update multiple rows in a database table. The code was like this\nvar db = new MyDataContext();\ndb.Execute(\"UPDATE Details SET IsActive = 0 WHERE MasterId = 1\");\n\nThen the other day when I got the latest version of the file I saw tha...
How can I prevent the user from being able to resize an image in designMode? (disable the handles when image is clicked)
To prevent users from resizing an image in `designMode`, you can disable the resize handles when the image is clicked or focused. Below are some approaches that you can use to achieve this. ### Method 1: CSS You can use CSS to remove the resizing capability by setting the `resize` property to `none`, and using a `poi...
39,315
[ { "from": "human", "value": "How can I prevent the user from being able to resize an image in designMode? (disable the handles when image is clicked)\n" }, { "from": "gpt", "value": "To prevent users from resizing an image in `designMode`, you can disable the resize handles when the image is cl...
I'm storing a tree in a DB using nested sets. The table's fields are id, lft, rgt, and name. Given a node ID, I need to find all of its direct children(not grandchildren) that are themselves leaf nodes.
To find all direct children of a specific node that are leaf nodes in a tree structure represented using the nested set model, you can follow these steps: 1. **Identify the Left and Right Values of the Parent Node**: First, you need to retrieve the left (`lft`) and right (`rgt`) values of the node for which you want t...
42,995
[ { "from": "human", "value": "I'm storing a tree in a DB using nested sets. The table's fields are id, lft, rgt, and name. \nGiven a node ID, I need to find all of its direct children(not grandchildren) that are themselves leaf nodes.\n" }, { "from": "gpt", "value": "To find all direct children...
It looks like the run-time compiler doesn't support the same language as the command-line compiler so if you want to use lambda expressions, extensions methods or LINQ, well, you're stuck. There's more detail here: http://metadatalabs.com/blog/ Is this correct or is there a work-around? (Short of spawning the command-...
The issue you're encountering typically arises from differences in the capabilities of the runtime compiler (like `CSharpCodeProvider` in .NET) and the command-line compiler (like `csc.exe`). In some cases, the runtime compiler may not support certain language features introduced in newer versions of C#, such as lambda...
39,008
[ { "from": "human", "value": "It looks like the run-time compiler doesn't support the same language as the command-line compiler so if you want to use lambda expressions, extensions methods or LINQ, well, you're stuck.\nThere's more detail here:\nhttp://metadatalabs.com/blog/\nIs this correct or is there a w...
I want to be able to access some device specific data while running an application on a remote machine. The problem is that if the RDP window is minimized this data is not available. One solution I'm examining is writing my own RDP client so that the server machine always thinks that it has an active display (even when...
Developing your own RDP client from scratch can be a complex task, as the Remote Desktop Protocol (RDP) is quite intricate. However, there are a few approaches you could consider, especially if you're looking to do this in .NET. ### Existing Libraries Before diving into writing your own RDP client, you might want to...
41,988
[ { "from": "human", "value": "I want to be able to access some device specific data while running an application on a remote machine. The problem is that if the RDP window is minimized this data is not available. One solution I'm examining is writing my own RDP client so that the server machine always thinks...
I want to be replace any occurrence of more than one space with a single space, but take no action in text between quotes. Is there any way of doing this with a Java regex? If so, can you please attempt it or give me a hint?
Yes, you can achieve this using Java regex with a combination of lookaheads and lookbehinds. Here's a way to replace occurrences of more than one space with a single space, while ignoring spaces that are within quotes. You can use a regex pattern that captures the groups of spaces outside quotes. Here is a sample Java...
36,456
[ { "from": "human", "value": "I want to be replace any occurrence of more than one space with a single space, but take no action in text between quotes.\nIs there any way of doing this with a Java regex? If so, can you please attempt it or give me a hint?\n" }, { "from": "gpt", "value": "Yes, you...
Often you need to show a list of database items and certain aggregate numbers about each item. For instance, when you type the title text on Stack Overflow, the Related Questions list appears. The list shows the titles of related entries and the single aggregated number of quantity of responses for each title. I have a...
To achieve your goal of retrieving both the total item count per category and the count of items owned by a specific user in a single SQL query, you can use conditional aggregation. This allows you to calculate the aggregates for both totals and owned items simultaneously. Here’s how you can construct the query: ```sq...
40,648
[ { "from": "human", "value": "Often you need to show a list of database items and certain aggregate numbers about each item. For instance, when you type the title text on Stack Overflow, the Related Questions list appears. The list shows the titles of related entries and the single aggregated number of quant...
We have a problem with our project. We make web services with C# and a client for the web services. In our office the client work fine, but in production we have a problem with proxy. Proxy is configured in Windows Internet Properties. The client has to connect to http:\aaa.com and http:\aaa.com is a proxy exception. B...
It looks like the issue you’re encountering may stem from how the proxy settings are being handled by your C# client application. Here are some potential reasons and solutions for the problem you're facing: ### 1. **Use of Default Credentials** Make sure that your application is set up to use the default system creden...
39,104
[ { "from": "human", "value": "We have a problem with our project. We make web services with C# and a client for the web services. In our office the client work fine, but in production we have a problem with proxy. Proxy is configured in Windows Internet Properties. The client has to connect to http:\\aaa.com...
I can understand wanting to avoid having to use a cursor due to the overhead and inconvenience, but it looks like there's some serious cursor-phobia-mania going on where people are going to great lengths to avoid having to use one. For example, one question asked how to do something obviously trivial with a cursor and ...
The aversion to cursors in SQL and other database systems often stems from a combination of performance considerations, best practices, and historical context. Here are some reasons why many developers and database professionals tend to avoid cursors, even in cases where they might seem like a reasonable choice: 1. **...
39,511
[ { "from": "human", "value": "I can understand wanting to avoid having to use a cursor due to the overhead and inconvenience, but it looks like there's some serious cursor-phobia-mania going on where people are going to great lengths to avoid having to use one.\nFor example, one question asked how to do some...
I want to create a Rails (2.1 and 2.2) model with ActiveRecord validations, but without a database table. What is the most widely used approach? I've found some plugins that claim to offer this functionality, but many of them don't appear to be widely used or maintained. What does the community recommend I do? Righ...
If you're looking to create a Rails model without a corresponding database table in Rails 2.1 or 2.2, one common approach is to utilize Ruby's built-in capabilities and ActiveRecord's validation features without persisting data in a database. Here’s a basic outline of how you can achieve this: 1. **Subclass ActiveRec...
41,308
[ { "from": "human", "value": "I want to create a Rails (2.1 and 2.2) model with ActiveRecord validations, but without a database table. What is the most widely used approach? I've found some plugins that claim to offer this functionality, but many of them don't appear to be widely used or maintained. What...
Can I use SQL Authentication with User Instances?
SQL Server User Instances are a feature that allows users to run a separate instance of SQL Server Express for each user. This is particularly useful for applications that require their own database without needing administrative access to the system-wide SQL Server instance. However, when it comes to SQL authenticati...
43,752
[ { "from": "human", "value": "Can I use SQL Authentication with User Instances?\n" }, { "from": "gpt", "value": "SQL Server User Instances are a feature that allows users to run a separate instance of SQL Server Express for each user. This is particularly useful for applications that require thei...
I have an iPhone app that is running great in the simulator. It responds well to the memory warnings by getting rid of everything that is not absolutely essential. When I run it on the device, it runs well. But after a certain amount of usage it crashes with error code 101 - which, from what I can tell, is the OS ki...
It sounds like you're encountering an issue with memory management that may not be directly tied to memory leaks but rather to an accumulation of memory usage over time, which can eventually lead to the app being terminated by the OS (in your case, the error code 101). Here are some steps and considerations that may he...
40,355
[ { "from": "human", "value": "I have an iPhone app that is running great in the simulator. It responds well to the memory warnings by getting rid of everything that is not absolutely essential. When I run it on the device, it runs well. But after a certain amount of usage it crashes with error code 101 - ...
I have a HTML page with which I want to do some client side replacement using Javascript. The values I would like to replace are in an array like so: var searchFor = new Object(); var replaceWith = new Object(); searchFor = [ "quick", "brown", "fox", ]; replaceWith = [ "nimble", "black", "cat",...
You can achieve this by using JavaScript to loop through the `searchFor` array and replace instances of each word with the corresponding value in the `replaceWith` array. Here's a simple implementation that uses the `innerHTML` property to replace text within an HTML element. This code will work cross-browser as it u...
41,827
[ { "from": "human", "value": "I have a HTML page with which I want to do some client side replacement using Javascript. The values I would like to replace are in an array like so:\nvar searchFor = new Object();\nvar replaceWith = new Object();\nsearchFor =\n[\n \"quick\",\n \"brown\",\n \"fox\",\n];...
You are applying for a role "Java Developer" and you are called for an interview. What are the general knowledge you should/must learn before you sit in front of the panel?
Before attending an interview for a Java Developer position, it's essential to have a solid understanding of various concepts and technologies related to Java development. Here’s a comprehensive checklist of topics you should cover: ### Core Java Concepts 1. **Java Basics**: - Data types, variables, and operators ...
41,767
[ { "from": "human", "value": "You are applying for a role \"Java Developer\" and you are called for an interview.\nWhat are the general knowledge you should/must learn before you sit in front of the panel?\n" }, { "from": "gpt", "value": "Before attending an interview for a Java Developer positio...
Is it possible to programmatically either via the win32API (python) or via a command line option set the processor affinity for a process?
Yes, it's possible to set the processor affinity for a process programmatically in Python using the `win32api` module (part of the `pywin32` package) or by using the Windows command line. ### Using Python with `pywin32` Here’s how you can set the processor affinity for a process using the `pywin32` library: 1. First...
42,710
[ { "from": "human", "value": "Is it possible to programmatically either via the win32API (python) or via a command line option set the processor affinity for a process?\n" }, { "from": "gpt", "value": "Yes, it's possible to set the processor affinity for a process programmatically in Python using...
We are using the Mindfusion WPF Diagramming Component. I require a Visualbrush which must be able to be used in a third-party component for diagramming. We have horizontally-stretching lanes on the diagramming canvas. We must define a background color for this lane, and some text on the top-left corner, to be repeated...
To achieve your goal of creating a `VisualBrush` for a lane in a diagramming component that has a fixed-size text in the top-left corner, repeated along the x-axis, while also having a background color that stretches, you can make use of a `DrawingVisual` to compose your desired visual structure. The key is to create a...
39,043
[ { "from": "human", "value": "We are using the Mindfusion WPF Diagramming Component. I require a Visualbrush which must be able to be used in a third-party component for diagramming.\nWe have horizontally-stretching lanes on the diagramming canvas. We must define a background color for this lane, and some t...
We currently have an appserver setup where EVERYTHING is off of one big context root, and we copy class files and restart app servers to deploy. Not ideal. I'm trying to set up an ant script to do the build and deploy using wdeploy, and everything works, except I need my servlet to forward to jsps outside of the contex...
Forwarding from a servlet to JSPs or resources outside of your WAR file's context root is generally not a recommended practice, as it can lead to maintainability and security issues. However, if you absolutely must access resources outside of your WAR file, here are several approaches you can consider: ### 1. Use Abso...
41,233
[ { "from": "human", "value": "We currently have an appserver setup where EVERYTHING is off of one big context root, and we copy class files and restart app servers to deploy. Not ideal.\nI'm trying to set up an ant script to do the build and deploy using wdeploy, and everything works, except I need my servle...
The other day I decided to write an implementation of radix sort in Java. Radix sort is supposed to be O(k*N) but mine ended up being O(k^2*N) because of the process of breaking down each digit to one number. I broke down each digit by modding (%) the preceding digits out and dividing by ten to eliminate the succeeding...
In terms of breaking down digits from a number for the purpose of radix sort, your professor's suggestion to use bit operations could be more efficient than the first two methods you mentioned, especially if you are working with binary representations of the numbers (which is typically what bit operations are used for)...
38,768
[ { "from": "human", "value": "The other day I decided to write an implementation of radix sort in Java. Radix sort is supposed to be O(k*N) but mine ended up being O(k^2*N) because of the process of breaking down each digit to one number. I broke down each digit by modding (%) the preceding digits out and di...
I'm porting a Forms app to a VB.NET web app, and one of the feature the users really liked was the ability to narrow the possible choices as the user typed in a search box. The search itself goes against multiple tables and columns (and takes several seconds), so it's not a simple AutoComplete or anything. What's the b...
To implement a feature in your VB.NET web application that allows users to type in a search box and asynchronously update a ListView with matching results from a complex search (across multiple tables and columns), you can follow a few key steps. Here’s a high-level approach that you can consider, including specific te...
40,060
[ { "from": "human", "value": "I'm porting a Forms app to a VB.NET web app, and one of the feature the users really liked was the ability to narrow the possible choices as the user typed in a search box. The search itself goes against multiple tables and columns (and takes several seconds), so it's not a simp...
How can I use command line arguments in a creationComplete event handler? It seems the invoke event happens in my AIR app after creationComplete gets called, so I can't use the args in that function, although I really would like to. Any other event that might always fire after the invoke event happens?
In an Adobe AIR application, the `creationComplete` event is triggered after the component is fully created but before the application is invoked with command line arguments. This means that you won't be able to access command line arguments directly in the `creationComplete` event handler. However, you can handle the...
32,095
[ { "from": "human", "value": "How can I use command line arguments in a creationComplete event handler? It seems the invoke event happens in my AIR app after creationComplete gets called, so I can't use the args in that function, although I really would like to. Any other event that might always fire after t...
I use a non-default Windows colour scheme on most of my machines, and have a laptop with a 124 DPI screen, which Windows is set to. A lot of programs I tested or even use daily seem to have problems with that, showing for example non-standard sizes of controls, cut-off UI elements, unreadable text and so on. There is ...
Your question raises important points about developing applications that conform to UI guidelines and provide a good user experience across different display settings, particularly when it comes to high-DPI screens and various color schemes. Here’s a structured response to your concerns: 1. **Adhering to UI Guidelines...
42,090
[ { "from": "human", "value": "I use a non-default Windows colour scheme on most of my machines, and have a laptop with a 124 DPI screen, which Windows is set to.\nA lot of programs I tested or even use daily seem to have problems with that, showing for example non-standard sizes of controls, cut-off UI eleme...
How do you traverse a folder structure using C# without falling into the trap of junction points?
Traversing a folder structure in C# while avoiding issues with junction points (which can lead to infinite loops) requires careful handling. Junction points are a type of reparse point that can point to another directory, potentially causing recursion if not managed correctly. Here’s a basic approach to safely travers...
40,655
[ { "from": "human", "value": "How do you traverse a folder structure using C# without falling into the trap of junction points? \n" }, { "from": "gpt", "value": "Traversing a folder structure in C# while avoiding issues with junction points (which can lead to infinite loops) requires careful hand...
I JOIN 2 tables for example table_A +---------+-----------+-----------+ | user_id | ticket_id | user_name | +---------+-----------+-----------+ table_B +-----------+-------------+ | ticket_id | ticket_name | +-----------+-------------+ If I run the following query: SELECT table_A.user_id , table_A.user_name , ta...
The issue you're encountering with the ambiguous column name in the `WHERE` clause is due to the fact that both `table_A` and `table_B` contain a column named `ticket_id`. In your query, when you refer to `ticket_id` in the `WHERE` clause, MySQL can't determine which `ticket_id` you are referencing. In your case, it ...
42,716
[ { "from": "human", "value": "I JOIN 2 tables \nfor example\n\ntable_A\n+---------+-----------+-----------+\n| user_id | ticket_id | user_name |\n+---------+-----------+-----------+\n\ntable_B\n+-----------+-------------+\n| ticket_id | ticket_name |\n+-----------+-------------+\n\nIf I run the following que...
I currently work at a company that has a lot of custom applications that are made internally. There are not currently standards for a lot of things. I would like to implement a way to record/track errors that happen in this programs (most are asp.net). I am currently thinking of handling this in the Global.asax in th...
Implementing an error logging mechanism is a great way to improve the reliability of your applications and provide insights into issues that users may encounter. Here’s a comprehensive strategy that you can consider for tracking errors in your ASP.NET applications. ### 1. Error Handling Approach Using the `Applicatio...
32,292
[ { "from": "human", "value": "I currently work at a company that has a lot of custom applications that are made internally. There are not currently standards for a lot of things. I would like to implement a way to record/track errors that happen in this programs (most are asp.net).\nI am currently thinking...
I have read a book whose title is "Oracle PL SQL Programming" (2nd ed.) by Steven Feuerstein & Bill Pribyl. On page 99, there is a point suggested that Do not "SELECT COUNT(*)" from a table unless you really need to know the total number of "hits." If you only need to know whether there is more than one match, simply ...
The recommendation to avoid using `SELECT COUNT(*)` to check for the existence of records in a table is primarily about efficiency. When you use `SELECT COUNT(*)`, the database must scan the entire table (or at least the portion of the table that matches the condition) to compute the total count. If you only want to ch...
43,091
[ { "from": "human", "value": "I have read a book whose title is \"Oracle PL SQL Programming\" (2nd ed.) by Steven Feuerstein & Bill Pribyl. On page 99, there is a point suggested that \nDo not \"SELECT COUNT(*)\" from a table unless you really need to know the total number of \"hits.\" If you only need to kn...
I have MAMP set up on my iMac and on my Macbook. I want to keep both installs synced using dropbox. When upgrading MAMP the only 2 folders you need to transfer are 'db' & 'htdocs'. My theory is then that these are the only 2 folders I need to keep in sync. Sound right to you so far? Syncing the 'htdocs' folder is easy ...
You're on the right track by identifying the `db` and `htdocs` folders as the key components you need to sync between your MAMP installations. The `htdocs` folder can indeed be easily managed by storing it in Dropbox and pointing MAMP to that location. However, syncing the `db` folder can be a bit more complex since MA...
38,605
[ { "from": "human", "value": "I have MAMP set up on my iMac and on my Macbook. I want to keep both installs synced using dropbox. When upgrading MAMP the only 2 folders you need to transfer are 'db' & 'htdocs'. My theory is then that these are the only 2 folders I need to keep in sync. Sound right to you so ...
I'm new to unit testing. But how do I unit test my DAL which is written with Entity Framework, so I can make sure my DAL code is working correctly but no database is actually touched? Could someone give as much detail as possible please.
Unit testing a Data Access Layer (DAL) that uses Entity Framework can be effectively accomplished using mocking. By utilizing a mocking framework, you can simulate the behavior of database interactions without needing a real database connection. Here's a step-by-step guide on how to do that. ### Step 1: Set Up Your Pr...
36,202
[ { "from": "human", "value": "I'm new to unit testing. But how do I unit test my DAL which is written with Entity Framework, so I can make sure my DAL code is working correctly but no database is actually touched? Could someone give as much detail as possible please.\n" }, { "from": "gpt", "val...
Preferably in VB.Net, but C# is fine, how can I access the extra properties added to a file by my digital camera, like Date Picture Taken, Shutter Speed or Camera Model?
To access the extra properties of a file, like EXIF data from images captured by a digital camera, you can use the built-in functionality of .NET libraries. In VB.NET or C#, you can use the `System.Drawing` namespace or use `Windows.Storage` for modern Windows applications. Below, I'll provide examples in both VB.NET a...
39,902
[ { "from": "human", "value": "Preferably in VB.Net, but C# is fine, how can I access the extra properties added to a file by my digital camera, like Date Picture Taken, Shutter Speed or Camera Model?\n" }, { "from": "gpt", "value": "To access the extra properties of a file, like EXIF data from im...
I think I'm pretty good at using semantic markup on my pages but I still have a handful of classes like this: /**** Aligns ****/ .right_align { text-align: right; } .left_align { text-align: left; } .center_align { text-align: center; } Which, technically, is a no-no. But when you just want to position some text in...
Using semantic markup is important for creating accessible and maintainable web pages, but there are cases where using CSS classes for specific styles like text alignment can still be acceptable, especially for quick formatting in certain contexts like tables. However, there are ways to improve your approach. Here are...
43,272
[ { "from": "human", "value": "I think I'm pretty good at using semantic markup on my pages but I still have a handful of classes like this:\n/**** Aligns ****/\n.right_align { text-align: right; }\n.left_align { text-align: left; }\n.center_align { text-align: center; }\n\nWhich, technically, is a no-no. ...
I'm looking for a really generic way to "fill out" a form based on a parameter string using javascript. for example, if i have this form: <form id="someform"> <select name="option1"> <option value="1">1</option> <option value="2">2</option> </select> <select name="option2"> <option value="1">1</option...
Your current approach is on the right track, but we can indeed clean it up a bit for better readability and efficiency. Instead of iterating through each form element for every key in the parameters, you can do a single pass to create a lookup map from the parameters and then set the values accordingly. This can help i...
41,091
[ { "from": "human", "value": "I'm looking for a really generic way to \"fill out\" a form based on a parameter string using javascript.\nfor example, if i have this form:\n<form id=\"someform\">\n <select name=\"option1\">\n <option value=\"1\">1</option>\n <option value=\"2\">2</option>\n </select>\...
Can anybody help me to build an XSD file to validate XMLs like these: [test] [a/] [b/] [a/] [b/] [/test] [test] [a/] [a/] [b/] [/test] Basically, I can have any number of <a> and/or <b> nodes without any other rule (can't use <xs:sequence>).
To create an XML Schema Definition (XSD) that allows any number of `<a>` and `<b>` elements within a `<test>` element, you can use the `<xs:choice>` element in conjunction with the `<xs:sequence>` element to allow multiple occurrences of `<a>` and `<b>` without enforcing a specific order. Here is a simple XSD that mee...
43,262
[ { "from": "human", "value": "Can anybody help me to build an XSD file to validate XMLs like these:\n[test]\n[a/]\n[b/]\n[a/]\n[b/]\n[/test]\n\n[test]\n[a/]\n[a/]\n[b/]\n[/test]\n\nBasically, I can have any number of <a> and/or <b> nodes without any other rule (can't use <xs:sequence>).\n" }, { "from...
Is there any way I can restrict my rendering format to PDF for one of my report in Report Manager? Thanks, brijit
In SQL Server Reporting Services (SSRS) Report Manager, there isn't a direct way to restrict the rendering format of a report to only PDF within the user interface itself. However, you can achieve this by implementing a workaround that involves limiting user access or modifying the report's behavior through a few poten...
43,085
[ { "from": "human", "value": "Is there any way I can restrict my rendering format to PDF for one of my report in Report Manager?\nThanks,\nbrijit\n" }, { "from": "gpt", "value": "In SQL Server Reporting Services (SSRS) Report Manager, there isn't a direct way to restrict the rendering format of a...
Is there an apache module that implements Kerberos authentication for use by Tomcat and also supports Kerberos delegation? I've already looked at mod_spnego and it throws away the SSPI context it creates only keeping the principal name. Instead, I'm looking for a module that would allow for the delegation of the ticke...
To implement Kerberos authentication with delegation support for a Tomcat application server using Apache, you indeed have a few options, but achieving your specific requirements can be quite tricky. ### 1. mod_auth_gssapi One of the more promising options you can explore is `mod_auth_gssapi`. This Apache module supp...
40,315
[ { "from": "human", "value": "Is there an apache module that implements Kerberos authentication for use by Tomcat and also supports Kerberos delegation?\nI've already looked at mod_spnego and it throws away the SSPI context it creates only keeping the principal name. Instead, I'm looking for a module that w...
Many databases I've encountered (Like SQL Server) use a single file to store the entire database. This seems to be a pretty common approach. What are the advantages to storing the entire database in a single file, as opposed to breaking up the data into more logical units, such as a single table per file. Also, how ...
Storing an entire database in a single file, as seen in many relational database management systems (RDBMS) like SQL Server, has several advantages: ### Advantages of a Single File Database Storage 1. **Simplicity**: Managing a single file is simpler than managing multiple files. Administrators can focus on a single ...
39,922
[ { "from": "human", "value": "Many databases I've encountered (Like SQL Server) use a single file to store the entire database. This seems to be a pretty common approach. What are the advantages to storing the entire database in a single file, as opposed to breaking up the data into more logical units, such...
I have been using classes for only a short while and when I write a method, I make all variables reference self, e.g. self.foo. However, I'm looking through the wxPython in Action book and notice that "self" isn't used all the time. For example: import wx class TextFrame(wx.Frame): def __init__(self): wx....
You're correct in your understanding that `self` refers to the instance of the class, and it is used to access instance variables and methods. Whether to use `self` for a variable or not depends on the variable's scope and lifetime. Here are some guidelines to help you understand when to use `self`: ### When to Use `...
42,988
[ { "from": "human", "value": "I have been using classes for only a short while and when I write a method, I make all variables reference self, e.g. self.foo.\nHowever, I'm looking through the wxPython in Action book and notice that \"self\" isn't used all the time. For example:\n import wx\n class TextFrame(...
I noticed that the following banal call from my main thread [self performSelectorOnMainThread:@selector(rollBar:) withObject:nil waitUntilDone:false]; was causing [NSThread isMultiThreaded] to report that my app had become multithreaded. I thought that was only supposed to happen when you detach a thread, ...
It sounds like you encountered a behavior in your application that is somewhat unexpected. When you observe `[NSThread isMultiThreaded]` returning `YES`, it typically indicates that at least one thread other than the main thread has been created. However, your situation seems to stem from the interaction with `NSProgre...
42,044
[ { "from": "human", "value": "I noticed that the following banal call from my main thread\n[self performSelectorOnMainThread:@selector(rollBar:)\n withObject:nil\n waitUntilDone:false];\n\nwas causing [NSThread isMultiThreaded] to report that my app\nhad become multithreaded. I thought that was onl...