instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
How can I detect the current text formatting at the cursor position in a WPF RichTextBox?
To detect the current text formatting at the cursor position in a WPF `RichTextBox`, you can access the `TextSelection` object, which represents the text that is currently selected or at the caret position. You can then use the `GetPropertyValue` method to retrieve formatting properties like font size, font family, for...
18,985
[ { "from": "human", "value": "How can I detect the current text formatting at the cursor position in a WPF RichTextBox?\n" }, { "from": "gpt", "value": "To detect the current text formatting at the cursor position in a WPF `RichTextBox`, you can access the `TextSelection` object, which represents...
I want to disable "Alert window" that I get from login page of one HTTPS site with "untrusted certificate". ServicePointManager is used for WebRequest/WebResponse: > public static bool > ValidateServerCertificate(object > sender, X509Certificate certificate, > X509Chain chain, SslPolicyErrors > sslPolicyErrors) { > ...
In a WinForms application, if you are using the `WebBrowser` control and you want to disable the security warning for untrusted SSL certificates, you cannot directly use `ServicePointManager` as you would with `WebRequest` and `WebResponse`. The `WebBrowser` control relies on the Internet Explorer rendering engine, whi...
20,694
[ { "from": "human", "value": "I want to disable \"Alert window\" that I get from login page of one HTTPS site with \"untrusted certificate\".\nServicePointManager is used for WebRequest/WebResponse:\n\n> public static bool\n> ValidateServerCertificate(object\n> sender, X509Certificate certificate,\n> X509Cha...
I'm looking at working on a project which uses C#.NET (sitting on a windows box) as the primary language and PostgreSQL as the backend database (backend is sitting on a linux box). I've heard that ODBC.NET allows for easy integration of these two components. Has anyone had experience actually setting C# and PostgreS...
Integrating C#.NET with PostgreSQL is a common scenario, and using ODBC.NET is one way to achieve this, although it's not the most common or recommended approach. Instead, many developers prefer using the Npgsql library, which is a .NET data provider specifically designed for PostgreSQL. ### Using Npgsql Npgsql is a ...
14,382
[ { "from": "human", "value": "I'm looking at working on a project which uses C#.NET (sitting on a windows box) as the primary language and PostgreSQL as the backend database (backend is sitting on a linux box). I've heard that ODBC.NET allows for easy integration of these two components. \nHas anyone had e...
Question: ((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3)) This was #1 on the midterm, I put "81 9" he thought I forgot to cross one out lawl, so I cross out 81, and he goes aww. Anyways, I dont understand why it's 81. I understand why (lambda (x) (* x x)) (* 3 3) = 81, but the first lambda I dont understand what ...
Let's break down the expression step by step: You have the following expression: ```scheme ((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3)) ``` 1. **Understanding the outer lambda expression**: - The outer lambda is defined as `(lambda (x y) (x y))`. This means that it takes two arguments, `x` and `y`, and eva...
22,803
[ { "from": "human", "value": "Question: \n((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3))\n\nThis was #1 on the midterm, I put \"81 9\" he thought I forgot to cross one out lawl, so I cross out 81, and he goes aww. Anyways, I dont understand why it's 81.\nI understand why (lambda (x) (* x x)) (* 3 3) = 8...
I notice that there's frequently an aspnet_client folder under the standard IIS web folder structure. What is this used for? Is it needed?
The `aspnet_client` folder in an IIS (Internet Information Services) web server's directory structure is primarily used by ASP.NET applications to store client-side script files and resources needed for some ASP.NET Web Forms controls. Here’s a bit more detail on its purpose: ### Purpose of `aspnet_client` Folder 1. ...
22,891
[ { "from": "human", "value": "I notice that there's frequently an aspnet_client folder under the standard IIS web folder structure. What is this used for? Is it needed?\n" }, { "from": "gpt", "value": "The `aspnet_client` folder in an IIS (Internet Information Services) web server's directory str...
We're running into issues with how we specify font sizes. If we specify the font sizes using pt, they don't always look the same across browsers/platforms. If we specify font sizes using px, IE6 users can't resize the text.
Font sizing can indeed be tricky, especially when considering cross-browser compatibility and user accessibility. Here are a few strategies you can employ to specify font sizes more effectively while addressing your concerns: 1. **Use `em` or `rem` Units**: - Instead of using `pt` or `px`, consider using relative u...
21,011
[ { "from": "human", "value": "We're running into issues with how we specify font sizes. If we specify the font sizes using pt, they don't always look the same across browsers/platforms. If we specify font sizes using px, IE6 users can't resize the text.\n" }, { "from": "gpt", "value": "Font sizin...
Using SQL Server, which is the fastest or best practice method to use for date retrieval? Is there a difference between CURRENT_TIMESTAMP and GetDate()?
In SQL Server, both `CURRENT_TIMESTAMP` and `GETDATE()` are used to retrieve the current date and time. They are functionally equivalent, and there is no significant performance difference between the two. Here’s a brief comparison and best practices for date retrieval: ### Comparison of CURRENT_TIMESTAMP and GETDATE(...
21,140
[ { "from": "human", "value": "Using SQL Server, which is the fastest or best practice method to use for date retrieval? Is there a difference between CURRENT_TIMESTAMP and GetDate()?\n" }, { "from": "gpt", "value": "In SQL Server, both `CURRENT_TIMESTAMP` and `GETDATE()` are used to retrieve the ...
I've got the following query to determine how many votes a story has received: SELECT s_id, s_title, s_time, (s_time-now()) AS s_timediff, ( (SELECT COUNT(*) FROM s_ups WHERE stories.q_id=s_ups.s_id) - (SELECT COUNT(*) FROM s_downs WHERE stories.s_id=s_downs.s_id) ) AS votes FROM stories I'd like to apply the fol...
To incorporate the ranking function from Reddit's algorithm directly into your SQL query, you can modify the SELECT statement to include the calculation for the score and then use that score for sorting in your main query. The Reddit-style ranking function can be approximated as follows: ``` score = (ups - downs) / (...
18,688
[ { "from": "human", "value": "I've got the following query to determine how many votes a story has received:\nSELECT s_id, s_title, s_time, (s_time-now()) AS s_timediff, \n\n(\n (SELECT COUNT(*) FROM s_ups WHERE stories.q_id=s_ups.s_id) -\n (SELECT COUNT(*) FROM s_downs WHERE stories.s_id=s_downs.s_id)\n) AS...
I'm trying to parse objects to XML in Delphi, so I read about calling the object's ClassInfo method to get its RTTI info. The thing is, this apparently only works for TPersistent objects. Otherwise, I have to specifically add a compiler directive {$M+} to the source code for the compiler to generate RTTI info. So I hap...
When working with RTTI (Run-Time Type Information) in Delphi, you need to ensure that the classes you are dealing with are properly defined to expose RTTI information. Here's a breakdown of what you might be missing or what steps you should take to ensure RTTI is set up correctly for your classes. ### 1. Use the Corre...
20,838
[ { "from": "human", "value": "I'm trying to parse objects to XML in Delphi, so I read about calling the object's ClassInfo method to get its RTTI info.\nThe thing is, this apparently only works for TPersistent objects. Otherwise, I have to specifically add a compiler directive {$M+} to the source code for th...
Do you always use a second-level cache in Hibernate or do you first try it without and only use it when the performance goes down?
The use of a second-level cache in Hibernate is generally dependent on the specific needs of your application, the complexity of your data model, and your performance requirements. Here are some considerations to help you decide: 1. **Use Cases**: If your application has a high read-to-write ratio, meaning that data i...
22,937
[ { "from": "human", "value": "Do you always use a second-level cache in Hibernate or do you first try it without and only use it when the performance goes down?\n" }, { "from": "gpt", "value": "The use of a second-level cache in Hibernate is generally dependent on the specific needs of your appli...
We have recently migrated a large, high demand web application to Tomcat 5.5 from Tomcat 4 and have noticed some peculiar slowdown behavior that appears to be related to JVM pauses. In order to run our application and support increased load over time on Tomcat 4, many not so standard JVM parameters were set and tuned ...
Migrating from Tomcat 4 to Tomcat 5.5 and experiencing performance issues can stem from several factors, especially around the JVM configuration. It’s important to review the parameters being used to see if they are still beneficial or potentially detrimental given the changes in the Java environment and the applicatio...
19,127
[ { "from": "human", "value": "We have recently migrated a large, high demand web application to Tomcat 5.5 from Tomcat 4 and have noticed some peculiar slowdown behavior that appears to be related to JVM pauses. In order to run our application and support increased load over time on Tomcat 4, many not so st...
How can I transform a website to be able to handle multi language (example : english, french, spanish)? I do not like the resource file because I feel limited and it's pretty long to build the list. Do you have any suggestion? Update For the moment the best way we found is to use an XML file and with some Xpath et get ...
Transforming a website to support multiple languages can be approached in several ways, each with its own benefits and drawbacks. Here are a few methods, including your mention of XML files, along with some additional suggestions to help you manage translations more effectively: ### 1. **XML Files** Since you've alrea...
16,882
[ { "from": "human", "value": "How can I transform a website to be able to handle multi language (example : english, french, spanish)?\nI do not like the resource file because I feel limited and it's pretty long to build the list. Do you have any suggestion?\nUpdate\nFor the moment the best way we found is to...
I would like to change the name of my SQL Server instance. Is there a simple way of doing this or is a significant effort required? Note, this is a named instance - not the default instance.
Changing the name of a SQL Server named instance is not a straightforward task and generally requires significant effort. Unlike default instances, named instances have their own unique identifiers and renaming them involves multiple steps. Below are the steps involved in renaming a SQL Server named instance: ### Step...
22,658
[ { "from": "human", "value": "I would like to change the name of my SQL Server instance. Is there a simple way of doing this or is a significant effort required? Note, this is a named instance - not the default instance.\n" }, { "from": "gpt", "value": "Changing the name of a SQL Server named i...
In my ideal world, what I'm looking for would exist as something along the lines of this: public string UserDefinedField { get { return _userDefinedField; } internal set { _userDefinedField = value; } set { _userDefinedField = value; ChangedFields.Add(Fields.UserDefinedField); } } Where one stateme...
In C#, property access modifiers control how properties can be accessed but do not allow for the conditional behavior you’re looking for directly within the property setter itself. The standard approach using reflection to check the call stack would indeed work, but it can be somewhat cumbersome and not the most perfor...
21,049
[ { "from": "human", "value": "In my ideal world, what I'm looking for would exist as something along the lines of this:\npublic string UserDefinedField\n{\n get { return _userDefinedField; }\n internal set { _userDefinedField = value; } \n set { _userDefinedField = value; ChangedFields.Add(Fi...
I am in the middle of implementing an application using ASP.NET MVC and would love to cache the data passed to user controls or the output rendering on some user controls that I render using the Html.RenderPartial, that way I don't have to query the DB with every request I do to the controller for a new view.
Caching is a great way to improve the performance of your ASP.NET MVC application by reducing the number of database queries needed to render your views. ASP.NET MVC provides several caching techniques that can be applied to both action results and partial views rendered with `Html.RenderPartial`. Here’s how you can im...
19,560
[ { "from": "human", "value": "I am in the middle of implementing an application using ASP.NET MVC and would love to cache the data passed to user controls or the output rendering on some user controls that I render using the Html.RenderPartial, that way I don't have to query the DB with every request I do to...
Internet explorer 6 seems totally ignore CSS classes or rules on select, option or optgroup tags. Is there a way to bypass that limitation (except install a recent version of IE) ? Edit : to be more precise, I'm trying to build a hierarchy between options like that example: Here's the HTML snippet : <select name="hiera...
Internet Explorer 6 is notorious for its lack of support for CSS styling on `<select>`, `<option>`, and `<optgroup>` elements. Unfortunately, it does not recognize many styles that are commonly used in modern web design, including font styles, background images, and padding for option elements. Here's a summary of yo...
21,033
[ { "from": "human", "value": "Internet explorer 6 seems totally ignore CSS classes or rules on select, option or optgroup tags.\nIs there a way to bypass that limitation (except install a recent version of IE) ?\nEdit : to be more precise, I'm trying to build a hierarchy between options like that example:\nH...
I am looking to store 2D arrays of 900x100 elements in a database. Efficient recall and comparison of the arrays is important. I could use a table with a schema like [A, x, y, A(x,y)] such that a single array would compromise 90,000 records. This seems like an ~ok~ table design to store the array, and would provide ...
Storing large 2D arrays efficiently in a database while allowing for quick recall and comparison can be quite challenging, especially with your stated size of 900x100 (90,000 elements). Let's analyze your current design and discuss alternative options. ### Current Design: Your current schema with `[A, x, y, A(x,y)]` h...
19,980
[ { "from": "human", "value": "I am looking to store 2D arrays of 900x100 elements in a database. Efficient recall and comparison of the arrays is important. I could use a table with a schema like [A, x, y, A(x,y)] such that a single array would compromise 90,000 records. This seems like an ~ok~ table desi...
Some people claim that code's worst enemy is its size, and I tend to agree. Yet every day you keep hearing things like I write blah lines of code in a day. I own x lines of code. Windows is x million lines of code. Question: When is "#lines of code" useful? ps: Note that when such statements are made, the tone is "mo...
The metric of "#lines of code" (LOC) can be useful in certain contexts, but it can also be misleading. Here are a few scenarios where counting lines of code might provide meaningful insight: 1. **Estimating Project Size**: In the early stages of a project, LOC can serve as a rough measure of the expected effort and co...
21,597
[ { "from": "human", "value": "Some people claim that code's worst enemy is its size, and I tend to agree. Yet every day you keep hearing things like\n\nI write blah lines of code in a day.\nI own x lines of code.\nWindows is x million lines of code.\n\nQuestion: When is \"#lines of code\" useful?\nps: Note t...
I find print_r in PHP extremely useful, but wonder if there is anything remotely equivalent in Perl?
Yes, in Perl, there is a function called `Data::Dumper` that serves a similar purpose to `print_r` in PHP. It allows you to inspect complex data structures like arrays and hashes in a human-readable format. Here’s how you can use `Data::Dumper`: 1. First, you need to include the module in your Perl script: ```per...
22,883
[ { "from": "human", "value": "I find print_r in PHP extremely useful, but wonder if there is anything remotely equivalent in Perl?\n" }, { "from": "gpt", "value": "Yes, in Perl, there is a function called `Data::Dumper` that serves a similar purpose to `print_r` in PHP. It allows you to inspect c...
I have a set of calculation methods sitting in a .Net DLL. I would like to make those methods available to Excel (2003+) users so they can use them in their spreadsheets. For example, my .net method: public double CalculateSomethingReallyComplex(double a, double b) {...} I would like enable them to call this method j...
To make your .NET methods available to Excel users as worksheet functions, you can use a technique called "Excel-DNA". Excel-DNA is a free and open-source library that allows you to create Excel add-ins using .NET. Here’s a step-by-step guide to achieving your goal: ### Step 1: Set Up Your Project 1. **Install Excel-...
10,191
[ { "from": "human", "value": "I have a set of calculation methods sitting in a .Net DLL. I would like to make those methods available to Excel (2003+) users so they can use them in their spreadsheets.\nFor example, my .net method:\npublic double CalculateSomethingReallyComplex(double a, double b) {...}\n\nI...
So I made some timers for a quiz. The thing is, I just realized when I put javascript: alert("blah"); in the address, the popup alert box pauses my timer. Which is very unwanted in a quiz. I don't think there is any way to stop this behaviour... but I'll ask anyway. If there is not, mind suggesting what should I do?
You're correct that using `alert()` in JavaScript will pause the execution of any code in your page until the alert dialog is dismissed, which is generally not desirable in a quiz application where you want a timer to continue running. To avoid this issue, you can consider alternative ways to show messages or alerts w...
18,529
[ { "from": "human", "value": "So I made some timers for a quiz. The thing is, I just realized when I put \njavascript: alert(\"blah\");\n\nin the address, the popup alert box pauses my timer. Which is very unwanted in a quiz.\nI don't think there is any way to stop this behaviour... but I'll ask anyway.\nIf ...
I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...). So the question is: Portlets, tiles or some other technology?
When building reusable modules in a Spring MVC application with JSP views, you have a few options. The choice between Portlets, Tiles, or other technologies depends on your specific requirements. Here’s a brief overview of the options you mentioned and a couple of others to consider: ### 1. **Spring MVC with JSP Inclu...
19,405
[ { "from": "human", "value": "I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like \"latest news\" \"upcoming events\"...).\nSo the question is: Portlets, tiles or some other technology?\n" }, { "from":...
What is the best way to parse a float in CSharp? I know about TryParse, but what I'm particularly wondering about is dots, commas etc. I'm having problems with my website. On my dev server, the ',' is for decimals, the '.' for separator. On the prod server though, it is the other way round. How can I best capture this?...
In C#, when you're dealing with parsing floats (or any numeric types), the formatting can be affected by culture settings, which can differ between environments. The `float.TryParse` method can be used effectively to handle this, and you can specify the culture information to ensure consistency across different environ...
14,840
[ { "from": "human", "value": "What is the best way to parse a float in CSharp?\nI know about TryParse, but what I'm particularly wondering about is dots, commas etc.\nI'm having problems with my website. On my dev server, the ',' is for decimals, the '.' for separator. On the prod server though, it is the ot...
I have many years of experience in Java including Swing, Servlet and JDBC, but have never programmed for a Java EE server. Many job advertisements from large companies are specifically asking for Java EE experience. Are there specific skills or development environments that I should learn to qualify for these kinds of...
Yes, transitioning from Java SE (Standard Edition) to Java EE (Enterprise Edition), which is now known as Jakarta EE, can enhance your job prospects and enable you to work on enterprise-level applications. Here are some specific skills and technologies that you should consider learning: ### Core Technologies 1. **Jaka...
18,362
[ { "from": "human", "value": "I have many years of experience in Java including Swing, Servlet and JDBC, but have never programmed for a Java EE server.\nMany job advertisements from large companies are specifically asking for Java EE experience. Are there specific skills or development environments that I ...
I use a pattern that looks something like this often. I'm wondering if this is alright or if there is a best practice that I am not applying here. Specifically I'm wondering; in the case that an exception is thrown is the code that I have in the finally block enough to ensure that the connection is closed appropriatel...
In your provided code, you have a pattern that uses a `try`/`finally` block to ensure that resources are cleaned up, but there are a few issues and improvements that could be made for better resource management and exception safety. Let's address them step-by-step. ### Issues in Your Code 1. **Connection Management**...
17,091
[ { "from": "human", "value": "I use a pattern that looks something like this often. I'm wondering if this is alright or if there is a best practice that I am not applying here.\nSpecifically I'm wondering; in the case that an exception is thrown is the code that I have in the finally block enough to ensure ...
What's the best way of inserting information in table A and using the index from table A to relate to table B. The "solution" I tried is inserting the info in table A (which has a automatically generated ID), then, select the last index and insert it in table B. This may not be very useful, as the last index may chan...
The challenge you're facing is common when working with relational databases, and indeed, relying on the "last inserted ID" can lead to race conditions if multiple users are inserting records simultaneously. Instead, you should leverage the mechanisms provided by the database systems to safely retrieve the ID of the ne...
19,855
[ { "from": "human", "value": "What's the best way of inserting information in table A and using the index from table A to relate to table B. \nThe \"solution\" I tried is inserting the info in table A (which has a automatically generated ID), then, select the last index and insert it in table B. This may no...
I am looking to purchase a new development PC. My budget is not more than $1,000 USD (including monitor). I am open to laptop (desktop replacement type) or the traditional desktop PC would do just fine. My primary development environment will be Microsoft, Visual Studio 2008 (and support of older Visual Studio 6 code...
Based on your requirements and budget of $1,000 (including a monitor), you can build a solid development PC suitable for your needs. Here are some recommendations and clarifications regarding your concerns: ### AMD vs. Intel 1. **Compatibility**: There are no inherent compatibility issues with developing software in V...
18,783
[ { "from": "human", "value": "I am looking to purchase a new development PC. My budget is not more than $1,000 USD (including monitor). I am open to laptop (desktop replacement type) or the traditional desktop PC would do just fine.\nMy primary development environment will be Microsoft, Visual Studio 2008 ...
I am migrating a struts application from Websphere to Tomcat 6 and my application has support for Russian language. In Websphere we use to pass the JVM param -Dclinet.encoding.override=cp1251 but when I tried this with tomcat by passing the JVM argument -DFile.encoding=cp1251, the system doesnt accept input (I an any t...
Migrating a Struts application from Websphere to Tomcat, especially with regards to character encoding, can be a bit tricky. When dealing with character encoding issues in web applications, you need to ensure that multiple aspects of the stack are properly configured. Here's a checklist of things to try: ### 1. Set JV...
19,167
[ { "from": "human", "value": "I am migrating a struts application from Websphere to Tomcat 6 and my application has support for Russian language. In Websphere we use to pass the JVM param -Dclinet.encoding.override=cp1251 but when I tried this with tomcat by passing the JVM argument -DFile.encoding=cp1251, t...
I have two tables containing Tasks and Notes, and want to retrieve a list of tasks with the number of associated notes for each one. These two queries do the job: select t.TaskId, (select count(n.TaskNoteId) from TaskNote n where n.TaskId = t.TaskId) 'Notes' from Task t -- or select t.TaskId, count(n.T...
Both of your queries effectively achieve the same goal of retrieving a list of tasks along with the count of associated notes. However, there are some differences between the two approaches, which can influence performance and readability depending on the context. Let’s examine both queries: ### 1. Subquery Approach ...
22,437
[ { "from": "human", "value": "I have two tables containing Tasks and Notes, and want to retrieve a list of tasks with the number of associated notes for each one. These two queries do the job:\nselect t.TaskId,\n (select count(n.TaskNoteId) from TaskNote n where n.TaskId = t.TaskId) 'Notes'\nfrom Tas...
How can I construct my ajaxSend call, this seems like the place to put it, to preview what is being passed back to the broker? also, can I stop the ajax call in ajaxSend?..so I can perfect my url string before dealing with errors from the broker? This is the complete URL that, when passed to the broker, will return the...
To help you construct your `$.post` call and troubleshoot your AJAX request, let's clarify how you can build the URL string correctly, see what data is being sent, and also handle any errors before the AJAX call is made. ### Constructing the URL Your current use of the `$.post` method does not directly create a compl...
11,970
[ { "from": "human", "value": "How can I construct my ajaxSend call, this seems like the place to put it, to preview what is being passed back to the broker? also, can I stop the ajax call in ajaxSend?..so I can perfect my url string before dealing with errors from the broker?\nThis is the complete URL that, ...
I want Netbeans 6.1 to store the .netbeans directory in another place than the default. How do I do this?
To change the location of the `.netbeans` directory for NetBeans 6.1, you need to set the `netbeans.user` property in the `netbeans.conf` file. Here's how to do it: 1. **Locate the `netbeans.conf` file**: - This file is usually found in the `etc` directory of your NetBeans installation. For example, it might be at ...
23,307
[ { "from": "human", "value": "I want Netbeans 6.1 to store the .netbeans directory in another place than the default. How do I do this?\n" }, { "from": "gpt", "value": "To change the location of the `.netbeans` directory for NetBeans 6.1, you need to set the `netbeans.user` property in the `netbe...
I want to create a custom MSBuild task that changes my .cs files before they are compiled by csc.exe (but, of course, that doesn't modify them in place - I don't want actual source files touched). I am aware of PostSharp and other AOP frameworks for .NET and they are not an option for this particular project, plus I'd...
Creating a custom MSBuild task to modify C# files on-the-fly during the build process is a great way to learn more about both MSBuild and how .NET compiles code. Here's a high-level overview of the steps you need to follow, as well as a sample implementation. ### High-Level Steps 1. **Create a Custom MSBuild Task**: ...
17,694
[ { "from": "human", "value": "I want to create a custom MSBuild task that changes my .cs files before they are compiled by csc.exe (but, of course, that doesn't modify them in place - I don't want actual source files touched). I am aware of PostSharp and other AOP frameworks for .NET and they are not an opt...
I want to be able to compare an image taken from a webcam to an image stored on my computer. The library doesn't need to be one hundred percent accurate as it won't be used in anything mission critical (e.g. police investigation), I just want something OK I can work with. I have tried a demonstration project for Image ...
Yes, there have been many successful projects in the field of image recognition, and there are several libraries you can use in C# or VB.NET that should meet your needs for basic image comparison. Here are a few libraries that are popular for image recognition and comparison: 1. **Emgu CV**: - Emgu CV is a .NET wr...
20,166
[ { "from": "human", "value": "I want to be able to compare an image taken from a webcam to an image stored on my computer.\nThe library doesn't need to be one hundred percent accurate as it won't be used in anything mission critical (e.g. police investigation), I just want something OK I can work with.\nI ha...
i have robot and want to control it via internet using radio wave .. but still i dont know the best language to do that . with the need to build scure site to insure not any body can use it . i expect for site asp with c# but what is the language i'll need it to control from sender device to the recipt robot . also nee...
No need to apologize! Your project sounds exciting, and it's great that you're reaching out for guidance. Here's a structured approach to help you figure out the best technology stack for your needs: ### 1. **Web Application for Control** Since you mentioned that you're considering ASP.NET with C#, that's a solid choi...
18,391
[ { "from": "human", "value": "i have robot and want to control it via internet using radio wave .. but still i dont know the best language to do that . with the need to build scure site to insure not any body can use it . i expect for site asp with c# but what is the language i'll need it to control from sen...
I have this big data-entry sort of page, a table kind of layout using divs. Each row has subrows which can be toggled open/closed. The toggling is triggered using css visibility settings. Each "cell" of the table has a little image in its corner, you click on the image, and a popup window opens that allows you to put n...
It sounds like you're encountering a common issue in older versions of Internet Explorer, particularly IE7, where iframes can sometimes have rendering problems related to z-index and hover states. Here are a few strategies you could try to resolve the issue: ### 1. Set the `iframe` and its Parent `div`'s Z-Index Make...
18,654
[ { "from": "human", "value": "I have this big data-entry sort of page, a table kind of layout using divs. Each row has subrows which can be toggled open/closed. The toggling is triggered using css visibility settings. Each \"cell\" of the table has a little image in its corner, you click on the image, and a ...
How does one do this? If I want to analyze how something is getting compiled, how would I get the emitted assembly code?
To analyze how your source code is getting compiled and to obtain the emitted assembly code, you can follow these general steps depending on the programming language and compiler you are using. Here’s a breakdown of how to achieve this for some popular languages and compilers: ### For C/C++ with GCC 1. **Use the `-S`...
18,474
[ { "from": "human", "value": "How does one do this?\nIf I want to analyze how something is getting compiled, how would I get the emitted assembly code?\n" }, { "from": "gpt", "value": "To analyze how your source code is getting compiled and to obtain the emitted assembly code, you can follow thes...
What is the difference between <% %> and <%= %> in ASP.NET MVC? And when to use which?
In ASP.NET MVC, `<% %>` and `<%= %>` are used in ASP.NET Web Forms syntax for embedding server-side code in HTML. However, their usage and purpose differ: ### `<% %>`: Code Block - The `<% %>` syntax is used to execute a block of code without writing anything to the output stream. You can use it to perform various ope...
19,212
[ { "from": "human", "value": "What is the difference between <% %> and <%= %> in ASP.NET MVC? And when to use which?\n" }, { "from": "gpt", "value": "In ASP.NET MVC, `<% %>` and `<%= %>` are used in ASP.NET Web Forms syntax for embedding server-side code in HTML. However, their usage and purpose ...
How can I find out the folder where the windows service .exe file is installed dynamically? Path.GetFullPath(relativePath); returns a path based on C:\WINDOWS\system32 directory. However, the XmlDocument.Load(string filename) method appears to be working against relative path inside the directory where the service .ex...
To dynamically find the folder where the Windows service executable (.exe) file is installed, you can use the `AppDomain.CurrentDomain.BaseDirectory` property or retrieve the location of the current assembly using the `Assembly.GetExecutingAssembly().Location` property. Both approaches will give you the path of the dir...
22,863
[ { "from": "human", "value": "How can I find out the folder where the windows service .exe file is installed dynamically?\nPath.GetFullPath(relativePath);\n\nreturns a path based on C:\\WINDOWS\\system32 directory.\nHowever, the XmlDocument.Load(string filename) method appears to be working against relative ...
Using groovy, would you expect better performance in terms of speed and memory overhead to read and query JSON vs XML?
When comparing JSON and XML in the context of Groovy (or any programming language), there are several factors to consider regarding performance in terms of speed and memory overhead: ### Performance 1. **Parsing Speed**: - **JSON**: Typically, JSON parsing is faster than XML parsing because JSON has a simpler stru...
22,890
[ { "from": "human", "value": "Using groovy, would you expect better performance in terms of speed and memory overhead to read and query JSON vs XML? \n" }, { "from": "gpt", "value": "When comparing JSON and XML in the context of Groovy (or any programming language), there are several factors to ...
Can anybody recommend a good method for determining the Rect of some wrapped text on an iPhone? I've tried all the built-in methods for NSString in the 2.1 SDK to no avail. The size methods never return sizes that allow me to completely fit wrapped text in my custom view. I'm drawing some user customizable text that ...
To determine the bounding rectangle for wrapped text in a custom view on iOS, you can use the `NSString` method `boundingRectWithSize:options:attributes:context:`. This method can help you accurately calculate the size of a string given a maximum width, a font, and other attributes. Here’s a step-by-step approach to a...
21,539
[ { "from": "human", "value": "Can anybody recommend a good method for determining the Rect of some wrapped text on an iPhone? I've tried all the built-in methods for NSString in the 2.1 SDK to no avail. The size methods never return sizes that allow me to completely fit wrapped text in my custom view.\nI'm...
I'd like to find the base url of my application, so I can automatically reference other files in my application tree... So given a file config.php in the base of my application, if a file in a subdirectory includes it, knows what to prefix a url with. application/config.php application/admin/something.php application/...
To determine the base URL of your application dynamically in PHP, you can create a function in your `config.php` file that calculates the application root based on the current script's URL. This will allow your application to adapt regardless of where it's installed on the server. Here's how you can implement this: 1...
20,847
[ { "from": "human", "value": "I'd like to find the base url of my application, so I can automatically reference other files in my application tree...\nSo given a file config.php in the base of my application, if a file in a subdirectory includes it, knows what to prefix a url with. \napplication/config.php\n...
This is probably a very simple question, but what is the technical term for this class of language? They use an "intermediate" assembly type language which is sent through the JVM or CLR. They both are object oriented and they both depend on an intermediary such as the Java Virtual Machine or the Common Language Run...
Yes, the technical term you are looking for is often "managed languages." Both Java and C# fall into this category because they rely on a runtime environment (the Java Virtual Machine for Java and the Common Language Runtime for C#) that provides various services such as memory management (including garbage collection)...
25,668
[ { "from": "human", "value": "This is probably a very simple question, but what is the technical term for this class of language? \nThey use an \"intermediate\" assembly type language which is sent through the JVM or CLR. They both are object oriented and they both depend on an intermediary such as the Jav...
I need my program to work only with certain USB Flash drives (from a single manufacturer) and ignore all other USB Flash drives (from any other manufacturers). is it possible to check that specific USB card is inserted on windows using .NET 2.0? how? if I find it through WMI, can I somehow determine which drive letter ...
Yes, it is possible to check if a specific USB flash drive from a certain manufacturer is inserted on Windows using .NET 2.0, and you can also determine which drive letter the USB drive is assigned to. You can do this using Windows Management Instrumentation (WMI) to query the connected USB devices and filter by the ma...
16,240
[ { "from": "human", "value": "I need my program to work only with certain USB Flash drives (from a single manufacturer) and ignore all other USB Flash drives (from any other manufacturers).\nis it possible to check that specific USB card is inserted on windows using .NET 2.0? how?\nif I find it through WMI, ...
This may be a matter of style, but there's a bit of a divide in our dev team and I wondered if anyone else had any ideas on the matter... Basically, we have some debug print statements which we turn off during normal development. Personally I prefer to do the following: //---- SomeSourceFile.cpp ---- #define DEBUG_ENA...
You raise a valid point regarding the distinction between the two approaches for enabling debug statements, and both methods have their pros and cons. Let's break down each approach: ### 1. Using `#define DEBUG_ENABLED (0)`: ```cpp #define DEBUG_ENABLED (0) SomeFunction() { int someVariable = 5; #if(DEBUG_ENABL...
21,559
[ { "from": "human", "value": "This may be a matter of style, but there's a bit of a divide in our dev team and I wondered if anyone else had any ideas on the matter...\nBasically, we have some debug print statements which we turn off during normal development. Personally I prefer to do the following:\n//----...
I would like to send a (as yet undetermined) SIGnal from a bash script to a Gambas program when a specific file has been changed. How can I get my Gambas program to process this SIGnal?
To send a signal from a bash script to a Gambas program when a specific file has changed, you can use the `inotifywait` command to monitor the file for changes and then send a signal to the Gambas program. The Gambas program can handle signals using the `Signal` class. Here are the steps to achieve this: ### Step 1: ...
20,886
[ { "from": "human", "value": "I would like to send a (as yet undetermined) SIGnal from a bash script to a Gambas program when a specific file has been changed. \nHow can I get my Gambas program to process this SIGnal?\n" }, { "from": "gpt", "value": "To send a signal from a bash script to a Gamba...
How does one write a unit test that fails only if a function doesn't throw an expected exception?
To write a unit test that fails only if a specific function does not throw an expected exception, you can use a testing framework like Python's `unittest` or `pytest`. Here's how to do it in both frameworks: ### Using `unittest` In Python's `unittest` framework, you can use the `assertRaises` method. This method chec...
23,031
[ { "from": "human", "value": "How does one write a unit test that fails only if a function doesn't throw an expected exception?\n" }, { "from": "gpt", "value": "To write a unit test that fails only if a specific function does not throw an expected exception, you can use a testing framework like P...
I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example: foo = "0.0.0.0" goo = "here is some other stuff 0.0.0.0" if goo =~ /value of foo here dynamically/ puts "success!" end
Yes, you can easily substitute the value of a string into a regular expression in Ruby by using string interpolation. Here's how you can do it in your example: ```ruby foo = "0.0.0.0" goo = "here is some other stuff 0.0.0.0" if goo =~ /#{Regexp.escape(foo)}/ puts "success!" end ``` ### Explanation: - `#{Regexp.es...
23,564
[ { "from": "human", "value": "I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example:\nfoo = \"0.0.0.0\"\ngoo = \"here is some other stuff 0.0.0.0\" \nif goo =~ /value of foo here dynamically/\n puts \"success!\"\nend\n\n" }, { "fr...
i need to get the color at a particular coordinate from a texture. There are 2 ways i can do this, by getting and looking at the raw png data, or by sampling my generated opengl texture. Is it possible to sample an opengl texture to get the color (RGBA) at a given UV or XY coord? If so, how?
Yes, you can sample an OpenGL texture to get the color (RGBA) at a specific coordinate (UV or XY) using a fragment shader. This involves using a texture sampling function to retrieve the color from the texture based on the given coordinates. ### Steps to Sample a Texture in OpenGL 1. **Create and Load Your Texture**:...
20,186
[ { "from": "human", "value": "i need to get the color at a particular coordinate from a texture. There are 2 ways i can do this, by getting and looking at the raw png data, or by sampling my generated opengl texture. Is it possible to sample an opengl texture to get the color (RGBA) at a given UV or XY coor...
I would like to provide downloadable files to website users, but want to hide the URL of the files from the user... I'm thinking an HTTPHandler could do the trick, but is it possible to retrieve a file from an external server and stream it to the user? Perhaps somebody can give me a hint at how to accomplish this, or p...
To achieve your goal of hiding the actual file URLs while allowing users to download files hosted on an external server, you can indeed use an ASP.NET HTTP handler or a controller action (if you're using MVC). However, it's important to note that in order to completely avoid using your server's bandwidth, the file must...
19,991
[ { "from": "human", "value": "I would like to provide downloadable files to website users, but want to hide the URL of the files from the user... I'm thinking an HTTPHandler could do the trick, but is it possible to retrieve a file from an external server and stream it to the user?\nPerhaps somebody can give...
Basically, I have a class with 2 methods: one to serialize an object into an XML file and another to read an object from XML. Here is an example of synchronized part from the method that restores an object: public T restore(String from) throws Exception { // variables declaration synchronized (from) { ...
Your current approach to synchronizing on the `from` string argument in your `restore` method isn't the best practice. Since strings are interned in Java, multiple threads could end up synchronizing on the same string, which might lead to unexpected behaviors and is not a safe way to achieve thread safety. Let's addres...
19,433
[ { "from": "human", "value": "Basically, I have a class with 2 methods: one to serialize an object into an XML file and another to read an object from XML.\nHere is an example of synchronized part from the method that restores an object:\n public T restore(String from) throws Exception {\n // variable...
Simple question that keeps bugging me. Should I HTML encode user input right away and store the encoded contents in the database, or should I store the raw values and HTML encode when displaying? Storing encoded data greatly reduces the risk of a developer forgetting to encode the data when it's being displayed. Howeve...
The best practice is to **store raw values** in the database and **HTML-encode** them at the time of rendering/displaying. Here's why: 1. **Flexibility**: Storing raw data allows for greater flexibility. If you need to render the same data in different contexts (e.g., HTML, JSON, XML), you can encode it appropriately ...
22,878
[ { "from": "human", "value": "Simple question that keeps bugging me.\nShould I HTML encode user input right away and store the encoded contents in the database, or should I store the raw values and HTML encode when displaying?\nStoring encoded data greatly reduces the risk of a developer forgetting to encode...
Shouldn't this be a pretty straightforward operation? However, I see there's neither a size() nor length() method.
It sounds like you're dealing with a data structure or collection type that does not provide a direct method to retrieve its size or length, which can indeed be frustrating. In many programming languages and libraries, common data structures (like arrays, lists, sets, or maps) typically have a way to access their siz...
23,711
[ { "from": "human", "value": "Shouldn't this be a pretty straightforward operation? However, I see there's neither a size() nor length() method.\n" }, { "from": "gpt", "value": "It sounds like you're dealing with a data structure or collection type that does not provide a direct method to retriev...
I want to have a reusable button which can be registered for one of many different callbacks, determined by an external source. When a new callback is set, I want to remove the old. I also want to be able to clear the callback externally at any time. public function registerButtonCallback(function:Function):void { cl...
To implement a reusable button with the ability to register and unregister callbacks in ActionScript 3 (AS3), you can utilize a property to store the current callback function. This way, you can easily remove it before adding a new one, and also clear the callback at any time. Here’s how you can structure your code: ...
21,744
[ { "from": "human", "value": "I want to have a reusable button which can be registered for one of many different callbacks, determined by an external source. When a new callback is set, I want to remove the old. I also want to be able to clear the callback externally at any time.\npublic function registerBut...
If you were tasked to build an event scheduling system that supported recurring events, how would you do it? How do you handle when an recurring event is removed? How could you see when the future events will happen? i.e. When creating an event, you could pick "repeating daily" (or weekly, yearly, etc). One design pe...
To design an event scheduling system that supports recurring events with the capabilities you've outlined, I would follow a structured approach. Below is a high-level design using Ruby on Rails, complete with details on managing recurring events, handling deletions, adding data to specific instances, and calculating fu...
15,465
[ { "from": "human", "value": "If you were tasked to build an event scheduling system that supported recurring events, how would you do it? How do you handle when an recurring event is removed? How could you see when the future events will happen?\ni.e. When creating an event, you could pick \"repeating dai...
What is the approved way to convert from char* to System::string and back in C++/CLI? I found a few references to marshal_to<> templated functions on Google, but it appears that this feature never made the cut for Visual Studio 2005 (and isn't in Visual Studio 2008 either, AFAIK). I have also seen some code on Stan Lip...
In C++/CLI, converting between `char*` (native C-style strings) and `System::String` (managed strings) is a common requirement when interacting between managed and unmanaged code. While there are multiple ways to do this, the most straightforward and widely accepted methods can be illustrated using the `System::Runtime...
18,420
[ { "from": "human", "value": "What is the approved way to convert from char* to System::string and back in C++/CLI? I found a few references to marshal_to<> templated functions on Google, but it appears that this feature never made the cut for Visual Studio 2005 (and isn't in Visual Studio 2008 either, AFAIK...
My build process consists of Qt's qmake Makefile generator and the typical make utility bundled with linux. My application consists of a few shared libraries and the main application is linked against them. How can I apply the typical linux versioning scheme on my libraries? (Use version 2 -> link against foo.so.2 that...
In Linux, the typical versioning scheme for shared libraries involves creating symlinks to manage different versions of the libraries while allowing applications to link against stable interfaces. Here’s a general overview of how you can apply this versioning scheme for your shared libraries: ### Shared Library Versio...
15,067
[ { "from": "human", "value": "My build process consists of Qt's qmake Makefile generator and the typical make utility bundled with linux.\nMy application consists of a few shared libraries and the main application is linked against them.\nHow can I apply the typical linux versioning scheme on my libraries? (...
Using toad and an oracle database, how can I call a sp and see the results by passing an array to one of the parameters of the sp?
To call a stored procedure (SP) in Oracle that takes an array (also known as a collection) as one of its parameters using Toad, you need to follow these steps: ### Step 1: Define the Array Type First, make sure that the array type is defined in your Oracle database. This typically involves creating a SQL type that can...
13,298
[ { "from": "human", "value": "Using toad and an oracle database, how can I call a sp and see the results by passing an array to one of the parameters of the sp?\n" }, { "from": "gpt", "value": "To call a stored procedure (SP) in Oracle that takes an array (also known as a collection) as one of it...
I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc. What are some of the differences amongst those mentioned (and any I neglected). Strengths? Weaknesses? Better fit (like StructureMap is...
When it comes to Inversion of Control (IoC) containers in .NET, each has its own strengths and weaknesses, and the choice often depends on the specific requirements of your project. Here’s an overview of the containers you mentioned, along with some others that are popular, including their strengths and weaknesses. ##...
10,808
[ { "from": "human", "value": "I'd like to get a feel for what people are using for IoC containers. I've read some good things about Castle Windsor, but I know a lot of people use StructureMap, Unity, Ninject, etc. \nWhat are some of the differences amongst those mentioned (and any I neglected). Strengths? We...
With the recent announcement of .NET 4.0 and Visual Studio 2010, it is becoming ever more difficult to keep track of what .NET Framework versions build on what version of the CLR and belong with which version(s) of Visual Studio. Is there a definitive table that shows these relationships?
Yes, keeping track of the .NET Framework versions, CLR versions, and their corresponding Visual Studio versions can indeed be confusing. Below is a table that outlines the relationships between .NET Framework versions, their associated Common Language Runtime (CLR) versions, and the corresponding Visual Studio versions...
20,814
[ { "from": "human", "value": "With the recent announcement of .NET 4.0 and Visual Studio 2010, it is becoming ever more difficult to keep track of what .NET Framework versions build on what version of the CLR and belong with which version(s) of Visual Studio.\nIs there a definitive table that shows these rel...
How do I replace the standard system tray clock in the taskbar? Thanks!
Replacing the standard system tray clock in the Windows taskbar can typically be done using third-party software. Here are some options you can consider: ### Option 1: Use Third-Party Applications There are several applications available that can replace or enhance the taskbar clock. Here are a few popular options: 1...
22,717
[ { "from": "human", "value": "How do I replace the standard system tray clock in the taskbar?\nThanks!\n" }, { "from": "gpt", "value": "Replacing the standard system tray clock in the Windows taskbar can typically be done using third-party software. Here are some options you can consider:\n\n### ...
I'm looking for a program that I can install on a Mac that will tell me how many bytes I download each day, and store that info in such a way that I could later view the results. Limiting by ports (80, 443, 21, 22) would be awesome as well. Does such a thing exist?
Yes, there are several tools and applications that can help you monitor your network usage on a Mac, including the ability to track data usage by port. Here are a few options: 1. **Little Snitch**: This is a popular network monitoring and firewall application for macOS. Little Snitch allows you to see incoming and out...
21,901
[ { "from": "human", "value": "I'm looking for a program that I can install on a Mac that will tell me how many bytes I download each day, and store that info in such a way that I could later view the results.\nLimiting by ports (80, 443, 21, 22) would be awesome as well.\nDoes such a thing exist?\n" }, {...
My ISP account requires that I send a username & password for outbound SMTP mail. How do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (SMTP= ) and From: (sendmail_from= ).
To send emails using PHP with SMTP authentication, you can't use the built-in `mail()` function directly because it doesn't support SMTP authentication. Instead, you can use a library like PHPMailer, which provides more flexibility and capabilities, including SMTP authentication. Here are the steps to set up PHPMailer...
17,760
[ { "from": "human", "value": "My ISP account requires that I send a username & password for outbound SMTP mail. \nHow do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (SMTP= ) and From: (sendmail_from= ).\n" }, { "from": "gpt", "value": "To...
Can anyone recommend a ready-to-use class/library compatible with C/C++/MFC/ATL that would parse iCal/vCal/Google calendar files (with recurrences)? It can be free or commercial.
There are several libraries that can help you parse iCal, vCal, and Google Calendar files in C/C++/MFC/ATL. Here are some recommendations: 1. **libical**: - **Description**: A widely-used open-source library for parsing and manipulating iCalendar data (RFC 5545). - **Language**: C - **Link**: [libical](https:...
19,155
[ { "from": "human", "value": "Can anyone recommend a ready-to-use class/library compatible with C/C++/MFC/ATL that would parse iCal/vCal/Google calendar files (with recurrences)? It can be free or commercial.\n" }, { "from": "gpt", "value": "There are several libraries that can help you parse iCa...
In C#, how do I get the name of the drive that the Operating System is installed on?
In C#, you can get the name of the drive that the operating system is installed on by using the `Environment` class in combination with the `System.IO` namespace. The `Environment.SystemDirectory` property provides the path to the system directory, and from that path, you can extract the drive letter. Here’s a simple w...
24,006
[ { "from": "human", "value": "In C#, how do I get the name of the drive that the Operating System is installed on?\n" }, { "from": "gpt", "value": "In C#, you can get the name of the drive that the operating system is installed on by using the `Environment` class in combination with the `System.I...
How can I fetch data in a Winforms application or ASP.NET form from a SAP database? The .NET framework used is 2.0. , language is C# and SAP version is 7.10.
To fetch data from a SAP database in a WinForms application or ASP.NET form using .NET Framework 2.0 and C#, you can utilize the SAP .NET Connector (NCo). This connector allows .NET applications to communicate with SAP systems. Here’s a step-by-step guide to help you set up your project to connect to a SAP database: ...
12,417
[ { "from": "human", "value": "How can I fetch data in a Winforms application or ASP.NET form from a SAP database? The .NET framework used is 2.0. , language is C# and SAP version is 7.10. \n" }, { "from": "gpt", "value": "To fetch data from a SAP database in a WinForms application or ASP.NET form...
How do you find out the length/size of the data in an ntext column in SQL? - It's longer than 8000 bytes so I can't cast it to a varchar. Thanks.
To find out the length of data stored in an `ntext` column in SQL Server, you can use the `DATALENGTH` function. However, because `ntext` data types can hold large amounts of data (more than 8000 bytes), you should retrieve the data using `CAST` or `CONVERT` to a suitable type, such as `nvarchar(max)`, which can handle...
23,848
[ { "from": "human", "value": "How do you find out the length/size of the data in an ntext column in SQL? - It's longer than 8000 bytes so I can't cast it to a varchar. Thanks.\n" }, { "from": "gpt", "value": "To find out the length of data stored in an `ntext` column in SQL Server, you can use th...
I'm working with my ASP.NET development team to try and create "better" (i.e. cleaner) HTML when rendering pages. At the moment, .NET has a nasty tendency to do things like dump JavaScript into the page, making it a mandatory requirement on form controls and not allowing forms to work when JS isn't available. In some...
Using ASP.NET MVC can indeed provide you with more control over the HTML output and help you achieve a cleaner separation of concerns compared to traditional ASP.NET Web Forms. Here's a breakdown of the benefits and recommendations to help you and your development team create cleaner HTML while using ASP.NET MVC: ### ...
17,727
[ { "from": "human", "value": "I'm working with my ASP.NET development team to try and create \"better\" (i.e. cleaner) HTML when rendering pages. At the moment, .NET has a nasty tendency to do things like dump JavaScript into the page, making it a mandatory requirement on form controls and not allowing form...
How would I be able to get N results for several groups in an oracle query. For example, given the following table: |--------+------------+------------| | emp_id | name | occupation | |--------+------------+------------| | 1 | John Smith | Accountant | | 2 | Jane Doe | Engineer | | 3 | Jack Bla...
Yes, you can achieve this in Oracle SQL without using a subquery by utilizing the `ROW_NUMBER()` analytic function along with a Common Table Expression (CTE). However, if you strictly want to avoid using subqueries, you can still manage it with a CTE since it is part of the same SQL execution context. Here’s how you c...
21,044
[ { "from": "human", "value": "How would I be able to get N results for several groups in\nan oracle query.\nFor example, given the following table:\n|--------+------------+------------|\n| emp_id | name | occupation |\n|--------+------------+------------|\n| 1 | John Smith | Accountant |\n| 2...
I have a pdf file.I need to find all the hyperlinks available in that file and then make change on those links. I am using C# and I'd rather not to use a third party tool!
To extract and modify hyperlinks from a PDF file in C# without using a third-party library, you can use the built-in capabilities of the .NET Framework. However, manipulating PDF files is quite complex since PDF is a binary format. While it’s quite difficult to read and write PDF files directly with just the .NET Fram...
20,368
[ { "from": "human", "value": "I have a pdf file.I need to find all the hyperlinks available in that file and then make change on those links. I am using C# and I'd rather not to use a third party tool!\n" }, { "from": "gpt", "value": "To extract and modify hyperlinks from a PDF file in C# without...
I am looking for a framework to turn given Java class into WebService (may be with some limitations on method parameters etc) Thanks
There are several frameworks and libraries in Java that can help you turn a Java class into a web service. The choice of framework often depends on whether you want to create a RESTful or SOAP-based web service. Below are some of the most popular frameworks for both approaches: ### 1. **JAX-WS (Java API for XML Web Se...
16,803
[ { "from": "human", "value": "I am looking for a framework to turn given Java class into WebService (may be with some limitations on method parameters etc)\nThanks\n" }, { "from": "gpt", "value": "There are several frameworks and libraries in Java that can help you turn a Java class into a web se...
What is the rationale behind throwing an exeption in JPA, when something can't be found? Added: This behaviour was seen in EJB2, and has as far been removed from EJB3 - but... It remains when calling Query#getSingleResult() which throws a NoResultException. Normally I would not expect it to be an exception that somethi...
The behavior of throwing an exception in JPA when a query does not return a result, particularly with `Query#getSingleResult()`, is an interesting design choice that reflects several underlying principles and considerations in JPA's design philosophy. ### Rationale for Throwing Exceptions: 1. **Clear Intent**: By thr...
19,446
[ { "from": "human", "value": "What is the rationale behind throwing an exeption in JPA, when something can't be found?\nAdded:\nThis behaviour was seen in EJB2, and has as far been removed from EJB3 - but... It remains when calling Query#getSingleResult() which throws a NoResultException.\nNormally I would n...
What are some best practices to orchestrate the interaction between complex components that are in your View? I'm not talking about simple widgets like a combo box or a grid control but components that are made up of multiple widgets and that may deserve being unit tested on their own. Would you: Define abstract inter...
When orchestrating interactions between complex components in a view, the goal is to maintain a clean architecture that promotes decoupling, testability, and maintainability. Here are some best practices and strategies you might consider: ### 1. **Use an Event Aggregator or Mediator Pattern** Rather than having compon...
17,304
[ { "from": "human", "value": "What are some best practices to orchestrate the interaction between complex components that are in your View?\nI'm not talking about simple widgets like a combo box or a grid control but components that are made up of multiple widgets and that may deserve being unit tested on th...
I am interested in what methods of logging is frequent in an Oracle database. Our method is the following: We create a log table for the table to be logged. The log table contains all the columns of the original table plus some special fields including timestamp, modification type (insert, update, delete), modifier's i...
Your approach to logging changes in an Oracle database is a common practice known as Change Data Capture (CDC). However, as you've pointed out, it does come with some limitations, and there are alternative methods you can consider. Here are some other possibilities for logging and auditing data in an Oracle database: ...
19,228
[ { "from": "human", "value": "I am interested in what methods of logging is frequent in an Oracle database.\nOur method is the following:\nWe create a log table for the table to be logged. The log table contains all the columns of the original table plus some special fields including timestamp, modification ...
Within a stored procedure, another stored procedure is being called within a cursor. For every call, the SQL Management Studio results window is showing a result. The cursor loops over 100 times and at that point the results window gives up with an error. Is there a way I can stop the stored procedure within the cursor...
Yes, you can suppress the output of a stored procedure within a cursor by using one of the following methods: 1. **Use a Temporary Table**: Instead of directly executing the procedure that outputs results, you can redirect the output to a temporary table and ignore the results. Here’s how you could modify your cod...
20,653
[ { "from": "human", "value": "Within a stored procedure, another stored procedure is being called within a cursor. For every call, the SQL Management Studio results window is showing a result. The cursor loops over 100 times and at that point the results window gives up with an error. Is there a way I can st...
Which is generally fastest when reading/comparing row info from a DataTable? 'assume dt as datatable' 'method 1' dim i as int32 for i = 0 to dt.rows.count - 1 .... next 'method 2' dim row as datarow for each row in dt.rows .... next And if there's a difference, in what circumstances does it pay to use one ove...
When reading or comparing row information from a `DataTable`, both methods you've described have their own characteristics, but generally speaking: ### Method 1: Using Indexes ```vb.net Dim i As Int32 For i = 0 To dt.Rows.Count - 1 ' Access rows using index Dim row As DataRow = dt.Rows(i) ' ... Next ``` #...
20,426
[ { "from": "human", "value": "Which is generally fastest when reading/comparing row info from a DataTable?\n'assume dt as datatable'\n\n'method 1'\ndim i as int32\nfor i = 0 to dt.rows.count - 1\n ....\nnext\n\n'method 2'\ndim row as datarow\nfor each row in dt.rows\n ....\nnext\n\nAnd if there's a diff...
I have a 2 dimensional array, like so: char[,] str = new char[2,50]; Now, after I've stored contents in both str[0] and str[1], how do I store it in a string[] s = new string[2]; ? I tried s[0] = str[0].ToString(); but that seems to be an error: VC# expects 'two' indices within the braces, which means I can conver...
In C#, the `char[,]` is a two-dimensional array, and you cannot directly convert it to a string using `ToString()` as you discovered. The `ToString()` method will only work on single characters, and there’s no direct method to convert an entire row of a two-dimensional character array to a string. To achieve your goa...
18,137
[ { "from": "human", "value": "I have a 2 dimensional array, like so:\nchar[,] str = new char[2,50];\n\nNow, after I've stored contents in both str[0] and str[1], how do I store it in a \nstring[] s = new string[2];\n\n?\nI tried \ns[0] = str[0].ToString();\n\nbut that seems to be an error: VC# expects 'two' ...
I used to work with Subversion and a system tray tool (SVN Notifier) to monitor the repository so I would immediately see when my local copy was not up-to-date anymore, and I am wondering if some equivalent was available for Perforce (on Windows).
For Perforce, there are several tools and options that you can consider for monitoring changes in your repository similar to how SVN Notifier worked with Subversion. 1. **P4V (Perforce Visual Client)**: P4V has a built-in functionality to monitor the depot for changes. You can use the "Pending" tab to see changes that...
23,380
[ { "from": "human", "value": "I used to work with Subversion and a system tray tool (SVN Notifier) to monitor the repository so I would immediately see when my local copy was not up-to-date anymore, and I am wondering if some equivalent was available for Perforce (on Windows).\n" }, { "from": "gpt",...
I'm considering rolling my own, but just in case there's a good piece of software already available, I'm asking here: Is there something that will provide an interface to webserver redirect configuration, and allow redirects to be managed by a fairly non-technical userbase. The following requirements must be fulfilled:...
Creating a custom solution for managing web server redirects can be a complex task, but there are some existing open-source tools that might meet your requirements. Below are a few options that you can consider: ### 1. **Redirector** - **Description**: Redirector is a simple web application that allows users to manage...
20,259
[ { "from": "human", "value": "I'm considering rolling my own, but just in case there's a good piece of software already available, I'm asking here: Is there something that will provide an interface to webserver redirect configuration, and allow redirects to be managed by a fairly non-technical userbase. The ...
I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects. Do I need to worry about the String Constant Pool for memory and performance? Is there any way to see how big the pool is at any point?
In Java, the String Constant Pool is an area of memory where the Java Virtual Machine (JVM) stores string literals. Strings in the pool are shared, meaning that if you create multiple identical string literals, they will refer to the same instance in the pool, which can help reduce memory usage. ### Do You Need to Wor...
17,765
[ { "from": "human", "value": "I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects.\nDo I need to worry about the String Constant Pool for memory and performance?\nIs there any way to see how big the pool is at any point?\n" }, { "from"...
I would like to send HTML email with graphic elements included. I have no idea to attach garaphics to this email.
Sending HTML emails with graphic elements included can be accomplished in several ways. Here’s a basic guide on how to do it, whether you're using a programming language, email marketing service, or a regular email client. ### 1. Using Inline Images in HTML Emails If you want to include images directly in your HTML e...
13,223
[ { "from": "human", "value": "I would like to send HTML email with graphic elements included. I have no idea to attach garaphics to this email.\n" }, { "from": "gpt", "value": "Sending HTML emails with graphic elements included can be accomplished in several ways. Here’s a basic guide on how to d...
What is Dynamic Code Analysis? How is it different from Static Code Analysis (ie, what can it catch that can't be caught in static)? I've heard of bounds checking and memory analysis - what are these? What other things are checked using dynamic analysis? -Adam
Dynamic code analysis and static code analysis are two important techniques used in software development for identifying vulnerabilities and improving code quality. ### Dynamic Code Analysis Dynamic code analysis involves executing a program with the aim of identifying errors, vulnerabilities, and performance issues...
17,024
[ { "from": "human", "value": "What is Dynamic Code Analysis?\nHow is it different from Static Code Analysis (ie, what can it catch that can't be caught in static)?\nI've heard of bounds checking and memory analysis - what are these?\nWhat other things are checked using dynamic analysis?\n-Adam\n" }, { ...
I'm currently primarily a D programmer and am looking to add another language to my toolbox, preferably one that supports the metaprogramming hacks that just can't be done in a statically compiled language like D. I've read up on Lisp a little and I would love to find a language that allows some of the cool stuff that ...
Based on your requirements, both Ruby and Python could be good candidates, but each has strengths and weaknesses in relation to your specific criteria. Here's a comparison to help you choose: ### Ruby 1. **Good Metaprogramming**: Ruby is renowned for its metaprogramming capabilities. You can create and modify classes...
12,503
[ { "from": "human", "value": "I'm currently primarily a D programmer and am looking to add another language to my toolbox, preferably one that supports the metaprogramming hacks that just can't be done in a statically compiled language like D.\nI've read up on Lisp a little and I would love to find a languag...
We have a fairly large code base, 400K LOC of C++, and code duplication is something of a problem. Are there any tools which can effectively detect duplicated blocks of code? Ideally this would be something that developers could use during development rather than just run occasionally to see where the problems are. It ...
Code duplication is indeed a significant concern in large code bases, and there are several tools available that can help you detect duplicated blocks of code in C++. Below are some options, both free and commercial, that can integrate well into your development process and work with Continuous Integration (CI) systems...
22,571
[ { "from": "human", "value": "We have a fairly large code base, 400K LOC of C++, and code duplication is something of a problem. Are there any tools which can effectively detect duplicated blocks of code?\nIdeally this would be something that developers could use during development rather than just run occas...
Is there anyway to determine if a ResourceManager contains a named resource? Currently I am catching the MissingManifestResourceException but I hate having to use Exceptions for non-exceptional situations. There must be some way to enumerate the name value pairs of a ResourceManager through reflection, or something? E...
In .NET, the `ResourceManager` class does not provide a direct method to check if a specific resource exists without throwing an exception if the resource does not exist. However, there are a couple of approaches you can consider to avoid catching exceptions for non-exceptional flow: ### 1. Using `GetResourceSet` and ...
21,203
[ { "from": "human", "value": "Is there anyway to determine if a ResourceManager contains a named resource? Currently I am catching the MissingManifestResourceException but I hate having to use Exceptions for non-exceptional situations. There must be some way to enumerate the name value pairs of a ResourceMa...
I'm using Console.WriteLine() from a very simple WPF test application, but when I execute the application from the command line, I'm seeing nothing being written to the console. Does anyone know what might be going on here? I can reproduce it by creating a WPF application in VS 2008, and simply adding Console.WriteLine...
You are correct that `Console.WriteLine()` is primarily used for console applications. In a WPF application, the output of `Console.WriteLine()` goes to the console window, which does not exist when you're running a WPF application unless you specifically create a console window for it. If you want to write output for...
19,550
[ { "from": "human", "value": "I'm using Console.WriteLine() from a very simple WPF test application, but when I execute the application from the command line, I'm seeing nothing being written to the console. Does anyone know what might be going on here?\nI can reproduce it by creating a WPF application in VS...
Emacs edits my .emacs file whenever I use the customization facility, or when I type a command that is disabled by default. Any automatic editing of my configuration makes me nervous. How can I stop Emacs from ever editing my .emacs. file?
You can prevent Emacs from automatically editing your `.emacs` file (or `init.el` if that's what you are using) by setting a few variables in your configuration. Here are some steps to achieve this: 1. **Disable Custom File Handling**: Emacs uses the `custom-set-variables` and `custom-set-faces` functions to save user...
22,042
[ { "from": "human", "value": "Emacs edits my .emacs file whenever I use the customization facility, or when I type a command that is disabled by default. Any automatic editing of my configuration makes me nervous. How can I stop Emacs from ever editing my .emacs. file?\n" }, { "from": "gpt", "v...
Is it possible to make hibernate do "the right thing" for some value of "right" in this situation? from ClassA a, ClassB b where a.prop = b.prop The thing is that prop is a UserType with different representation in the joined tables. In table A it is represented as an integer and in table B it is represented as a char...
In Hibernate, when you encounter a scenario where you need to compare fields that are represented in different ways in the database (like an integer in one table and a char in another), you can handle this by either using a custom SQL query or by leveraging a `UserType` to manage the different representations. ### Opt...
16,351
[ { "from": "human", "value": "Is it possible to make hibernate do \"the right thing\" for some value of \"right\" in this situation?\nfrom ClassA a, ClassB b\nwhere a.prop = b.prop\n\nThe thing is that prop is a UserType with different representation in the joined tables. In table A it is represented as an i...
So which is better. Do we start letting Tests design our code. Do we start introducing constructor injection for dependencies just to make code testable? or do we use the "override" protected method & sub class the class under test.
The question of how to structure code for testability often leads to different opinions and approaches. Both constructor injection and using protected methods with subclassing can be valid strategies, but they serve different purposes and come with their own sets of pros and cons. Here’s a breakdown of both approaches:...
20,862
[ { "from": "human", "value": "So which is better. \nDo we start letting Tests design our code. Do we start introducing constructor injection for dependencies just to make code testable? or do we use the \"override\" protected method & sub class the class under test.\n" }, { "from": "gpt", "value"...
I'm trying to create a user control that allows users to make something like the following: <uc1:MyControl id="controlThing" runat="server"> <uc1:BoundColumn id="column1" Column="Name" runat="server" /> <uc1:CheckBoxBoundColumn id="column2" Column="Selector" runat="server" /> <uc1:BoundColumn id="column3...
Creating a custom user control in ASP.NET that accepts specific child controls can be achieved by leveraging the `ControlCollection` and a combination of `ParseChildren` and `PersistChildren` attributes. Below, I'll guide you through the process step-by-step. ### Step 1: Create Your Custom User Control 1. **Create th...
18,041
[ { "from": "human", "value": "I'm trying to create a user control that allows users to make something like the following:\n <uc1:MyControl id=\"controlThing\" runat=\"server\">\n\n <uc1:BoundColumn id=\"column1\" Column=\"Name\" runat=\"server\" />\n <uc1:CheckBoxBoundColumn id=\"column2\" Column=\"Se...
Is there an Open Source Free Graph Control for Windows Forms .NET 2.0?
Yes, there are several open-source graph controls available for Windows Forms that you can use with .NET 2.0. Here are a couple of options you might consider: 1. **ZedGraph**: - ZedGraph is a popular open-source charting library for .NET that allows you to create various types of graphs and charts. It is compatible...
21,720
[ { "from": "human", "value": "Is there an Open Source Free Graph Control for Windows Forms .NET 2.0?\n" }, { "from": "gpt", "value": "Yes, there are several open-source graph controls available for Windows Forms that you can use with .NET 2.0. Here are a couple of options you might consider:\n\n1...
I'm implementing a class that wraps around an xml document with a very strictly defined schema. I don't control the schema. One of the properties in the class is for an element value that the schema indicates must match a certain regular expression. In the setter for the property, if a string doesn't match the expr...
To effectively communicate the requirements for a property in your class that wraps around an XML document with a strict schema, you have several options. Here are some recommendations: ### 1. XML Comments You can use XML documentation comments to document the property and its requirements. This approach provides clea...
18,758
[ { "from": "human", "value": "I'm implementing a class that wraps around an xml document with a very strictly defined schema. I don't control the schema. \nOne of the properties in the class is for an element value that the schema indicates must match a certain regular expression. In the setter for the pr...
I'm trying to host a PHP web site that was given to me. I see this warning: Warning: Unknown: Your script possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is ...
The warning you are encountering is related to the way PHP handles session variables and the use of `register_globals`. Here’s a breakdown of the warning and how you might resolve it. ### Understanding the Warning 1. **Session Variables**: In PHP, sessions allow you to store data across different pages. Normally, you...
20,879
[ { "from": "human", "value": "I'm trying to host a PHP web site that was given to me. I see this warning:\n\nWarning: Unknown: Your script possibly\n relies on a session side-effect which\n existed until PHP 4.2.3. Please be\n advised that the session extension\n does not consider global variables as\n ...
I have a problem with stopping a service and starting it again and want to be notified when the process runs and let me know what the result is. Here's the scenario, I have a text file output of an "sc" command. I want to send that file but not as an attachment. Also, I want to see the initial status quickly in the ...
To achieve the goal of sending an email with the specific subject and body using the contents of your `servstop.txt` file, you can utilize the `blat` command line tool to send the email. Below is a basic outline of how you can implement this, including reading the file and formatting the email. ### Steps to Implement:...
21,151
[ { "from": "human", "value": "I have a problem with stopping a service and starting it again and want to be notified when the process runs and let me know what the result is. \nHere's the scenario,\nI have a text file output of an \"sc\" command. I want to send that file but not as an attachment. Also, I w...
I'm trying to learn C++ so forgive me if this question demonstrates a lack of basic knowledge, you see, the fact is, I have a lack of basic knowledge. I want some help working out how to create an iterator for a class I have created. I have a class 'Shape' which has a container of Points. I have a class 'Piece' which ...
Creating an iterator for your `Piece` class that wraps around the `Points` in a `Shape` while applying an offset from the `Piece`'s position is a great way to get familiar with iterators in C++. Below are the steps and an example implementation to help you set this up. ### Step-by-Step Implementation 1. **Define Your...
16,565
[ { "from": "human", "value": "I'm trying to learn C++ so forgive me if this question demonstrates a lack of basic knowledge, you see, the fact is, I have a lack of basic knowledge.\nI want some help working out how to create an iterator for a class I have created.\nI have a class 'Shape' which has a containe...
How can I perform list comprehensions in C#?
In C#, you can achieve similar functionality to Python's list comprehensions using LINQ (Language Integrated Query). LINQ provides a concise way to manipulate collections, and you can filter, project, and perform operations on collections using its query syntax or method syntax. ### Using LINQ Query Syntax You can us...
15,427
[ { "from": "human", "value": "How can I perform list comprehensions in C#?\n" }, { "from": "gpt", "value": "In C#, you can achieve similar functionality to Python's list comprehensions using LINQ (Language Integrated Query). LINQ provides a concise way to manipulate collections, and you can filte...
I try to read a binary field in database ( Project Server 2007; dbo.MSP_CALENDAR ). MS don't implemante any fonction into PSI. Everybody have a suggestion? Thanks in advance SPo In Database Piblished, in table dbo.MSP_CALENDAR, i found a field named CAL_DATA, this field is BINARY. I try to CAST or CONVERT this fiel...
Reading binary data from the `CAL_DATA` field in the `dbo.MSP_CALENDAR` table of Project Server 2007 can be challenging, as it is indeed designed to store the personal calendar data in a binary format, and Microsoft hasn't provided any built-in way to interpret this data outside of Microsoft Project. Here are a few ap...
21,723
[ { "from": "human", "value": "I try to read a binary field in database ( Project Server 2007; dbo.MSP_CALENDAR ). MS don't implemante any fonction into PSI. \nEverybody have a suggestion?\nThanks in advance\nSPo\nIn Database Piblished, in table dbo.MSP_CALENDAR, i found a field named CAL_DATA, this field i...
What is the % code-coverage on your project? I'm curious as to reasons why. Is the dev team happy with it? If not, what stands in the way from increasing it? Stuart Halloway is one whose projects aim for 100% (or else the build breaks!). Is anyone at that level? We are at a painful 25% but aspire to 80-90% for new co...
Code coverage is a crucial metric in software development, as it gives an indication of how much of your codebase is tested by automated tests. A percentage of 25% can be quite low, particularly if you are aiming for a target of 80-90% for new code. Here are some insights regarding code coverage, challenges faced, and ...
18,578
[ { "from": "human", "value": "What is the % code-coverage on your project? I'm curious as to reasons why.\nIs the dev team happy with it? If not, what stands in the way from increasing it? \nStuart Halloway is one whose projects aim for 100% (or else the build breaks!). Is anyone at that level?\nWe are at a...
I'm using spring 2.5 and annotations to configure my spring-mvc web context. Unfortunately, I am unable to get the following to work. I'm not sure if this is a bug (seems like it) or if there is a basic misunderstanding on how the annotations and interface implementation subclassing works. For example, @Controller @R...
The behavior you're experiencing with the Spring MVC framework in your application is indeed a bit counterintuitive, but it is not a bug. The issue arises from how Spring MVC identifies handler methods and the underlying assumptions it makes based on class inheritance and interface implementations. ### Understanding t...
19,807
[ { "from": "human", "value": "I'm using spring 2.5 and annotations to configure my spring-mvc web context. Unfortunately, I am unable to get the following to work. I'm not sure if this is a bug (seems like it) or if there is a basic misunderstanding on how the annotations and interface implementation subcl...
I've recently began using dTrace and have noticed just how awesome it is. Its the perfect tool for profiling without placing the burden on programmers to set up hundreds of probes in their applications. I've found some nice one liner and sample scripts here and there, but I was wondering about what scripts, tools and l...
dtrace is indeed a powerful tool for performance analysis and troubleshooting in dynamic systems. It's great that you're exploring its capabilities! Here are some helpful scripts, tools, and resources that you might find useful: ### Useful dTrace Scripts 1. **Basic System Call Monitoring**: ```bash dtrace -n 'sy...
22,458
[ { "from": "human", "value": "I've recently began using dTrace and have noticed just how awesome it is. Its the perfect tool for profiling without placing the burden on programmers to set up hundreds of probes in their applications.\nI've found some nice one liner and sample scripts here and there, but I was...
Assume I have a function template like this: template<class T> inline void doStuff(T* arr) { // stuff that needs to use sizeof(T) } Then in another .h filee I have a template class Foo that has: public: operator T*() const; Now, I realize that those are different Ts. But If I have a variable Foo<Bar> f on the stack...
In C++, the function template's argument must match exactly with the expected type unless there is an implicit conversion available. In your case, the function `doStuff` expects a pointer type `T*`, but you are passing an instance of `Foo<Bar>`, which does not match that type directly. While `Foo<Bar>` has an implicit ...
22,528
[ { "from": "human", "value": "Assume I have a function template like this:\ntemplate<class T>\ninline\nvoid\ndoStuff(T* arr)\n{\n // stuff that needs to use sizeof(T)\n}\n\nThen in another .h filee I have a template class Foo that has:\npublic: operator T*() const;\n\nNow, I realize that those are different...