instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
How can i set value(in code behind) for an element declared in the xslt ? Here is my xslt <xsl:for-each select="Header/Item"> <td class="rowHead" style="vertical-align:bottom;"> <a href="#"> <xsl:attribute name="id"> <xsl:text>aColumnText</xsl:text> <xsl:value-of sel...
To set the value of the `hiddenColumnValue` input element in the code-behind of an ASP.NET web application, you need to ensure that the input element has a unique identifier so that you can easily access it in the server-side code. The XSLT you've provided generates HTML markup for a series of table cells, each contai...
32,754
[ { "from": "human", "value": "How can i set value(in code behind) for an element declared in the xslt ?\nHere is my xslt\n <xsl:for-each select=\"Header/Item\">\n <td class=\"rowHead\" style=\"vertical-align:bottom;\">\n <a href=\"#\">\n <xsl:attribute name=\"id\">\n <xsl:...
This is a C# console application. I have a function that does something like this: static void foo() { Application powerpointApp; Presentation presentation = null; powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); } That's all it does. When it is called there is a fiftee...
The delay you're experiencing is likely due to the loading of the Microsoft Office Interop assemblies, which can be time-consuming on the first use because they are being loaded from disk and initialized. Here are several strategies you can use to reduce or eliminate the delay when calling your function `foo`: ### 1. ...
34,411
[ { "from": "human", "value": "This is a C# console application. I have a function that does something like this:\nstatic void foo()\n{\n Application powerpointApp;\n Presentation presentation = null;\n\n powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();\n}\n\nThat'...
I'm curious as to the best route (more looking towards simplicity, not speed or efficiency) to sort a DropDownList in C#/ASP.NET - I've looked at a few recommendations but they aren't clicking well with me. Edit: Folks, I do not have control over how the data comes into the DropDownList - I cannot modify the SQL.
To sort the items in a `DropDownList` in C#/ASP.NET in a simple way, you can take the following approach: 1. **Retrieve the Data**: Get the data that you bind to the `DropDownList`. 2. **Sort the Data**: Use LINQ or a simple sorting method to sort the items in memory. 3. **Bind the Sorted Data**: Bind the sorted data ...
35,470
[ { "from": "human", "value": "I'm curious as to the best route (more looking towards simplicity, not speed or efficiency) to sort a DropDownList in C#/ASP.NET - I've looked at a few recommendations but they aren't clicking well with me.\nEdit: Folks, I do not have control over how the data comes into the D...
Is it correct to assume that JQuery is not actually an implementation of ECMA spec but rather some kind of framework? If that is true, what run time does it use? For example in IE, does it finally end up with the javascript engine in IE? thanks Sesh
Yes, you are correct in your understanding. jQuery is not an implementation of the ECMAScript specification; rather, it is a JavaScript library or framework that simplifies HTML document traversal, event handling, and animation, among other tasks. It provides a convenient API for developers to work with the DOM (Docume...
37,957
[ { "from": "human", "value": "Is it correct to assume that JQuery is not actually an implementation of ECMA spec but rather some kind of framework? \nIf that is true, what run time does it use? For example in IE, does it finally end up with the javascript engine in IE? \nthanks\nSesh\n" }, { "from": ...
I am connecting to a MySQL DB trough a terminal who only have a program with an ODBC connection to a MySQL DB. I can put querys in the program, but not access MySQL directly. I there a way to query the DB to obtain the list of fields in a table other than select * from table ?? (don't know why but the select returns a...
Yes, you can retrieve the list of fields (columns) in a MySQL table using the `INFORMATION_SCHEMA` database, which is a metadata repository in MySQL. You can execute a query against this schema to get the information about the columns in a specific table. Here's how you can do it: ### Query to Get Column Names You ca...
35,696
[ { "from": "human", "value": "I am connecting to a MySQL DB trough a terminal who only have a program with an ODBC connection to a MySQL DB. I can put querys in the program, but not access MySQL directly.\nI there a way to query the DB to obtain the list of fields in a table other than\nselect * from table\n...
Is there a way to determine if the screen has been shut off via the top Power button? I just need to know if the screen has been somehow set to off to kill a loop that updates location. Thanks
Yes, you can determine if the screen has been turned off via the Power button on an Android device by using a combination of broadcast receivers and lifecycle methods in your application. To achieve this, you can listen for changes in the device's screen state. Specifically, you can register a `BroadcastReceiver` to l...
33,777
[ { "from": "human", "value": "Is there a way to determine if the screen has been shut off via the top Power button?\nI just need to know if the screen has been somehow set to off to kill a loop that updates location.\nThanks\n" }, { "from": "gpt", "value": "Yes, you can determine if the screen ha...
I am trying to develop a plug-in for QtWebkit. But I am not able to find how to develop a plugin for QtWebKit, hopefully one that can be invoked by JavaScript. Does anyone know of any tutorials or documents that explain how to do this? Webkit has been intregated into Qt and this integrated package is called QtWebkit. ...
Developing a plugin for QtWebKit that can be invoked by JavaScript involves several steps. Below is a general outline of the process, along with links to relevant documentation that might help you along the way. ### Steps to Create a QtWebKit Plugin 1. **Set Up Your Development Environment**: Make sure you have th...
34,840
[ { "from": "human", "value": "I am trying to develop a plug-in for QtWebkit. But I am not able to find how to develop a plugin for QtWebKit, hopefully one that can be invoked by JavaScript. Does anyone know of any tutorials or documents that explain how to do this?\nWebkit has been intregated into Qt and th...
Traditional logfile analytics tools (awstats, statcounter) or general web analytics (google analytics, yahoo web analytics) are not suitable for analyzing traffic on servlets. Is there a good alternative to log messages using a logging framework (log4j for example) and to write a custom analytics software for these?
When analyzing traffic on servlets, traditional log file analytics tools may not always provide the depth or flexibility required for detailed insights, particularly because web analytics tools are often designed for static sites or don't capture servlet-specific interactions effectively. If you're considering using a ...
32,454
[ { "from": "human", "value": "Traditional logfile analytics tools (awstats, statcounter) or general web analytics (google analytics, yahoo web analytics) are not suitable for analyzing traffic on servlets. Is there a good alternative to log messages using a logging framework (log4j for example) and to write ...
I'm trying to figure out the best way to store user uploaded files in a file system. The files range from personal files to wiki files. Of course, the DB will point to those files by someway which I have yet to figure out. Basic Requirements: Fairy Decent Security so People Can't Guess Filenames (Picture001.jpg, P...
When designing a file storage system for user-uploaded files, it's important to consider factors like security, backup efficiency, scalability, and ease of access. Here are some best practices to help you achieve your requirements: ### File Naming and Storage 1. **Unique Identifiers for Filenames**: - Instead of u...
34,325
[ { "from": "human", "value": "I'm trying to figure out the best way to store user uploaded files in a file system. The files range from personal files to wiki files. Of course, the DB will point to those files by someway which I have yet to figure out. \nBasic Requirements:\n\nFairy Decent Security so Peo...
I have a list of cities, states/provinces, and countries and I need to find their respective timezones easily. Specifically, I need to know which Windows TimeZone they map to. So far this has been a difficult process, because there's no easy way to pass a city to something and get a timezone back (a timezone being an ...
You’re right that determining timezones from city names can be challenging. However, there are several resources and libraries that can simplify the process of mapping cities to their respective Windows TimeZone IDs. Here are some options you can explore: 1. **GeoNames**: The GeoNames database offers a large set of ge...
30,456
[ { "from": "human", "value": "I have a list of cities, states/provinces, and countries and I need to find their respective timezones easily. Specifically, I need to know which Windows TimeZone they map to. So far this has been a difficult process, because there's no easy way to pass a city to something and ...
I am not a mathematician. I enjoy a good math puzzle, but I admit my weaknesses whole heartedly. That said, I've always had an interest in Neural Networks, and while I understand them enough to implement them from scratch, I hit a wall when I need to understand any concept that I can only find mathematic proofs for. Wh...
It's great to hear that you have an interest in neural networks! There are several resources that explain concepts in neural networks using code and practical examples rather than heavy mathematical proofs. Here are some recommendations that focus more on practical implementations and less on mathematical formalism: 1...
35,620
[ { "from": "human", "value": "I am not a mathematician. I enjoy a good math puzzle, but I admit my weaknesses whole heartedly. That said, I've always had an interest in Neural Networks, and while I understand them enough to implement them from scratch, I hit a wall when I need to understand any concept that ...
I am curious as to why an implicit cast fails in... int? someValue = SomeCondition ? ResultOfSomeCalc() : null; and why I have to perform an explicit cast instead int? someValue = SomeCondition ? ResultofSomeCalc() : (int?)null; It seems to me that the compiler has all the information it need to make an implicit cast...
The issue you are encountering is related to how the C# compiler infers types in conditional expressions (also known as the ternary operator `?:`). Let's break down what's happening in your example. When you write: ```csharp int? someValue = SomeCondition ? ResultOfSomeCalc() : null; ``` The compiler is trying to de...
34,034
[ { "from": "human", "value": "I am curious as to why an implicit cast fails in...\nint? someValue = SomeCondition ? ResultOfSomeCalc() : null;\n\nand why I have to perform an explicit cast instead\nint? someValue = SomeCondition ? ResultofSomeCalc() : (int?)null;\n\nIt seems to me that the compiler has all t...
I am building an application where most of the HTML is built using javascript. The DOM structure is built using some JSON data structures that are sent from the server, and then the client-side code builds a UI for that data. My current approach is to walk the JSON data structures, and call script.aculo.us's Builder...
It sounds like you are seeking a more maintainable way to manage your DOM structure and separate it from the application logic, which is a common concern in front-end development. While you're currently using Prototype.js and Script.aculo.us, there are several lightweight templating solutions and approaches you could c...
31,772
[ { "from": "human", "value": "I am building an application where most of the HTML is built using javascript. The DOM structure is built using some JSON data structures that are sent from the server, and then the client-side code builds a UI for that data. \nMy current approach is to walk the JSON data stru...
I need to write a regular expression that finds javascript files that match <anypath><slash>js<slash><anything>.js For example, it should work for both : c:\mysite\js\common.js (Windows) /var/www/mysite/js/common.js (UNIX) The problem is that the file separator in Windows is not being properly escaped : pattern = ...
To create a regular expression that works for both Windows and UNIX file paths while matching JavaScript files, you can use a regular expression that allows for both types of path separators (backslashes for Windows and forward slashes for UNIX). You can achieve this by using a character class to specify either separ...
35,981
[ { "from": "human", "value": "I need to write a regular expression that finds javascript files that match \n<anypath><slash>js<slash><anything>.js\n\nFor example, it should work for both :\n\nc:\\mysite\\js\\common.js (Windows)\n/var/www/mysite/js/common.js (UNIX)\n\nThe problem is that the file separator i...
I have a Coupon table. A Coupon can be applicable to certain items only or to a whole category of items. For example: a 5$ coupon for a Pizza 12" AND (1L Pepsi OR French fries) The best I could come up with is to make a CouponMenuItems table containing a coupon_id and bit fields such as IsOr and IsAnd. It doesn't work ...
To model a coupon system where you have complex relationships (AND/OR) between different items or categories, you can adopt a hierarchical structure. This approach allows you to represent the different logic combinations without overly complicating your database schema. Here’s how you could structure your tables: ### ...
32,700
[ { "from": "human", "value": "I have a Coupon table. A Coupon can be applicable to certain items only or to a whole category of items.\nFor example: a 5$ coupon for a Pizza 12\" AND (1L Pepsi OR French fries)\nThe best I could come up with is to make a CouponMenuItems table containing a coupon_id and bit fie...
When I launch CruiseControl.NET with a particular configuration file I receive the following error: ThoughtWorks.CruiseControl.Core.Config.ConfigurationException: Duplicate node detected What does this mean, and what causes it?
The error message you're encountering, `ThoughtWorks.CruiseControl.Core.Config.ConfigurationException: Duplicate node detected`, indicates that there is a problem in your CruiseControl.NET configuration file. Specifically, it means that within the XML configuration, there are two or more definitions for the same node (...
34,217
[ { "from": "human", "value": "When I launch CruiseControl.NET with a particular configuration file I receive the following error:\n\nThoughtWorks.CruiseControl.Core.Config.ConfigurationException: Duplicate node detected\n\nWhat does this mean, and what causes it?\n" }, { "from": "gpt", "value": "...
is there anyone who makes use of the Microsoft Open XML SDK 2.0 for editing Excel Spreadsheet, I edited Open XML documents already by only using XML methods, but as there exists the SDK, does someone know if there are really easy methods for some essential functions? For Example the inserting of content in a cell. Also...
Yes, the Microsoft Open XML SDK 2.0 is a powerful library for creating and manipulating Open XML documents, including Excel spreadsheets. It provides a more convenient and higher-level abstraction for working with Open XML files compared to directly manipulating XML. ### Inserting Content into a Cell Here's a simple ...
32,019
[ { "from": "human", "value": "is there anyone who makes use of the Microsoft Open XML SDK 2.0 for editing Excel Spreadsheet, I edited Open XML documents already by only using XML methods, but as there exists the SDK, does someone know if there are really easy methods for some essential functions? For Example...
Following on from this question here I have a custom ActiveX control which raises an event "BeforePageValidated" which has a parameter "args" which is an object which contains a boolean. The purpose of this is to allow the client to override the validation and force it fail by setting the boolean value to true. I can c...
To access the properties of the `args` object when handling the `BeforePageValidated` event of your ActiveX control in Internet Explorer, you need to follow these steps: 1. **Define the event handler**: In your script, you define a function to handle the `BeforePageValidated` event. Inside this function, you can acces...
31,848
[ { "from": "human", "value": "Following on from this question here\nI have a custom ActiveX control which raises an event \"BeforePageValidated\" which has a parameter \"args\" which is an object which contains a boolean. The purpose of this is to allow the client to override the validation and force it fail...
Which SQL statement is faster? SELECT TOP 2 c1.Price, c2.Price, ..... c49.Price, c50.Price FROM Table1 AS c1, Table2 AS c2, ..... Table49 AS c49, Table50 AS c50 WHERE c1.Date = c2.Date AND c2.Date = c3.Date ..... c49.Date = c50.Date ORDER BY c1.ID DESC OR SELECT TOP 2 c1.Price, c2.Price, ..... c49.Price, c50....
The performance of the two SQL statements you provided can depend on various factors, including the database engine being used, the structure of the tables, available indexes, and the amount of data in those tables. However, we can analyze them from a conceptual perspective. 1. **First Statement (Cartesian product app...
34,293
[ { "from": "human", "value": "Which SQL statement is faster?\nSELECT TOP 2 c1.Price, c2.Price, ..... c49.Price, c50.Price\nFROM Table1 AS c1, Table2 AS c2, ..... Table49 AS c49, Table50 AS c50\nWHERE c1.Date = c2.Date AND c2.Date = c3.Date ..... c49.Date = c50.Date\nORDER BY c1.ID DESC\n\n OR\n\nSELEC...
I'm currently in the process of writing a wizard and want to make each page validate before moving onto the next page. I want to prevent the user from progressing by calling the Validate() method on every child control on the page and and stopping navigation if any of them fail. The problem is that the Validate() metho...
In Windows Forms, the `Validate()` method is indeed a private method on control classes such as `TextBox`, so you won't be able to access it directly. However, you can use reflection to invoke this method. Below is a step-by-step guide on how to do that. ### Step 1: Create a method to validate all controls You'll wan...
34,307
[ { "from": "human", "value": "I'm currently in the process of writing a wizard and want to make each page validate before moving onto the next page.\nI want to prevent the user from progressing by calling the Validate() method on every child control on the page and and stopping navigation if any of them fail...
Any code can be reused in a way or an other, at least if you modify the code. Random code is not very reusable as such. When I read some books, they usually say that you should explicitly make the code reusable by taking into account other situations of code usage too. But certain code should not be an omnipotent all d...
Creating reusable code is a fundamental goal in software development. When you design for reusability, you're not just thinking about your current problem but also about how the code might be utilized in future contexts. Here are key principles, requirements, and best practices for developing reusable code: ### Requir...
33,731
[ { "from": "human", "value": "Any code can be reused in a way or an other, at least if you modify the code. Random code is not very reusable as such. When I read some books, they usually say that you should explicitly make the code reusable by taking into account other situations of code usage too. But certa...
I somehow got lumbered with deploying SharePoint at work. I hate it, even the simplest things seem to be unnecessarily difficult. I've seen a few resources scattered around, but they all seem to stop short of helping me really take control of the css. Can someone point me in the right direction? EDIT I'm not afraid of...
Deploying and customizing SharePoint can indeed be a challenging experience, especially when it comes to tweaking the appearance through CSS. Here are some steps and resources to help you take control of the CSS in SharePoint using SharePoint Designer 2007. ### Steps to Edit CSS in SharePoint 2007 1. **Open SharePoin...
34,405
[ { "from": "human", "value": "I somehow got lumbered with deploying SharePoint at work. I hate it, even the simplest things seem to be unnecessarily difficult.\nI've seen a few resources scattered around, but they all seem to stop short of helping me really take control of the css.\nCan someone point me in t...
I have this code: myVariable which I want to change into trace("myVariable: " + myVariable); using a direct hotkey like alt - f12 to do it. I.e not using ctrl - space and arrow buttons. is it possible in eclipse?
Yes, you can set up a custom hotkey in Eclipse to achieve the transformation you want. This involves creating a custom template or using an existing feature like "Code Templates." However, as Eclipse does not have a built-in feature specifically for the transformation you described, here's a way to set it up: ### Opti...
35,159
[ { "from": "human", "value": "I have this code:\nmyVariable\nwhich I want to change into\ntrace(\"myVariable: \" + myVariable);\nusing a direct hotkey like alt - f12 to do it. I.e not using ctrl - space and arrow buttons.\nis it possible in eclipse?\n" }, { "from": "gpt", "value": "Yes, you can s...
How does one go about establishing a CSS 'schema', or hierarchy, of general element styles, nested element styles, and classed element styles. For a rank novice like me, the amount of information in stylesheets I view is completely overwhelming. What process does one follow in creating a well factored stylesheet or s...
Establishing a CSS "schema" or hierarchy involves organizing your styles in a way that makes them easier to manage and understand. This process allows you to create scalable, reusable styles for your web project. Here’s a step-by-step guide to help you create a well-structured stylesheet: ### 1. **Understand the Basic...
16,248
[ { "from": "human", "value": "How does one go about establishing a CSS 'schema', or hierarchy, of general element styles, nested element styles, and classed element styles. For a rank novice like me, the amount of information in stylesheets I view is completely overwhelming. What process does one follow in...
I'm trying to use the Windows API to set the primary monitor. It doesn't seem to work - my screen just flicks and nothing happens. public const int DM_ORIENTATION = 0x00000001; public const int DM_PAPERSIZE = 0x00000002; public const int DM_PAPERLENGTH = 0x00000004; public const int DM_PAPERWIDTH = 0x00000008; publ...
Setting the primary monitor in Windows using the Windows API can be tricky. Your current implementation appears to have some issues. Here are some points to consider and suggestions for modifying your code: ### Key Points to Consider 1. **Ensure Correct Device ID**: When you use `EnumDisplayDevices`, you're using a h...
18,433
[ { "from": "human", "value": "I'm trying to use the Windows API to set the primary monitor. It doesn't seem to work - my screen just flicks and nothing happens.\n public const int DM_ORIENTATION = 0x00000001;\npublic const int DM_PAPERSIZE = 0x00000002;\npublic const int DM_PAPERLENGTH = 0x00000004;\npubl...
I use partial page caching with ASP.NET. I find it to be particularly helpful with large volume sites, where I need only certain sections of a page to cache. Do other web application platforms have this type of technology?
Yes, many web application platforms support partial page caching or similar caching mechanisms. Here are a few notable examples: 1. **Ruby on Rails**: - Rails provides built-in caching mechanisms, including fragment caching, which allows you to cache parts of views. You can use the `cache` method to store and retri...
35,543
[ { "from": "human", "value": "I use partial page caching with ASP.NET. I find it to be particularly helpful with large volume sites, where I need only certain sections of a page to cache.\nDo other web application platforms have this type of technology?\n" }, { "from": "gpt", "value": "Yes, many...
I have a project with 2 subfolders in the App_code folder, one for VB and one for F# (C# files are in the root). I can access the VB classes just fine (via the namespace) but not the F# code. Has anyone had a problem like this and if so how did you fix it? Addendum: F# code that is not in the App_Code folder runs just ...
It sounds like you're encountering a specific issue with how ASP.NET handles code in the `App_Code` folder, particularly with F# files. In ASP.NET, the `App_Code` folder is treated specially, and there are some nuances to how the compilation works, especially with different languages. Here are a few steps you can take ...
35,228
[ { "from": "human", "value": "I have a project with 2 subfolders in the App_code folder, one for VB and one for F# (C# files are in the root). I can access the VB classes just fine (via the namespace) but not the F# code. Has anyone had a problem like this and if so how did you fix it?\nAddendum:\nF# code th...
I'm using Web Services Enhancements 3.0 to call a web-service from an ASP.NET application written in C# with Visual Studio 2005. I can call the web-service in Internet Explorer if I change the network connection settings to use a specific SOCKS5 proxy but from the .ASPX page I get an error message that tells me that I ...
To configure your ASP.NET application to use a SOCKS5 proxy when calling a web service, you may need to make some adjustments since the default .NET `WebClient` or `HttpWebRequest` does not natively support SOCKS5 proxies out of the box. However, here are some strategies you can consider: ### Method 1: Use a Third-Par...
35,482
[ { "from": "human", "value": "I'm using Web Services Enhancements 3.0 to call a web-service from an ASP.NET application written in C# with Visual Studio 2005.\nI can call the web-service in Internet Explorer if I change the network connection settings to use a specific SOCKS5 proxy but from the .ASPX page I ...
I'm starting a project which I think would benefit from bindings (I've got a source list table, several browser views, etc), but I think it would also be quite doable, and perhaps more understandable, without them. From my limited experience I've found bindings to be difficult to troubleshoot and very "magic" (e.g. it'...
Your concerns about bindings are valid and not uncommon, especially for those new to frameworks that heavily utilize them. Here’s a breakdown of the situation to help you decide on the best approach for your project: ### Pros of Using Bindings: 1. **Less Boilerplate Code**: Bindings can significantly reduce the amoun...
31,203
[ { "from": "human", "value": "I'm starting a project which I think would benefit from bindings (I've got a source list table, several browser views, etc), but I think it would also be quite doable, and perhaps more understandable, without them. From my limited experience I've found bindings to be difficult t...
This question is regarding the performance issue in Mac OS X Canvas3D object is embedded in a JPanel; then the panel is integrated with the rest of the Swing-built application. Within that Canvas I am rendering a simple cube by applying certain transformations. At the initial launch It works fine. But when i try to re...
The flickering issue you're experiencing in your Swing application with a `Canvas3D` object can be attributed to the way Swing handles painting and rendering, especially when combining heavyweight components (like `Canvas3D`) with lightweight components (like Swing components). Here are several approaches to help mitig...
31,401
[ { "from": "human", "value": "This question is regarding the performance issue in Mac OS X\nCanvas3D object is embedded in a JPanel; then the panel is integrated with the rest of the Swing-built application. Within that Canvas I am rendering a simple cube by applying \ncertain transformations. At the initial...
I have a database table (sql server 2008) that I want to view data for, what is the quickest way of displaying this data? (if it could have paging that would be perfect). Would it be a gridview or ? query: select * from testData
To display data from a SQL Server 2008 database table in a user-friendly way, particularly with paging functionality, a `GridView` in an ASP.NET web application is a great choice. Here are the steps you would follow to achieve this: ### Using GridView with Paging in ASP.NET 1. **Set Up Your ASP.NET Web Application:**...
34,686
[ { "from": "human", "value": "I have a database table (sql server 2008) that I want to view data for, what is the quickest way of displaying this data?\n(if it could have paging that would be perfect).\nWould it be a gridview or ?\nquery: select * from testData\n" }, { "from": "gpt", "value": "To...
What is a git topic branch? Does it differ from an ordinary branch in some way? Are there any branches that are not topic branches?
A **git topic branch** is a branch created to work on a specific feature, task, or topic within a project. The idea behind topic branches is to encapsulate related changes in a separate branch to keep the main development branch (often `main` or `master`) clean and stable. This concept aligns with a common Git workflow...
35,486
[ { "from": "human", "value": "What is a git topic branch? Does it differ from an ordinary branch in some way? Are there any branches that are not topic branches?\n" }, { "from": "gpt", "value": "A **git topic branch** is a branch created to work on a specific feature, task, or topic within a pr...
I need to highlight, case insensitively, given keywords in a JavaScript string. For example: highlight("foobar Foo bar FOO", "foo") should return "<b>foo</b>bar <b>Foo</b> bar <b>FOO</b>" I need the code to work for any keyword, and therefore using a hardcoded regular expression like /foo/i is not a sufficient soluti...
You can achieve case-insensitive highlighting of keywords in a string using JavaScript by creating a function that constructs a regular expression based on the provided keyword and then uses that to replace the keyword occurrences in the string with a bolded version. Here's how you can implement this: ```javascript fu...
34,406
[ { "from": "human", "value": "I need to highlight, case insensitively, given keywords in a JavaScript string.\nFor example:\n\nhighlight(\"foobar Foo bar FOO\", \"foo\") should return \"<b>foo</b>bar <b>Foo</b> bar <b>FOO</b>\"\n\nI need the code to work for any keyword, and therefore using a hardcoded regul...
I'm considering using PostgreSQL with a .Net web app. Basically 3 reasons: Mature Geo Queries Small footprint + Linux Price I'm wondering a bit about tools though, SQL Server Profiler and query plans and performance monitors have been helpful. How is this world with Postgres? Some other things I should consider? Edit...
Using PostgreSQL with a .NET web app is a great choice, especially given the reasons you've listed—mature geo queries, a small footprint on Linux, and cost-effectiveness. Here are some points regarding tools, monitoring, and other considerations: ### 1. **Monitoring and Performance Tools** While PostgreSQL does not h...
34,912
[ { "from": "human", "value": "I'm considering using PostgreSQL with a .Net web app. Basically 3 reasons:\n\nMature Geo Queries\nSmall footprint + Linux\nPrice\n\nI'm wondering a bit about tools though, SQL Server Profiler and query plans and performance monitors have been helpful. How is this world with Post...
I have an ICollection<T> called foos in my class which I want to expose as read-only (see this question). I see that the interface defines a property .IsReadOnly, which seems appropriate... My question is this: how do I make it obvious to the consumer of the class that foos is read-only? I don't want to rely on them r...
To expose your `ICollection<T>` as read-only in a way that clearly communicates to the consumers of your class that they should not modify it, there are a few approaches you can take. Here are the recommended options: ### 1. Expose it as a ReadOnlyCollection<T> Although you noted that `ReadOnlyCollection<T>` does not ...
35,380
[ { "from": "human", "value": "I have an ICollection<T> called foos in my class which I want to expose as read-only (see this question). I see that the interface defines a property .IsReadOnly, which seems appropriate... My question is this: how do I make it obvious to the consumer of the class that foos is r...
I am trying to run a VB application that was coded long back on Windows 2000. My current OS is windows XP SP2. The error message is: "Component 'MSCOMCT2.OCX' or one of its dependencies not correctly registered: a file is missing or invalid" I searched my computer for this file (this is different from MSCOMCT***L***...
The error message you're encountering indicates that the `MSCOMCT2.OCX` file, which is a Microsoft common controls library, is missing or not registered correctly on your Windows XP system. Here are steps you can take to resolve this issue: ### 1. Obtain the MSCOMCT2.OCX File You will need to obtain the `MSCOMCT2.OCX`...
34,791
[ { "from": "human", "value": "I am trying to run a VB application that was coded long back on Windows 2000. My current OS is windows XP SP2. \nThe error message is: \n\"Component 'MSCOMCT2.OCX' or one of its dependencies not \ncorrectly registered: a file is missing or invalid\"\nI searched my computer for t...
What is the best way to remove an entry from a hashtable that uses linear probing? One way to do this would be to use a flag to indicate deleted elements? Are there any ways better than this?
In a hashtable that uses linear probing for collision resolution, removing an entry can be challenging due to the way probing works. When an entry is deleted, simply marking it as deleted (e.g., with a special flag) is a common approach, but it comes with trade-offs. Here’s a breakdown of methods for removal and their ...
35,324
[ { "from": "human", "value": "What is the best way to remove an entry from a hashtable that uses linear probing? One way to do this would be to use a flag to indicate deleted elements? Are there any ways better than this?\n" }, { "from": "gpt", "value": "In a hashtable that uses linear probing fo...
Given a point (pX, pY) and a circle with a known center (cX,cY) and radius (r), what is the shortest amount of code you can come up with to find the point on the circle closest to (pX, pY) ? I've got some code kind of working but it involves converting the circle to an equation of the form (x - cX)^2 + (y - cY)^2 = r^2...
You can find the point on the circle closest to a given point in a much simpler and more elegant way. The idea is to use vector math to determine the point directly. Here's a concise way to do it in Python: ```python def closest_point_on_circle(pX, pY, cX, cY, r): from math import atan2, cos, sin angle = atan...
36,359
[ { "from": "human", "value": "Given a point (pX, pY) and a circle with a known center (cX,cY) and radius (r), what is the shortest amount of code you can come up with to find the point on the circle closest to (pX, pY) ?\nI've got some code kind of working but it involves converting the circle to an equation...
I have finally finished my web site. I published it, and I was surprised at the results. Although the App_Code compiled into a single DLL file, every page's code behind compiled into its own DLL file. How do I make it so that it is one DLL file? Also, is it possible to compile everything (SubSonic, AJAX, etc.) into tha...
Congratulations on finishing your website! To address your questions about the compilation of your ASP.NET web application into a single DLL file, here's how you can achieve that: ### 1. **Compiling All Code Behind into a Single DLL** By default, ASP.NET compiles each page's code-behind into a separate DLL file. Howe...
32,337
[ { "from": "human", "value": "I have finally finished my web site. I published it, and I was surprised at the results. Although the App_Code compiled into a single DLL file, every page's code behind compiled into its own DLL file. How do I make it so that it is one DLL file?\nAlso, is it possible to compile ...
In eclipse, I have a javaproject (not a web project), though it does provide reusable tag files. layout +src +++META-INF ----my.tld +++++++++++tags ---------------include.jsp I keep on getting Fragment "/META-INF/tags/include.jsp" was not be found at expected path /Project/META-INF/tags/taginclude.jsp How can I modify ...
To resolve the issue with Eclipse not finding your JSP files in the specified path, you'll need to ensure that Eclipse recognizes the structure of your project correctly. Since you want to include `"src"` in the lookup path, here are the steps you can follow: ### Step 1: Verify Project Structure Ensure your project st...
33,555
[ { "from": "human", "value": "In eclipse, I have a javaproject (not a web project), though it does provide reusable tag files.\nlayout\n+src\n+++META-INF\n----my.tld\n+++++++++++tags\n---------------include.jsp\nI keep on getting Fragment \"/META-INF/tags/include.jsp\" was not be found at expected path /Proj...
My PHP/MS Sql Server 2005/win 2003 Application occasionally becomes very unresponsive, the memory/cpu usage does not spike. If i try to open any new connection from sql management studio, then the it just hangs at the open connection dialog box. how to deterime the total number of active connections ms sql server 200...
To determine the total number of active connections to your MS SQL Server 2005, you can run a query using SQL Server Management Studio (SSMS) or any other SQL query execution tool connected to your SQL Server instance. Below are some steps and the SQL query to help you identify the active connections: ### Step 1: Open...
32,982
[ { "from": "human", "value": "My PHP/MS Sql Server 2005/win 2003 Application occasionally becomes very unresponsive, the memory/cpu usage does not spike. If i try to open any new connection from sql management studio, then the it just hangs at the open connection dialog box. \nhow to deterime the total numb...
When you have a complex property, should you instantiate it or leave it to the user to instantiate it? For example (C#) A) class Xyz{ List<String> Names {get; set;} } When I try to use, I have to set it. ... Xyz xyz = new Xyz(); xyz.Name = new List<String>(); xyz.Name.Add("foo"); ... Where as if I modify the c...
When deciding whether to instantiate complex properties (like lists or dictionaries) in a class or to leave it up to the user to instantiate them, several principles and rules of thumb can guide your decision. Below are some considerations: ### 1. **Encapsulation and Internal State** - If the property represents an...
33,836
[ { "from": "human", "value": "When you have a complex property, should you instantiate it or leave it to the user to instantiate it?\nFor example (C#)\nA)\n class Xyz{\n List<String> Names {get; set;}\n }\n\nWhen I try to use, I have to set it.\n...\nXyz xyz = new Xyz();\nxyz.Name = new List<String>();\n...
Is it good practice to have a unit test that specifies how long a certain function takes to return a value. I'm unit testing a curl function and want to specify that it needs to time out after 5 seconds. Is this in line with the way unit tests work?
Unit tests typically focus on verifying the correctness of individual components in isolation, ensuring that they behave as expected given certain inputs. While performance is an important aspect of overall software quality, testing for performance characteristics like execution time typically falls under the domain of...
36,240
[ { "from": "human", "value": "Is it good practice to have a unit test that specifies how long a certain function takes to return a value. I'm unit testing a curl function and want to specify that it needs to time out after 5 seconds. Is this in line with the way unit tests work?\n" }, { "from": "gpt"...
I have an website. When the user is logged the session details will loaded. When the user logged out the session details will abandoned. (Log out by clicking the logout menu) when the user simply closes the browser then how to destroy the session. In the next time its get logging with the same session data. I need to a...
To effectively manage user sessions on your website, especially in regards to handling user logout actions through both a manual logout and a browser close, you can implement several strategies. Below are some methods you can use: ### 1. Use Session Timeouts Set a session timeout that automatically logs the user out ...
34,933
[ { "from": "human", "value": "I have an website. When the user is logged the session details will loaded.\nWhen the user logged out the session details will abandoned. (Log out by clicking the logout menu)\nwhen the user simply closes the browser then how to destroy the session.\nIn the next time its get log...
Could someone please explain the best way to connect to an Interbase 7.1 database using .NET/C#? The application will be installed on many end user computers so the less "add-ons" that I will have to package with my application the better.
Connecting to an Interbase 7.1 database using .NET/C# can be accomplished through several methods, but since you prefer to minimize dependencies and "add-ons," the best approach would typically involve using ADO.NET with an appropriate data provider for Interbase. ### Here are some steps to guide you through the conne...
32,187
[ { "from": "human", "value": "Could someone please explain the best way to connect to an Interbase 7.1 database using .NET/C#?\nThe application will be installed on many end user computers so the less \"add-ons\" that I will have to package with my application the better.\n" }, { "from": "gpt", "...
I have a module that sends an email to a specified email address but I want to default the email recipient to the portal administrator. How can I retrieve this information?
To retrieve the email address of the portal administrator in your module, you'll need to know the specifics of the platform or framework you are using, as the method can vary depending on the environment. However, here are some general strategies you might consider: ### 1. **Using Configuration Files:** - If your p...
34,621
[ { "from": "human", "value": "I have a module that sends an email to a specified email address but I want to default the email recipient to the portal administrator. How can I retrieve this information?\n" }, { "from": "gpt", "value": "To retrieve the email address of the portal administrator in...
I am having a problem like that i am having some 10 parameters. I am dispalying the parameter values in the textbox(10 different). I need to display the textbox based on my parameter values If the parameter has values - show them in textbox If the parameter has no values - hide the textbox. Currently I am using this ab...
Certainly! If you want to dynamically display or hide textboxes based on whether your parameters have values, there are several approaches you can take beyond simply toggling the visibility of existing controls. Here are a few options: ### 1. Dynamically Creating Controls You can create textboxes dynamically in your ...
32,055
[ { "from": "human", "value": "I am having a problem like that i am having some 10 parameters. I am dispalying the parameter values in the textbox(10 different). I need to display the textbox based on my parameter values\nIf the parameter has values - show them in textbox\nIf the parameter has no values - hid...
I need to access the Selection.ListObject.QueryTable object in order to preserve the column width. The code is as follows: Range("B9").Select() With Selection.ListObject.QueryTable .RowNumbers = False .FillAdjacentFormulas = False .PreserveFormatting = True .RefreshOnFileOpen = False .BackgroundQuer...
To convert the provided VBA code that manipulates a `ListObject.QueryTable` into VB.NET using the Excel Interop library, you'll need to adjust the syntax and structure to fit VB.NET conventions. Below is an example of how you might write this in VB.NET: ```vb.net Imports Excel = Microsoft.Office.Interop.Excel Module ...
33,882
[ { "from": "human", "value": "I need to access the Selection.ListObject.QueryTable object in order to preserve the column width.\nThe code is as follows:\nRange(\"B9\").Select()\nWith Selection.ListObject.QueryTable\n .RowNumbers = False\n .FillAdjacentFormulas = False\n .PreserveFormatting = True\n...
Search the web for the phrase "I cosay". I run across this phrase being used from time to time by individuals in tech forums, but for the life of me, I cannot figure out what it means or how it makes sense in the context of the conversations where it is used. Am I just way behind the times? New slang?
The phrase "I cosay" seems to be a play on words, often used humorously in online discussions, particularly in tech forums or gaming communities. It can be interpreted as a contraction of "I could say" or a way to introduce an opinion or statement. It's likely part of a larger trend where people create shorthand or pla...
37,236
[ { "from": "human", "value": "Search the web for the phrase \"I cosay\". I run across this phrase being used from time to time by individuals in tech forums, but for the life of me, I cannot figure out what it means or how it makes sense in the context of the conversations where it is used.\nAm I just way b...
My server has both Subversion and Apache installed, and the Apache web directory is also a Subversion working copy. The reason for this is that the simple command svn update /server/staging will deploy the latest source to the staging server. Apache public web directory: /server/staging — (This is an SVN working copy.)...
The issue you're experiencing arises from the way file permissions and ownerships work in UNIX-like systems. When you set the owner of the `/server/staging` directory to `richard`, only `richard` has full permissions to it, while `austin`, as a member of the `developers` group, does not have the necessary permissions t...
31,152
[ { "from": "human", "value": "My server has both Subversion and Apache installed, and the Apache web directory is also a Subversion working copy. The reason for this is that the simple command svn update /server/staging will deploy the latest source to the staging server.\nApache public web directory: /serve...
Stackoverflow is built on MVC and does a bunch of simple but nice things with dates and numbers (answer counts, votes, etc...). I'm assuming this is all done with a couple of static helper classes. My question is should the view call these helper objects or should the controller call these helper objects and embed the...
The question you're grappling with is a common design consideration in MVC (Model-View-Controller) applications regarding where to handle formatting logic—whether in the controller or in the view itself. Both approaches you outlined have their own merits and considerations: ### Option 1: Controller Populates View Data...
34,823
[ { "from": "human", "value": "Stackoverflow is built on MVC and does a bunch of simple but nice things with dates and numbers (answer counts, votes, etc...). I'm assuming this is all done with a couple of static helper classes.\nMy question is should the view call these helper objects or should the controll...
I have a program that will calculate the minimal area taken by fitting rectangles together. Input: Rectangles of different height and width. Output: One rectangle that contains all these rectangles. Rules: One cannot turn or roll the rectangles around and they cannot overlap. I understand that this is related or is pos...
You're correct that the problem you're facing is related to the bin packing problem, specifically the "rectangle packing" or "2D packing" problem, which can indeed be NP-hard. Since you're looking to minimize the area of a bounding rectangle containing all the given rectangles without overlap and without rotation, here...
32,758
[ { "from": "human", "value": "I have a program that will calculate the minimal area taken by fitting rectangles together.\nInput: Rectangles of different height and width.\nOutput: One rectangle that contains all these rectangles.\nRules: One cannot turn or roll the rectangles around and they cannot overlap....
Everyone is talking about TDD (BDD) in Rails (and not just Rails) development world today. It's easy to find plenty of good general information about it, there are quite a few tools you can use for this purpose and there are many (good) examples of how to use them. Now, I'm already on the train. I like the idea (never...
It's great to hear that you're diving into Test-Driven Development (TDD) with Rails and using Shoulda for your testing framework! TDD can be a bit daunting at first, but with practice, it becomes an integral part of the development process. Here's a comprehensive guide to help you navigate TDD with Shoulda, as well as ...
34,603
[ { "from": "human", "value": "Everyone is talking about TDD (BDD) in Rails (and not just Rails) development world today. It's easy to find plenty of good general information about it, there are quite a few tools you can use for this purpose and there are many (good) examples of how to use them. \nNow, I'm al...
Hey I have a windows server running python CGI scripts and I'm having a little trouble with smtplib. The server is running python 2.1 (unfortunately and I can not upgrade it). Anyway I have the following code: session = smtplib.SMTP("smtp-auth.ourhosting.com", 587) session.login(smtpuser, smtppass) and it's giving me ...
You are correct that the `login()` method in `smtplib` was added after Python 2.1. Since you are unable to upgrade Python and cannot compile modules, you will need to use a workaround to authenticate with your SMTP server. In Python 2.1, there is no built-in support for SMTP AUTH, which is necessary for logging in wit...
35,108
[ { "from": "human", "value": "Hey I have a windows server running python CGI scripts and I'm having a little trouble with smtplib. The server is running python 2.1 (unfortunately and I can not upgrade it). Anyway I have the following code:\nsession = smtplib.SMTP(\"smtp-auth.ourhosting.com\", 587)\nsession.l...
Is there an open source or public domain framework that can document shell scripts similar to what JavaDoc produces? I don't need to limit this just to a specific flavor of shell script, ideally I would like a generic framework for documenting API or command line type commands on a web page that is easy to extend or ev...
Yes, there are several tools and frameworks that can help you document shell scripts or command-line tools, similar to how JavaDoc works for Java. Here are some options you might find useful: ### 1. **bashdoc** - **Description**: `bashdoc` is a simple tool that can generate documentation for Bash scripts. It looks for...
33,108
[ { "from": "human", "value": "Is there an open source or public domain framework that can document shell scripts similar to what JavaDoc produces? I don't need to limit this just to a specific flavor of shell script, ideally I would like a generic framework for documenting API or command line type commands o...
I've created a custom list & also added a column in the Announcement List. Question is, how can I include those newly created items when I create a fresh Web Application (like a script, feature or something)? Additional Info: It's like when you're to deploy from your development machine to a staging or production serv...
In SharePoint, if you want to programmatically update an existing list (like adding a new column to the Announcement List) when deploying your solution, you can use a combination of features, scripts, or PowerShell commands. Below are a few methods you can use, depending on your preference and the SharePoint environmen...
26,151
[ { "from": "human", "value": "I've created a custom list & also added a column in the Announcement List. Question is, how can I include those newly created items when I create a fresh Web Application (like a script, feature or something)?\nAdditional Info: It's like when you're to deploy from your developme...
I have a file on a Windows 2003 server which is locked by a process running on another Windows 2003 server. Is it possible to find out which process on which machine is locking this resource. I don't mind which language I use to do this.
Yes, it is possible to determine which process is locking a file on a Windows server. You can use various tools and programming approaches to achieve this. Here are some methods you can use: ### Method 1: Using Process Explorer 1. **Download and Run Process Explorer:** - Download Process Explorer from the Microsof...
32,208
[ { "from": "human", "value": "I have a file on a Windows 2003 server which is locked by a process running on another Windows 2003 server. Is it possible to find out which process on which machine is locking this resource. I don't mind which language I use to do this.\n" }, { "from": "gpt", "val...
I have video that I've converted to FLV format. I'd rather host it on my own site than use a service like YouTube. What is the easiest player to use? I'd like to just put the .swf file of the player somewhere on my server, and give it the video as a parameter.
To host your FLV video on your own site with an easy-to-use player, you can consider using **Flowplayer**, which is a popular open-source Flash video player that supports FLV files. Here are the steps to set it up: ### Step 1: Download Flowplayer 1. Go to the [Flowplayer website](https://flowplayer.org/). 2. Download...
14,842
[ { "from": "human", "value": "I have video that I've converted to FLV format. I'd rather host it on my own site than use a service like YouTube. What is the easiest player to use? I'd like to just put the .swf file of the player somewhere on my server, and give it the video as a parameter.\n" }, { ...
I've got a small web form with 2 radio buttons, call them PickFromList and EnterValue. When PickFromList is checked I want to show a GridView that I've configured to bind to an ObjectDataSource. When EnterValue is checked I want the GridView to disappear. This form is laid out using a table and want to hide/show the ...
The issue you're encountering with your GridView not binding when the `<tr>` element has both `id` and `runat="server"` attributes is likely related to ASP.NET's naming and ID management. When you add `runat="server"` to an element, ASP.NET takes control of its lifecycle and naming, which may lead to unexpected behavio...
30,933
[ { "from": "human", "value": "I've got a small web form with 2 radio buttons, call them PickFromList and EnterValue. When PickFromList is checked I want to show a GridView that I've configured to bind to an ObjectDataSource. When EnterValue is checked I want the GridView to disappear.\nThis form is laid ou...
I am trying to make a copy of a database to a new database on the same server. The server is my local computer running SQL 2008 Express under Windows XP. Doing this should be quite easy using the SMO.Transfer class and it almost works! My code is as follows (somewhat simplified): Server server = new Server("server"); ...
It seems you are experiencing challenges with the `Transfer` class in SMO when attempting to copy both the structure and the data of a SQL Server database. Here are a few things to consider that may help address the issues you're encountering: ### 1. Ensure Proper Permissions Make sure that the account running your ap...
34,110
[ { "from": "human", "value": "I am trying to make a copy of a database to a new database on the same server. The server is my local computer running SQL 2008 Express under Windows XP. \nDoing this should be quite easy using the SMO.Transfer class and it almost works!\nMy code is as follows (somewhat simplifi...
What is the best way to find out whether two number ranges intersect? My number range is 3023-7430, now I want to test which of the following number ranges intersect with it: <3000, 3000-6000, 6000-8000, 8000-10000, >10000. The answer should be 3000-6000 and 6000-8000. What's the nice, efficient mathematical way to do ...
To determine whether two number ranges intersect, you can utilize the concept of minimum and maximum values of the ranges. Two ranges \( [a_1, b_1] \) and \( [a_2, b_2] \) intersect if: \[ \text{max}(a_1, a_2) \leq \text{min}(b_1, b_2) \] This means that the starting point of one range is less than or equal to the en...
33,163
[ { "from": "human", "value": "What is the best way to find out whether two number ranges intersect?\nMy number range is 3023-7430, now I want to test which of the following number ranges intersect with it: <3000, 3000-6000, 6000-8000, 8000-10000, >10000. The answer should be 3000-6000 and 6000-8000.\nWhat's ...
One thing I've run into a few times is a service class (like a JBoss service) that has gotten overly large due to helper inner classes. I've yet to find a good way to break the class out. These helpers are usually threads. Here's an example: /** Asset service keeps track of the metadata about assets that live on other ...
You've highlighted a common dilemma in object-oriented design: balancing class size and maintainability with encapsulation and cohesion. Here are some strategies that can help you refactor your `AssetService` while still maintaining good encapsulation and keeping the helper classes manageable. ### 1. Use Package-Priva...
31,523
[ { "from": "human", "value": "One thing I've run into a few times is a service class (like a JBoss service) that has gotten overly large due to helper inner classes. I've yet to find a good way to break the class out. These helpers are usually threads. Here's an example:\n/** Asset service keeps track of the...
I am trying to function doRow(rowNum) { $.ajax({ url: "z.html", cache: false, success: function(html){ $('#result + rowNum + "'").append(html); } }); This does not seem to work. I also want to pass variables to data attribute when I get that far.
It looks like there are a couple of issues in your JavaScript code, particularly in the way you are trying to use the `rowNum` variable within the jQuery selector. The concatenation is not being done correctly, which is causing your code not to work as expected. Additionally, if you want to pass variables to a data att...
34,412
[ { "from": "human", "value": "I am trying to \nfunction doRow(rowNum)\n{\n\n $.ajax({\n url: \"z.html\",\n cache: false,\n success: function(html){\n $('#result + rowNum + \"'\").append(html);\n }\n});\n\nThis does not seem to work.\nI also want to pass variables to data attribute when I get that far...
I am using an Infragistics UltraGrid in a WinForms application. Which event is raised on "check change" of checkbox in Infragistics UltraGrid?
In an Infragistics UltraGrid, when a checkbox cell is checked or unchecked, the event that is typically raised is the `AfterCellChange` event. This event occurs after the value of a cell has changed, which includes changes due to user interactions like checking or unchecking a checkbox. Here is a simple way to handle ...
36,899
[ { "from": "human", "value": "I am using an Infragistics UltraGrid in a WinForms application.\nWhich event is raised on \"check change\" of checkbox in Infragistics UltraGrid?\n" }, { "from": "gpt", "value": "In an Infragistics UltraGrid, when a checkbox cell is checked or unchecked, the event th...
Suppose that you have two huge files (several GB) that you want to concatenate together, but that you have very little spare disk space (let's say a couple hundred MB). That is, given file1 and file2, you want to end up with a single file which is the result of concatenating file1 and file2 together byte-for-byte, and...
To concatenate two large files (file1 and file2) without running out of disk space during the process, you can use a streaming approach or a temporary file approach that keeps disk usage low. Below are several methods for various platforms. ### Method 1: Using a Streaming Approach (Unix/Linux/Mac) You can use the `ca...
35,024
[ { "from": "human", "value": "Suppose that you have two huge files (several GB) that you want to concatenate together, but that you have very little spare disk space (let's say a couple hundred MB). That is, given file1 and file2, you want to end up with a single file which is the result of concatenating fi...
I have a bunch of JUnit 3 classes which extend TestCase and would like to automatically migrate them to be JUnit4 tests with annotations such as @Before, @After, @Test, etc. Any tool out there to do this in a big batch run?
Migrating JUnit 3 tests to JUnit 4 can be a tedious process, especially if you have a lot of test classes. While there is no fully automated tool that can handle every possible scenario due to the differences in test structure and usage patterns, you can use a combination of tools and techniques to make the migration e...
32,279
[ { "from": "human", "value": "I have a bunch of JUnit 3 classes which extend TestCase and would like to automatically migrate them to be JUnit4 tests with annotations such as @Before, @After, @Test, etc.\nAny tool out there to do this in a big batch run?\n" }, { "from": "gpt", "value": "Migrating...
There are lots of tools for creating installers on Windows (InstallShield, InnoSetup, NSIS, just to name a few). All tools I've seen fall in one or both of these categories Point-and-click. Nice GUI for creating the installer, but the installer definition/project file can not be manually edited. Textfile: No (official...
If you're looking for installer creation tools that offer a complete API for programmatic control over the installation process, while not being based on MSI, here are some options to consider: 1. **NSIS (Nullsoft Scriptable Install System)**: - While NSIS primarily uses script files for configuration, it has a plu...
31,872
[ { "from": "human", "value": "There are lots of tools for creating installers on Windows (InstallShield, InnoSetup, NSIS, just to name a few). All tools I've seen fall in one or both of these categories\n\nPoint-and-click. Nice GUI for creating the installer, but the installer definition/project file can not...
I have a JAX-RPC (Java) web service that needs to return a complex polymorphic value. To be more specific, the class structure is something like this: abstract class Child { } class Question extends Child { private String name; // other fields, getters, and setters } class Section extends Child { private...
To properly handle polymorphic types in JAX-RPC while returning a complex object like your `Quiz` that can contain subclasses of `Child` (like `Question` and `Section`), you need to ensure that the subclasses are correctly represented in your WSDL and can be serialized/deserialized properly. Here are steps to achieve ...
30,475
[ { "from": "human", "value": "I have a JAX-RPC (Java) web service that needs to return a complex polymorphic value. To be more specific, the class structure is something like this:\nabstract class Child {\n}\n\nclass Question extends Child {\n private String name;\n // other fields, getters, and sette...
I've been struggling lately with understanding the best way to organize jQuery code. I asked another question earlier and I don't think I was specific enough (found in this question here). My problem is that the richer you make an application, the quicker your client side gets out of control. Consider this situation......
Organizing jQuery code (or any JavaScript code) can indeed become complex, especially when dealing with deeply nested structures and asynchronous operations like AJAX calls. Here are some strategies to help you manage and organize your jQuery code effectively: ### 1. **Modular Approach** Consider breaking your code in...
34,242
[ { "from": "human", "value": "I've been struggling lately with understanding the best way to organize jQuery code. I asked another question earlier and I don't think I was specific enough (found in this question here).\nMy problem is that the richer you make an application, the quicker your client side gets ...
What do you do when you join a team that says they use Scrum, but only use it as a time-management tool and not the whole process? How can I reinstate back testing and documentation? I was thinking to start off with adding user stories specifically for testing and documenting. Perhaps someone else has more experience w...
Joining a team that claims to use Scrum but is primarily leveraging it as a time-management tool can be challenging, especially when you're trying to advocate for best practices like testing and documentation. Here are some strategies you might consider to reinstate testing and documentation within the Scrum framework:...
34,503
[ { "from": "human", "value": "What do you do when you join a team that says they use Scrum, but only use it as a time-management tool and not the whole process?\nHow can I reinstate back testing and documentation?\nI was thinking to start off with adding user stories specifically for testing and documenting....
I often have occasion to search for a function name in a project that I haven't retrieved from Team Foundation Server (TFS) and that I don't want to retrieve. Is there a way to search for that function name (any word) on TFS?
Yes, you can search for function names or any other keywords in a Team Foundation Server (TFS) project without having to retrieve the entire project. TFS provides a way to search for files and content within the source control. Here are a few methods you can use to search for a function name in TFS: 1. **TFS Web Inte...
36,881
[ { "from": "human", "value": "I often have occasion to search for a function name in a project that I haven't retrieved from Team Foundation Server (TFS) and that I don't want to retrieve. Is there a way to search for that function name (any word) on TFS?\n" }, { "from": "gpt", "value": "Yes, you...
We've installed Windows Search Server Express on one of our servers, which apparently runs on top of sharepoint. Sharepoint was installed on port 80, where our "normal" intranet runs. When I disable the intranet and run the sharepoint site, everything works as intended. The intranet is linked in many places it would b...
Migrating SharePoint to a different port or virtual directory while maintaining your existing intranet can be tricky, but it can certainly be done with some careful configuration. Here are several steps and suggestions that may help you resolve the issues you're facing: ### 1. Moving SharePoint to a Different Port If ...
34,982
[ { "from": "human", "value": "We've installed Windows Search Server Express on one of our servers, which apparently runs on top of sharepoint.\nSharepoint was installed on port 80, where our \"normal\" intranet runs. When I disable the intranet and run the sharepoint site, everything works as intended. The ...
I won the bid on a project and now the client (who is itself from IT Department) wants me to architect/implement the solution in a very particular way. I am sure the application will fail that way for performance problems. And it will not be easily scalable. This particular client/user does not know ANYTHING about the ...
This is a challenging situation, and your decision should take into account both your professional integrity and the practical aspects of your business. Here are a few considerations to help guide your decision: ### 1. **Professional Integrity and Reputation** - **Long-Term Reputation**: Your reputation as a reliab...
32,106
[ { "from": "human", "value": "I won the bid on a project and now the client (who is itself from IT Department) wants me to architect/implement the solution in a very particular way. I am sure the application will fail that way for performance problems. And it will not be easily scalable.\nThis particular cli...
Delphi 2009 introduced a hierarchical system for project options configuration, where you set "base" options and then have different build styles with their own option sets. But can you extend the hierarchy even further? I do most of my coding with debug options on, of course, but sometimes there are special cases wher...
In Delphi 2009, the hierarchical system for project options does allow you to set up different build configurations (like Debug, Release, etc.), but it doesn't provide built-in support for extending that hierarchy into sub-configurations directly within the IDE itself. The build configurations can be based on the proje...
37,079
[ { "from": "human", "value": "Delphi 2009 introduced a hierarchical system for project options configuration, where you set \"base\" options and then have different build styles with their own option sets. But can you extend the hierarchy even further? I do most of my coding with debug options on, of course,...
I have assembly A with class Z that inherits from class X in assembly B. Now in a completely different solution, I have assembly C, which uses class Z. The compiler complains unless assembly C has a reference to both assembly A & B. Even though assembly C does not use class Z directly in anyway. Is this expected? It se...
What you're experiencing is expected behavior in C# and .NET regarding type dependencies and assembly references. Here's a deeper look into what's happening and why you see this behavior: ### Understanding Assembly References 1. **Inheritance and Type Resolution**: When you have class `Z` in assembly A that inherits ...
35,591
[ { "from": "human", "value": "I have assembly A with class Z that inherits from class X in assembly B. Now in a completely different solution, I have assembly C, which uses class Z.\nThe compiler complains unless assembly C has a reference to both assembly A & B. Even though assembly C does not use class Z d...
Through some bungling in creating and removing publications, I was left with a lot of obsolete publications which for some reason still remains in the Replication Monitor. How do you remove these publications? It doesn't seem to have a clear way to remove them.
To remove obsolete publications that still appear in the Replication Monitor for SQL Server, you may need to follow a few steps, as they are not always straightforward to remove through the graphical interface. Here’s a general process to clean up these publications: 1. **Remove Subscriptions**: First, ensure that ...
32,207
[ { "from": "human", "value": "Through some bungling in creating and removing publications, I was left with a lot of obsolete publications which for some reason still remains in the Replication Monitor. \nHow do you remove these publications? It doesn't seem to have a clear way to remove them.\n" }, { ...
For example, Convert.ToDouble("0.1234567890123456789") = 0.123456789012346 What is the maximum number of significant figures? Couldn't find it in the docs.
In C#, the `Convert.ToDouble` method converts a string representation of a number into a `double`. The `double` data type in C# is a 64-bit IEEE 754 floating-point number, which provides approximately 15-17 significant decimal digits of precision. When you convert a string to a `double`, the precision of the resulting...
38,158
[ { "from": "human", "value": "For example, Convert.ToDouble(\"0.1234567890123456789\") = 0.123456789012346\nWhat is the maximum number of significant figures? Couldn't find it in the docs.\n" }, { "from": "gpt", "value": "In C#, the `Convert.ToDouble` method converts a string representation of a...
I have an Excel worksheet with an image (logo). If I right-click on the picture and select Format Picture / Protection, the Locked checkbox is checked. I then protect the worksheet with a password. Despite all of the above, the end user can still select and delete the image. Is there any way to prevent this? Update Ind...
Yes, you're correct that in Excel, even when the "Locked" option is checked for an image, it doesn't fully prevent users from deleting or modifying the image unless the right protection settings are applied when you protect the worksheet. To ensure that users cannot select or delete the image, you need to set the `Dra...
32,496
[ { "from": "human", "value": "I have an Excel worksheet with an image (logo).\nIf I right-click on the picture and select Format Picture / Protection, the Locked checkbox is checked.\nI then protect the worksheet with a password.\nDespite all of the above, the end user can still select and delete the image.\...
I'm not that familiar with WCF, but I thought I'll learn while trying to consume an existing service. One of the REST APIs I thought of was the Twitter API. I thought of developing a WPF client that will just output to the screen the last 5 tweets by a certain Twitter user. I was wondering if someone could please brief...
To consume a REST API like the Twitter API using WCF (Windows Communication Foundation) in a WPF (Windows Presentation Foundation) application, you will generally follow these steps. While WCF is often used for SOAP-based services, it can also be configured to work with RESTful services. Here's a brief outline of the ...
32,932
[ { "from": "human", "value": "I'm not that familiar with WCF, but I thought I'll learn while trying to consume an existing service.\nOne of the REST APIs I thought of was the Twitter API. I thought of developing a WPF client that will just output to the screen the last 5 tweets by a certain Twitter user.\nI ...
By default, .NET application's configuration file is named after "exe file name".config. I'm wondering whether it is possible to have one application's configuration specified dynamically. For example, the built application is "foo.exe". At runtime, the config file is "foo.exe.config". Is it possible to have it accept ...
Yes, it is possible to use a custom configuration file in a .NET application by specifying the file at runtime. The default behavior is to load the configuration from the `foo.exe.config` file, but you can override this by manually loading the configuration from a different file. Here's how you can implement this in y...
33,789
[ { "from": "human", "value": "By default, .NET application's configuration file is named after \"exe file name\".config. I'm wondering whether it is possible to have one application's configuration specified dynamically.\nFor example, the built application is \"foo.exe\". At runtime, the config file is \"foo...
When working with my .Net 2.0 code base ReSharper continually recommends applying the latest c# 3.0 language features, most notably; convert simple properties into auto-implement properties or declaring local variables as var. Amongst others. When a new language feature arrives do you go back and religiously apply it ...
When deciding whether to apply new language features to an existing code base, there are several factors to consider, including project size, team practices, and long-term maintainability. Here are some considerations: ### Pros of Applying New Language Features 1. **Consistency**: If your team adopts new language fea...
33,515
[ { "from": "human", "value": "When working with my .Net 2.0 code base ReSharper continually recommends applying the latest c# 3.0 language features, most notably; convert simple properties into auto-implement properties or declaring local variables as var. Amongst others.\nWhen a new language feature arrive...
How to put a File path control in VBA front panel? I want the user to be able to select the browse button and select the file path rather than putting up dialog boxes all over the place. I need the user to select three or more file paths.
To create a user-friendly interface in a VBA UserForm that allows users to select multiple file paths through a "Browse" button, follow the steps outlined below. This process uses a combination of `TextBox` controls for displaying the selected file paths and a `CommandButton` control for opening the file dialog. ### S...
32,673
[ { "from": "human", "value": "How to put a File path control in VBA front panel? I want the user to be able to select the browse button and select the file path rather than putting up dialog boxes all over the place. I need the user to select three or more file paths.\n" }, { "from": "gpt", "valu...
I have a project with literally thousands of image files that aren't being used. The main problem is that they are intermixed with images that are. Is there a way to get a list of all project artifacts which aren't referenced? EDIT: Assuming I don't have access to the web logs... Is there an option?
If you're looking to identify unused image files in a project where the images are intermixed with used ones, and you don't have access to web logs or analytics, here are several approaches you can take: ### 1. **File Name Reference Search** - Use a code editor or IDE that supports search functionality (like VSCode...
33,671
[ { "from": "human", "value": "I have a project with literally thousands of image files that aren't being used. The main problem is that they are intermixed with images that are.\nIs there a way to get a list of all project artifacts which aren't referenced?\nEDIT: Assuming I don't have access to the web log...
I'm trying to read the transactional deal letter queue in MSMQ using C#.NET and am getting: A workgroup installation computer does not support the operation For 10 Stack Overflow points, what am I doing wrong?
The error message "A workgroup installation computer does not support the operation" typically indicates that the application is trying to access features of Microsoft Message Queuing (MSMQ) that are not supported in a workgroup environment. MSMQ has certain limitations when running in a workgroup rather than in a doma...
31,575
[ { "from": "human", "value": "I'm trying to read the transactional deal letter queue in MSMQ using C#.NET and am getting: \n\nA workgroup installation computer does not support the operation\n\nFor 10 Stack Overflow points, what am I doing wrong? \n" }, { "from": "gpt", "value": "The error messag...
I'm trying to determine what situations MySQL updates an index. Say I have the following table: CREATE TABLE MyTable ( ID INT NOT NULL AUTO_INCREMENT, MyIndexedColumn VARCHAR NOT NULL, MyNonIndexedColumn VARCHAR, PRIMARY KEY (ID), INDEX MyNewIndex(MyIndexedColumn) ) Then I run the following SQL to insert a ...
In MySQL, when you update a row in a table, any indexed columns that are included in the update statement will trigger an update of the index, regardless of whether the actual value has changed or not. In your example: ```sql UPDATE MyTable SET MyIndexedColumn = 'MyTestValue', MyNonIndexedColumn = 'A New Value' WHE...
35,361
[ { "from": "human", "value": "I'm trying to determine what situations MySQL updates an index. Say I have the following table:\nCREATE TABLE MyTable (\n ID INT NOT NULL AUTO_INCREMENT,\n MyIndexedColumn VARCHAR NOT NULL,\n MyNonIndexedColumn VARCHAR,\n PRIMARY KEY (ID),\n INDEX MyNewIndex(MyIndexedColum...
In Visual Studio website projects (in Visual Studio 2005 or later, not web application projects where there is still a .csproj file) how is the reference information stored, and is it possible to source control it without storing compiled binaries in source control? If you right-click on a website project and select Pr...
In Visual Studio website projects (especially in versions like Visual Studio 2005 and later), reference information is somewhat different from that in traditional web application projects, where references are managed via the `.csproj` file. For website projects, there is no project file that explicitly lists these ref...
34,016
[ { "from": "human", "value": "In Visual Studio website projects (in Visual Studio 2005 or later, not web application projects where there is still a .csproj file) how is the reference information stored, and is it possible to source control it without storing compiled binaries in source control?\nIf you righ...
Is there something similar to sprintf() in C#? I would for instance like to convert an integer to a 2-byte byte-array. Something like: int number = 17; byte[] s = sprintf("%2c", number);
In C#, you can achieve similar functionality to `sprintf()` using `String.Format` or by using the `BitConverter` class for converting integers to byte arrays. However, converting an integer specifically to a 2-byte byte array can be done directly without needing formatting strings. If you want to convert an integer to...
35,873
[ { "from": "human", "value": "Is there something similar to sprintf() in C#?\nI would for instance like to convert an integer to a 2-byte byte-array.\nSomething like:\nint number = 17;\nbyte[] s = sprintf(\"%2c\", number);\n\n" }, { "from": "gpt", "value": "In C#, you can achieve similar function...
I'm looking for a quick way to detect faces in pictures (stored as JPG or any other popular image format). Code in any popular programming language will do (Python, C#, Java, Matlab, etc.). I'm also willing to implement an algorithm by myself, as long as it is proven to be a good working one. Alternatively, if there ar...
Detecting faces in images is a well-studied problem in computer vision, and there are many tools and libraries available for this task. Below are some popular options, including code examples, libraries, and commercial products. ### Python with OpenCV and dlib 1. **Using OpenCV**: OpenCV is a popular computer vision ...
30,276
[ { "from": "human", "value": "I'm looking for a quick way to detect faces in pictures (stored as JPG or any other popular image format). Code in any popular programming language will do (Python, C#, Java, Matlab, etc.). I'm also willing to implement an algorithm by myself, as long as it is proven to be a goo...
I am creating a form within InfoPath which is to be integrated into a SharePoint 2007 Portal. Within this form there will be a textfield into which a user can enter the Name of a Person. How can I validate whether this Person exists or not? Instead of validating the user, is there a way to fill a dropdown List with al...
In InfoPath integrated with SharePoint 2007, there are a couple of approaches you can take to validate whether a person exists and to populate a dropdown list with usernames from Active Directory. ### 1. **Validating User Input in a Text Field** To validate whether the name entered in a text field corresponds to an e...
33,962
[ { "from": "human", "value": "I am creating a form within InfoPath which is to be integrated into a SharePoint 2007 Portal. Within this form there will be a textfield into which a user can enter the Name of a Person. \nHow can I validate whether this Person exists or not?\nInstead of validating the user, is ...
What is the Win32 API call to determine the system-wide font (in particular the color) for say Menus. This would be equivalent to going into Appearance Settings - Advanced - and then choosing Menu as the item to look at. I can use GetSysColor to find the colors of various system-wide window elements, but cannot find th...
In the Win32 API, you can retrieve system font settings using the `GetStockObject` function in conjunction with `SystemParametersInfo`. This allows you to get system-wide font information, including the font used for menus. To obtain the system font for menus, you can use the `SystemParametersInfo` function with the `...
32,911
[ { "from": "human", "value": "What is the Win32 API call to determine the system-wide font (in particular the color) for say Menus.\nThis would be equivalent to going into Appearance Settings - Advanced - and then choosing Menu as the item to look at.\nI can use GetSysColor to find the colors of various syst...
Recently, I started maintaining a web application which unfortunately works only with IE 6. Most of the issues are related to CSS. Is there any tool which can help me standardize the CSS classes to work with both IE 6 and IE 7? I understand I have to go through standards but I need something to start with quickly. Fire...
Maintaining a web application that only works with Internet Explorer 6 can indeed be quite challenging, especially due to the many differences in how CSS is handled in that browser compared to more modern standards. While there aren't many dedicated tools that specifically target compatibility between IE 6 and IE 7, th...
35,321
[ { "from": "human", "value": "Recently, I started maintaining a web application which unfortunately works only with IE 6. Most of the issues are related to CSS.\nIs there any tool which can help me standardize the CSS classes to work with both IE 6 and IE 7? I understand I have to go through standards but I ...
I havent used flash or action script much. I am planning a small project that i'd like to be online via flash but i'd like to reuse the code in my c/c++ projects Is there a script language i can use? i am thinking lua or python. After googling i found flua which is incomplete and jython. Can i use java in flash? would ...
Flash and ActionScript are technologies that have been largely deprecated in favor of more modern web technologies such as HTML5, CSS3, and JavaScript. However, if you are still interested in using Flash for your project, let's explore your options regarding scripting languages. 1. **ActionScript**: The primary langua...
35,297
[ { "from": "human", "value": "I havent used flash or action script much. I am planning a small project that i'd like to be online via flash but i'd like to reuse the code in my c/c++ projects\nIs there a script language i can use? i am thinking lua or python. After googling i found flua which is incomplete a...
I have a PHP website backed by a MySQL database and a small team of programmers submitting code to subversion. Typically we write code, test it locally, commit to subversion and then copy changed files to a hidden area for online testing. However mistakes can be made. Occasionally I want to refresh the site so that I...
To ensure that your PHP website and MySQL database accurately reflect the code in your Subversion repository, you can create a script or series of scripts that automate the process of updating both the code and the database. Below are steps and tips to create a one-click solution for refreshing your website: ### Steps...
32,690
[ { "from": "human", "value": "I have a PHP website backed by a MySQL database and a small team of programmers submitting code to subversion. Typically we write code, test it locally, commit to subversion and then copy changed files to a hidden area for online testing.\nHowever mistakes can be made. Occasio...
Our website connects to a database correctly when running the website locally using the built-in web server. But, when we deploy the site to our server running IIS, we get a database connection error. The database server is different from our IIS server. Note that a trusted connection to a different database on the ...
When you're trying to connect to a SQL database on a different server using a trusted connection while hosting your application on IIS, there are several steps you may need to follow to resolve the connection issue: 1. **Ensure Network Connectivity**: - Make sure that the IIS server can reach the database server ov...
35,635
[ { "from": "human", "value": "Our website connects to a database correctly when running the website locally using the built-in web server. But, when we deploy the site to our server running IIS, we get a database connection error. The database server is different from our IIS server. Note that a trusted c...
Is there any way of using Memcached for fragment caching in Rails?
Yes, you can use Memcached for fragment caching in Rails. Fragment caching allows you to cache parts of your views, which can significantly improve the performance of your application by reducing the time needed to render complex views. To use Memcached for fragment caching in a Rails application, follow these steps: ...
31,020
[ { "from": "human", "value": "Is there any way of using Memcached for fragment caching in Rails?\n" }, { "from": "gpt", "value": "Yes, you can use Memcached for fragment caching in Rails. Fragment caching allows you to cache parts of your views, which can significantly improve the performance of ...
Does anyone have any T4 example Templates (or links to same) that can be used to generate a Webservice? I'm thinking of the fact that I guess the Webservice is not just the Vb or Cs field but also requires an appropriate asmx file. I'm really not sure how to achieve this
Creating a web service using T4 templates involves generating various files, including the service implementation (in C# or VB.NET), the service definition, and potentially the ASMX file for ASP.NET web services. Below is a basic guide to help you set up T4 templates for generating a web service. ### Step-by-Step Guid...
28,872
[ { "from": "human", "value": "Does anyone have any T4 example Templates (or links to same) that can be used to generate a Webservice?\nI'm thinking of the fact that I guess the Webservice is not just the Vb or Cs field but also requires an appropriate asmx file.\nI'm really not sure how to achieve this\n" ...
How do you split a string? Lets say i have a string "dog, cat, mouse,bird" My actual goal is to insert each of those animals into a listBox, so they would become items in a list box. but i think i get the idea on how to insert those items if i know how to split the string. or does anyone know a better way to do this? i...
In C#, you can split a string using the `String.Split` method. Given your string `"dog, cat, mouse,bird"`, you can split it by the comma and then insert the resulting items into a ListBox. Below is an example of how you can achieve this in an ASP.NET Web Forms application. ### Example Code Assuming you have a ListBox...
35,073
[ { "from": "human", "value": "How do you split a string?\nLets say i have a string \"dog, cat, mouse,bird\"\nMy actual goal is to insert each of those animals into a listBox, so they would become items in a list box.\nbut i think i get the idea on how to insert those items if i know how to split the string. ...
Is there anyway to decompile java webstart application?
Yes, it is possible to decompile a Java Web Start application, though it's important to note that doing so may violate copyright laws and terms of service agreements. If you have the legal right to decompile the application (for example, if it’s your own application, or if you have permission from the copyright holder)...
32,778
[ { "from": "human", "value": "Is there anyway to decompile java webstart application? \n" }, { "from": "gpt", "value": "Yes, it is possible to decompile a Java Web Start application, though it's important to note that doing so may violate copyright laws and terms of service agreements. If you hav...
I'm trying to write a software synthesizer that recreates the sounds made by classic synthesizers like the Moog and the DX7. Does anyone know of any code resources for something like this? Thanks.
Creating a software synthesizer that emulates classic synthesizers like the Moog and the DX7 is an exciting project! Here are some code resources, libraries, and frameworks that can help you get started: ### 1. **JUCE** - **Website**: [JUCE](https://juce.com/) - JUCE is a widely-used C++ framework for building audio a...
34,376
[ { "from": "human", "value": "I'm trying to write a software synthesizer that recreates the sounds made by classic synthesizers like the Moog and the DX7. Does anyone know of any code resources for something like this? Thanks.\n" }, { "from": "gpt", "value": "Creating a software synthesizer tha...
Are there any known hash algorithms which input a vector of int's and output a single int that work similarly to an inner product? In other words, I am thinking about a hash algorithm that might look like this in C++: // For simplicity, I'm not worrying about overflow, and assuming |v| < 7. int HashVector(const vector<...
The type of hash function you've described is indeed similar to a linear combination of input values, and it can behave similarly to an inner product. Your approach, where you multiply each element of the input vector by a constant weight and sum the results (modulo some large number), is a common technique for hash fu...
34,598
[ { "from": "human", "value": "Are there any known hash algorithms which input a vector of int's and output a single int that work similarly to an inner product?\nIn other words, I am thinking about a hash algorithm that might look like this in C++:\n// For simplicity, I'm not worrying about overflow, and ass...