instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
My applications installer offers the user the ability to run the application as a service through use of the srvany.exe application. To remove the application on uninstall, I've been using the application instsrv.exe with the following command: instsrv "myservice" REMOVE On Windows Server 2003, I encounter error 178...
Error 1783 in Windows typically indicates that the specified service is not responding. This error can occur for several reasons when trying to remove a service using `instsrv.exe`: 1. **Service Does Not Exist**: Ensure that the service you're trying to remove actually exists. You can verify this by checking the list ...
33,889
[ { "from": "human", "value": "My applications installer offers the user the ability to run the application as a service through use of the srvany.exe application. To remove the application on uninstall, I've been using the application instsrv.exe with the following command:\n\ninstsrv \"myservice\" REMOVE\n...
I'm writing a web application which uses windows authentication and I can happily get the user's login name using something like: string login = User.Identity.Name.ToString(); But I don't need their login name I want their DisplayName. I've been banging my head for a couple hours now... Can I access my organisation's...
Yes, you can access your organization's Active Directory (AD) to retrieve additional user information like their DisplayName from a web application. To do this, you will typically use the System.DirectoryServices namespace, which allows you to interact with Active Directory. Here’s a general outline of the steps you'l...
29,200
[ { "from": "human", "value": "I'm writing a web application which uses windows authentication and I can happily get the user's login name using something like:\n string login = User.Identity.Name.ToString();\n\nBut I don't need their login name I want their DisplayName. I've been banging my head for a couple...
Do you bother initialising java bean values? Say, for example: ([g|s]etters omitted) public class SomeClass { private String foo; private Date bar; private Baz someObject; } (Yes, this is a POJO being used as a bean rather than a Java Bean in the strictest sense) In the empty constructor, do you initia...
In Java, whether or not to initialize the fields of a bean (or any class) in the constructor often depends on your specific use case, coding style, and project conventions. Here are a few considerations to help you decide: ### Leave Them as Null 1. **Default Behavior**: In Java, instance variables (fields) are initia...
31,259
[ { "from": "human", "value": "Do you bother initialising java bean values? Say, for example:\n([g|s]etters omitted)\npublic class SomeClass {\n\n private String foo;\n\n private Date bar;\n\n private Baz someObject;\n\n}\n\n(Yes, this is a POJO being used as a bean rather than a Java Bean in the str...
I want to scale an image in C# with quality level as good as Photoshop does. Is there any C# image processing library available to do this thing?
Yes, there are several C# libraries that can help you scale images with a quality level comparable to Photoshop. Here are a few popular ones: 1. **ImageSharp**: - **Description**: ImageSharp is a modern, cross-platform, open-source library for image processing in .NET. It supports various image formats and provides...
30,285
[ { "from": "human", "value": "I want to scale an image in C# with quality level as good as Photoshop does. Is there any C# image processing library available to do this thing?\n" }, { "from": "gpt", "value": "Yes, there are several C# libraries that can help you scale images with a quality level ...
I was looking for something like Server.MapPath in the ASP.NET realm to convert the output of Assembly.GetExecutingAssembly().CodeBase into a file path with drive letter. The following code works for the test cases I've tried: private static string ConvertUriToPath(string fileName) { fileName = fileName.Replace("fi...
You're correct that there's typically a more elegant way to convert a `CodeBase` URI to a file path, and it's good to aim for a solution that handles various edge cases and different URI formats. The method you're currently using works for most cases, but it can be improved by using built-in .NET classes that handle U...
32,906
[ { "from": "human", "value": "I was looking for something like Server.MapPath in the ASP.NET realm to convert the output of Assembly.GetExecutingAssembly().CodeBase into a file path with drive letter.\nThe following code works for the test cases I've tried:\nprivate static string ConvertUriToPath(string file...
If I write Session["asdf"] = 234; In my asp.net web app, does this mean the client will have a cookie stored on their browser?
In an ASP.NET web application, when you use `Session["asdf"] = 234;`, it means you're storing a value in the session state on the server side. However, the way sessions are tracked can involve cookies, depending on the session state configuration. By default, ASP.NET uses a cookie to identify the session. This cookie ...
34,393
[ { "from": "human", "value": "If I write Session[\"asdf\"] = 234;\nIn my asp.net web app, does this mean the client will have a cookie stored on their browser?\n" }, { "from": "gpt", "value": "In an ASP.NET web application, when you use `Session[\"asdf\"] = 234;`, it means you're storing a value ...
I have a menu control inside of an updatepanel. When I hover over a selected item, and then move back off of it, the css class gets set to staticSubMenuItem instead of staticSubMenuItemSelected. Is there a fix for this? <asp:UpdatePanel runat="server"> <ContentTemplate> ...
The behavior you're experiencing with the `asp:Menu` control in an `UpdatePanel` is related to how ASP.NET handles state management and events, especially within asynchronous postbacks. The issue where the CSS class changes when you hover over a selected item can stem from the way the `Menu` control handles the `Static...
18,864
[ { "from": "human", "value": "I have a menu control inside of an updatepanel. When I hover over a selected item, and then move back off of it, the css class gets set to staticSubMenuItem instead of staticSubMenuItemSelected. Is there a fix for this?\n <asp:UpdatePanel runat=\"server\">\n ...
In developing software for the Pocket PC platform, I have been happily using the Pocket PC emulator that Microsoft provides with Visual Studio (and as a free download). It provides for much faster develop/deploy/test cycles. (Of course, I do still final testing on real hardware). I have also found that providing the...
Using the Pocket PC emulator does indeed require Microsoft Virtual PC to enable networking capabilities, which can be seen as an overhead for a lightweight tool. Unfortunately, the requirement to install Virtual PC is a standard part of the Pocket PC emulator setup as it relies on virtual networking for emulation. How...
32,812
[ { "from": "human", "value": "In developing software for the Pocket PC platform, I have been happily using the Pocket PC emulator that Microsoft provides with Visual Studio (and as a free download). It provides for much faster develop/deploy/test cycles. (Of course, I do still final testing on real hardwar...
I need to find two adjacent repeating digits in a string and replace with a single one. How to do this in Java. Some examples: 123345 should be 12345 77433211 should be 74321
You can achieve the task of replacing adjacent repeating digits in a string with a single one in Java by using a `StringBuilder` to construct the result while iterating through the input string. Below is a sample implementation of how you can do this: ```java public class RemoveAdjacentRepeatingDigits { public sta...
31,444
[ { "from": "human", "value": "I need to find two adjacent repeating digits in a string and replace with a single one. How to do this in Java. Some examples:\n123345 should be 12345\n 77433211 should be 74321\n" }, { "from": "gpt", "value": "You can achieve the task of replacing adjacent repeating...
I need to do a union of two tables using NHibernate and HQL. I have found very little help online, and I want to know if it is possible and if so how?
In HQL (Hibernate Query Language), you cannot directly perform a `UNION` operation like you would in SQL. However, you can achieve a similar result by using `JOIN` or `SELECT` with `WHERE` conditions if you are dealing with the same entity type. If you are working with different entity types and want to combine their r...
29,458
[ { "from": "human", "value": "I need to do a union of two tables using NHibernate and HQL. I have found very little help online, and I want to know if it is possible and if so how?\n" }, { "from": "gpt", "value": "In HQL (Hibernate Query Language), you cannot directly perform a `UNION` operation...
I have a script that successfully encrypts a credit card. I need it to work as a trigger, so that any insert done to the creditcard column automatically encrypts it. Right now, my trigger works BUT the creditcard column is a varchar. When an app tries to insert, I do this: DECLARE @encryptedCreditCardNumber varbinary(...
To convert the `varbinary(max)` result of your encryption back into a `varchar`, you'll need to use the `CONVERT` function in SQL Server. However, it's important to choose the correct character encoding to avoid any issues with the representation of your binary data. If you want to store the encrypted data in a `varch...
15,683
[ { "from": "human", "value": "I have a script that successfully encrypts a credit card. I need it to work as a trigger, so that any insert done to the creditcard column automatically encrypts it. Right now, my trigger works BUT the creditcard column is a varchar. When an app tries to insert, I do this:\n\nDE...
I met an interesting issue about C#. I have code like below. List<Func<int>> actions = new List<Func<int>>(); int variable = 0; while (variable < 5) { actions.Add(() => variable * 2); ++ variable; } foreach (var act in actions) { Console.WriteLine(act.Invoke()); } I expect it to output 0, 2, 4, 6, 8. How...
Yes, you are correct that in your current code, all the lambda expressions capture the same variable `variable`, which means they all refer to the final value of `variable` after the loop completes (which is 5). This is why you see the same output of 10 for each invocation. To work around this issue, you can create a ...
32,595
[ { "from": "human", "value": "I met an interesting issue about C#. I have code like below.\nList<Func<int>> actions = new List<Func<int>>();\n\nint variable = 0;\nwhile (variable < 5)\n{\n actions.Add(() => variable * 2);\n ++ variable;\n}\n\nforeach (var act in actions)\n{\n Console.WriteLine(act.I...
Apache/2.2.6 (Unix) DAV/2 mod_python/3.2.8 Python/2.4.4 configured ... One of apache processes spawns some long-running python script asynchronously, and apparently doesn't seem to collect its child process table entry. After that long-run-in-subprocess python script finishes - defunct python process has been left. # ...
When you encounter defunct (or "zombie") processes, it usually means that the parent process has not yet read the exit status of its child process, which allows the child to remain in the process table. In the context of Apache and mod_python, there are a few approaches to ensuring that Apache collects its child proces...
31,008
[ { "from": "human", "value": "Apache/2.2.6 (Unix) DAV/2 mod_python/3.2.8 Python/2.4.4 configured ...\n\nOne of apache processes spawns some long-running python script asynchronously, and apparently doesn't seem to collect its child process table entry. After that long-run-in-subprocess python script finishes...
I am considering to adopt ZFS and I would be happy to know your experience in both production and testing environment.
Adopting ZFS (Zettabyte File System) can be a great decision for managing data, especially in environments that require high reliability, scalability, and data integrity. Here are some key insights based on experiences in both production and testing environments: ### Benefits of ZFS: 1. **Data Integrity**: ZFS uses c...
28,197
[ { "from": "human", "value": "I am considering to adopt ZFS and I would be happy to know your experience in both production and testing environment.\n" }, { "from": "gpt", "value": "Adopting ZFS (Zettabyte File System) can be a great decision for managing data, especially in environments that req...
I have recently made use of the SrcSrv feature in the Debugging Tools For Windows, but have noticed that when I index the pdb with SVNIndex.cmd it does not pick up any of the files that are from an external link. Any suggestions ?
When using the SrcSrv feature with Debugging Tools for Windows, indexing PDB files can sometimes be tricky, especially when dealing with external source files or links that are not in the expected format. Here are some suggestions to help you troubleshoot the issue: 1. **Check Source Link Configuration**: Ensure that ...
31,260
[ { "from": "human", "value": "I have recently made use of the SrcSrv feature in the Debugging Tools For Windows, but have noticed that when I index the pdb with SVNIndex.cmd it does not pick up any of the files that are from an external link. \nAny suggestions ?\n" }, { "from": "gpt", "value": "W...
Quick add on requirement in our project. A field in our DB to hold a phone number is set to only allow 10 characters. So, if I get passed "(913)-444-5555" or anything else, is there a quick way to run a string through some kind of special replace function that I can pass it a set of characters to allow? Regex?
Yes, you can definitely use regular expressions (regex) to filter and sanitize the phone number input by allowing only specific characters. In your case, if you want to extract only the digits from the phone number and ignore characters like parentheses, dashes, and spaces, you can use the following approach in various...
31,664
[ { "from": "human", "value": "Quick add on requirement in our project. A field in our DB to hold a phone number is set to only allow 10 characters. So, if I get passed \"(913)-444-5555\" or anything else, is there a quick way to run a string through some kind of special replace function that I can pass it ...
I'd like a consistent and simple way to throw exceptions in JNI code; something that handles chained exceptions (implicitly from the env->ExceptionOccurred method, or explicitly by parameters, either way is good) and saves me looking up constructors every time I want to do this. All of the above is preferably in C, al...
Certainly! In JNI (Java Native Interface), handling exceptions consistently can be a bit cumbersome if you have to deal with it manually each time. Below is an approach to help you streamline the process of throwing exceptions, including handling chained exceptions, in C. ### Exception Handling Helper in C You can de...
24,479
[ { "from": "human", "value": "I'd like a consistent and simple way to throw exceptions in JNI code; something that handles chained exceptions (implicitly from the env->ExceptionOccurred method, or explicitly by parameters, either way is good) and saves me looking up constructors every time I want to do this....
Is anyone aware of any gems, tutorials, or solutions enabling a user to sign in to a website at one domain and automatically given access to other partner domains in the same session? I have two rails apps running, let's call them App-A and App-B. App-A has a database associated with it, powering the registration and ...
To achieve a seamless single sign-on (SSO) experience between your two Rails applications (App-A and App-B), you can use several approaches. Here are some recommended solutions and gems to consider: ### 1. **Using OAuth2/OpenID Connect** Implementing OAuth2 or OpenID Connect is a common way to enable SSO across multi...
31,206
[ { "from": "human", "value": "Is anyone aware of any gems, tutorials, or solutions enabling a user to sign in to a website at one domain and automatically given access to other partner domains in the same session? \nI have two rails apps running, let's call them App-A and App-B. App-A has a database associat...
My app crashes when I do the following in the applicationDidFinishLaunching event in the app delegate: _textures[mytex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@"a.png"]]; However when I replace @"a.png" with @"/Users/MyUserName/Desktop/MyProjectFolder/a.png" everything works fine. I've experimented ...
The issue you're experiencing is likely due to the way that the image resources are being bundled with your app. When you reference an image using `UIImage imageNamed:@"a.png"`, UIKit looks for that image in the app's main bundle. If the image isn't properly added to your app bundle, it will return `nil`, and attemptin...
31,760
[ { "from": "human", "value": "My app crashes when I do the following in the applicationDidFinishLaunching event in the app delegate:\n_textures[mytex] = [[Texture2D alloc] initWithImage: [UIImage imageNamed:@\"a.png\"]];\n\nHowever when I replace @\"a.png\" with\n@\"/Users/MyUserName/Desktop/MyProjectFolder/...
MDI Bug http://www.dicu.com/pics/bug_mdi.jpg That's what I get when I try to automatically maximize MDI children. The code is something like this: this.IsMdiContainer = true; child = new Form(); child.MdiParent = this; child.WindowState = FormWindowState.Maximized; child.Show(); Any ideas why do I get multiple control...
The issue you're encountering with multiple control buttons on your MDI children when you try to maximize them programmatically is likely related to how you're handling the MDI forms and their properties. When you set the `WindowState` of an MDI child form to `FormWindowState.Maximized` before calling the `Show()` met...
32,436
[ { "from": "human", "value": "MDI Bug http://www.dicu.com/pics/bug_mdi.jpg\nThat's what I get when I try to automatically maximize MDI children.\nThe code is something like this:\nthis.IsMdiContainer = true;\nchild = new Form();\nchild.MdiParent = this;\nchild.WindowState = FormWindowState.Maximized;\nchild....
I am new to Hibernate and attempting to run a java/spring example that retrieves data from a table in MS SqlServer. Everytime I try to run the program, the data source loads ok. But when spring tries to load the session facotry it gets the following error: Exception in thread "main" org.springframework.beans.factory.B...
The error you are encountering, `java.lang.NoClassDefFoundError: javax/transaction/TransactionManager`, typically indicates that a required class is missing from your classpath. In this case, it seems that the `javax.transaction.TransactionManager` class is not found, which is essential for transaction management in Hi...
28,454
[ { "from": "human", "value": "I am new to Hibernate and attempting to run a java/spring example that retrieves data from a table in MS SqlServer. Everytime I try to run the program, the data source loads ok. But when spring tries to load the session facotry it gets the following error:\nException in thread ...
I am trying to use MS access to connect to a Oracle database. I keep on getting the following error message: ORA-12154: TSN- could not resolve the connect identifier secified The Oracle Drivers OracleClient10g can verify that the database server exists. I have a section in my tsnnames.ora file that looks like this: UBA...
The error message "ORA-12154: TNS:could not resolve the connect identifier specified" usually indicates that the Oracle client is unable to find the connection details for the specified TNS service name in your `tnsnames.ora` file. Here are some troubleshooting steps you can take to resolve this issue: 1. **Verify the...
29,662
[ { "from": "human", "value": "I am trying to use MS access to connect to a Oracle database.\nI keep on getting the following error message:\nORA-12154: TSN- could not resolve the connect identifier secified\nThe Oracle Drivers OracleClient10g can verify that the database server exists.\nI have a section in m...
Delphi 2009, among some cool stuff, has also just got Anonymous methods. I've seen the examples, and the blog posts regarding anonymous methods, but I don't get them yet. Can someone explain why I should be excited?
Absolutely! Anonymous methods in Delphi 2009 are a significant addition that can enhance your coding experience and capabilities. Here are some key points that highlight why you should be excited about them: ### 1. **Improved Code Readability and Maintainability** Anonymous methods allow you to define function-like co...
33,449
[ { "from": "human", "value": "Delphi 2009, among some cool stuff, has also just got Anonymous methods. I've seen the examples, and the blog posts regarding anonymous methods, but I don't get them yet. Can someone explain why I should be excited?\n" }, { "from": "gpt", "value": "Absolutely! Anonym...
I just added asp.net calendar control in new page under sample folder in asp.net mvc beta application. when i execute the particaular page that i need and it shows the error following Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the sa...
The error message you're encountering, "Validation of viewstate MAC failed," typically occurs in ASP.NET applications due to issues with ViewState validation. This is especially common when working with ASP.NET Web Forms controls (like the Calendar control you added) in an ASP.NET MVC application, as MVC does not nativ...
25,909
[ { "from": "human", "value": "I just added asp.net calendar control in new page under sample folder in asp.net mvc beta application. when i execute the particaular page that i need and it shows the error following \nValidation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, e...
I'm working on keyboard input for a very basic kernel that I'm developing and I'm completely stuck. I can't seem to find any information online that can show me the information I need to know. My kernel is running in protected mode right now, so I can't use the real mode keyboard routines without jumping into real mode...
Accessing keyboard input from protected mode in x86 architecture involves interacting with the keyboard controller and handling interrupts. Here’s a general overview of how you can achieve this: ### Keyboard Controller Overview The keyboard is typically accessed through the following ports: - **Data Port**: `0x60` - T...
27,488
[ { "from": "human", "value": "I'm working on keyboard input for a very basic kernel that I'm developing and I'm completely stuck. I can't seem to find any information online that can show me the information I need to know.\nMy kernel is running in protected mode right now, so I can't use the real mode keyboa...
When using XmlDocument.Load , I am finding that if the document refers to a DTD, a connection is made to the provided URI. Is there any way to prevent this from happening?
Yes, when using `XmlDocument.Load` in .NET, if the XML document references a DTD (Document Type Definition), the XML parser may try to resolve the DTD by making a network request to the specified URI. This behavior can be undesirable, particularly for security or performance reasons. To prevent the `XmlDocument` from...
32,274
[ { "from": "human", "value": "When using XmlDocument.Load , I am finding that if the document refers to a DTD, a connection is made to the provided URI. Is there any way to prevent this from happening?\n" }, { "from": "gpt", "value": "Yes, when using `XmlDocument.Load` in .NET, if the XML documen...
Trying to create several layers of folders at once C:\pie\applepie\recipies\ without using several different commands, is there an easy way similar to Directory.CreateDirectory()
Yes, if you want to create multiple layers of folders at once in a single command without having to issue multiple commands, you can use the `Directory.CreateDirectory` method in C# (or similar methods in other programming languages). This method will create all necessary directories in the specified path if they do no...
34,491
[ { "from": "human", "value": "Trying to create several layers of folders at once C:\\pie\\applepie\\recipies\\\nwithout using several different commands, is there an easy way similar to Directory.CreateDirectory()\n" }, { "from": "gpt", "value": "Yes, if you want to create multiple layers of fold...
I'd like to format a duration in seconds using a pattern like H:MM:SS. The current utilities in java are designed to format a time but not a duration.
To format a duration in seconds to the `H:MM:SS` format in Java, you can manually compute the hours, minutes, and seconds from the total seconds. Here's a straightforward approach to do this: ```java public class DurationFormatter { public static String formatDuration(long seconds) { long hours = seconds /...
33,837
[ { "from": "human", "value": "I'd like to format a duration in seconds using a pattern like H:MM:SS. The current utilities in java are designed to format a time but not a duration.\n" }, { "from": "gpt", "value": "To format a duration in seconds to the `H:MM:SS` format in Java, you can manually c...
I know many people who use computers every day, who do not know how to select multiple items in a HTML select box/list. I don't want to use this control in my pages any more: Please pick 3 options: <select name="categories" size="10" multiple="yes"> So what user-friendly alternatives do you suggest? Perhaps have 10 ti...
You’re right to consider alternatives to the traditional HTML multiple select box, especially for non-technical users. Here are some user-friendly alternatives that can help convey the selection process more clearly: ### 1. **Checkboxes** Using a series of checkboxes is often the simplest and most intuitive option. Yo...
29,467
[ { "from": "human", "value": "I know many people who use computers every day, who do not know how to select multiple items in a HTML select box/list. I don't want to use this control in my pages any more:\nPlease pick 3 options:\n<select name=\"categories\" size=\"10\" multiple=\"yes\">\n\nSo what user-frien...
If I had a phone number like this string phone = "6365555796"; Which I store with only numeric characters in my database (as a string), is it possible to output the number like this: "636-555-5796" Similar to how I could if I were using a number: long phone = 6365555796; string output = phone.ToString("000-000-...
Certainly! You can format a phone number string in C# using string manipulation methods. Since you want to format a string containing only numeric characters, you can achieve this using the `String.Insert` method or by using string interpolation. Here's an example of how you can format a phone number stored as a strin...
29,661
[ { "from": "human", "value": "If I had a phone number like this \nstring phone = \"6365555796\";\n\nWhich I store with only numeric characters in my database (as a string), is it possible to output the number like this: \n\"636-555-5796\"\n\nSimilar to how I could if I were using a number: \nlong phone = ...
Could someone explain to me how Any-related annotations (@Any, @AnyMetaDef, @AnyMetaDefs and @ManyToAny) work in practice. I have a hard time finding any useful documentation (JavaDoc alone isn't very helpful) about these. I have thus far gathered that they somehow enable referencing to abstract and extended classes. I...
The `@Any`, `@AnyMetaDef`, `@AnyMetaDefs`, and `@ManyToAny` annotations in Hibernate are part of a flexible mapping system that allows you to create polymorphic associations, where an entity can refer to different types of entities, potentially from different classes, without being explicitly defined in the entity mode...
23,284
[ { "from": "human", "value": "Could someone explain to me how Any-related annotations (@Any, @AnyMetaDef, @AnyMetaDefs and @ManyToAny) work in practice. I have a hard time finding any useful documentation (JavaDoc alone isn't very helpful) about these.\nI have thus far gathered that they somehow enable refer...
When printing RFC documents on my A4 format printer I noticed that I print more than it is considered to be one page in RFC document. I figure this is because probably RFC is written in North American paper letter format (216 × 279 mm) and I want to use ISO A4 format (210 × 297 mm). Info on Paper size. So my question i...
To print RFC documents formatted for letter size on A4 paper such that each letter-size page fits on a separate A4 page, you can follow these steps using various methods or software. The key is to ensure that the printer settings and the document handling are configured correctly. ### Method 1: Using PDF Readers 1. **...
30,403
[ { "from": "human", "value": "When printing RFC documents on my A4 format printer I noticed that I print more than it is considered to be one page in RFC document. I figure this is because probably RFC is written in North American paper letter format (216 × 279 mm) and I want to use ISO A4 format (210 × 297 ...
I have this simple controller: public class OneController : Controller { [AcceptVerbs(HttpVerbs.Get)] public ActionResult Create() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(IList<TestModel> m) { return View(m); } } And a very simple vie...
The `NullReferenceException` you're encountering during the re-submit of the form with invalid data is typically due to the model binder not being able to re-bind the `IList<TestModel> m` parameter correctly. When validation fails and you return the view with the same model, the model binder is trying to bind the data ...
29,141
[ { "from": "human", "value": "I have this simple controller:\npublic class OneController : Controller\n{\n [AcceptVerbs(HttpVerbs.Get)]\n public ActionResult Create()\n {\n return View();\n }\n\n [AcceptVerbs(HttpVerbs.Post)]\n public ActionResult Create(IList<TestModel> m)\n {\n ...
I've just wasted the past two hours of my life trying to create a table with an auto incrementing primary key bases on this tutorial, The tutorial is great the issue I've been encountering is that the Create Target fails if I have a column which is a timestamp and a table that is called timestamp in the same table... W...
The issue you're encountering arises from the fact that the word `TIMESTAMP` in Oracle SQL can refer to a data type, and using it as a column name can lead to confusion, particularly when you're creating PL/SQL blocks like triggers. While Oracle allows the creation of a table with a column named `timestamp`, it may not...
32,413
[ { "from": "human", "value": "I've just wasted the past two hours of my life trying to create a table with an auto incrementing primary key bases on this tutorial, The tutorial is great the issue I've been encountering is that the Create Target fails if I have a column which is a timestamp and a table that i...
I am a little confused about null values and variables in .NET. (VB preferred) Is there any way to check the "nullness" of ANY given variable regardless of whether it was an object or a value type? Or does my null check have to always anticipate whether it's checking a value type (e.g. System.Integer) or an object? I ...
In .NET, especially when working in VB.NET, it's important to understand how nullability works for both reference types and value types. Here's a breakdown of how to handle null checks and manage potential null values in your code. ### Understanding Nulls in .NET 1. **Reference Types**: These can be assigned `Nothing...
31,631
[ { "from": "human", "value": "I am a little confused about null values and variables in .NET. (VB preferred)\nIs there any way to check the \"nullness\" of ANY given variable regardless of whether it was an object or a value type? Or does my null check have to always anticipate whether it's checking a value ...
How can I display a sort arrow in the header of the sorted column in a list view which follows the native look of the operating system?
To display a sort arrow in the header of a sorted column in a list view while following the native look of the operating system, you can follow these general steps, which will be applicable in different programming environments and frameworks. Below are the core principles to implement: ### 1. **Determine the Sort Dir...
29,183
[ { "from": "human", "value": "How can I display a sort arrow in the header of the sorted column in a list view which follows the native look of the operating system?\n" }, { "from": "gpt", "value": "To display a sort arrow in the header of a sorted column in a list view while following the native...
I am using a Cursor in my stored procedure. It works on a database that has a huge number of data. for every item in the cursor i do a update operation. This is taking a huge amount of time to complete. Almost 25min. :( .. Is there anyway i can reduce the time consumed for this?
Using a cursor in a stored procedure to process large sets of data can indeed lead to performance issues, especially when updating each item individually. Here are several strategies you can consider to improve the performance of your operation: ### 1. **Set-Based Operations Over Cursors** Instead of using a cursor to...
29,870
[ { "from": "human", "value": "I am using a Cursor in my stored procedure. It works on a database that has a huge number of data. for every item in the cursor i do a update operation. This is taking a huge amount of time to complete. Almost 25min. :( .. Is there anyway i can reduce the time consumed for this?...
I'm wondering how slow it's going to be switching between 2 databases on every call of every page of a site. The site has many different databases for different clients, along with a "global" database that is used for some general settings. I'm wondering if there would be much time added for the execution of each scrip...
When considering the performance implications of switching between multiple MySQL databases on each page load of a website, there are several factors to keep in mind: ### Database Connection Overhead 1. **Connection Time**: Establishing a new connection to a database server can be time-consuming due to network latenc...
32,360
[ { "from": "human", "value": "I'm wondering how slow it's going to be switching between 2 databases on every call of every page of a site. The site has many different databases for different clients, along with a \"global\" database that is used for some general settings. I'm wondering if there would be much...
I'm trying to access the message in a jthrowable while handing an exception generated when I fail to find a class. However, I am unable to access the message ID of getMessage() on the jthrowable object, and I don't know why. I've tried changing the signature of getMessage to "()Ljava/lang/String" (without the semicol...
From the code and information you've provided, it looks like you're trying to access the `getMessage` method of a `Throwable` in the Java Native Interface (JNI), but you're running into an issue where `GetMethodID` is returning `NULL`. This usually indicates that the method could not be found for some reason. Here are...
31,338
[ { "from": "human", "value": "I'm trying to access the message in a jthrowable while handing an exception generated when I fail to find a class. However, I am unable to access the message ID of getMessage() on the jthrowable object, and I don't know why. I've tried changing the signature of getMessage to \...
Is there a way to perform an HTTP GET request within a Visual Basic script? I need to get the contents of the response from a particular URL for processing.
Yes, you can perform an HTTP GET request in a Visual Basic script using the `MSXML2.ServerXMLHTTP` object, which is commonly used for making HTTP requests. Below is an example of how you can achieve this in a VBScript: ```vbscript Dim url, httpRequest, responseText ' Specify the URL you want to send the GET request t...
33,162
[ { "from": "human", "value": "Is there a way to perform an HTTP GET request within a Visual Basic script? I need to get the contents of the response from a particular URL for processing.\n" }, { "from": "gpt", "value": "Yes, you can perform an HTTP GET request in a Visual Basic script using the ...
I'm looking for someone to explain how to drag and drop in javascript, I want a horizontal line with some customizable images in it. I've had a look at the online tutorials for these but find them very hard to use.
Creating a drag-and-drop interface in JavaScript can be straightforward if broken down into manageable steps. Below, I will guide you through creating a simple horizontal line of customizable images that can be dragged and dropped. ### Step 1: HTML Structure First, set up your HTML. You will create a container for yo...
27,179
[ { "from": "human", "value": "I'm looking for someone to explain how to drag and drop in javascript, I want a horizontal line with some customizable images in it.\nI've had a look at the online tutorials for these but find them very hard to use.\n" }, { "from": "gpt", "value": "Creating a drag-an...
According to this http://perldoc.perl.org/UNIVERSAL.html I shouldn't use UNIVERSAL::isa() and should instead use $obj->isa() or CLASS->isa(). This means that to find out if something is a reference in the first place and then is reference to this class I have to do eval { $poss->isa("Class") } and check $@ and all tha...
The recommendation to avoid using `UNIVERSAL::isa()` in favor of the instance methods `$obj->isa()` or `CLASS->isa()` arises from a few considerations regarding code clarity, object-oriented programming principles, and potential pitfalls associated with `UNIVERSAL::isa()`. ### Reasons to Avoid `UNIVERSAL::isa()` 1. *...
31,082
[ { "from": "human", "value": "According to this\nhttp://perldoc.perl.org/UNIVERSAL.html\nI shouldn't use UNIVERSAL::isa() and should instead use $obj->isa() or CLASS->isa().\nThis means that to find out if something is a reference in the first place and then is reference to this class I have to do\neval { $p...
I have an s-expression bound to a variable in Common Lisp: (defvar x '(+ a 2)) Now I want to create a function that when called, evaluates the expression in the scope in which it was defined. I've tried this: (let ((a 4)) (lambda () (eval x))) and (let ((a 4)) (eval `(lambda () ,x))) But both of these create a ...
To achieve what you're looking for in Common Lisp, a good approach is to use a macro that captures the variables in the lexical environment where the expression is defined. This allows you to evaluate the expression correctly without relying on `eval`, which always evaluates in the global context. Here's a solution us...
32,551
[ { "from": "human", "value": "I have an s-expression bound to a variable in Common Lisp:\n(defvar x '(+ a 2))\n\nNow I want to create a function that when called, evaluates the expression in the scope in which it was defined. I've tried this:\n(let ((a 4))\n (lambda () (eval x)))\n\nand\n(let ((a 4))\n (e...
Is it possible to iterate collection and list only filtered object information while debugging in Visual Studio? I'd use Immediate window for that, but although it allows to execute methods on objects, it seems not to allow execute custom loop statements. Simplest example in ASP.NET: this.Page.Validate(); if (!this.Pag...
In Visual Studio's Immediate Window, you're correct that it doesn't support full C# constructs like loops or lambda expressions, making it somewhat tricky to filter and output information directly. However, there are a few workarounds you can utilize to achieve your goal without modifying your source code. ### 1. Usin...
32,586
[ { "from": "human", "value": "Is it possible to iterate collection and list only filtered object information while debugging in Visual Studio? I'd use Immediate window for that, but although it allows to execute methods on objects, it seems not to allow execute custom loop statements.\nSimplest example in AS...
I have an Ant script that needs to checkout a directory from Subversion. This works using svnant/svnkit. However, Subversion access is authenticated, and I do not want to store my user password in a file. Can I make svnkit pop up a password dialog? Or even better, make it use the same credential caching that subversiv...
Using `svnant` with `svnkit`, you can handle authentication for Subversion in a more secure manner without storing your password in a file. While `svnkit` does not directly provide a password dialog, you can use the following approaches to achieve your goal. ### Approach 1: Using System Properties If you want to avoi...
28,548
[ { "from": "human", "value": "I have an Ant script that needs to checkout a directory from Subversion. This works using svnant/svnkit. However, Subversion access is authenticated, and I do not want to store my user password in a file.\nCan I make svnkit pop up a password dialog? \nOr even better, make it use...
If I have a key set of 1000, what is a suitable size for my Hash table, and how is that determined?
When choosing a suitable size for a hash table, a common practice is to use a size that is approximately 1.5 to 2 times the number of keys you expect to store. This helps to minimize collisions and ensures efficient performance. For a key set of 1000, here’s how you might determine the appropriate size: 1. **Load Fa...
33,568
[ { "from": "human", "value": "If I have a key set of 1000, what is a suitable size for my Hash table, and how is that determined?\n" }, { "from": "gpt", "value": "When choosing a suitable size for a hash table, a common practice is to use a size that is approximately 1.5 to 2 times the number of ...
Is it possible to place an ActiveX control in a Google Earth placemark pop up? I have a proprietary third party activex control that I can put in embed in HTML. Would this work for Google Earth?
No, you cannot place an ActiveX control in a Google Earth placemark pop-up. Google Earth supports HTML content in placemarks, but it does not support ActiveX controls or any other forms of executable code for security reasons. Google Earth supports basic HTML, JavaScript, images, and some limited formatting for pop-u...
35,329
[ { "from": "human", "value": "Is it possible to place an ActiveX control in a Google Earth placemark pop up?\nI have a proprietary third party activex control that I can put in embed in HTML. Would this work for Google Earth?\n" }, { "from": "gpt", "value": "No, you cannot place an ActiveX contro...
Sometimes you're developing and you decide to commit, forgetting you created a few files on your project. Then a few days down the line your buddy gets your build out of Subversion and complains that some files appear to be missing. You realize, ah crap, I forgot to add those files! How can I get a list of the files th...
In Subversion, you can easily identify files that are not under version control by using the `svn status` command. This command will show you the status of files in your working copy. Specifically, files that are not under version control will be marked with a question mark (`?`). Here’s how to do it: 1. Open a termi...
33,066
[ { "from": "human", "value": "Sometimes you're developing and you decide to commit, forgetting you created a few files on your project. Then a few days down the line your buddy gets your build out of Subversion and complains that some files appear to be missing. You realize, ah crap, I forgot to add those fi...
I'm hoping to tap into some collective experience here, so What (if any) utility tables, or common fields do you always include in your database design? An example is that I always include an App_Errors table to store any uncaught exception information in, and an App_Audit table which stores all the edit information. I...
When designing a database for a globally accessible web application, particularly one resembling social networking platforms, incorporating certain utility tables and common fields can greatly enhance maintainability, performance, and usability. Here are several recommendations based on collective experience: ### Comm...
29,006
[ { "from": "human", "value": "I'm hoping to tap into some collective experience here, so What (if any) utility tables, or common fields do you always include in your database design?\nAn example is that I always include an App_Errors table to store any uncaught exception information in, and an App_Audit tabl...
I am a trying to learn C# .Net. I had written small (hobby) Analog Clock application in VB sometime ago(edit: VB6, to be precise), and I thought I will rewrite in C#.NET, as part of my learning process. In the VB application, I drew the hands of the clock in XOR Drawmode, so that I have to move the second hand, I just ...
In C#, there isn't a direct equivalent of the XOR drawing mode that you had in VB6. However, you can achieve similar functionality through other means. Below are two methods to manage redrawing the clock hands in a way that is efficient and effective for your clock application. ### Option 1: Using `ControlPaint.DrawRe...
30,215
[ { "from": "human", "value": "I am a trying to learn C# .Net.\nI had written small (hobby) Analog Clock application in VB sometime ago(edit: VB6, to be precise), and I thought I will rewrite in C#.NET, as part of my learning process.\nIn the VB application, I drew the hands of the clock in XOR Drawmode, so t...
Posting a stack overflow question on stackoverflow.com, how amusing :-) I'm running some recursive Ruby code and I get the: "Stack level too deep (SystemStackError)" (I'm quite sure the code works, that I'm not in an infinite recursive death spiral, but that is not the point anyway) Is there anyway to change the allowe...
It sounds like you have encountered the `SystemStackError` due to excessive recursion in your Ruby code. To address your original questions regarding stack size and depth: 1. **Ruby's Stack Level Management**: The error message you are seeing indicates that the call stack has exceeded its allowed limits. Ruby does hav...
33,849
[ { "from": "human", "value": "Posting a stack overflow question on stackoverflow.com, how amusing :-)\nI'm running some recursive Ruby code and I get the: \"Stack level too deep (SystemStackError)\"\n(I'm quite sure the code works, that I'm not in an infinite recursive death spiral, but that is not the point...
Surely there is a way to store a date value prior than 1-1-1900 in a column other than varchar? Or do I really have to break this out, and perform my own datetime library for date differences, sorting, and such? Yes, I understand how datetime's are actually stored (an integer value from a specific date), but I remember...
In most databases, the default `DATETIME` or `DATE` types typically do not support dates prior to 1900. However, there are several workarounds you can use to handle historical dates without resorting to storing them as `VARCHAR`. ### Workarounds: 1. **Use a `DATE` or `DATETIME` format and a custom offset:** You ca...
30,951
[ { "from": "human", "value": "Surely there is a way to store a date value prior than 1-1-1900 in a column other than varchar? Or do I really have to break this out, and perform my own datetime library for date differences, sorting, and such?\nYes, I understand how datetime's are actually stored (an integer v...
I'm getting this error: javax.servlet.ServletException: bean not found within scope on a page with this at the top. <jsp:useBean id="bean" type="com.example.Bean" scope="request" /> The class exists in the classpath, it worked this morning, and I don't get what not found within scope means. How is this caused and how...
The error you're encountering, `javax.servlet.ServletException: bean not found within scope`, typically indicates that the JSP page is trying to access a bean that has not been properly initialized or stored in the specified scope (in this case, the `request` scope). Here are some potential reasons and solutions to re...
30,024
[ { "from": "human", "value": "I'm getting this error:\njavax.servlet.ServletException: bean not found within scope\n\non a page with this at the top.\n<jsp:useBean id=\"bean\" type=\"com.example.Bean\" scope=\"request\" />\n\nThe class exists in the classpath, it worked this morning, and I don't get what not...
I'm getting ora-01475 whenever I try to insert a null value in a column (of type DateTime) after some records have already been inserted that have real date values. I'm using the OracleParameter constructor that takes the name and the value as an object (I assume the data type is then implied from the datatype of the ...
The ORA-01475 error you're encountering is often related to inserting or updating a NULL value in a column defined as `NOT NULL`, or it could also indicate issues with the way parameters are being handled in your query when NULL values are involved. Since you mentioned that your column is of type `DateTime`, it's possi...
33,155
[ { "from": "human", "value": "I'm getting ora-01475 whenever I try to insert a null value in a column (of type DateTime) after some records have already been inserted that have real date values. \nI'm using the OracleParameter constructor that takes the name and the value as an object (I assume the data type...
I have two windows services running on the same machine. Both the services uses private HttpListener listener; I specify the baseURL as "http://IPAddress:8080/" & "http://IPAddress:8081/" respectively for each of the services. Then I do the needful and call listener.Start(); The first service starts successfully at 808...
The error you are encountering indicates that the second HttpListener is trying to bind to the same port that the first one is already using, but your description suggests you are using different ports (8080 and 8081). Based on your questions, let's clarify a few points: 1. **Is it possible to start two HTTP listeners...
31,766
[ { "from": "human", "value": "I have two windows services running on the same machine. Both the services uses\nprivate HttpListener listener;\nI specify the baseURL as \"http://IPAddress:8080/\" & \"http://IPAddress:8081/\" respectively for each of the services. Then I do the needful and call\nlistener.Start...
I have written a simple PowerShell filter that pushes the current object down the pipeline if its date is between the specified begin and end date. The objects coming down the pipeline are always in ascending date order so as soon as the date exceeds the specified end date I know my work is done and I would like to le...
In PowerShell, there isn't a built-in way to "tell" upstream commands to stop processing their output based on the results of downstream filtering. However, you can accomplish your goal in a different way by using a combination of a filtering mechanism and the `Where-Object` cmdlet. Since the objects you're processing...
31,602
[ { "from": "human", "value": "I have written a simple PowerShell filter that pushes the current object down the pipeline if its date is between the specified begin and end date. The objects coming down the pipeline are always in ascending date order so as soon as the date exceeds the specified end date I kn...
I am trying to use the error model in ns2 with wireless links, I am using ns2.33. I tried the uniform error model and the markov chain model. No errors from ns but when I am trying to find the dropped packets due to corruption I can not find any of them using either the uniform or markov models. So please help me if I...
Your NS2 simulation script appears to be well-structured, but I can help identify some potential issues related to packet drops due to the error model you've implemented. Here are a few suggestions and troubleshooting steps: ### 1. Error Model Configuration Make sure that the error model is configured properly. Since ...
28,730
[ { "from": "human", "value": "I am trying to use the error model in ns2 with wireless links, I am using ns2.33. I tried the uniform error model and the markov chain model. No errors from ns but when I am trying to find the dropped packets due to corruption I can not find any of them using either the uniform...
I have a string encrypted in PHP that I would like to decrypt in C#. I used the tutorial below to do the encryption, but am having problems decrypting. Can anyone post an example on how to do this? http://www.sanity-free.org/131/triple_des_between_php_and_csharp.html
To decrypt a string that was encrypted in PHP using Triple DES in C#, you need to ensure that you are using the same parameters for encryption in both languages. Below, I'll provide a step-by-step example of how to decrypt a Triple DES-encrypted string from PHP in C#. ### PHP Encryption Example First, ensure that yo...
29,404
[ { "from": "human", "value": "I have a string encrypted in PHP that I would like to decrypt in C#. I used the tutorial below to do the encryption, but am having problems decrypting. Can anyone post an example on how to do this? \nhttp://www.sanity-free.org/131/triple_des_between_php_and_csharp.html\n" }...
I need to run a Linux CLI command and get its stdout output from C. I can use pipe() to create a pipe, then fork/exec, redirecting child's stdout descriptor into the pipe before calling exec(), and reading from the pipe in parent. Plus I'll need to wait on the child. Is there a simple call to do fork + redirect + exec ...
In C, you can achieve the desired behavior of executing a command, capturing its output, and getting its exit status by combining `pipe()`, `fork()`, `dup2()`, `exec()`, and `waitpid()` effectively. Unfortunately, there isn't a built-in single function that combines all these steps like `system()` or `popen()` does, bu...
27,693
[ { "from": "human", "value": "I need to run a Linux CLI command and get its stdout output from C.\nI can use pipe() to create a pipe, then fork/exec, redirecting child's stdout descriptor into the pipe before calling exec(), and reading from the pipe in parent. Plus I'll need to wait on the child.\nIs there ...
As a matter of fact you have smth like /java/src and /java/test. But then, how do you name packages/classes the unittests go to? The same as classes they are written against? And when refactoring comes, do you manually rename in /test? Please share your experience.
In Java projects, it's common to have a structured directory layout where source code and test code are separated, typically something like: ``` /java/src /com/example/project ClassA.java ClassB.java /java/test /com/example/project ClassATest.java ClassBTest.java ``` ### Naming...
29,585
[ { "from": "human", "value": "As a matter of fact you have smth like /java/src and /java/test. But then, how do you name packages/classes the unittests go to? The same as classes they are written against? And when refactoring comes, do you manually rename in /test? Please share your experience.\n" }, { ...
How can I deploy a custom authentication provider in MOSS 2007? Is there any provided functionality to do this (like a Sharepoint feature)? Or do I have to install it in the GAC on each box in the farm manually?
Deploying a custom authentication provider in Microsoft Office SharePoint Server (MOSS) 2007 can be somewhat complex, as MOSS does not natively provide a straightforward way to add custom authentication providers out of the box. However, you can achieve this through the following steps: ### Steps to Deploy a Custom Au...
28,660
[ { "from": "human", "value": "How can I deploy a custom authentication provider in MOSS 2007?\nIs there any provided functionality to do this (like a Sharepoint feature)?\nOr do I have to install it in the GAC on each box in the farm manually? \n" }, { "from": "gpt", "value": "Deploying a custom ...
Do any one know which sorting algorithm is used by .net when we implement IComparer in our class?
In .NET, when you implement the `IComparer` interface and use it for sorting collections (such as in the `Array.Sort` method or `List<T>.Sort` method), the sorting algorithm used is typically an implementation of the **QuickSort** algorithm. Specifically, the .NET Framework uses a variation of QuickSort called **Intros...
33,214
[ { "from": "human", "value": "Do any one know which sorting algorithm is used by .net when we implement IComparer in our class?\n" }, { "from": "gpt", "value": "In .NET, when you implement the `IComparer` interface and use it for sorting collections (such as in the `Array.Sort` method or `List<T>...
When I run selenium tests (written as nunit tests) from VS2008 I am getting: System.UnauthorizedAccessException : Access to the path /bin/Debug is denied. The test is trying to read an entry in App.Config. This file is copied to bin/Debug during compilation. I used unlocker to check file handles and it is VS2008 tha...
The `System.UnauthorizedAccessException` that you are encountering suggests that the Visual Studio environment has a lock on the `App.Config` file or the output directory (`/bin/Debug`), preventing your tests from accessing the necessary files. Here are some possible solutions to resolve this issue: 1. **Ensure Proper...
31,982
[ { "from": "human", "value": "When I run selenium tests (written as nunit tests) from VS2008 I am getting: \n\nSystem.UnauthorizedAccessException : Access to the path /bin/Debug is denied.\n\nThe test is trying to read an entry in App.Config. This file is copied to bin/Debug during compilation.\nI used unloc...
What's the different between SCSF and Acropolis ?
SCSF (Service Control and Security Framework) and Acropolis are terms that could refer to different concepts based on context. However, I'll provide a general overview of what these terms could represent in various domains. If you have a specific field or technology in mind, please let me know for a more tailored answe...
34,568
[ { "from": "human", "value": "What's the different between SCSF and Acropolis ?\n" }, { "from": "gpt", "value": "SCSF (Service Control and Security Framework) and Acropolis are terms that could refer to different concepts based on context. However, I'll provide a general overview of what these te...
In JUnit 3 I simply called suite.addTestSuite( MyTest.class ) However if MyTest is a JUnit 4 test which does not extend TestCase this doesn't work. What should I do instead to create a suite of tests?
In JUnit 4, the way to create a test suite is different from JUnit 3. You do not need to extend `TestCase`, and instead, you can use the `@RunWith` and `@Suite` annotations to create a test suite. Here’s how you can do it: 1. **Create a Test Suite Class**: You will create a class that uses the `@RunWith(Suite.class)` ...
31,479
[ { "from": "human", "value": "In JUnit 3 I simply called\nsuite.addTestSuite( MyTest.class )\n\nHowever if MyTest is a JUnit 4 test which does not extend TestCase this doesn't work. What should I do instead to create a suite of tests?\n" }, { "from": "gpt", "value": "In JUnit 4, the way to create...
I've written a DLL that monitors our netowork printer. The printer is connected to the server via USB cable. When I print something directly from the server, it displays information about pages sent/printed properly, but when I print something from one of the client computers it only displays its IP, sent/printed is al...
The behavior you're experiencing with the Winspool API when printing from client machines is a common one, especially when the printer is connected directly to the server via USB and shared over the network. Here are some key points to consider and potential approaches to work around the limitation you're facing: ### ...
25,346
[ { "from": "human", "value": "I've written a DLL that monitors our netowork printer. The printer is connected to the server via USB cable. When I print something directly from the server, it displays information about pages sent/printed properly, but when I print something from one of the client computers it...
Background My task is to, in SharePoint, show an image of a process map which should be clickable. Think of an imagemap in html. Some areas take you to other process map images and other brings up a pop-up window. "Connected" to each process map is a set of documents. These documents are stored in a document library. T...
Your idea of creating a custom web part to handle the process map and document library interactions is a solid approach. Here’s a more detailed breakdown of how you can achieve this, along with considerations to ensure you stay on the right track: ### Key Components of the Solution 1. **Custom Web Part**: As you ment...
29,206
[ { "from": "human", "value": "Background\nMy task is to, in SharePoint, show an image of a process map which should be clickable. Think of an imagemap in html. Some areas take you to other process map images and other brings up a pop-up window.\n\"Connected\" to each process map is a set of documents. These ...
In my experience it seems that most people will tell you that it is unwise to force a garbage collection but in some cases where you are working with large objects that don't always get collected in the 0 generation but where memory is an issue, is it ok to force the collect? Is there a best practice out there for doi...
Forcing garbage collection in managed environments, such as with the .NET Framework or Java, is generally not recommended for several reasons: 1. **Performance Implications**: Forcing a garbage collection (GC) can disrupt the normal optimization strategies of the runtime. The garbage collector is designed to operate e...
31,258
[ { "from": "human", "value": "In my experience it seems that most people will tell you that it is unwise to force a garbage collection but in some cases where you are working with large objects that don't always get collected in the 0 generation but where memory is an issue, is it ok to force the collect? I...
I've just recently setup a custom replication for my subscriber database, as described in another post here. Basically, when the publisher pushes a new record to the subscribers, the stored procedure will also insert a replicated time into an extra column in the table, and insert a new record to a log table. My problem...
It looks like you've encountered a common issue with transactional replication in SQL Server, particularly involving loopback detection. Here’s a brief overview of why setting `@loopback_detection = 'false'` resolves the problem, and how loopback detection works in the context of replication. ### Explanation of Loopba...
32,259
[ { "from": "human", "value": "I've just recently setup a custom replication for my subscriber database, as described in another post here. Basically, when the publisher pushes a new record to the subscribers, the stored procedure will also insert a replicated time into an extra column in the table, and inser...
I have a user interface that requires placing some round buttons in a C# project with some data behind them. The buttons are System.Windows.Forms.buttons and I have used a GIF image with transparency to create them. However, the transparent areas aren't transparent. I've looked for references online but haven't found...
To properly display transparent areas of GIF images in `System.Windows.Forms.Button` controls in a C# WinForms application, particularly in Visual Studio 2005, you can follow these steps: ### Method 1: Custom Button Class with Bitmap Since `Button` controls do not directly support transparent GIFs, you can create a c...
28,109
[ { "from": "human", "value": "I have a user interface that requires placing some round buttons in a C# project with some data behind them. The buttons are System.Windows.Forms.buttons and I have used a GIF image with transparency to create them. However, the transparent areas aren't transparent. I've looke...
How can i get rid of hard coding in creating a new EntityKey in Entity Framework
In Entity Framework, hard coding values into the `EntityKey` when creating or retrieving entities can lead to code that is difficult to maintain and can introduce errors if the underlying structure of the entity changes. Instead of hard coding, you can utilize several techniques to make your code more dynamic and maint...
31,892
[ { "from": "human", "value": "How can i get rid of hard coding in creating a new EntityKey in Entity Framework\n" }, { "from": "gpt", "value": "In Entity Framework, hard coding values into the `EntityKey` when creating or retrieving entities can lead to code that is difficult to maintain and can ...
I have an authentication script (CheckLogin.aspx), and if any of the credentials do not match my application will redirect (via Server.Transfer) to the access denied page (forbidden.aspx). Each time my script runs,it gets an InvalidOperationException: Failed to map the path '/forbidden.aspx'. Here is a mockup of my a...
The `InvalidOperationException: Failed to map the path` error you are encountering indicates that the `Server.Transfer` method is having trouble locating the `forbidden.aspx` page due to the way the path is specified. When using `Server.Transfer`, the path you provide must be relative to the root of the application. S...
29,836
[ { "from": "human", "value": "I have an authentication script (CheckLogin.aspx), and if any of the credentials do not match my application will redirect (via Server.Transfer) to the access denied page (forbidden.aspx). Each time my script runs,it gets an InvalidOperationException: Failed to map the path '/f...
Does anybody have a snippet of Java that can return the newest file in a directory (or knowledge of a library that simplifies this sort of thing)?
You can easily find the newest file in a directory using Java's `java.nio.file` package, which is available in Java 7 and later. Below is a simple snippet of code that demonstrates how to do this: ```java import java.io.IOException; import java.nio.file.*; import java.nio.file.attribute.BasicFileAttributes; import jav...
33,309
[ { "from": "human", "value": "Does anybody have a snippet of Java that can return the newest file in a directory (or knowledge of a library that simplifies this sort of thing)?\n" }, { "from": "gpt", "value": "You can easily find the newest file in a directory using Java's `java.nio.file` package...
What is the most concise and efficient way to find out if a JavaScript array contains a value? This is the only way I know to do it: function contains(a, obj) { for (var i = 0; i < a.length; i++) { if (a[i] === obj) { return true; } } return false; } Is there a better and more c...
Yes, there is a more concise and efficient way to check if a JavaScript array contains a value using the `Array.prototype.includes()` method. This method returns `true` if the array contains the specified element, and `false` otherwise. Here's how you can use it: ```javascript function contains(a, obj) { return a....
34,752
[ { "from": "human", "value": "What is the most concise and efficient way to find out if a JavaScript array contains a value?\nThis is the only way I know to do it:\nfunction contains(a, obj) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] === obj) {\n return true;\n }\n }\n...
I'm having some trouble figuring out how to use more than one left outer join using LINQ to SQL. I understand how to use one left outer join. I'm using VB.NET. Below is my SQL syntax. T-SQL SELECT o.OrderNumber, v.VendorName, s.StatusName FROM Orders o LEFT OUTER JOIN Vendors v ON v.Id = o.Vendor...
To perform multiple left outer joins using LINQ to SQL in VB.NET, you can utilize the `GroupJoin` method followed by `SelectMany` to flatten the results. This is similar to how the SQL `LEFT JOIN` works, allowing you to include all records from the primary table while also linking to related tables. Below is an example...
30,431
[ { "from": "human", "value": "I'm having some trouble figuring out how to use more than one left outer join using LINQ to SQL. I understand how to use one left outer join. I'm using VB.NET. Below is my SQL syntax.\nT-SQL\nSELECT\n o.OrderNumber,\n v.VendorName,\n s.StatusName\nFROM\n Orders o\...
I'm currently working on a project that hooks into various system calls and writes things to a log, depending on which one was called. So, for example, when I change the permissions of a file, I write a little entry to a log file that tracks the old permission and new permission. However, I'm having some trouble pinn...
The presence of multiple system calls like `sys_fchmod`, `sys_fchmodat`, and `sys_chmod` in the Linux kernel can indeed be a bit confusing at first glance. However, there are specific reasons for their existence, each serving different use cases or addressing different requirements. Let's break these down: 1. **`sys_c...
32,001
[ { "from": "human", "value": "I'm currently working on a project that hooks into various system calls and writes things to a log, depending on which one was called. So, for example, when I change the permissions of a file, I write a little entry to a log file that tracks the old permission and new permissio...
Is there a way to do this with SQL Server tools? If not, is there a 3rd party tool that does this? There doesn't seem to be a good way to edit longer text columns in the SQL Server Managers for SQL Server 2000 or 2005. While SQL Server Manager is really not for editing data in your db, what other tool does Microsoft...
In SQL Server 2000 and 2005, editing long text columns directly in SQL Server Management Studio (SSMS) can be cumbersome, as you’ve noted. SQL Server Management Studio has limitations when it comes to displaying and editing large text fields such as `TEXT`, `NTEXT`, or `VARCHAR(MAX)`. ### Options for Editing Long Text...
32,755
[ { "from": "human", "value": "\nIs there a way to do this with SQL Server tools?\nIf not, is there a 3rd party tool that does this?\n\nThere doesn't seem to be a good way to edit longer text columns in the SQL Server Managers for SQL Server 2000 or 2005. While SQL Server Manager is really not for editing da...
In C# some of default name space such as System.Collections are listed without typing in using blah. In visual basic, they are not imports for you. Is there a way to force vb to auto imports some of default name space or VB work differently than C#?
In Visual Basic (VB.NET), the handling of default namespaces is indeed different from C#. In VB.NET, certain namespaces are included by default, and you don’t have to explicitly import them to use the types defined within those namespaces. This is in contrast to C#, where you generally have to explicitly include a name...
32,919
[ { "from": "human", "value": "In C# some of default name space such as System.Collections are listed without typing in using blah. In visual basic, they are not imports for you. Is there a way to force vb to auto imports some of default name space or VB work differently than C#?\n" }, { "from": "gpt"...
I have a site behind basic authentication (IIS6). Part of this site calls a web service that is also part of the site and thus behind basic authentication as well. However, when this happens the calling code receives a 401 Authentication Error. I've tried a couple of things, with the general recommendation being code l...
When dealing with Basic Authentication in an environment like IIS6, it’s not uncommon to run into issues like the 401 Unauthorized error, especially when making calls from one part of your site (e.g., a web service) to another part that is also protected by Basic Authentication. Here are a few suggestions and troubles...
27,917
[ { "from": "human", "value": "I have a site behind basic authentication (IIS6).\nPart of this site calls a web service that is also part of the site and thus behind basic authentication as well.\nHowever, when this happens the calling code receives a 401 Authentication Error.\nI've tried a couple of things, ...
I have a simple application with the following code: FileInfo[] files = (new DirectoryInfo(initialDirectory)).GetFiles(); List<Thread> threads = new List<Thread>(files.Length); foreach (FileInfo f in files) { Thread t = new Thread(delegate() { Console.WriteLine(f.FullName); ...
The issue you're encountering is a common pitfall when using closures within a loop in C#. In your code, the variable `f` is captured by the anonymous method that you are creating for each thread. However, by the time the threads execute and access the variable `f`, the loop has already completed, and `f` will refer to...
34,104
[ { "from": "human", "value": "I have a simple application with the following code:\n FileInfo[] files = (new DirectoryInfo(initialDirectory)).GetFiles();\n List<Thread> threads = new List<Thread>(files.Length);\n\n foreach (FileInfo f in files)\n {\n Thread t = new Thread(delegate()\n {\n...
I have a C++ library that provides various classes for managing data. I have the source code for the library. I want to extend the C++ API to support C function calls so that the library can be used with C code and C++ code at the same time. I'm using GNU tool chain (gcc, glibc, etc), so language and architecture supp...
Extending your C++ library to support C function calls is certainly possible, and you've already gathered some good initial information about how to approach this. Let's delve into your questions and the considerations you should keep in mind as you implement this. ### Technical Feasibility There are no fundamental re...
28,769
[ { "from": "human", "value": "I have a C++ library that provides various classes for managing data. I have the source code for the library.\nI want to extend the C++ API to support C function calls so that the library can be used with C code and C++ code at the same time.\nI'm using GNU tool chain (gcc, gli...
This error has been driving me nuts. We have a server running Apache and Tomcat, serving multiple different sites. Normally the server runs fine, but sometimes an error happens where people are served the wrong page - the page that somebody else requested! Clues: The pages being delivered are those that another user ...
It sounds like you're experiencing a frustrating and complex issue. The symptoms you've described—randomly serving the wrong pages from Tomcat—suggest that it may be a problem with session handling or request routing between Apache and Tomcat, particularly under load. Here are a few suggestions to help you further diag...
29,229
[ { "from": "human", "value": "This error has been driving me nuts. We have a server running Apache and Tomcat, serving multiple different sites. Normally the server runs fine, but sometimes an error happens where people are served the wrong page - the page that somebody else requested!\nClues:\n\nThe pages ...
How would I achieve the pseudo-code below in JavaScript? I want to include the date check in the second code excerpt, where txtDate is for the BilledDate. If ABS(billeddate – getdate) > 31 then yesno “The date you have entered is more than a month from today, Are you sure the date is correct,”. if (txtDate && txtD...
To achieve the functionality described in your pseudo-code in JavaScript, you can use the following approach. We'll check if the date entered in the `txtDate` input field is either empty or if the difference between that date and the current date is greater than 31 days. If the difference is greater than 31 days, we'll...
27,570
[ { "from": "human", "value": "How would I achieve the pseudo-code below in JavaScript? I want to include the date check in the second code excerpt, where txtDate is for the BilledDate.\nIf ABS(billeddate – getdate) > 31 then yesno “The date you have entered is more than a month from today, Are you sure th...
I am collecting logs from several custom made applications. Each application has it's own log format. What I'm looking for is a central tool which would allow me to search through all of my logs. This means the tool would have to be able to define a different regex (or alike) for each log file (marking where a record b...
Certainly! Here are several tools you might consider for centralizing and searching through logs with custom formats: 1. **ELK Stack (Elasticsearch, Logstash, Kibana)**: - **Description**: The ELK stack is a powerful and popular solution for log management. You can use Logstash to ingest logs and apply custom filte...
16,551
[ { "from": "human", "value": "I am collecting logs from several custom made applications. Each application has it's own log format. What I'm looking for is a central tool which would allow me to search through all of my logs. This means the tool would have to be able to define a different regex (or alike) fo...
Is there a way to create a Distinct query in HQL. Either by using the "distinct" keyword or some other method. I am not sure if distinct is a valid keywork for HQL, but I am looking for the HQL equivalent of the SQL keyword "distinct".
Yes, you can use the `distinct` keyword in HQL (Hibernate Query Language), which is indeed analogous to its use in SQL. The `distinct` keyword in HQL is used to return unique results, just like in standard SQL. Here’s an example of how to use the `distinct` keyword in an HQL query: ```java String hql = "SELECT DISTIN...
34,922
[ { "from": "human", "value": "Is there a way to create a Distinct query in HQL. Either by using the \"distinct\" keyword or some other method. I am not sure if distinct is a valid keywork for HQL, but I am looking for the HQL equivalent of the SQL keyword \"distinct\".\n" }, { "from": "gpt", "v...
I have a .NET assembly that (for reasons outside my control) must be in the GAC. However, the same assembly is used by another program, which has a its own copy of an older version of the same assembly. It must use its own copy and not whatever is in the GAC. Proper versioning is probably more hassle than it's worth in...
In .NET, the runtime primarily looks for assemblies in the Global Assembly Cache (GAC), as well as other locations based on configuration. However, if you have a scenario where you need to force the runtime to use a specific assembly (DLL) from a particular location and ignore the GAC or other sources, you have a few o...
31,452
[ { "from": "human", "value": "I have a .NET assembly that (for reasons outside my control) must be in the GAC. However, the same assembly is used by another program, which has a its own copy of an older version of the same assembly. It must use its own copy and not whatever is in the GAC. Proper versioning i...
What is the equivalent of Java's System.currentTimeMillis() in C#?
In C#, the equivalent of Java's `System.currentTimeMillis()` can be obtained using `DateTime.UtcNow` combined with `DateTimeOffset` or by using `Stopwatch` for high-resolution timing. However, if you want the equivalent in terms of getting the current time in milliseconds since the Unix epoch (January 1, 1970), you can...
34,528
[ { "from": "human", "value": "What is the equivalent of Java's System.currentTimeMillis() in C#?\n" }, { "from": "gpt", "value": "In C#, the equivalent of Java's `System.currentTimeMillis()` can be obtained using `DateTime.UtcNow` combined with `DateTimeOffset` or by using `Stopwatch` for high-re...
The equals() method of the URL class in the Java class library makes a DNS request to get the IP for the hostname, to check the two IP's for equality. This happens even for URLs that are created from the same String. Is there a way to avoid this internet access?
Yes, you can avoid DNS lookups when comparing URLs in Java by using the `URL` class's `getHost()` method to extract the host part and manually perform the comparison instead of relying on the `equals()` method. Here’s a simple example that shows how you can compare two URLs without triggering DNS lookups: ```java imp...
33,310
[ { "from": "human", "value": "The equals() method of the URL class in the Java class library makes a DNS request to get the IP for the hostname, to check the two IP's for equality. This happens even for URLs that are created from the same String. Is there a way to avoid this internet access?\n" }, { ...
My new project is targeting an embedded ARM processor. I have a build system that uses a cross-compiler running on an Ubuntu linux box. I like to use unit testing as much as possible, but I'm a little bit confused about how to proceed with this setup. I can't see how to run unit tests on the ARM device itself (somebo...
Your approach of using a cross-compiler for the ARM processor while performing unit tests on the host machine (Ubuntu Linux) is a valid and commonly used strategy in embedded development. It’s essential to be able to effectively unit test your code before deploying it to the target hardware, even if that means testing ...
28,896
[ { "from": "human", "value": "My new project is targeting an embedded ARM processor. I have a build system that uses a cross-compiler running on an Ubuntu linux box. I like to use unit testing as much as possible, but I'm a little bit confused about how to proceed with this setup.\nI can't see how to run u...
Please give me the advantages and disadvantages of using the particular framework. Can give me examples of successes where you have used AOP in you .net applications?
Aspect-Oriented Programming (AOP) is a programming paradigm that provides a way to modularize cross-cutting concerns in software applications. Here are some advantages and disadvantages of using AOP, particularly in the context of .NET applications. ### Advantages of AOP 1. **Separation of Concerns**: AOP allows deve...
29,067
[ { "from": "human", "value": "Please give me the advantages and disadvantages of using the particular framework.\nCan give me examples of successes where you have used AOP in you .net applications?\n" }, { "from": "gpt", "value": "Aspect-Oriented Programming (AOP) is a programming paradigm that p...
I previously asked how to do this in Groovy. However, now I'm rewriting my app in Perl because of all the CPAN libraries. If the page contained these links: <a href="http://www.google.com">Google</a> <a href="http://www.apple.com">Apple</a> The output would be: Google, http://www.google.com Apple, http://www.apple...
To extract links from an HTML page and format them in the desired output using Perl, you can use the `HTML::Parser` module, which is part of CPAN and provides a simple way to parse HTML content. Here’s a complete example of how you can achieve this: 1. First, make sure you have `HTML::Parser` installed. You can insta...
30,170
[ { "from": "human", "value": "I previously asked how to do this in Groovy. However, now I'm rewriting my app in Perl because of all the CPAN libraries.\nIf the page contained these links:\n\n<a href=\"http://www.google.com\">Google</a>\n\n<a href=\"http://www.apple.com\">Apple</a>\n\nThe output would be:\n\...
I am trying to write a stored procedure which selects columns from a table and adds 2 extra columns to the ResultSet. These 2 extra columns are the result of conversions on a field in the table which is a Datetime field. The Datetime format field has the following format 'YYYY-MM-DD HH:MM:SS.S' The 2 additional fields ...
Certainly! You can achieve this in a stored procedure by using SQL's built-in date functions to extract the desired formats from the `DATETIME` field. Here's an example of how you might write the stored procedure to select the desired columns from your table and generate the two additional columns in the requested form...
31,682
[ { "from": "human", "value": "I am trying to write a stored procedure which selects columns from a table and adds 2 extra columns to the ResultSet. These 2 extra columns are the result of conversions on a field in the table which is a Datetime field.\nThe Datetime format field has the following format 'YYYY-...
I am debugging a VB6 executable. The executable loads dlls and files from it's current directory, when running. When run in debugger, the current directory seems to be VB6's dir. How do I set working directory for VB6?
In VB6, when you're running an application directly from the IDE, the current working directory defaults to the directory where the VB6 IDE is installed, which can lead to issues when your application relies on files being in its own directory. To change the current directory for a VB6 application when running it from...
20,775
[ { "from": "human", "value": "I am debugging a VB6 executable. The executable loads dlls and files from it's current directory, when running. When run in debugger, the current directory seems to be VB6's dir. \nHow do I set working directory for VB6?\n" }, { "from": "gpt", "value": "In VB6, when ...
I'm trying to develop an Internet Explorer 7 addon using "Browser Helper Objects" (BHO). The goal is to have a standard IE toolbar with some buttons and one custom control. I would like to develop it in .NET I started from the baseline sample here. This works fine but... How to control where in the browser the toolbar...
Developing a Browser Helper Object (BHO) for Internet Explorer 7 to create a custom toolbar can be a bit tricky due to the limitations and complexities of the Internet Explorer API. Here's how you can address the questions you have about positioning your toolbar and allowing the user to move it around like other toolba...
26,400
[ { "from": "human", "value": "I'm trying to develop an Internet Explorer 7 addon using \"Browser Helper Objects\" (BHO). The goal is to have a standard IE toolbar with some buttons and one custom control. I would like to develop it in .NET\nI started from the baseline sample here. This works fine but...\n\nH...
There are two different ways to create an empty object in JavaScript: var objectA = {} var objectB = new Object() Is there any difference in how the script engine handles them? Is there any reason to use one over the other? Similarly it is also possible to create an empty array using different syntax: var arrayA = [] ...
In JavaScript, both methods of creating objects and arrays that you've mentioned are valid and will produce the same result in terms of functionality. However, there are some subtle differences and considerations regarding how the script engine handles them, as well as best practices for their use. ### Creating Object...
32,482
[ { "from": "human", "value": "There are two different ways to create an empty object in JavaScript:\nvar objectA = {}\nvar objectB = new Object()\n\nIs there any difference in how the script engine handles them? Is there any reason to use one over the other?\nSimilarly it is also possible to create an empty ...
I have seen many examples, with many 'no, you missed something' comments. What is the right way to match an e-mail address? For Sanity sake, only fully-qualified domain names, no @localhost allowed. (or, both ways) Subdomains must be allowed (issac@deptartment.company.museum)
Matching email addresses using regular expressions can be quite challenging, especially if you're looking to cover a wide range of valid formats while avoiding common pitfalls. Since you specified that you want to allow only fully qualified domain names (FQDNs) and subdomains, I'll provide you with a regex pattern that...
28,535
[ { "from": "human", "value": "I have seen many examples, with many 'no, you missed something' comments. What is the right way to match an e-mail address?\nFor Sanity sake, only fully-qualified domain names, no @localhost allowed. (or, both ways)\nSubdomains must be allowed (issac@deptartment.company.museum)...
I'm starting a new database application and I wonder if it would be better to start the design at the objects (with UML) and build the database schema accordingly, or start at the design of the database (with ER) and create the objects accordingly. What are the pros and cons of either approach? (I dont think it matters...
When starting a new database application, choosing whether to design your system around objects (using UML) or to start with the database schema (using ER diagrams) can significantly affect the development process and outcome. Here are some pros and cons of each approach: ### Starting with Object Design (UML) **Pros:...
29,610
[ { "from": "human", "value": "I'm starting a new database application and I wonder if it would be better to start the design at the objects (with UML) and build the database schema accordingly, or start at the design of the database (with ER) and create the objects accordingly.\nWhat are the pros and cons of...
Does anyone know how to generate SQL scripts from a query? For example, Script some tables. Do custom action 1. Script the views. Do custom action 2. Etc.
To generate SQL scripts from a query in a structured way, you can use SQL Server Management Studio (SSMS) or any other SQL client that supports scripting. Here's a general approach using SSMS and T-SQL: ### Step 1: Script Tables To generate scripts for tables in SSMS, you can follow these steps: 1. Open SSMS and con...
31,232
[ { "from": "human", "value": "Does anyone know how to generate SQL scripts from a query?\nFor example, \n\nScript some tables.\nDo custom action 1.\nScript the views. \nDo custom action 2.\nEtc.\n\n" }, { "from": "gpt", "value": "To generate SQL scripts from a query in a structured way, you can u...
How do I programmatically force the deletion of files that are locked by the operating system or any other program with C/C++? The functionality should be similar to the software "Unlocker" at http://ccollomb.free.fr/unlocker.
Forcefully deleting files that are locked by the operating system or other programs can be quite complex and risky. Attempting to manipulate files that are currently in use can lead to data loss or system instability. Software like Unlocker typically works by interacting with the Windows API to unlock handles or close ...
30,051
[ { "from": "human", "value": "How do I programmatically force the deletion of files that are locked by the operating system or any other program with C/C++? The functionality should be similar to the software \"Unlocker\" at http://ccollomb.free.fr/unlocker.\n" }, { "from": "gpt", "value": "Force...
$('input[type=checkbox]').unbind().click(function(e){ $(this).attr('checked', true) return false; }); I NEED to return false because I have an event on its parent and I don't want to trigger that. It just WON'T check that checkbox.
The issue you're encountering is because calling `return false;` inside the click handler for a checkbox will prevent the checkbox from being checked. Instead of using `return false;`, you can prevent the event propagation without affecting the default behavior of the checkbox. You can achieve this by calling `e.stop...
33,492
[ { "from": "human", "value": " $('input[type=checkbox]').unbind().click(function(e){\n $(this).attr('checked', true)\n return false;\n });\n\nI NEED to return false because I have an event on its parent and I don't want to trigger that.\nIt just WON'T check that checkbox.\n" }, { ...