instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Imagine I have a document (word document). I have an enumeration which will indicate how to extract data from the document. So if I want just text, the images, or both (3 members of the enumeration). I have a case statement based on this enumeration, but without falling into a code smell, how can I write code which isn...
To handle different extraction modes from a document without falling into repetitive code or code smells, you can utilize a strategy design pattern. This allows you to encapsulate the behavior for each case into separate classes or methods, keeping your code clean and maintainable. Here’s a general approach you can fol...
39,628
[ { "from": "human", "value": "Imagine I have a document (word document).\nI have an enumeration which will indicate how to extract data from the document. So if I want just text, the images, or both (3 members of the enumeration).\nI have a case statement based on this enumeration, but without falling into a...
Apologies in advance for the long-winded question. I'm really a database programmer, but have inherited support of a classic-ASP intranet application which has recently been migrated from IIS 5 to a new server running IIS 6. The user-base is about a dozen, all using IE 6. The UI displays hierarchies of items returned f...
It seems like you've done a thorough job investigating the issue you're experiencing with your classic ASP application on IIS 6. The problem you described does indeed align with known quirks in Internet Explorer 6, especially regarding how it handles caching and loading images, particularly when generated dynamically t...
36,140
[ { "from": "human", "value": "Apologies in advance for the long-winded question.\nI'm really a database programmer, but have inherited support of a classic-ASP intranet application which has recently been migrated from IIS 5 to a new server running IIS 6. The user-base is about a dozen, all using IE 6.\nThe ...
I am programming in C against a third party library (in HP/Mercury Loadrunner) that allows a varargs-style variable size argument list for one of it's functions. I want to call this function but I do not know up front how many arguments I will have. There is a function made by one of my predecessors that serves somewh...
In order to properly handle a variable number of arguments when calling `web_submit_data()` without hardcoding a large number of arguments, you can use the C standard library's variadic functions, specifically `stdarg.h`, which provides macros to access the variable arguments. However, since `web_submit_data()` require...
35,290
[ { "from": "human", "value": "I am programming in C against a third party library (in HP/Mercury Loadrunner) that allows a varargs-style variable size argument list for one of it's functions. I want to call this function but I do not know up front how many arguments I will have. \nThere is a function made by...
I'm coding a simple code editor for a very simple scripting language we use at work. My syntax highlighting code works fine if I do it on the entire RichTextBox (rtbMain) but when I try to get it to work on just that line, so I can run the function with rtbMain changes, it gets weird. I can't seem to figure out why. Am...
It seems that you are trying to apply syntax highlighting to a single line in a `RichTextBox`, and you've encountered some issues with your implementation. Let's analyze your current approach and identify potential problems while providing improvements. ### Key Issues: 1. **Incorrect Indexing**: When you're highlighti...
35,763
[ { "from": "human", "value": "I'm coding a simple code editor for a very simple scripting language we use at work. My syntax highlighting code works fine if I do it on the entire RichTextBox (rtbMain) but when I try to get it to work on just that line, so I can run the function with rtbMain changes, it gets ...
When should I continue to make derived classes, and when should I just add conditionals to my code? eg for a missile class Object; class Projectile : public Object; class Missile : public Projectile; class MissileGuided : public Missile; Or should I implement that last one in the missile's code? void Missile::Update(...
Deciding between using derived classes and incorporating conditionals within a method is a common design dilemma in object-oriented programming, especially when dealing with complex systems like game entities (missiles, projectiles, ships, etc.). Here are some guidelines to help you determine when to create derived cla...
33,872
[ { "from": "human", "value": "When should I continue to make derived classes, and when should I just add conditionals to my code?\neg for a missile\nclass Object;\nclass Projectile : public Object;\n\nclass Missile : public Projectile;\nclass MissileGuided : public Missile;\n\nOr should I implement that last...
For a system I need to convert a pointer to a long then the long back to the pointer type. As you can guess this is very unsafe. What I wanted to do is use dynamic_cast to do the conversion so if I mixed them I'll get a null pointer. This page says http://publib.boulder.ibm.com/infocenter/lnxpcomp/v7v91/index.jsp?topic...
Using `dynamic_cast` for type safety is a good idea when dealing with polymorphic types in C++. However, there are a few limitations and misunderstandings to clarify, especially when it comes to typecasting pointers to non-polymorphic types or using pointers as integers. ### Key Points to Consider: 1. **`dynamic_cast...
37,606
[ { "from": "human", "value": "For a system I need to convert a pointer to a long then the long back to the pointer type. As you can guess this is very unsafe. What I wanted to do is use dynamic_cast to do the conversion so if I mixed them I'll get a null pointer. This page says http://publib.boulder.ibm.com/...
I using a ASP.net. I need to copy all the session data (both session variables and session request variables) to String []. How can i do this? Also i need the reverse condition. How can i do this using Serialization concepts
In ASP.NET, session data is typically stored in a session state object. You can serialize the session variables to a string array and later deserialize them back to session variables. Below, I'll outline how you can do both tasks: copying session variables to a string array and restoring them from a string array using ...
34,799
[ { "from": "human", "value": "I using a ASP.net. I need to copy all the session data (both session variables and session request variables) to String []. How can i do this?\nAlso i need the reverse condition.\nHow can i do this using Serialization concepts\n" }, { "from": "gpt", "value": "In ASP....
Due to the nature of the live server I deploy to, my mail settings are using deliveryMethod="PickupDirectoryFromIis". I'm using log4net to send logs via email and I need find a way of getting it to do the same thing. I can see from the docs that there is an SmtpPickupDirAppender, which has a pickupDir setting. If I set...
To achieve your goal of making log4net's email logging configuration consistent with the IIS email delivery method without hardcoding the pickup directory, you'll have to programmatically retrieve the pickup directory that IIS uses. As of now, log4net does not provide a built-in way to automatically pull the `PickupDi...
37,380
[ { "from": "human", "value": "Due to the nature of the live server I deploy to, my mail settings are using deliveryMethod=\"PickupDirectoryFromIis\". I'm using log4net to send logs via email and I need find a way of getting it to do the same thing.\nI can see from the docs that there is an SmtpPickupDirAppen...
I need to have a set of overloaded functions in my code but I get convertion wanrings. Here is a test code: #include windows.h void f(DWORD arg){...} //void f(SIZE_T arg){} void main(void) { DWORD dword=0; SIZE_T size_t=dword; f(size_t); } The compiler gives warning: test.cpp(11) : warning C4244: 'argument' : conv...
The warning you're encountering is due to a potential loss of data when passing a `SIZE_T` value to a function that expects a `DWORD` parameter. This can happen because `SIZE_T` is typically an unsigned type that is larger than or equal to `DWORD`, and if `SIZE_T` exceeds `DWORD`, it could lead to data loss when the va...
35,020
[ { "from": "human", "value": "I need to have a set of overloaded functions in my code but I get convertion wanrings.\nHere is a test code:\n#include windows.h\n\nvoid f(DWORD arg){...}\n\n//void f(SIZE_T arg){}\n\nvoid main(void)\n{\nDWORD dword=0;\nSIZE_T size_t=dword;\nf(size_t);\n\n}\n\nThe compiler gives...
I came across a code snippet like this: Timestamp expiryDate = Timestamp.valueOf(dateStr + " " + "23:59:59.000"); Here dateStr is a string entered by the user in a form, in the format yyyy-mm-dd. Now the behavior of Timestamp.valueOf is such that it converts non-existent dates into appropriate proper dates. Say 31st J...
In Java, you can check if a date string is valid by using the `java.time` package, which provides a more modern and flexible API for date and time operations compared to the older `java.util.Date` and `java.util.Calendar`. Specifically, you can use the `LocalDate` class in combination with a `DateTimeFormatter` to achi...
39,684
[ { "from": "human", "value": "I came across a code snippet like this:\nTimestamp expiryDate = Timestamp.valueOf(dateStr + \" \" + \"23:59:59.000\"); \nHere dateStr is a string entered by the user in a form, in the format yyyy-mm-dd. Now the behavior of Timestamp.valueOf is such that it converts non-existent ...
In C++, is the return type considered part of the function signature? and no overloading is allowed with just return type modified.
In C++, the return type of a function is **not considered part of its signature**. The function signature in C++ includes only the function name and the types of its parameters (the parameter list). This means that you cannot overload functions based solely on the return type. For example, the following two functions...
40,510
[ { "from": "human", "value": "In C++, is the return type considered part of the function signature? and no overloading is allowed with just return type modified.\n" }, { "from": "gpt", "value": "In C++, the return type of a function is **not considered part of its signature**. The function signat...
When I select a file to attach in gmail compose screen, It automatically uploads the file to server without page refresh. I looked at the html source code via FireBug and have not seen a n iframe. How do they upload attachments? Thanks.
Gmail uses modern web technologies to handle file uploads seamlessly without a page refresh. While the specific implementation details are proprietary, the general approach typically involves the following: 1. **AJAX Requests**: When you select a file to upload, Gmail likely uses AJAX (Asynchronous JavaScript and XML)...
36,784
[ { "from": "human", "value": "When I select a file to attach in gmail compose screen, It automatically uploads the file to server without page refresh. I looked at the html source code via FireBug and have not seen a n iframe. How do they upload attachments?\nThanks.\n" }, { "from": "gpt", "value...
A friend of mine downloaded some malware from Facebook, and I'm curious to see what it does without infecting myself. I know that you can't really decompile an .exe, but can I at least view it in Assembly or attach a debugger? Edit to say it is not a .NET executable, no CLI header.
While it’s understandable to be curious about the inner workings of malware, running or analyzing malware on your personal machine can be risky. Instead, you should consider using a controlled environment for malware analysis. Here are some general steps and guidelines you can follow to safely analyze an executable fil...
37,016
[ { "from": "human", "value": "A friend of mine downloaded some malware from Facebook, and I'm curious to see what it does without infecting myself. I know that you can't really decompile an .exe, but can I at least view it in Assembly or attach a debugger? \nEdit to say it is not a .NET executable, no CLI he...
I need to avoid being vulnerable to SQL injection in my ASP.NET application. How might I accomplish this?
To avoid SQL injection vulnerabilities in your ASP.NET application, consider implementing the following best practices: ### 1. Use Parameterized Queries Instead of concatenating SQL queries with user inputs, use parameterized queries or stored procedures. This helps separate SQL logic from the data, ensuring that user...
36,398
[ { "from": "human", "value": "I need to avoid being vulnerable to SQL injection in my ASP.NET application. How might I accomplish this?\n" }, { "from": "gpt", "value": "To avoid SQL injection vulnerabilities in your ASP.NET application, consider implementing the following best practices:\n\n### 1...
Another angle: how do I browse all the XUL for a given chrome path, e.g. http://kb.mozillazine.org/Dev_:_Firefox_Chrome_URLs has a listing but seems to be out of date.
To browse and explore XUL (XML User Interface Language) files and associated resources for a given Chrome path in Firefox, you can follow these steps: 1. **Use the Chrome URL Structure**: Firefox utilizes a Chrome URL structure to organize its interface. You can access various XUL files through these Chrome URLs, whic...
38,018
[ { "from": "human", "value": "Another angle:\nhow do I browse all the XUL for a given chrome path, e.g.\nhttp://kb.mozillazine.org/Dev_:_Firefox_Chrome_URLs has a listing but seems to be out of date.\n" }, { "from": "gpt", "value": "To browse and explore XUL (XML User Interface Language) files an...
Where can I find the source code for SQLMembershipProvider (.NET2.0)? Is it available?
The SQLMembershipProvider is a part of the ASP.NET Membership System, which is included in the .NET Framework. While the full source code for the .NET Framework itself is not available, you can access the source code for many components of .NET through the .NET Reference Source website or through the .NET Core GitHub r...
40,030
[ { "from": "human", "value": "Where can I find the source code for SQLMembershipProvider (.NET2.0)? \nIs it available?\n" }, { "from": "gpt", "value": "The SQLMembershipProvider is a part of the ASP.NET Membership System, which is included in the .NET Framework. While the full source code for the...
I have some numbers of different length (like 1, 999, 76492, so on) and I want to convert them all to strings with a common length (for example, if the length is 6, then those strings will be: '000001', '000999', '076492'). In other words, I need to add correct amount of leading zeros to the number. int n = 999; strin...
In C++, there isn't a built-in function specifically for padding numbers with leading zeros, but you can easily achieve this using standard library functions. One way to do this is by using the `std::ostringstream` class from the `<sstream>` header. Here's a simple function that takes an integer and a desired length, t...
36,657
[ { "from": "human", "value": "I have some numbers of different length (like 1, 999, 76492, so on) and I want to convert them all to strings with a common length (for example, if the length is 6, then those strings will be: '000001', '000999', '076492'). \nIn other words, I need to add correct amount of leadi...
Is there a way to determine if the loop is iterating for the last time. My code looks something like this: int[] array = {1, 2, 3...}; StringBuilder builder = new StringBuilder(); for(int i : array) { builder.append("" + i); if(!lastiteration) builder.append(","); } Now the thing is I don't want to ap...
You can determine if you're on the last iteration of a loop without using an external counter by leveraging the properties of the `for-each` loop in Java. While the `for-each` loop itself does not provide a built-in way to track the current index or determine if it's the last iteration, you can achieve this by using a ...
37,223
[ { "from": "human", "value": "Is there a way to determine if the loop is iterating for the last time. My code looks something like this:\nint[] array = {1, 2, 3...};\nStringBuilder builder = new StringBuilder();\n\nfor(int i : array)\n{\n builder.append(\"\" + i);\n if(!lastiteration)\n builder....
It would also be useful to be able to check the "Requires Checkout" flag as well. I thought it might be a property on the SPDocumentLibrary object, but I can't see it. Do I need to look in one of the admin namespaces...?
In SharePoint, the "Requires Checkout" setting is not a direct property of the `SPDocumentLibrary` object. Instead, you can access this property through the `SPList` object that represents the document library. The `SPList` class provides a property called `EnableVersioning` and a couple of other properties that you ca...
37,488
[ { "from": "human", "value": "It would also be useful to be able to check the \"Requires Checkout\" flag as well. I thought it might be a property on the SPDocumentLibrary object, but I can't see it.\nDo I need to look in one of the admin namespaces...?\n" }, { "from": "gpt", "value": "In ShareP...
A while ago, I had a discussion with a colleague about how to insert values in STL maps. I preferred map[key] = value; because it feels natural and is clear to read whereas he preferred map.insert(std::make_pair(key, value)). I just asked him and neither of us can remember the reason why insert is better, but I am sure...
In C++, both `map[key] = value;` and `map.insert(std::make_pair(key, value));` can be used to insert values into an STL map, but they have different behaviors and implications that might lead to performance considerations or specific use cases where one might be preferred over the other. 1. **Behavior on Insertion**: ...
39,119
[ { "from": "human", "value": "A while ago, I had a discussion with a colleague about how to insert values in STL maps. I preferred map[key] = value; because it feels natural and is clear to read whereas he preferred map.insert(std::make_pair(key, value)).\nI just asked him and neither of us can remember the ...
(Warning - asp newbie) I have an aspx file with the tag <%@ Page Language=VB ... %> right at the beginning of the file. When calling this from my IIS server (http://localhost/myservice/default.aspx), this gives me the error This page contains the following errors: error on line 1 at column 2: StartTag: in...
The error you're encountering suggests that there's a problem with the ASP.NET page's syntax, specifically with the `@ Page` directive at the beginning of your .aspx file. Here are some common issues and solutions you can check for: 1. **Ensure the Directive is Correct**: Make sure that your `@ Page` directive is corr...
36,113
[ { "from": "human", "value": "(Warning - asp newbie) I have an aspx file with the tag\n <%@ Page Language=VB ... %>\n\nright at the beginning of the file.\nWhen calling this from my IIS server (http://localhost/myservice/default.aspx), this gives me the error \n\nThis page contains the following\n error...
Is there a way to have a function return a editable reference to some internal data. Here's an example I hope helps show what I mean. class foo { public int value; } class bar { bar() { m_foo = new foo(); m_foo.value = 42; } private m_foo; foo getFoo(){return m_foo;} } class main...
In C#, when you want to return a reference to an internal object and allow modifications to that object, you need to return the object itself rather than returning it by value. In your current example, you are returning the object `m_foo`, but the method `getFoo()` returns a copy of the `foo` instance, not a reference ...
39,773
[ { "from": "human", "value": "Is there a way to have a function return a editable reference to some internal data. Here's an example I hope helps show what I mean.\nclass foo\n{\n public int value;\n}\n\nclass bar\n{\n bar()\n {\n m_foo = new foo();\n m_foo.value = 42;\n }\n privat...
I have a list of objects, each with it's own checkbox, where the user can select multiple of these. The list is a result of a query. How can I mark in the view which checkboxes are already selected? There doesn't seem to be an in operator in the template language. I want something along the lines of: <input {% if id in...
In many template languages, there isn't a direct `in` operator to check for membership in a list. However, you can achieve the same goal by using other methods depending on the template engine you are using. Below are examples for a few common template languages. ### Django Template Language In Django templates, you ...
39,717
[ { "from": "human", "value": "I have a list of objects, each with it's own checkbox, where the user can select multiple of these. The list is a result of a query.\nHow can I mark in the view which checkboxes are already selected? There doesn't seem to be an in operator in the template language.\nI want somet...
What is forward reference in C with respect to pointers? Can I get an example?
In C programming, a forward reference typically refers to the situation where a pointer or a function is used before its actual declaration or definition in the code. This is a common scenario when dealing with pointers to structures or functions. ### Forward Reference with Pointers to Structures In C, when you defin...
39,703
[ { "from": "human", "value": "What is forward reference in C with respect to pointers?\nCan I get an example?\n" }, { "from": "gpt", "value": "In C programming, a forward reference typically refers to the situation where a pointer or a function is used before its actual declaration or definition ...
INPUT <logs> <logentry revision="648"> <author>nshmyrev</author> <date>2008-09-21T19:43:10.819236Z</date> <paths> <path action="M">/trunk/po/ru.pi</path> </paths> <msg>2008-09-21 Nickolay V. Shmyrev nshmyrev@yandex.ru * ru.po: Updated Russian translation.</msg> </logentry> <logentry revision="647"> <author>ckirbach...
To transform the provided XML log entries and ignore paths with the '.pi' extension, you can follow this structure: 1. Parse the log entries. 2. Check the file paths and filter out any that end with '.pi'. 3. Create a new XML structure with the desired format. Here’s how the modified XML would look based on your requ...
40,815
[ { "from": "human", "value": "INPUT\n<logs>\n<logentry revision=\"648\">\n<author>nshmyrev</author> \n<date>2008-09-21T19:43:10.819236Z</date> \n<paths>\n<path action=\"M\">/trunk/po/ru.pi</path> \n</paths>\n<msg>2008-09-21 Nickolay V. Shmyrev nshmyrev@yandex.ru * ru.po: Updated Russian translation.</msg> \n...
I've tried the following, but I was unsuccessful: ALTER TABLE person ALTER COLUMN dob POSITION 37;
The SQL statement you attempted to use to change the position of a column (in this case, `dob`) in the `person` table is not supported in most relational database management systems (RDBMS) like MySQL, PostgreSQL, SQL Server, etc. SQL does not provide a standard way to change the order of columns in a table through an ...
38,579
[ { "from": "human", "value": "I've tried the following, but I was unsuccessful:\nALTER TABLE person ALTER COLUMN dob POSITION 37;\n\n" }, { "from": "gpt", "value": "The SQL statement you attempted to use to change the position of a column (in this case, `dob`) in the `person` table is not support...
It' possible to use Junitperf with junit4? I've a simplet Junit4 test class with several tests and I want to do a TimedTest on single test of that class. How can I do that? To be more clear my Junit4 class is something like: public class TestCitta { @Test public void test1 {} @Test public void tes...
In JUnit 4, the structure and approach for creating performance tests have changed compared to JUnit 3. JUnit 4 doesn't have a built-in `TimedTest` class, but you can achieve similar functionality using the `@Test` annotation along with a simple timing mechanism. Here's how you can implement a timed test for a specifi...
38,633
[ { "from": "human", "value": "It' possible to use Junitperf with junit4?\nI've a simplet Junit4 test class with several tests and I want to do a TimedTest on single test of that class. How can I do that?\nTo be more clear my Junit4 class is something like:\npublic class TestCitta {\n\n @Test\n public v...
A customer's application "AppName" has its configuration files stored in CommonAppData. Under Windows XP that is C:\Documents and Settings\All Users\Application Data\AppName Under Windows Vista that is C:\ProgramData\AppName How do I get the correct foldername with VBScript?
In VBScript, you can determine the correct path to the Common Application Data directory based on the version of Windows that is being used. You can use the `WScript.Shell` object to access environment variables and the Windows Management Instrumentation (WMI) to find the operating system version. Here's a sample VBSc...
36,891
[ { "from": "human", "value": "A customer's application \"AppName\" has its configuration files stored in CommonAppData. \n\nUnder Windows XP that is C:\\Documents and Settings\\All Users\\Application Data\\AppName\nUnder Windows Vista that is C:\\ProgramData\\AppName\n\nHow do I get the correct foldername wi...
I am using Eclipse 3.3.2 with the Flex Builder Plugin (3.0.194161) and the Flex SDK 3.2. Recently the intellisense has started forgetting about everything in the flash.* package EXCEPT flash.errors.* The code still compiles, but attempting to automatically resolve something (CTRL+SPACE) removes any of the flash.* impor...
It seems like you're facing an issue with the Intellisense feature in Eclipse with the Flex Builder plugin, specifically relating to the `flash.*` package. Here are some troubleshooting steps and suggestions to resolve the issue: 1. **Check SDK Configuration**: Make sure that your project is correctly configured to us...
39,530
[ { "from": "human", "value": "I am using Eclipse 3.3.2 with the Flex Builder Plugin (3.0.194161) and the Flex SDK 3.2. Recently the intellisense has started forgetting about everything in the flash.* package EXCEPT flash.errors.*\nThe code still compiles, but attempting to automatically resolve something (CT...
I am implementing a tagging system on my website similar to one stackoverflow uses, my question is - what is the most effective way to store tags so that they may be searched and filtered? My idea is this: Table: Items Columns: Item_ID, Title, Content Table: Tags Columns: Title, Item_ID Is this too slow? Is there a b...
Your proposed schema for storing tags is on the right track, but it has some inefficiencies and could lead to issues with scalability and performance, especially if you expect a lot of tags or items. Here are some suggestions to improve your tagging system: ### Revised Database Schema 1. **Items Table**: - **Table...
39,641
[ { "from": "human", "value": "I am implementing a tagging system on my website similar to one stackoverflow uses, my question is - what is the most effective way to store tags so that they may be searched and filtered?\nMy idea is this:\nTable: Items\nColumns: Item_ID, Title, Content\n\nTable: Tags\nColumns:...
I saw this sentence in some matrials: "In Java, simple data types such as int and char operate just as in C." I am wondering that actually they are different in Java & C++? In C++, simple variables like the primitives in Java are assigned a memory address as well, so these primitive types in C++ can have a pointer as w...
Yes, you are correct in your observations about the differences between primitive types in Java and C++. ### Java: 1. **Primitive Types**: In Java, primitive data types (like `int`, `char`, `float`, etc.) are not objects, and they do not have methods or properties. When you declare a primitive type variable, it direct...
40,138
[ { "from": "human", "value": "I saw this sentence in some matrials:\n\"In Java, simple data types such as int and char operate just as in C.\"\nI am wondering that actually they are different in Java & C++?\nIn C++, simple variables like the primitives in Java are assigned a memory address as well, so these ...
I have two tables A and B. I would like to delete all the records from table A that are returned in the following query: SELECT A.* FROM A , B WHERE A.id = B.a_id AND b.date < '2008-10-10' I have tried: DELETE A WHERE id in ( SELECT a_id FROM B WHERE date < '2008-10-10') but that only works if the ...
To delete records from table A based on the results of a join with table B in both SQL Server and MySQL, you can use different approaches because of their differences in SQL syntax. Below are two methods you can use that should work on both systems. ### Method 1: Using JOIN For MySQL and SQL Server, you can use a `JO...
39,035
[ { "from": "human", "value": "I have two tables A and B. I would like to delete all the records from table A that are returned in the following query:\nSELECT A.*\nFROM A , B\nWHERE A.id = B.a_id AND\n b.date < '2008-10-10'\n\nI have tried:\nDELETE A \nWHERE id in (\n SELECT a_id \n FROM B \n WHE...
Our app encrypts a value using RC2 in C++ code and I wrote a decryption routine in .NET The problem is that it works fine on our dev server, which is Windows 2003 but fails on the Windows 2000 one. It's running the same code and I checked everything else and it seems there are differences in the way the 2 encrypt. Ha...
When you encounter differences in encryption results across different platforms or versions of an operating system, there are several factors that could be at play, especially when dealing with encryption algorithms like RC2. Here are some things to investigate that may help you resolve the issue: 1. **Key Size and Pa...
37,312
[ { "from": "human", "value": "Our app encrypts a value using RC2 in C++ code and I wrote a decryption routine in .NET \nThe problem is that it works fine on our dev server, which is Windows 2003 but fails on the Windows 2000 one. It's running the same code and I checked everything else and it seems there are...
So I've got a big text file which looks like the following: <option value value='1' >A <option value value='2' >B <option value value='3' >C <option value value='4' >D It's several hundred lines long and I really don't want to do it manually. The expression that I'm trying to use is: <option value='.{1,}' > Which is ...
It looks like you're trying to match a specific pattern in a text file but are encountering issues when using Vim and Notepad++. ### For Vim: In Vim, you can use the substitute command to find and replace text based on a pattern. To remove everything before "A", "B", "C", etc., you can use the following command: 1. ...
39,186
[ { "from": "human", "value": "So I've got a big text file which looks like the following:\n<option value value='1' >A\n<option value value='2' >B\n<option value value='3' >C\n<option value value='4' >D\n\nIt's several hundred lines long and I really don't want to do it manually. The expression that I'm tryin...
I'm looking for something like: svnserve stop
To stop an `svnserve` process, you typically need to terminate the running process associated with it. Unlike some services, `svnserve` doesn't have a built-in command to stop it directly like `svnserve stop`. Instead, you would handle it based on how `svnserve` was started. Here are a few common methods: ### Method 1...
39,978
[ { "from": "human", "value": "I'm looking for something like: \nsvnserve stop\n\n" }, { "from": "gpt", "value": "To stop an `svnserve` process, you typically need to terminate the running process associated with it. Unlike some services, `svnserve` doesn't have a built-in command to stop it direc...
I have to maintain a large number of classic ASP pages, many of which have tabular data with no sort capabilities at all. Whatever order the original developer used in the database query is what you're stuck with. I want to to tack on some basic sorting to a bunch of these pages, and I'm doing it all client side with j...
If you're looking for a character that visually represents the opposite direction of the caret (^) for indicating sort direction, you have a few options: 1. **Down Arrow**: You could use a downward arrow character like `↓` (U+2193) to represent descending sort order. It provides a clear visual indication of sorting in...
40,010
[ { "from": "human", "value": "I have to maintain a large number of classic ASP pages, many of which have tabular data with no sort capabilities at all. Whatever order the original developer used in the database query is what you're stuck with.\nI want to to tack on some basic sorting to a bunch of these page...
I am binding a TreeView to an XMLDataSource, the databindings are being generated automatically and the XML looks like this:- <Passengers> <Passenger> <PassengerName>Name1</PassengerName> </Passenger> <Passenger> <PassengerName>Name2</PassengerName> </Passenger> <Passenger> <PassengerName>Name3</P...
When working with a `TreeView` and an `XmlDataSource`, it's important to correctly bind the `TreeView` so that the nodes reflect the underlying data correctly, and the `SelectedNode.DataPath` should correspond to the actual node selected. If you're always seeing the path to the first passenger, it may indicate a couple...
37,958
[ { "from": "human", "value": "I am binding a TreeView to an XMLDataSource, the databindings are being generated automatically and the XML looks like this:-\n<Passengers>\n <Passenger>\n <PassengerName>Name1</PassengerName>\n </Passenger>\n <Passenger>\n <PassengerName>Name2</PassengerName>\n </Pass...
Consider the following trivial HTML page that throws an error: <html><head><script> throw new Error('oops'); alert('should not reach here'); </script></head></html> The user I am logged into Vista with is a member of both the Administrators and Debugger Users groups. If I run Internet Explorer on Vista as an admin...
Debugging JavaScript in Internet Explorer with User Account Control (UAC) enabled can indeed be tricky due to the security model in Vista and later versions of Windows. Here are some methods you can use to successfully debug JavaScript in Internet Explorer while adhering to UAC: ### Method 1: Run Visual Studio as Admi...
35,951
[ { "from": "human", "value": "Consider the following trivial HTML page that throws an error:\n<html><head><script>\n throw new Error('oops');\n alert('should not reach here');\n</script></head></html>\n\nThe user I am logged into Vista with is a member of both the Administrators and Debugger Users groups.\...
I am migrating an application from .NET 1.1 to .NET 2.0. Should I remove all uses of CollectionBase? If so, what is the best strategy for migration?
Migrating an application from .NET 1.1 to .NET 2.0 gives you the opportunity to take advantage of many improvements and features that have been introduced in the later version, including the generics feature. ### Should You Remove All Uses of `CollectionBase`? While it is not strictly necessary to remove all uses of ...
37,707
[ { "from": "human", "value": "I am migrating an application from .NET 1.1 to .NET 2.0. Should I remove all uses of CollectionBase? If so, what is the best strategy for migration?\n" }, { "from": "gpt", "value": "Migrating an application from .NET 1.1 to .NET 2.0 gives you the opportunity to take ...
I was at an interview for a C position in which they presented me with an idiom that I haven't previously encountered. This is a trick that simplifies implementation of various algorithms involving linked lists and I'm wondering if anybody else has encountered this. Say we have a linked list record defined so: typedef ...
The idiom you're encountering in the `insert_sorted` function is often referred to as the "pointer to pointer" technique. In this context, it allows you to manipulate the pointers to the linked list nodes directly, which simplifies the insertion process. Here's a bit more detail about your questions: ### 1. Name of th...
39,472
[ { "from": "human", "value": "I was at an interview for a C position in which they presented me with an idiom that I haven't previously encountered. This is a trick that simplifies implementation of various algorithms involving linked lists and I'm wondering if anybody else has encountered this.\nSay we have...
I'm using python\pyodbc and would like to access the second result set of a stored procedure. As near as I can tell, pyodbc does not support multiple result sets. Additionally, I can't modify the stored procedure. Are there any options to access the second result set using SQL or some other work-around? Perhaps create ...
Accessing multiple result sets from a stored procedure using `pyodbc` can be challenging since `pyodbc` does not directly support iterating through multiple result sets. However, there are some workarounds you can try: ### 1. Create a Wrapper Stored Procedure Since you cannot modify the original stored procedure, you ...
37,524
[ { "from": "human", "value": "I'm using python\\pyodbc and would like to access the second result set of a stored procedure. As near as I can tell, pyodbc does not support multiple result sets. Additionally, I can't modify the stored procedure. Are there any options to access the second result set using SQL ...
We have a My_list class that has a list of pointers to Abstract_things. To optimize on memory usage, all derived Things use one memory pool that is established with the "new and delete" stereotype. In order to size the pool properly during the initization of the application, the builder figures out which Thing is the...
The design challenge you're facing is quite common in software development, especially in scenarios where memory management is critical, such as in embedded systems. Here are several approaches you could consider to address the issue of managing the maximum pool size dynamically and automatically when new `Thing` class...
38,024
[ { "from": "human", "value": "We have a My_list class that has a list of pointers to Abstract_things. To optimize on memory usage, all derived Things use one memory pool that is established with the \"new and delete\" stereotype. In order to size the pool properly during the initization of the application,...
I've got 2 Questions: 1. I've sarted working around with Linq to XML and i'm wondering if it is possible to change an XML document via Linq. I mean, is there someting like XDocument xmlDoc = XDocument.Load("sample.xml"); update item in xmlDoc.Descendants("item") where (int)item .Attribute("id") == id ... 2. I alread...
Certainly! You can use LINQ to XML to both update and remove elements from an XML document. Here’s how you can do both operations: ### 1. Updating an Item in an XML Document To update an item in an XML document using LINQ to XML, you can use the `Descendants` method to find the relevant elements and then modify their...
38,745
[ { "from": "human", "value": "I've got 2 Questions:\n1.\nI've sarted working around with Linq to XML and i'm wondering if it is possible to change an XML document via Linq. I mean, is there someting like \nXDocument xmlDoc = XDocument.Load(\"sample.xml\");\n\nupdate item in xmlDoc.Descendants(\"item\")\nwher...
I need to extract multiple text/dropdown list fields from an asp.net form and format appropriately ready for sending to recipient via email. What's the best way of reading those fields without having to hard code each item such as: item1 = InputField1.Text; item2 = InputField2.Text; I will have about 10 or 20 items...
To extract multiple fields from an ASP.NET form without hardcoding each item, you can use a loop to iterate through all the controls on the form. This approach is flexible and scalable, allowing you to handle a varying number of input fields without modifying your code for each new field. Here's a general approach to ...
37,774
[ { "from": "human", "value": "I need to extract multiple text/dropdown list fields from an asp.net form and format appropriately ready for sending to recipient via email.\nWhat's the best way of reading those fields without having to hard code each item such as: \nitem1 = InputField1.Text; \nitem2 = InputFie...
I am the owner of a business that is building a new website application. My partner is the programmer who is doing the development and neither one of us has any real in-depth experience with Google Map API or it's polyline/polygon area capabilities. We need an easy way to capture inputs within our user admin area where...
To accomplish your project involving Google Maps API, polylines, and polygons, you'll need to consider both the front-end (user input and display) and the back-end (data storage and retrieval) aspects of the application. Below, I’ll guide you on how to approach this, including how to capture coordinates for storage in ...
34,241
[ { "from": "human", "value": "I am the owner of a business that is building a new website application. My partner is the programmer who is doing the development and neither one of us has any real in-depth experience with Google Map API or it's polyline/polygon area capabilities.\nWe need an easy way to captu...
We are developing a new web service and are looking into the "best practice" for returning errors in the soap response. We were looking into creating a error response object which every response would contain as a property. This seems a little heavy however and are wondering if it is possible to use the SOAP header ...
When developing a SOAP web service, handling errors effectively is crucial for both client and server-side interaction. Here are some best practices for returning errors in SOAP responses: ### Using SOAP Faults The standard way to communicate errors in SOAP is through **SOAP Faults**. A SOAP Fault provides a structure...
36,642
[ { "from": "human", "value": "We are developing a new web service and are looking into the \"best practice\" for returning errors in the soap response. \nWe were looking into creating a error response object which every response would contain as a property. This seems a little heavy however and are wonderi...
Say I have a class with a private dispatch table. $this->dispatch = array( 1 => $this->someFunction, 2 => $this->anotherFunction ); If I then call $this->dispatch[1](); I get an error that the method is not a string. When I make it a string like this: $this->dispatch = array( 1 => '$this->someFunction'...
In PHP, when you want to use private methods in a class with a dispatch table, you need to reference those methods correctly in the array. Your current attempt is using the method names directly without proper callback syntax. Here’s how you can structure your dispatch table to call private methods: ```php class Some...
38,051
[ { "from": "human", "value": "Say I have a class with a private dispatch table. \n$this->dispatch = array(\n 1 => $this->someFunction,\n 2 => $this->anotherFunction\n);\n\nIf I then call \n$this->dispatch[1]();\n\nI get an error that the method is not a string. When I make it a string like this: \n$thi...
Consider the following code in VB9: Dim text = "Line1<br/>Line2" Dim markup = <span><%= text %></span>.ToString While I was hoping markup would end up being <span>Line1<br/>Line2</span>, it actually evaluates to <span>Line1&lt;br/&gt;Line2</span>. Is there any way to get the value of the variable not to be HTML encode...
In VB.NET (or VB9, as you referred to it), the default behavior when using XML literals with interpolated expressions is to escape special characters (like `<` and `>`) for safety, which is why you're seeing `&lt;` and `&gt;` in your output. To achieve the desired output of `<span>Line1<br/>Line2</span>` without HTML ...
39,596
[ { "from": "human", "value": "Consider the following code in VB9:\nDim text = \"Line1<br/>Line2\"\nDim markup = <span><%= text %></span>.ToString\n\nWhile I was hoping markup would end up being <span>Line1<br/>Line2</span>, it actually evaluates to <span>Line1&lt;br/&gt;Line2</span>.\nIs there any way to get...
Does anyone know if the AjaxHelper in the ASP.NET MVC framework deals with degradation? For example, if you have an ActionLink that updates the content of a div, if JavaScript unavailable, will the page do a full postback by renderubg the page (via an action on a controller) and call the action specified in the ActionL...
In ASP.NET MVC, the AjaxHelper is designed to work with AJAX requests, which rely on JavaScript to update parts of the web page without requiring a full postback. This means that if JavaScript is disabled in the user's browser, the functionality provided by the AjaxHelper will not work as intended, and you will not get...
39,012
[ { "from": "human", "value": "Does anyone know if the AjaxHelper in the ASP.NET MVC framework deals with degradation?\nFor example, if you have an ActionLink that updates the content of a div, if JavaScript unavailable, will the page do a full postback by renderubg the page (via an action on a controller) an...
The following C# code takes 5 minutes to run: int i = 1; string fraction = ""; while (fraction.Length < 1000000) { fraction += i.ToString(); i++; } "Optimising it" like this causes it to run in 1.5 seconds: int i = 1; string fraction = ""; while (fraction.Length < 1000000) { // concatenating strings is muc...
The observed performance differences in your C# code arise from how string concatenation is handled in .NET. Let's break down the optimizations you applied and address the question about using `+` versus `string.Format()`. ### Explanation of Optimizations 1. **String Immutability**: Strings in C# are immutable, w...
35,950
[ { "from": "human", "value": "The following C# code takes 5 minutes to run:\nint i = 1;\nstring fraction = \"\";\nwhile (fraction.Length < 1000000)\n{\n fraction += i.ToString();\n i++;\n}\n\n\"Optimising it\" like this causes it to run in 1.5 seconds:\nint i = 1;\nstring fraction = \"\";\nwhile (fract...
Greetings! I'm calling a Web service from Javascript when a user clicks on a link. I need to get the coordinates where the user clicked so that I can display a DIV in an appropriate location. My client-side script looks like the following: var g_event; function DoWork(event, theId) { if (IsIE()) g_event ...
The issue you’re encountering stems from how event handling and the `window.event` object works in Internet Explorer, particularly in older versions like IE7. When you assign the `g_event` variable to `window.event`, it references the event object for the current event (the click event in this case). However, after the...
39,786
[ { "from": "human", "value": "Greetings!\nI'm calling a Web service from Javascript when a user clicks on a link. I need to get the coordinates where the user clicked so that I can display a DIV in an appropriate location. My client-side script looks like the following:\nvar g_event;\n\nfunction DoWork(eve...
Through profiling I've discovered that the sprintf here takes a long time. Is there a better performing alternative that still handles the leading zeros in the y/m/d h/m/s fields? SYSTEMTIME sysTime; GetLocalTime( &sysTime ); char buf[80]; for (int i = 0; i < 100000; i++) { sprintf(buf, "%4d-%02d-%02d %02d:%02d:%...
If `sprintf` is identified as a performance bottleneck in your code, there are several alternatives you can use that are often more efficient. One common approach in performance-critical code is to avoid the overhead of the formatted output functions by using `snprintf`, or even better, manually constructing the string...
38,410
[ { "from": "human", "value": "Through profiling I've discovered that the sprintf here takes a long time. Is there a better performing alternative that still handles the leading zeros in the y/m/d h/m/s fields?\nSYSTEMTIME sysTime;\nGetLocalTime( &sysTime );\nchar buf[80];\nfor (int i = 0; i < 100000; i++)\n...
I've looked at the ReaderWriterLock in .NET 2.0 and the ReaderWriterLockSlim in .NET 3.5, and the slim version doesn't use kernel objects for the locking. For my context, which can potentially generate a large (but not huge) amount of objects, this sounds better. But the code I write needs to be used in both .NET 2.0 a...
If you need similar functionality to `ReaderWriterLockSlim` in .NET 2.0, while still supporting a `ReaderWriterLock`, you have a few options. One approach is to create a wrapper class that mimics the behavior of `ReaderWriterLockSlim` using `ReaderWriterLock`. Here's a simple implementation that encapsulates the `Rea...
39,258
[ { "from": "human", "value": "I've looked at the ReaderWriterLock in .NET 2.0 and the ReaderWriterLockSlim in .NET 3.5, and the slim version doesn't use kernel objects for the locking. For my context, which can potentially generate a large (but not huge) amount of objects, this sounds better.\nBut the code I...
Just about every piece of example code everywhere omits error handling (because it "confuses the issue" that the example code is addressing). My programming knowledge comes primarily from books and web sites, and you seldom see any error handling in use at all there, let alone good stuff. Where are some places to see g...
Error handling is a critical aspect of programming, and while it's true that many examples omit it for simplicity, there are several resources where you can find good examples of error handling in C++. Here are some specific recommendations: ### Books 1. **"Effective C++" by Scott Meyers** - This book discusses best p...
32,382
[ { "from": "human", "value": "Just about every piece of example code everywhere omits error handling (because it \"confuses the issue\" that the example code is addressing). My programming knowledge comes primarily from books and web sites, and you seldom see any error handling in use at all there, let alone...
I'm looking at the new object initializers in C# 3.0 and would like to use them. However, I can't see how to use them with something like Microsoft Unity. I'm probably missing something but if I want to keep strongly typed property names then I'm not sure I can. e.g. I can do this (pseudo code) Dictionary<string,object...
You're correct that using object initializers in C# with a strongly-typed approach is a bit tricky, especially when dealing with dependency injection frameworks like Microsoft Unity. The challenge arises because object initializers typically work with properties that can be accessed directly and are not well-suited for...
38,626
[ { "from": "human", "value": "I'm looking at the new object initializers in C# 3.0 and would like to use them. However, I can't see how to use them with something like Microsoft Unity. I'm probably missing something but if I want to keep strongly typed property names then I'm not sure I can. e.g. I can do th...
I've been using Visual Studio as my main IDE for a while now (I still use Emacs for some personal projects, though). I like the way Emacs formats C/C++ code and I'd like to convince Visual Studio use similar conventions for C# code. For instance, in Emacs, a C function call looks like: functionName(argument1, ...
Yes, you can customize the code formatting rules in Visual Studio to better match your preferred style for C#. While Visual Studio does not have built-in settings for every formatting nuance (like the exact alignment you want), you can make several adjustments in the options menu and through the use of external tools. ...
39,325
[ { "from": "human", "value": "I've been using Visual Studio as my main IDE for a while now (I still use Emacs for some personal projects, though).\nI like the way Emacs formats C/C++ code and I'd like to convince Visual Studio use similar conventions for C# code. For instance, in Emacs, a C function call loo...
SVN and CVS are two very different systems that aim to address the same basic issue - source control. They both work in distinct ways, so it's probably difficult to deal with them exactly the same. What I'm wondering is, would it be conceivable to develop a programming library or API that exposes the same interface, bu...
Creating a unified API or library that abstracts the differences between SVN (Subversion) and CVS (Concurrent Versions System) is a feasible but challenging task. Here are some considerations and suggestions for approaching this project: ### Feasibility 1. **Common Functionality**: Both SVN and CVS serve the primary ...
35,937
[ { "from": "human", "value": "SVN and CVS are two very different systems that aim to address the same basic issue - source control.\nThey both work in distinct ways, so it's probably difficult to deal with them exactly the same.\nWhat I'm wondering is, would it be conceivable to develop a programming library...
How do I implement a circular list that overwrites the oldest entry when it's full? For a little background, I want to use a circular list within GWT; so using a 3rd party lib is not what I want.
To implement a circular list in Java that overwrites the oldest entry when it's full, you can create a class that uses an array to store the elements and maintains an index to keep track of the position to overwrite. Below is a simple implementation of such a circular list: ```java public class CircularList<T> { p...
30,891
[ { "from": "human", "value": "How do I implement a circular list that overwrites the oldest entry when it's full? \nFor a little background, I want to use a circular list within GWT; so using a 3rd party lib is not what I want.\n" }, { "from": "gpt", "value": "To implement a circular list in Java...
I recently downloaded Rob Conery's excellent ASP.NET Storefront reference application and am finding it incredibly instructive. One question that comes to mind is where one should place the Model classes (and the Data classes upon which they depend). The MVC project template creates a Model folder. But it seems to m...
You've raised an excellent point regarding the organization of your Model classes in an ASP.NET MVC application. The decision on where to place your Model classes—and particularly your Data classes—can indeed have implications for maintainability, reusability, and project organization. ### Pros of Separating Model int...
38,178
[ { "from": "human", "value": "I recently downloaded Rob Conery's excellent ASP.NET Storefront reference application and am finding it incredibly instructive. One question that comes to mind is where one should place the Model classes (and the Data classes upon which they depend). The MVC project template c...
I have seen C# code that uses the @ to tell the compiler the string has newlines in it and that it should be all in one line. Is there something like that for C/C++? Like if I want to put something like: 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 85861560789112...
In C and C++, there isn't a direct equivalent to C#'s verbatim string literals that allows you to write multiline strings in a way that the compiler treats them as a single line. However, there are a couple of alternatives to achieve the same effect. ### 1. Using String Literals with Line Continuations In C and C++, ...
34,286
[ { "from": "human", "value": "I have seen C# code that uses the @ to tell the compiler the string has newlines in it and that it should be all in one line.\nIs there something like that for C/C++?\nLike if I want to put something like:\n73167176531330624919225119674426574742355349194934\n96983520312774506326...
I'm using (GNU) Make in my project. I'm currently putting one makefile per directory and specify the subdirectories using SUBDIRS. It's been suggested to me that this is not the ideal way of using make, that using a one toplevel make file (or several, split up using include). I've tried migrating/using this layout in t...
Using recursive makefiles—where each subdirectory has its own Makefile that invokes the top-level Makefile—has its benefits and drawbacks. Here's a breakdown to help you weigh your options: ### Benefits of Using Recursive Makefiles: 1. **Modularity**: Each subdirectory can be treated as an independent module, which c...
38,007
[ { "from": "human", "value": "I'm using (GNU) Make in my project. I'm currently putting one makefile per directory and specify the subdirectories using SUBDIRS.\nIt's been suggested to me that this is not the ideal way of using make, that using a one toplevel make file (or several, split up using include). I...
I have started using Linq to SQL in a (bit DDD like) system which looks (overly simplified) like this: public class SomeEntity // Imagine this is a fully mapped linq2sql class. { public Guid SomeEntityId { get; set; } public AnotherEntity Relation { get; set; } } public class AnotherEntity // Imagine this is a...
The issue you're facing with `ObjectDisposedException` is indeed a common one when working with `LINQ to SQL`, especially when dealing with lazy loading of related entities. The `DataContext` that you're creating in the `SomeEntityRepository.Get` method is disposed after the method execution ends, which means that any ...
37,783
[ { "from": "human", "value": "I have started using Linq to SQL in a (bit DDD like) system which looks (overly simplified) like this:\npublic class SomeEntity // Imagine this is a fully mapped linq2sql class.\n{\n public Guid SomeEntityId { get; set; }\n public AnotherEntity Relation { get; set; }\n}\n\...
We have a COM object implemented with C++/ATL that includes a method which will return a DIB. We are also writing a .NET application that will use this COM object. Since we are writing both, we have the liberty of deciding how best to return this DIB from the COM object. To clarify, would it be best to return a nati...
When deciding how to return a DIB (Device Independent Bitmap) from a C++/ATL COM object to a .NET application, there are a few considerations regarding performance, memory management, and ease of use. Let's explore the options and then how you can work with the returned DIB in .NET. ### Options for Returning a DIB 1....
29,643
[ { "from": "human", "value": "We have a COM object implemented with C++/ATL that includes a method which will return a DIB. We are also writing a .NET application that will use this COM object. Since we are writing both, we have the liberty of deciding how best to return this DIB from the COM object. To c...
I'd like to use the Rhino JavaScript compiler to compile some JavaScript to .class bytecode files for use in a project. It seems like this should already exist, since there are groovyc, netrexxc, and jythonc tasks for Groovy, NetREXX(!) and Jython, respectively. Has anyone used or written such an Ant task, or can anyon...
Creating an Ant task for compiling JavaScript to Java bytecode using Rhino can be a great way to integrate JavaScript into your Java projects. While there may not be a widely recognized Ant task specifically for Rhino, you can create a custom task to achieve this. Below are some tips and steps on how to write such an A...
35,972
[ { "from": "human", "value": "I'd like to use the Rhino JavaScript compiler to compile some JavaScript to .class bytecode files for use in a project. It seems like this should already exist, since there are groovyc, netrexxc, and jythonc tasks for Groovy, NetREXX(!) and Jython, respectively. Has anyone used ...
I have two PHP files that I need to link. How can I link the files together using PHP? The effect I want is to have the user click a button, some information is proccessed on the page, and then the result is displayed in a different page, depending on the button the user clicked.Thanks
You can achieve this by using form submissions and redirections in PHP. Here's a simple way to link two PHP files together, where one file processes the user's input when they click a button, and the second file displays the results. ### Step 1: Create the First PHP File (form.php) This file contains the HTML form wi...
36,323
[ { "from": "human", "value": "I have two PHP files that I need to link. How can I link the files together using PHP? The effect I want is to have the user click a button, some information is proccessed on the page, and then the result is displayed in a different page, depending on the button the user clicked...
Writing the code for the user authentication portion of a web site (including account registration, logins, and password resets) is pretty simple, but what do you need to make a really good user authentication setup? For example, I'd consider not storing plaintext passwords to be a bare minimum requirement for a web s...
Building a robust user authentication system goes beyond merely implementing the basics like secure password storage. Here are some best practices and considerations to ensure a secure, user-friendly, and efficient authentication process: ### Password Handling 1. **Use Strong Hashing Algorithms:** - Store password...
35,215
[ { "from": "human", "value": "Writing the code for the user authentication portion of a web site (including account registration, logins, and password resets) is pretty simple, but what do you need to make a really good user authentication setup? For example, I'd consider not storing plaintext passwords to ...
Steve Yegge recently posted an interesting blog post on what he calls the universal design pattern. In there he details using prototypes as a modelling tool, instead of classes. I like the way this introduces less coupling compared to inheritance. But that is something one can get with classes as well, by implementing ...
Using prototypes as a modeling tool rather than relying on classes is a fundamental aspect of certain programming paradigms, particularly in JavaScript. The advantages of prototypes often arise from the flexibility they offer in terms of object creation, inheritance, and composition. Here are several key points and exa...
35,527
[ { "from": "human", "value": "Steve Yegge recently posted an interesting blog post on what he calls the universal design pattern. In there he details using prototypes as a modelling tool, instead of classes. I like the way this introduces less coupling compared to inheritance. But that is something one can g...
I'm trying to compile code from F# to use in Silverlight. I compile with: --noframework --cliroot "C:\program Files\Microsoft Silverlight\2.0.31005.0" --standalone This generates a standalone assembly that references the SL framework. But when I try to add a reference to the generated assembly, I get this error: You ...
When you're trying to create a Silverlight-compatible assembly using F#, and you encounter the error message "You can only add project references to other Silverlight projects in the solution," it typically indicates that Visual Studio is not recognizing your assembly as a valid Silverlight assembly. Here are some comm...
33,221
[ { "from": "human", "value": "I'm trying to compile code from F# to use in Silverlight. I compile with:\n--noframework --cliroot \"C:\\program Files\\Microsoft Silverlight\\2.0.31005.0\" --standalone\nThis generates a standalone assembly that references the SL framework. But when I try to add a reference to...
With so many languages and frameworks that exist, and with new ones appearing all the time, I don't have the time to download, install, and configure each one to evaluate it. In the past I've run across webapps that allow one to write or paste code into a window, and see the results in realtime in the browser, usually ...
There are several excellent online sandbox sites where you can experiment with various programming languages and frameworks in real-time. Here are some of my favorites categorized by technology: ### JavaScript and Front-End Frameworks 1. **CodePen** ([codepen.io](https://codepen.io/)): A powerful online code editor fo...
33,273
[ { "from": "human", "value": "With so many languages and frameworks that exist, and with new ones appearing all the time, I don't have the time to download, install, and configure each one to evaluate it. In the past I've run across webapps that allow one to write or paste code into a window, and see the res...
I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program. The alternatives I tried were: Boost.Python I liked the cleaner API produced by Boost.Python, but the fact that it...
I've encountered a variety of methods for wrapping C++ classes for use in Python, and each has its own strengths and weaknesses. Your experience with Boost.Python and SWIG reflects common considerations when choosing a binding tool. 1. **Boost.Python**: As you noted, it offers a clean and expressive API, making it rel...
39,049
[ { "from": "human", "value": "I'm currently working on a project were I had to wrap the C++ classes with Python to be able to script the program. So my specific experience also involved embedding the Python interpreter in our program.\nThe alternatives I tried were:\n\nBoost.Python\nI liked the cleaner API p...
What is the best way to do cross-platform handling of hidden files? (preferably in Python, but other solutions still appreciated) Simply checking for a leading '.' works for *nix/Mac, and file attributes work on Windows. However, this seems a little simplistic, and also doesn't account for alternative methods of hiding...
Handling hidden files in a cross-platform manner can indeed be tricky due to the differences in how operating systems define and treat hidden files. In Unix-like systems (Linux, macOS), a file is typically considered hidden if its name starts with a dot ('.'). In contrast, Windows uses file attributes to designate a fi...
35,219
[ { "from": "human", "value": "What is the best way to do cross-platform handling of hidden files?\n(preferably in Python, but other solutions still appreciated)\nSimply checking for a leading '.' works for *nix/Mac, and file attributes work on Windows. However, this seems a little simplistic, and also doesn'...
Sometimes while developing in Visual Studio IDE, when you use "Find in Files" dialog to find something, the search fails and you will see the following message in the "Find Results" window. No files were found to look in. Find stopped progress Once this message shows up, all the subsequent searches will result in t...
The issue you're experiencing in Visual Studio, where the "Find in Files" operation results in a message stating "No files were found to look in. Find stopped progress," can be attributed to a few potential causes. Here are some explanations and steps you can take to troubleshoot and potentially resolve the issue: ###...
36,123
[ { "from": "human", "value": "Sometimes while developing in Visual Studio IDE, when you use \"Find in Files\" dialog to find something, the search fails and you will see the following message in the \"Find Results\" window. \n\nNo files were found to look in. Find stopped progress\n\nOnce this message shows...
I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted. Can someone show me, using code, the simplest XNA implementation of drawing one or two lines on to the screen? Perhaps with a brief explanation (in...
Sure! XNA (which stands for XNA's Not an Acronym) is a set of tools provided by Microsoft for game development, and it's built on top of DirectX. While it can seem a bit convoluted, especially if you're coming from a more straightforward API like OpenGL, I can help you with a simple example to draw lines in XNA. Below...
29,554
[ { "from": "human", "value": "I've read a bunch of tutorials involving XNA (and it's various versions) and I still am a little confused on drawing primitives. Everything seems to be really convoluted.\nCan someone show me, using code, the simplest XNA implementation of drawing one or two lines on to the scr...
I want to implement an automated backup system for my site's SQL Server 2005 DB that will backup nightly to Amazon's S3 service. But since S3 charges both for space and bandwidth used, I would like to minimize the size of the files that I transfer in. What is the best way to achieve this? I should clarify that I'm not ...
Implementing an automated backup system for your SQL Server 2005 database that backs up to Amazon S3 can be a great way to ensure data safety while minimizing costs. To achieve this while minimizing the size of the backups and the associated bandwidth costs, consider the following strategies: ### 1. Backup Strategy #...
37,107
[ { "from": "human", "value": "I want to implement an automated backup system for my site's SQL Server 2005 DB that will backup nightly to Amazon's S3 service. But since S3 charges both for space and bandwidth used, I would like to minimize the size of the files that I transfer in. What is the best way to ach...
I'm wondering whether something like this is possible (and relatively easy to do), and if so, how I could do it? I would like to do band filtering on a wave file I'm reproducing. Something similar to the "Equalizer" you see in most Winamp-like applications. My idea is, however, not to equalize the sound, but to use ver...
Certainly! What you're trying to accomplish—filtering out specific frequency bands in audio—is definitely possible, but it requires some understanding of digital signal processing (DSP). ### 1. Using DirectSound: DirectSound itself does not provide built-in functionality for custom frequency filtering like an equaliz...
33,226
[ { "from": "human", "value": "I'm wondering whether something like this is possible (and relatively easy to do), and if so, how I could do it?\nI would like to do band filtering on a wave file I'm reproducing. Something similar to the \"Equalizer\" you see in most Winamp-like applications.\nMy idea is, howev...
I've been doing PHP/MySQL websites with shared hosting providers for the last couple years. The day-to-day process is basically: develop in Eclipse, one website per folder upload via FileZilla, one website per folder use PHPMyAdmin to create and manage your local and online databases and transfer data from one to anot...
Transitioning from PHP/MySQL to ASP.NET and SQL Server can be a rewarding process, but it does require some adjustments in your workflow and tools. Here are some pointers to help you optimize your development process and clarify your questions: ### 1. Visual Studio vs. Visual Web Developer Express - **Full Version Ben...
36,808
[ { "from": "human", "value": "I've been doing PHP/MySQL websites with shared hosting providers for the last couple years. The day-to-day process is basically:\n\ndevelop in Eclipse, one website per folder\nupload via FileZilla, one website per folder\nuse PHPMyAdmin to create and manage your local and online...
I have a WCF service with the following configuration: <system.serviceModel> <behaviors> <serviceBehaviors> <behavior name="MetadataEnabled"> <serviceDebug includeExceptionDetailInFaults="true" /> <serviceMetadata httpGetEnabled="true" /> </behavior> ...
The issue you are experiencing with your WCF service appears to stem from how you are trying to access the metadata endpoint. The `mexHttpBinding` is meant to provide metadata, but it is typically accessed through a specific URL pattern that is slightly different from what you're currently using. In WCF, metadata is u...
38,294
[ { "from": "human", "value": "I have a WCF service with the following configuration:\n<system.serviceModel>\n <behaviors>\n <serviceBehaviors>\n <behavior name=\"MetadataEnabled\">\n <serviceDebug includeExceptionDetailInFaults=\"true\" />\n <serviceMetadata...
I'm learning traditional Relational Databases (with PostgreSQL) and doing some research I've come across some new types of databases. CouchDB, Drizzle, and Scalaris to name a few, what is going to be the next database technologies to deal with?
The database landscape is constantly evolving, and while traditional relational databases like PostgreSQL continue to be powerful and widely used, several new technologies and paradigms are gaining traction. Here are some of the upcoming and emerging database technologies that you might want to explore: 1. **NoSQL Dat...
39,064
[ { "from": "human", "value": "I'm learning traditional Relational Databases (with PostgreSQL) and doing some research I've come across some new types of databases. CouchDB, Drizzle, and Scalaris to name a few, what is going to be the next database technologies to deal with?\n" }, { "from": "gpt", ...
Everytime I upload a file to my ASP.NET site, all users are logged out (aka, I guess their session become invalidated). Is there any way to "hotswap" the code in ASP.NET so that this doesn't happen? Compile before deploying etc. My deployment method is pretty simple through a SVN update. Thanks! /Niels
When you upload or modify files in an ASP.NET application, particularly if you are using the default configuration, it can cause the application to restart. This restart leads to a loss of session state for all users, which is likely why your users are getting logged out. Here are some strategies you can use to avoid ...
38,586
[ { "from": "human", "value": "Everytime I upload a file to my ASP.NET site, all users are logged out (aka, I guess their session become invalidated). \nIs there any way to \"hotswap\" the code in ASP.NET so that this doesn't happen? Compile before deploying etc. \nMy deployment method is pretty simple throug...
My WPF application generates sets of data which may have a different number of columns each time. Included in the output is a description of each column that will be used to apply formatting. A simplified version of the output might be something like: class Data { IList<ColumnDescription> ColumnDescriptions { get...
Yes, you can achieve a similar result using XAML data binding with the help of an `ItemsControl` instead of using a `DataGrid` with fixed columns. The idea is to create a dynamic column layout using data bindings in XAML. This would allow you to define your column headers and bindings in XAML based on your `ColumnDescr...
38,189
[ { "from": "human", "value": "My WPF application generates sets of data which may have a different number of columns each time. Included in the output is a description of each column that will be used to apply formatting. A simplified version of the output might be something like:\nclass Data\n{\n IList...
I am looking at embedding Lua in a C++ application I am developing. My intention is to use Lua to script what ordered operation(s) to perform for some given input, ie. receive a new work item in c++ program, pass details to Lua backend, Lua calls back into c++ to carry out necessary work, returns finished results. The...
Embedding Lua in a C++ application is a common approach for adding scripting capabilities to your application. Your use case of interacting with a large struct from Lua can indeed be approached in multiple ways, and each of the options you mentioned has its pros and cons. ### Option A: Pushing/Popping Members on the S...
34,518
[ { "from": "human", "value": "I am looking at embedding Lua in a C++ application I am developing. My intention is to use Lua to script what ordered operation(s) to perform for some given input, ie.\nreceive a new work item in c++ program, pass details to Lua backend, Lua calls back into c++ to carry out nece...
I have a loop (for item in @dataset) and I want, in each iteration, to get different data from another table and make some operations that will be printed in the view. I cant't get this data from the dataset used in the loop. How can I do this according to MVC? I can put the code into the loop, in the view, but I think...
In an MVC (Model-View-Controller) architecture, it's important to separate concerns effectively. Here’s how you can approach your situation while maintaining that separation and keeping your code clean. ### Option 1: Use a Service Layer 1. **Create a Service Class**: This service class will encapsulate the logic for ...
36,602
[ { "from": "human", "value": "I have a loop (for item in @dataset) and I want, in each iteration, to get different data from another table and make some operations that will be printed in the view. I cant't get this data from the dataset used in the loop.\nHow can I do this according to MVC? I can put the co...
Assume that the core project has a base entity and every plugin maybe extends the base entity. Solution structure : Application.Core.BaseClass Application.Module.SubClass (it's a plug in, maybe not available) Is any way to implement this mapping using NHibernate subclass?
Yes, you can implement this kind of mapping in NHibernate using the subclass mapping strategy. This allows you to create a base entity class and have your plugins (subclasses) inherit from this base class while maintaining a single table for all entities. Here’s how you can structure it: ### Step 1: Define Your Base ...
37,800
[ { "from": "human", "value": "Assume that the core project has a base entity and every plugin maybe extends the base entity.\nSolution structure :\nApplication.Core.BaseClass\nApplication.Module.SubClass (it's a plug in, maybe not available)\n\nIs any way to implement this mapping using NHibernate subclass? ...
What functionality does the yield keyword in Python provide? For example, I'm trying to understand this code1: def _get_child_candidates(self, distance, min_dist, max_dist): if self._leftchild and distance - max_dist < self._median: yield self._leftchild if self._rightchild and distance + max_dist >= se...
The `yield` keyword in Python is used to create a generator. A generator is a special type of iterator that allows you to iterate over a sequence of values, but instead of computing all the values at once and returning them (like a list), it computes them one at a time and yields them on demand. This makes generators m...
38,931
[ { "from": "human", "value": "What functionality does the yield keyword in Python provide?\nFor example, I'm trying to understand this code1:\ndef _get_child_candidates(self, distance, min_dist, max_dist):\n if self._leftchild and distance - max_dist < self._median:\n yield self._leftchild\n if ...
We had an ISP failure for about 10 minutes one day, which unfortunately occurred during a hosted exam that was being written from multiple locations. Unfortunately, this resulted in the loss of postback data for candidates' current page in progress. I can reconstruct the flow of events from the server log. However, of...
To assess the validity of extrapolating your findings from the 142 candidates to the entire set of 317, we need to consider a few key statistical principles. ### Extrapolation Validity 1. **Random Sampling**: If the 142 candidates you analyzed are a representative random sample of the entire population of 317 candidat...
38,588
[ { "from": "human", "value": "We had an ISP failure for about 10 minutes one day, which unfortunately occurred during a hosted exam that was being written from multiple locations.\nUnfortunately, this resulted in the loss of postback data for candidates' current page in progress.\nI can reconstruct the flow ...
A colleague and I are discussing best practices regarding ordering method parameters. The goal is to establish a standard in our organization to improve readability and productivity by giving our methods common signatures. We are merely establishing guidelines for the recent grads we are hiring. Example (userId is ...
When it comes to establishing standards for method parameter ordering, there are indeed several best practices that have been adopted in various programming communities. Here are some widely recognized guidelines that align with your reasoning as well as other common practices: 1. **Common Arguments First**: Placing c...
33,956
[ { "from": "human", "value": "A colleague and I are discussing best practices regarding ordering method parameters. The goal is to establish a standard in our organization to improve readability and productivity by giving our methods common signatures. We are merely establishing guidelines for the recent g...
I wonder if anyone could suggest the best way of looping through all the <option> s in a <select> element with jQuery, and building an array. Eg. Instead of the following, whereby a string ins passed to the autoCompleteArray(), $("#CityLocal").autocompleteArray( [ "Aberdeen", "Ada", "Adamsville", "...
You can achieve this by selecting all the `<option>` elements within your `<select>` element and using jQuery's `.each()` method to loop through them. You will then extract the text from each `<option>` and push it into an array. Here’s how you can do that: ```javascript // Initialize an empty array to hold the opti...
38,058
[ { "from": "human", "value": "I wonder if anyone could suggest the best way of looping through all the <option> s in a <select> element with jQuery, and building an array.\nEg.\nInstead of the following, whereby a string ins passed to the autoCompleteArray(),\n$(\"#CityLocal\").autocompleteArray(\n [...
Our application exposes queries by way of web services, and what we've found is that our clients often want custom queries, either by way of further limiting the results returned by specifying additional criteria, or by asking for things that we don't already expose. Now, we can take the approach of creating new method...
It sounds like you're encountering a common challenge in application design—balancing flexibility in querying with the stability and maintainability of your application. Your proposed named query mechanism is a solid approach, but there are several additional design patterns and techniques you might consider that could...
39,426
[ { "from": "human", "value": "Our application exposes queries by way of web services, and what we've found is that our clients often want custom queries, either by way of further limiting the results returned by specifying additional criteria, or by asking for things that we don't already expose.\nNow, we ca...
Is it advisable to use arrays in Javascript using tens of thousands of indexes? I have a database which contains a table of static data, meaning that it will never change. In this case would it be advisable to convert this table to a javascript array and look the info up in there when needed? Is this bad practice? The ...
Using a JavaScript array to handle tens of thousands of entries can be feasible, but there are several factors to consider regarding performance, memory usage, and best practices. ### Pros of Using Arrays 1. **Fast Access Time**: JavaScript arrays provide average time complexity of O(1) for accessing an element by in...
39,058
[ { "from": "human", "value": "Is it advisable to use arrays in Javascript using tens of thousands of indexes?\nI have a database which contains a table of static data, meaning that it will never change. In this case would it be advisable to convert this table to a javascript array and look the info up in the...
I have a large number of TIFF images that I’d need to use in a WPF program (.NET 3.5 SP1 specifically and using C#). Half of the TIFF files contain color images encoded using JPEG compression and they don’t work with WPF. The “Microsoft Office Document Imaging” application handles the files fine. As Windows itself does...
When dealing with TIFF images that use JPEG compression in a WPF application (especially on .NET 3.5 SP1), you do run into some limitations with the Windows Imaging Component (WIC) and WPF's default handling of TIFF files. Here are some options to work around these limitations: ### Option 1: Use Third-Party Libraries ...
37,772
[ { "from": "human", "value": "I have a large number of TIFF images that I’d need to use in a WPF program (.NET 3.5 SP1 specifically and using C#). Half of the TIFF files contain color images encoded using JPEG compression and they don’t work with WPF. The “Microsoft Office Document Imaging” application handl...
After upgrading my Visual C# 2008 Express Edition to .NET3.5, SP1, I've been unable to create new LINQ to SQL classes using a remotely connected database. I used to be able to do so fine. I open up a project (windows forms, class library, same behavior), and either use the New -> Linq To SQL classes method or go direct...
It sounds like you're experiencing issues with connecting to a SQL Server database after upgrading your Visual C# 2008 Express Edition to .NET 3.5 SP1. Here are a few steps you can take to troubleshoot and resolve the problem: ### 1. **Check SQL Server Installation** Ensure that your SQL Server is installed and run...
35,001
[ { "from": "human", "value": "After upgrading my Visual C# 2008 Express Edition to .NET3.5, SP1, I've been unable to create new LINQ to SQL classes using a remotely connected database. I used to be able to do so fine.\nI open up a project (windows forms, class library, same behavior), and either use the New ...
It seems that all of the documentation I can find about OpenGL-ES says something to the effect of "OpenGL-ES is just like OpenGL, but without a lot of stuff. For example, there's no glBegin or glEnd." Ok, that's great. So, what ELSE isn't there any of? Or is there a list of what's in? Or maybe a porting guide? (Spe...
OpenGL ES (OpenGL for Embedded Systems) is a subset of the OpenGL API, tailored for embedded systems like mobile devices and game consoles. As such, it omits many features of the full OpenGL to better suit the constraints of these platforms. Here’s a summary of the major differences, including features that are not pre...
35,443
[ { "from": "human", "value": "It seems that all of the documentation I can find about OpenGL-ES says something to the effect of \"OpenGL-ES is just like OpenGL, but without a lot of stuff. For example, there's no glBegin or glEnd.\"\nOk, that's great. So, what ELSE isn't there any of? Or is there a list o...
I need to make a mouseover menu that opens diagonally (from top-left to bottom-right).
Creating a mouseover menu that opens diagonally can be achieved with HTML, CSS, and a bit of JavaScript. Below, I'll provide a simple example that demonstrates this effect using a dropdown menu. The menu will appear when you hover over a button and will animate from the top-left to the bottom-right. ### HTML Structure...
36,374
[ { "from": "human", "value": "I need to make a mouseover menu that opens diagonally (from top-left to bottom-right). \n" }, { "from": "gpt", "value": "Creating a mouseover menu that opens diagonally can be achieved with HTML, CSS, and a bit of JavaScript. Below, I'll provide a simple example that...
I'm wondering if there are any simple ways to get a list of all fixed-width (monospaced) fonts installed on a user's system in C#? I'm using .net 3.5 so have access to the WPF System.Windows.Media namespace and LINQ to get font information, but I'm not sure what I'm looking for. I want to be able to provide a filtered ...
To retrieve a list of all fixed-width (monospaced) fonts installed on a user's system using C# in a .NET 3.5 environment, you can utilize the `System.Windows.Media` namespace in WPF. Here's how you can achieve this: 1. **Get all fonts**: Use `System.Windows.Media.Fonts.SystemFontFamilies` to obtain the list of availab...
32,891
[ { "from": "human", "value": "I'm wondering if there are any simple ways to get a list of all fixed-width (monospaced) fonts installed on a user's system in C#?\nI'm using .net 3.5 so have access to the WPF System.Windows.Media namespace and LINQ to get font information, but I'm not sure what I'm looking for...
What is the difference between using system() to execute a binary and using the combination of fork/execvp. Is there any security/portablility/performance difference.
Using `system()` and the combination of `fork()` and `execvp()` to execute a binary in a Unix-like operating system is fundamentally different in how they work, and there are various implications regarding security, portability, and performance for each approach. Let's examine these differences in detail: ### 1. Basic...
36,204
[ { "from": "human", "value": "What is the difference between using system() to execute a binary and using the combination of fork/execvp. \nIs there any security/portablility/performance difference.\n" }, { "from": "gpt", "value": "Using `system()` and the combination of `fork()` and `execvp()` t...
I have several branches in TFS (dev, test, stage) and when I merge changes into the test branch I want the automated build and deploy script to find all the updated SQL files and deploy them to the test database. I thought I could do this by finding all the changesets associated with the build since the last good build...
To tackle your requirements for working with branches in TFS (Team Foundation Server), we can address your two questions as follows: ### 1) How to Ensure that a Changeset is Associated with a Particular Build? In TFS, a build can be associated with one or more changesets, but sometimes this association may not be str...
38,830
[ { "from": "human", "value": "I have several branches in TFS (dev, test, stage) and when I merge changes into the test branch I want the automated build and deploy script to find all the updated SQL files and deploy them to the test database.\nI thought I could do this by finding all the changesets associate...
In SharePoint MOSS 2007, I have created a custom content type that I will be applying to a document library. One of the required fields is "Incoming Date" and another is the "Due Date". The Due Date is always 10 working days from the Incoming Date. The Incoming Date is when the mail room received the letter, not ne...
In SharePoint MOSS 2007, there's no built-in function to directly calculate working days (excluding weekends and holidays) in calculated columns. However, you can accomplish this with a workaround. While you cannot access Visual Studio or create custom code, you can still help streamline the process for your users usi...
39,911
[ { "from": "human", "value": "In SharePoint MOSS 2007, I have created a custom content type that I will be applying to a document library. One of the required fields is \"Incoming Date\" and another is the \"Due Date\". \nThe Due Date is always 10 working days from the Incoming Date. The Incoming Date is ...
Good evening I've got a little problem with my DataGridView in a .NET Windows Forms project. The grid is read-only and bound to a sortable BindingList<T> which contains custom business objects. My business object class does implement IEditableObject. Now the BeginEdit and EndEdit methods are called all the time while n...
Good evening, Matthias! It sounds like you're encountering an issue where the `DataGridView` is unnecessarily calling the `BeginEdit` and `EndEdit` methods of your business objects even though the grid is set to read-only. This behavior can be frustrating, especially when it’s not intended. Here are a few suggestions...
37,633
[ { "from": "human", "value": "Good evening\nI've got a little problem with my DataGridView in a .NET Windows Forms project. The grid is read-only and bound to a sortable BindingList<T> which contains custom business objects. My business object class does implement IEditableObject.\nNow the BeginEdit and EndE...
I have been given a .Hive file from a registry which i have to parse and use the contents as part of a html report(from this i assume i have to convert to text somehow). The whole thing must be done within the program so i cant just convert the hive file and then run it through my program. I currently have no idea how ...
Parsing a `.hive` file (which is typically a Windows Registry Hive file) programmatically can be a bit tricky, especially if you're not familiar with the structure of these files. However, you can accomplish this using libraries that can read the contents of a Hive file. Below are steps and code examples in Python that...
36,603
[ { "from": "human", "value": "I have been given a .Hive file from a registry which i have to parse and use the contents as part of a html report(from this i assume i have to convert to text somehow). The whole thing must be done within the program so i cant just convert the hive file and then run it through ...
I have a c# application that interfaces with the database only through stored procedures. I have tried various techniques for calling stored procedures. At the root is the SqlCommand class, however I would like to achieve several things: make the interface between c# and sql smoother, so that procedure calls look more...
Designing a smooth interface between C# and SQL stored procedures can significantly enhance maintainability, readability, and usability of your code. Here are several strategies and techniques that can help achieve your goals while working with stored procedures in C#: ### 1. **Repository Pattern** Using the Reposito...
31,151
[ { "from": "human", "value": "I have a c# application that interfaces with the database only through stored procedures. I have tried various techniques for calling stored procedures. At the root is the SqlCommand class, however I would like to achieve several things:\n\nmake the interface between c# and sql ...