instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Is it possible for a .NET application to grab all the window handles currently open, and move/resize these windows? I'd pretty sure its possible using P/Invoke, but I was wondering if there were some managed code wrappers for this functionality.
Yes, it is indeed possible for a .NET application to interact with open windows by grabbing their handles and manipulating them (e.g., moving or resizing). You can accomplish this through Platform Invocation Services (P/Invoke), which allows managed code to call unmanaged functions in Windows API. While you are correc...
15,372
[ { "from": "human", "value": "Is it possible for a .NET application to grab all the window handles currently open, and move/resize these windows?\nI'd pretty sure its possible using P/Invoke, but I was wondering if there were some managed code wrappers for this functionality.\n" }, { "from": "gpt", ...
An idiom commonly used in OO languages like Python and Ruby is instantiating an object and chaining methods that return a reference to the object itself, such as: s = User.new.login.get_db_data.get_session_data In PHP, it is possible to replicate this behavior like so: $u = new User(); $s = $u->login()->get_db_data()-...
In PHP, the method chaining you want to achieve can indeed be done using the `new` keyword, but you encountered a syntax error because PHP does not allow you to chain method calls directly after an object instantiation within the same expression. The correct approach is to first instantiate the object and then call its...
17,136
[ { "from": "human", "value": "An idiom commonly used in OO languages like Python and Ruby is instantiating an object and chaining methods that return a reference to the object itself, such as:\ns = User.new.login.get_db_data.get_session_data\n\nIn PHP, it is possible to replicate this behavior like so:\n$u =...
I have a VB6 COM component which I need to call from my .Net method. I use reflection to create an instance of the COM object and activate it in the following manner: f_oType = Type.GetTypeFromProgID(MyProgId); f_oInstance = Activator.CreateInstance(f_oType); I need to use GetTypeFromProgID rather than using tlbimp to...
To access the error number from a VB6 COM component in your .NET application, you can directly catch the `COMException` rather than relying on the `TargetInvocationException`. However, when invoking methods via reflection, the exceptions that arise will typically be wrapped in a `TargetInvocationException`. The error n...
16,887
[ { "from": "human", "value": "I have a VB6 COM component which I need to call from my .Net method. I use reflection to create an instance of the COM object and activate it in the following manner:\nf_oType = Type.GetTypeFromProgID(MyProgId);\nf_oInstance = Activator.CreateInstance(f_oType);\n\nI need to use ...
Is there a way to change the context sensitive help in Visual Studio so that it will only search against the text under the caret instead of a compilation error in your code? More info: After you compile and receive a compilation error(underlined), placing the caret within the underlined text and pressing F1 will take ...
In Visual Studio, the default behavior when you press F1 on a compilation error is indeed to navigate to the documentation for the compilation error rather than the documentation for the symbol under the caret. Unfortunately, there isn't a built-in setting to change this behavior so that pressing F1 will always direct ...
19,878
[ { "from": "human", "value": "Is there a way to change the context sensitive help in Visual Studio so that it will only search against the text under the caret instead of a compilation error in your code?\nMore info:\nAfter you compile and receive a compilation error(underlined), placing the caret within the...
When I parse my xml file (variable f) in this method, I get an error C:\Documents and Settings\joe\Desktop\aicpcudev\OnlineModule\map.dtd (The system cannot find the path specified) I know I do not have the dtd, nor do I need it. How can I parse this File object into a Document object while ignoring DTD reference e...
To parse an XML file while ignoring DTD references, you can customize the `DocumentBuilderFactory` settings. Specifically, you can set the following properties to disable DTD processing: 1. **Disable DTD Validation:** Set the `setValidating(false)` property to prevent the parser from validating against a DTD. 2. **Dis...
19,031
[ { "from": "human", "value": "When I parse my xml file (variable f) in this method, I get an error \n\nC:\\Documents and Settings\\joe\\Desktop\\aicpcudev\\OnlineModule\\map.dtd (The system cannot find the path specified)\n\nI know I do not have the dtd, nor do I need it. How can I parse this File object in...
What is important to keep in mind when designing a database? I don't want to limit your answer to my needs as I am sure that others can benefit from your insights as well. But I am planning a content management system for a multi-client community driven site.
When designing a database, especially for a content management system (CMS) intended for a multi-client community-driven site, there are several important considerations to keep in mind. Here are key aspects that apply broadly, with specific notes relevant to your context: ### 1. **Data Modeling** - **Identify Enti...
16,395
[ { "from": "human", "value": "What is important to keep in mind when designing a database?\nI don't want to limit your answer to my needs as I am sure that others can benefit from your insights as well. But I am planning a content management system for a multi-client community driven site.\n" }, { "f...
I'm in a situation where I would to generate a script for a database that I could run on another server and get a database identical to the original one, but without any of the data. In essence, I want to end up with a big create script that captures the database schema. I am working in an environment that has SQL Se...
If you are working with SQL Server 2000 and need to generate a script that replicates the schema of your database without any data, you can use the built-in tools, but they may not be as straightforward as you would like. However, there are some approaches you can take. ### Approach 1: Using SQL Server Management Stud...
15,857
[ { "from": "human", "value": "I'm in a situation where I would to generate a script for a database that I could run on another server and get a database identical to the original one, but without any of the data. In essence, I want to end up with a big create script that captures the database schema. \nI am...
In particular, I need a more full fledged version of Trac to support robust project management, and task tracking. I went through the plugins and literally found over 50 that looked promising. My question is to the admins/users of Trac: which ones are indespensible for making Trac feature complete and which ones sho...
When using Trac for project management and task tracking, there are several plugins that can greatly enhance its functionality. Here's a list of some indispensable plugins that you may find useful, along with a few to be cautious about due to potential stability issues. ### Indispensable Plugins for Trac 1. **TracTag...
18,200
[ { "from": "human", "value": "In particular, I need a more full fledged version of Trac to support robust project management, and task tracking. I went through the plugins and literally found over 50 that looked promising. \nMy question is to the admins/users of Trac: which ones are indespensible for makin...
In a servlet I do the following: Context context = new InitialContext(); value = (String) context.lookup("java:comp/env/propertyName"); On an Apache Geronimo instance (WAS CE 2.1) how do i associate a value with the key propertyName? In Websphere AS 6 i can configure these properties for JNDI lookup under the "Nam...
In Apache Geronimo (including versions like WAS CE 2.1), you can define environment entries for JNDI lookup in the deployment descriptor of your web application, specifically in the `web.xml` file. Here’s how you can associate a value with a key like `propertyName` for JNDI lookup. ### Steps to Define Environment Entr...
17,854
[ { "from": "human", "value": "In a servlet I do the following:\n Context context = new InitialContext();\n value = (String) context.lookup(\"java:comp/env/propertyName\");\n\nOn an Apache Geronimo instance (WAS CE 2.1) how do i associate a value with the key propertyName?\nIn Websphere AS 6 i can configure...
How do I determine in a .Net DLL whether it's running in a Windows GUI application or web service? I've got a low level class which is being shared between two applications and need to disable message boxes when it's used in a web service. The Windows application has over 200 solutions and I'm not in a position to re-...
To determine whether a .NET DLL is running in a Windows GUI application or a web service, you can use a few different techniques based on the context in which your code is being executed. Below are two common approaches you can implement: ### 1. Check the Application Type You can check the application type based on t...
17,556
[ { "from": "human", "value": "How do I determine in a .Net DLL whether it's running in a Windows GUI application or web service? I've got a low level class which is being shared between two applications and need to disable message boxes when it's used in a web service.\nThe Windows application has over 200 ...
I am using a multi-dimensional dynamic array in delphi and am trying to figure this out: I have 2 seperate values for the first index and second index that are totally seperate of each other. As new values come I want to grow the array if that new value is outside of either bound. For new values x, y I check: if Length...
Your approach for dynamically resizing a multi-dimensional dynamic array in Delphi is mostly correct, but there are a few improvements you can make to ensure that both dimensions are managed properly. The key issue in your code is that when you are resizing the second dimension, you should be ensuring that you are resi...
15,121
[ { "from": "human", "value": "I am using a multi-dimensional dynamic array in delphi and am trying to figure this out:\nI have 2 seperate values for the first index and second index that are totally seperate of each other.\nAs new values come I want to grow the array if that new value is outside of either bo...
What concerns, processes, and questions do you take into account when deciding when and how to cache. Is it always a no win situation? This presupposes you are stuck with a code base that has been optimized.
Caching is a crucial optimization technique, but it does come with its own set of concerns, processes, and questions that need to be considered. Here's a breakdown of the factors to consider when deciding when and how to implement caching, especially in the context of a legacy or optimized codebase: ### Concerns 1. *...
14,991
[ { "from": "human", "value": "What concerns, processes, and questions do you take into account when deciding when and how to cache. Is it always a no win situation?\nThis presupposes you are stuck with a code base that has been optimized. \n" }, { "from": "gpt", "value": "Caching is a crucial op...
I have a .net interop project that uses an app.config file. When I am running the VB6 project that is using the interop control in Debug mode, the ConfigurationManager cannot find the app.config file. When I make the VB6 project into an exe and rename the app.config file to (VB6 binary name).exe.config, the Configurati...
In .NET interop projects, the `ConfigurationManager` looks for the configuration file based on the executing assembly's name. When you're running the VB6 project in Debug mode, the .NET assembly that is part of the interop is not executed in a way that it can locate the `app.config` file directly by its default name. T...
17,865
[ { "from": "human", "value": "I have a .net interop project that uses an app.config file. When I am running the VB6 project that is using the interop control in Debug mode, the ConfigurationManager cannot find the app.config file. When I make the VB6 project into an exe and rename the app.config file to (VB6...
I'm starting work on a project using Rails, but I'm waiting for the 3rd edition of the pragmatic rails book to come out before I purchase a book. Anyway, my question is a bit more pointed than how do I get started... What are some of the must have gems that everyone uses? I need basic authentication, so I have the rest...
It's great to hear you're starting a project with Rails! While you're waiting for the new edition of the Pragmatic Rails book, here's a rundown of some must-have gems and basic setup that many Rails developers commonly use. ### Essential Gems 1. **Authentication and Authorization:** - **Devise**: A flexible authe...
13,085
[ { "from": "human", "value": "I'm starting work on a project using Rails, but I'm waiting for the 3rd edition of the pragmatic rails book to come out before I purchase a book.\nAnyway, my question is a bit more pointed than how do I get started...\nWhat are some of the must have gems that everyone uses?\nI n...
I would like to add a typing speed indicator just below the textarea we use on our contact form. It is just for fun and to give the user some interactivity with the page while they are completing the form. It should display the average speed while typing and keep the last average when the keystrokes are idle. When they...
You can create a typing speed indicator using jQuery by tracking the user's keystrokes in the textarea and calculating their typing speed in real-time. Below is a simple implementation that you can customize for your needs. ### HTML ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta ...
15,934
[ { "from": "human", "value": "I would like to add a typing speed indicator just below the textarea we use on our contact form. It is just for fun and to give the user some interactivity with the page while they are completing the form.\nIt should display the average speed while typing and keep the last avera...
When should you use generator expressions and when should you use list comprehensions in Python? # Generator expression (x*2 for x in range(256)) # List comprehension [x*2 for x in range(256)]
In Python, both generator expressions and list comprehensions provide a concise way to create collections from iterables, but they have different use cases based on their behavior and memory consumption. ### When to Use List Comprehensions 1. **When You Need a List**: Use list comprehensions when you require the enti...
14,765
[ { "from": "human", "value": "When should you use generator expressions and when should you use list comprehensions in Python?\n# Generator expression\n(x*2 for x in range(256))\n\n# List comprehension\n[x*2 for x in range(256)]\n\n" }, { "from": "gpt", "value": "In Python, both generator express...
With really small sets of data, the policy where I work is generally to stick them into text files, but in my experience this can be a development headache. Data generally comes from the database and when it doesn't, the process involved in setting it/storing it is generally hidden in the code. With the database you ca...
When dealing with small sets of infrequently changed data, there are a few approaches you could consider, each with its own benefits and drawbacks. The key is to balance maintainability, performance, and ease of access. Here are some approaches, along with considerations for each: ### 1. **Using a Database Table** - *...
14,087
[ { "from": "human", "value": "With really small sets of data, the policy where I work is generally to stick them into text files, but in my experience this can be a development headache. Data generally comes from the database and when it doesn't, the process involved in setting it/storing it is generally hid...
Given a simple (id, description) table t1, such as id description -- ----------- 1 Alice 2 Bob 3 Carol 4 David 5 Erica 6 Fred And a parent-child relationship table t2, such as parent child ------ ----- 1 2 1 3 4 5 5 6 Oracle offers a way of traversing this as a tree with some c...
Yes, you can definitely join another table within a hierarchical query like the one you're using with `CONNECT BY` in Oracle. To achieve the desired output where the path displays the names (from the `t1` table) instead of just the IDs, you can utilize the `SYS_CONNECT_BY_PATH` function in conjunction with a join to th...
18,862
[ { "from": "human", "value": "Given a simple (id, description) table t1, such as\nid description\n-- -----------\n1 Alice\n2 Bob\n3 Carol\n4 David\n5 Erica\n6 Fred\n\nAnd a parent-child relationship table t2, such as\nparent child\n------ -----\n1 2\n1 3\n4 5\n5 6\n\nO...
Summary for the impatient: What I want to know is what you want to have in a new gui language. About the short answers mentioning $your_favorite_one; I assume you mean that, such a language should look like $your_favorite_one. These are not helpful. Resist the temptation. I'm thinking on the user friendliness of XML ba...
Creating a new GUI language that is both user-friendly and powerful is a challenging task, but it sounds like you have some great ideas on what features should be prioritized. Here’s a synthesis of key features to consider for a new GUI language based on your points and additional thoughts: 1. **Human Readability and ...
12,132
[ { "from": "human", "value": "Summary for the impatient:\nWhat I want to know is what you want to have in a new gui language. About the short answers mentioning $your_favorite_one; I assume you mean that, such a language should look like $your_favorite_one. These are not helpful. Resist the temptation.\nI'm ...
Now this is .NET but I am sure the principal should apply to all OOP language, to simplify I take .NET as an example: R# usually creator constructor and passing incoming variable to private field, which for me mi tend to pass it to Property. Any opinion on how the different and what is the best practice for that?
In object-oriented programming (OOP), especially in .NET, there are several ways to handle the initialization of class properties via constructors. The practice of using private fields in conjunction with properties has implications for encapsulation and data integrity. Here’s a breakdown of the approaches and some bes...
16,096
[ { "from": "human", "value": "Now this is .NET but I am sure the principal should apply to all OOP language, to simplify I take .NET as an example:\nR# usually creator constructor and passing incoming variable to private field, which for me mi tend to pass it to Property. \nAny opinion on how the different a...
I've inherited a desktop application which has a custom .NET file chooser that is embedded in a control, but it has some issues. I'd like to replace it with a non-custom File Chooser (like the OpenFileDialog). However, for a variety of reasons it needs to be embedded in the parent control not a popup dialog. Is there...
In .NET, the standard file dialog components like `OpenFileDialog` and `SaveFileDialog` are indeed designed to function as modal dialog windows. They are not intended to be embedded within other controls, which can present a challenge if you want a file chooser experience similar to those dialogs but within a control. ...
14,498
[ { "from": "human", "value": "I've inherited a desktop application which has a custom .NET file chooser that is embedded in a control, but it has some issues.\nI'd like to replace it with a non-custom File Chooser (like the OpenFileDialog). \nHowever, for a variety of reasons it needs to be embedded in the ...
I'm looking for a word processing component for .NET that would act like an embedded MS Word in my WinForm/WPF .NET app. The main goal being for users to be able to create rich formatted text. I don't really want to have to write a highly custom RichTextBox component. Any suggestions?
If you're looking for a word processing component for .NET that provides rich formatting capabilities similar to Microsoft Word, there are several third-party libraries and components you can consider. Here are some popular options: 1. **GemBox.Document**: This is a .NET library that enables you to create, load, edit,...
17,644
[ { "from": "human", "value": "I'm looking for a word processing component for .NET that would act like an embedded MS Word in my WinForm/WPF .NET app. The main goal being for users to be able to create rich formatted text. I don't really want to have to write a highly custom RichTextBox component. Any sug...
I know what MVC is and I work in webforms but I don't know how MVC will be that much different. I guess the code behind model will be different. So will it be like webforms minus the code behind and instead having it in a controller? I see there are other related posts but I don't they address this.
Great question! Understanding the differences between ASP.NET Web Forms and ASP.NET MVC can help you appreciate the strengths and weaknesses of each framework. ### Overview of Web Forms - **Event-driven model**: Web Forms use an event-driven model. You write your code in the "code-behind" files, which handle events tr...
15,979
[ { "from": "human", "value": "I know what MVC is and I work in webforms but I don't know how MVC will be that much different. I guess the code behind model will be different. So will it be like webforms minus the code behind and instead having it in a controller?\nI see there are other related posts but I do...
In order to create an arbitrary precision floating point / drop in replacement for Double, I'm trying to wrap MPFR using the FFI but despite all my efforts the simplest bit of code doesn't work. It compiles, it runs, but it crashes mockingly after pretending to work for a while. A simple C version of the code happily p...
It looks like you are encountering a problem with memory management in your Haskell FFI (Foreign Function Interface) code. The C code works fine because it handles the `mpfr_ptr` memory correctly, while the Haskell code may have issues with how you manage this pointer. Here's an analysis of potential issues and a sugg...
16,242
[ { "from": "human", "value": "In order to create an arbitrary precision floating point / drop in replacement for Double, I'm trying to wrap MPFR using the FFI but despite all my efforts the simplest bit of code doesn't work. It compiles, it runs, but it crashes mockingly after pretending to work for a while....
If I safe an Array and reload it, is there a possibility to get the size if its unknown? Thanks
Yes, if you save an array and later reload it, you can easily determine its size regardless of whether you know its size beforehand. The method to find the size of an array may differ depending on the programming language you are using. Here are examples in a few common programming languages: ### Python In Python, you...
15,218
[ { "from": "human", "value": "If I safe an Array and reload it, is there a possibility to get the size if its unknown? \nThanks\n" }, { "from": "gpt", "value": "Yes, if you save an array and later reload it, you can easily determine its size regardless of whether you know its size beforehand. The...
I'd like to use ListView to display grouped data from my db. Because of the way the query is structured, each logical group might have 1 or 2 records associated with it. Is there anyway to use GroupTemplate, while overridding the GroupItemCount behavior? Ideally, I'd like it to behave the way SQL does- assign a column ...
To display grouped data using a `ListView` with a `GroupTemplate`, and to control the `GroupItemCount` behavior for each logical group, you can implement a custom solution in your code-behind or view model. In a typical scenario, you can follow these steps: 1. **Data Structure**: Ensure that your data structure suppo...
13,314
[ { "from": "human", "value": "I'd like to use ListView to display grouped data from my db. Because of the way the query is structured, each logical group might have 1 or 2 records associated with it. Is there anyway to use GroupTemplate, while overridding the GroupItemCount behavior? Ideally, I'd like it to ...
I've always been able to allocate 1400 megabytes for Java SE running on 32-bit Windows XP (Java 1.4, 1.5 and 1.6). java -Xmx1400m ... Today I tried the same option on a new Windows XP machine using Java 1.5_16 and 1.6.0_07 and got the error: Error occurred during initialization of VM Could not reserve enough space for...
The issue you're experiencing with allocating memory for the Java Virtual Machine (JVM) on your new Windows XP machine can be attributed to several factors, even when both machines seem to be similar in their specifications. Here are some potential reasons and considerations: 1. **Operating System Limitations**: On a ...
14,691
[ { "from": "human", "value": "I've always been able to allocate 1400 megabytes for Java SE running on 32-bit Windows XP (Java 1.4, 1.5 and 1.6).\njava -Xmx1400m ...\n\nToday I tried the same option on a new Windows XP machine using Java 1.5_16 and 1.6.0_07 and got the error:\nError occurred during initializa...
Does anyone have an XSLT that will take the app.config and render it into a non-techie palatable format? The purpose being mainly informational, but with the nice side-effect of validating the XML (if it's been made invalid, it won't render)
Sure! Below is an example XSLT stylesheet that you can use to transform an `app.config` file (which is typically in XML format) into a more human-readable HTML format. This transformation will make the configuration settings easier to understand for non-technical users. The output will be structured in a way that displ...
16,087
[ { "from": "human", "value": "Does anyone have an XSLT that will take the app.config and render it into a non-techie palatable format?\nThe purpose being mainly informational, but with the nice side-effect of validating the XML (if it's been made invalid, it won't render)\n" }, { "from": "gpt", "...
Is VBA going to go away any time soon, like VB6 has? Should I not develop new Office applications with VBA? Or should I be developing all new Office Apps with VSTO? Update: Recently read this article.
As of my last knowledge update in October 2023, VBA (Visual Basic for Applications) remains a widely used tool for automating tasks in Microsoft Office applications. While there are ongoing discussions about the future of VBA, it has not been officially deprecated, and it continues to be supported in Office application...
14,722
[ { "from": "human", "value": "Is VBA going to go away any time soon, like VB6 has? Should I not develop new Office applications with VBA? Or should I be developing all new Office Apps with VSTO?\nUpdate: Recently read this article.\n" }, { "from": "gpt", "value": "As of my last knowledge updat...
I want to create a VB.NET generic factory method that creates instances of classes (as a home-grown inversion of control container). If I pass the interface IDoSomething as the generic parameter, I want to return an instance of DoSomething (that implements IDoSomething). I cannot figure out the syntax of the if state...
In VB.NET, you cannot directly check the type of a generic parameter using the `Is` operator like you tried in your example. Instead, you can use `GetType()` to compare the type of the generic parameter `T` to the interfaces or classes you are interested in. Here's how you can create a generic factory method that crea...
18,885
[ { "from": "human", "value": "I want to create a VB.NET generic factory method that creates instances of classes (as a home-grown inversion of control container). If I pass the interface IDoSomething as the generic parameter, I want to return an instance of DoSomething (that implements IDoSomething). I can...
Has anyone else seen people do this: private string _name; public string Name{ get{ return _name; } set{ _name = value;}} I understand using accessors if you are going to exercise some sort of control over how it gets set or perform some sort of function on it when there is a get. But if you are just going to do this,...
You're not alone in noticing this pattern in C#. It is indeed common for developers to create properties that simply wrap a private field without adding any additional logic. This is often seen in code, and it can lead to questions about its necessity. Here are a few reasons why developers might choose to use properti...
19,057
[ { "from": "human", "value": "Has anyone else seen people do this:\nprivate string _name;\npublic string Name{ get{ return _name; } set{ _name = value;}}\nI understand using accessors if you are going to exercise some sort of control over how it gets set or perform some sort of function on it when there is a...
How do I read the Response Headers that are being sent down in a page ? I want to be able to read the header values and modify some of them. This is for an ASP.NET 1.1 application but I would be curious to know if it can done in any version of ASP.NET. The reason for doing this is someone may have added custom headers...
In ASP.NET, you can read and modify response headers using the `HttpResponse` class, which is part of the `System.Web` namespace. Below, I'll demonstrate how to read response headers in an ASP.NET 1.1 application, but the approach is similar in later versions of ASP.NET as well. ### Reading Response Headers in ASP.NET...
17,459
[ { "from": "human", "value": "How do I read the Response Headers that are being sent down in a page ? I want to be able to read the header values and modify some of them. This is for an ASP.NET 1.1 application but I would be curious to know if it can done in any version of ASP.NET. \nThe reason for doing thi...
I'm currently planning the infrastructure for my future web project. I want to go the way Joel went with having one DB per client and now thinking which DB engine will be good for me. The best would be of course SQL Server, but I can't afford a full-blown version at this moment and I don't think SQL Server Express will...
Using PostgreSQL with ASP.NET 3.5 and ORM frameworks like NHibernate or LINQ to SQL can be a viable choice, and many developers have successfully integrated PostgreSQL into their .NET applications. However, there are a few considerations and potential challenges you might encounter when using PostgreSQL instead of SQL ...
15,651
[ { "from": "human", "value": "I'm currently planning the infrastructure for my future web project. I want to go the way Joel went with having one DB per client and now thinking which DB engine will be good for me. The best would be of course SQL Server, but I can't afford a full-blown version at this moment ...
I have been given a set of COBOL DAT, IDX and KEY files and I need to read the data in them and export it into Access, XLS, CSV, etc. I do not know the version, vendor of the COBOL code as I only have the windows executable that created the files. I have tried Easysoft and Parkway ODBC drivers but I have not been succe...
Reading COBOL DAT, IDX, and KEY files can be challenging, especially without the source code or detailed documentation regarding the structure of those files. Here are some general steps and tools you can use to try to extract the data and export it to formats like Access, XLS, or CSV: ### 1. Understanding the File Fo...
16,342
[ { "from": "human", "value": "I have been given a set of COBOL DAT, IDX and KEY files and I need to read the data in them and export it into Access, XLS, CSV, etc. I do not know the version, vendor of the COBOL code as I only have the windows executable that created the files.\nI have tried Easysoft and Park...
I need to zip and password-protect a file. Is there a good (free) library for this? This needs to be opened by a third party, so the password protection needs to work with standard tools.
Yes, there are several good free libraries that can help you zip and password-protect a file. One popular option is to use **Python's `zipfile` module** in combination with the `pyzipper` library. `pyzipper` is a drop-in replacement for Python's `zipfile` and supports AES encryption, which is compatible with many stand...
19,250
[ { "from": "human", "value": "I need to zip and password-protect a file. Is there a good (free) library for this?\nThis needs to be opened by a third party, so the password protection needs to work with standard tools.\n" }, { "from": "gpt", "value": "Yes, there are several good free libraries th...
I need to scramble the names and logins of all the users in a UAT database we have. (because of the data protection act) However, there is a catch. The testers still need to be able to login using the hashed login names so if a user login is "Jesse.J.James" then the hash should be something like Ypois.X.Qasdf i.e. appr...
You're right that traditional hashing algorithms like MD5 or SHA-1 won't work in this case since they generate fixed-length outputs that are much longer than your desired length and often contain special characters that won't fit your validation requirements. Instead of hashing, you are looking for a way to obfuscate...
16,265
[ { "from": "human", "value": "I need to scramble the names and logins of all the users in a UAT database we have. (because of the data protection act)\nHowever, there is a catch.\nThe testers still need to be able to login using the hashed login names\nso if a user login is \"Jesse.J.James\" then the hash sh...
My question is on the ASP.NET GridView control. I am using a CommandField in the Columns tag as seen below. <asp:CommandField ShowEditButton="True" HeaderStyle-Width="40px" UpdateText="Save" ButtonType="Link" HeaderStyle-Wrap="true" ItemStyle-Wrap="true" ItemStyle-Width="40px"/> What renders is the shown in the follow...
To achieve the desired layout where the "Cancel" link appears on a new line in an ASP.NET GridView when using a `CommandField`, you will need to customize the rendering of the GridView a bit since the default behavior for `ButtonType="Link"` keeps both buttons on the same line. Here are a few approaches you can take t...
16,815
[ { "from": "human", "value": "My question is on the ASP.NET GridView control. I am using a CommandField in the Columns tag as seen below.\n<asp:CommandField ShowEditButton=\"True\" HeaderStyle-Width=\"40px\" UpdateText=\"Save\" ButtonType=\"Link\" HeaderStyle-Wrap=\"true\" ItemStyle-Wrap=\"true\" ItemStyle-W...
I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything is OK, until I have these complex queries which may and may not have conditions. It's not hard in Java to put together WHERE clause with conditions, but it's not nice. And on PL/SQL side I also found out that the only pos...
You're right to consider the separation of logic between Java and PL/SQL. Keeping your query logic in PL/SQL can help maintain cleaner code and encapsulate database logic within the database itself. Here are a few strategies to handle dynamic queries with optional conditions while keeping your code maintainable. ### 1...
11,801
[ { "from": "human", "value": "I have a dilemma, I'm using Java and Oracle and trying to keep queries on PL/SQL side. Everything is OK, until I have these complex queries which may and may not have conditions. \nIt's not hard in Java to put together WHERE clause with conditions, but it's not nice.\nAnd on PL/...
Are there any alternatives to The CMU Pronouncing Dictionary, commercial or open source?
Yes, there are several alternatives to The CMU Pronouncing Dictionary, both commercial and open source. Here are a few notable ones: ### Open Source Alternatives: 1. **Festival Speech Synthesis System**: This system includes a database of phoneme mappings and can be used to create pronunciations based on text input. ...
17,745
[ { "from": "human", "value": "Are there any alternatives to The CMU Pronouncing Dictionary, commercial or open source?\n" }, { "from": "gpt", "value": "Yes, there are several alternatives to The CMU Pronouncing Dictionary, both commercial and open source. Here are a few notable ones:\n\n### Open ...
I have recently inherited a couple of applications that run as windows services, and I am having problems providing a gui (accessible from a context menu in system tray) with both of them. The reason why we need a gui for a windows service is in order to be able to re-configure the behaviour of the windows service(s) w...
Running a Windows service that requires a GUI component can be challenging due to how Windows services are designed to operate. Here’s a breakdown of your questions and possible solutions: ### 1. Differences in Start-Up Time Between Local System Account and Named Account The reason you are experiencing delays when ru...
13,868
[ { "from": "human", "value": "I have recently inherited a couple of applications that run as windows services, and I am having problems providing a gui (accessible from a context menu in system tray) with both of them.\nThe reason why we need a gui for a windows service is in order to be able to re-configure...
When you want to add whitespace between HTML elements (using CSS), to which element do you attach it? I'm regularly in situations along these lines: <body> <h1>This is the heading</h1> <p>This is a paragraph</p> <h1>Here's another heading</h1> <div>This is a footer</div> </body> Now, say I wanted 1em of space ...
When considering how to manage whitespace between HTML elements with CSS, it's crucial to balance consistency, simplicity, and ease of maintenance. Based on your criteria, here are some considerations to help guide your approach: ### General Guidelines for Managing Margins 1. **Use Consistent Margin Practices**: -...
17,240
[ { "from": "human", "value": "When you want to add whitespace between HTML elements (using CSS), to which element do you attach it?\nI'm regularly in situations along these lines:\n<body>\n <h1>This is the heading</h1>\n <p>This is a paragraph</p>\n <h1>Here's another heading</h1>\n <div>This is a footer...
Implementing a file upload under html is fairly simple, but I just noticed that there is an 'accept' attribute that can be added to the <input type="file" ...> tag. Is this attribute useful as a way of limiting file uploads to images, etc? What is the best way to use it? Alternatively, is there a way to limit file type...
Yes, the `accept` attribute in the `<input type="file">` tag is very useful for limiting the types of files that a user can upload, particularly to images or other specific formats. This attribute can help improve the user experience by filtering the file dialog to only show the specified types of files, making it easi...
18,840
[ { "from": "human", "value": "Implementing a file upload under html is fairly simple, but I just noticed that there is an 'accept' attribute that can be added to the <input type=\"file\" ...> tag.\nIs this attribute useful as a way of limiting file uploads to images, etc? What is the best way to use it?\nAlt...
I have an SSIS package that copies the data in a table from one SQL Server 2005 to another SQL Server 2005. I do this with a "Data Flow" task. In the package config file I expose the destination table name. Problem is when I change the destination table name in the config file (via notepad) I get the following error ...
The issue you're encountering with SSIS and the "vs_needsnewmetadata" error is a common one when the metadata of the destination table changes, or when you try to point to a different table than the one that was originally configured in the Data Flow task. This can be problematic because SSIS uses the metadata of the d...
16,294
[ { "from": "human", "value": "I have an SSIS package that copies the data in a table from one SQL Server 2005 to another SQL Server 2005. I do this with a \"Data Flow\" task. In the package config file I expose the destination table name.\nProblem is when I change the destination table name in the config f...
What is the easiest way to manage the authorized_keys file for openssh across a large number of hosts? If I need to add or revoke a new key to an account on 10 hosts say, I must login and add the public key manually, or through a clumsy shell script, which is time consuming. Ideally there would be a central database l...
Managing `authorized_keys` files across a large number of hosts can indeed be a cumbersome task if done manually. Fortunately, there are several strategies and tools you can use to streamline this process, while still using standard OpenSSH without needing to resort to forking it or using LDAP. Here are a few recommend...
13,629
[ { "from": "human", "value": "What is the easiest way to manage the authorized_keys file for openssh across a large number of hosts? If I need to add or revoke a new key to an account on 10 hosts say, I must login and add the public key manually, or through a clumsy shell script, which is time consuming. \nI...
What i mean exactly is that build.xml that actually included those plugins like findbugs etc. Or nicely done build.xml
It looks like you are asking for an example of a `build.xml` file for an Apache Ant project that incorporates various plugins, such as FindBugs for static code analysis. Below is an example `build.xml` file that demonstrates how to set up a basic Ant build script with FindBugs and other common tasks. ```xml <project n...
13,003
[ { "from": "human", "value": "What i mean exactly is that build.xml that actually included those plugins like findbugs etc. Or nicely done build.xml \n" }, { "from": "gpt", "value": "It looks like you are asking for an example of a `build.xml` file for an Apache Ant project that incorporates vari...
Emacs puts backup files named foo~ everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points to the backup when I'm done editing, and that's confusing and awful. How can I either eliminate these backup files, or h...
You can manage Emacs backup files by either disabling them completely or redirecting them to a specific directory. Here’s how to do both: ### Disable Backup Files If you want to completely disable backup files in Emacs, you can add the following line to your Emacs configuration file (usually `.emacs` or `init.el`): ...
19,968
[ { "from": "human", "value": "Emacs puts backup files named foo~ everywhere and I don't like having to remember to delete them. Also, if I edit a file that has a hard link somewhere else in the file system, the hard link points to the backup when I'm done editing, and that's confusing and awful. How can I ...
I am setting up support for users to sign in with client certificates. Unfortunately IIS refuses to acknowledge any certificate not chained to an installed CA (see this article). As the feature is implemented only for users´ convenience, it would be great to allow any client certificate. Is there any way to accomplish ...
To allow any client certificate for authentication in IIS (especially on IIS 7, since IIS 6 is quite limited and no longer supported), you can work around the default behavior by configuring IIS to allow client certificates from non-trusted CAs. ### Option 1: Modify IIS Settings to Accept All Certificates 1. **Open ...
14,595
[ { "from": "human", "value": "I am setting up support for users to sign in with client certificates. Unfortunately IIS refuses to acknowledge any certificate not chained to an installed CA (see this article).\nAs the feature is implemented only for users´ convenience, it would be great to allow any client ce...
WPF WebBrowser control looks great but knowledge accumlated over time about WinForms WebBrowser is substantial and it's hard to ignore work like csExWB. It would be nice to know what functional shortcomings or advantages exists in .NET 3.5's WPF WebBrowser control over WinForms WebBrowser control. In particular, is it ...
The WPF `WebBrowser` control and the WinForms `WebBrowser` control both allow for embedding web content in applications, but they have some significant differences in terms of architecture, capabilities, and extensibility. Here are some of the functional shortcomings and advantages of the WPF `WebBrowser` control compa...
14,955
[ { "from": "human", "value": "WPF WebBrowser control looks great but knowledge accumlated over time about WinForms WebBrowser is substantial and it's hard to ignore work like csExWB. It would be nice to know what functional shortcomings or advantages exists in .NET 3.5's WPF WebBrowser control over WinForms ...
Ok, my actual problem was this: I was implementing an IList<T>. When I got to CopyTo(Array array, int index), this was my solution: void ICollection.CopyTo(Array array, int index) { // Bounds checking, etc here. if (!(array.GetValue(0) is T)) throw new ArgumentException("Cannot cast to this type of Arra...
Your situation highlights a common challenge when implementing methods that involve type safety in collections, especially when dealing with `Array` types in a non-generic collection like `ICollection`. Your current approach using a try-catch block to handle the type checking is indeed one way to ensure that you handl...
17,130
[ { "from": "human", "value": "Ok, my actual problem was this: I was implementing an IList<T>. When I got to CopyTo(Array array, int index), this was my solution:\nvoid ICollection.CopyTo(Array array, int index)\n{\n // Bounds checking, etc here.\n if (!(array.GetValue(0) is T))\n throw new Argum...
So most Java resources when speaking of packages mention a com.yourcompany.project setup. However, I do not work for a company, and don't have a website. Are there any naming conventions that are common? An email address, perhaps?
In Java, the convention for naming packages typically follows the reverse domain name structure (e.g., `com.yourcompany.project`). This helps prevent naming collisions by making the package name globally unique. However, if you don't work for a company and don't have a domain name, you can still follow best practices f...
18,577
[ { "from": "human", "value": "So most Java resources when speaking of packages mention a com.yourcompany.project setup. However, I do not work for a company, and don't have a website. Are there any naming conventions that are common? An email address, perhaps?\n" }, { "from": "gpt", "value": "In ...
I'm looking for a real time web log watcher that can visually display visitors as they browse around different pages etc. I'd like it to be a web application, it's going to be shown on a big screen in the office. Any tips?
There are several web applications and tools that can help you visually monitor web traffic in real time, displaying visitor behavior as they navigate through different pages. Here are some options you might consider: 1. **Google Analytics (Real-Time Reports)**: - Google Analytics offers real-time reporting feature...
16,238
[ { "from": "human", "value": "I'm looking for a real time web log watcher that can visually display visitors as they browse around different pages etc. I'd like it to be a web application, it's going to be shown on a big screen in the office. Any tips?\n" }, { "from": "gpt", "value": "There are s...
I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being truncated when displayed. I've tried tweaki...
To ensure that your ComboBox menu adjusts its width based on the longest label when using a custom item renderer, you'll need to manually calculate the required width based on the text content. Flex does not automatically adjust the dropdown width based on the item renderer's content, especially when using custom item ...
8,738
[ { "from": "human", "value": "I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being tr...
I'd like to be able to toggle easily between two values for "maximum number of parallel project builds" in Visual Studio 2008 (in Tools->Options->Projects and Solutions->Build and Run). (When I'm planning on doing concurrent work I'd like to reduce it from 4 to 3.) I'm not too well versed in writing macros for the IDE....
In Visual Studio 2008, macros can be quite limited when it comes to changing options in the settings dialog through direct manipulation like you're trying to do. However, you can achieve your goal of toggling between the two values for the "maximum number of parallel project builds" by using a bit of automation with a ...
15,775
[ { "from": "human", "value": "I'd like to be able to toggle easily between two values for \"maximum number of parallel project builds\" in Visual Studio 2008 (in Tools->Options->Projects and Solutions->Build and Run). (When I'm planning on doing concurrent work I'd like to reduce it from 4 to 3.) I'm not too...
Does anyone have an example of script that can work reliably well across IE/Firefox to detect if the browser is capable of displaying embedded flash content. I say reliably because I know its not possible 100% of the time.
Detecting the capability to display embedded Flash content can be tricky, especially given the deprecation of Flash support across most modern browsers, including Internet Explorer and Firefox. However, if you still need a script to check for Flash availability, you can use the following approach that relies on checkin...
17,074
[ { "from": "human", "value": "Does anyone have an example of script that can work reliably well across IE/Firefox to detect if the browser is capable of displaying embedded flash content. I say reliably because I know its not possible 100% of the time. \n" }, { "from": "gpt", "value": "Detecting ...
I know there is a tool that enables me to see what actually gets sent/received in my WCF application, that is it let's me see the actual SOAP messages being passed down the wire. The problem is I don't remember what that tool was called, and my Google skills are not of much help either. Anyone?
The tool you are looking for is likely **WCF Service Trace Viewer Tool** (SvcTraceViewer.exe). This tool is included with the Windows SDK and allows you to view and analyze the tracing and message logs generated by your WCF applications. You can use it to see the actual SOAP messages being sent and received, which is v...
21,040
[ { "from": "human", "value": "I know there is a tool that enables me to see what actually gets sent/received in my WCF application, that is it let's me see the actual SOAP messages being passed down the wire.\nThe problem is I don't remember what that tool was called, and my Google skills are not of much hel...
I've found mention of a data application block existing for ODBC, but can't seem to find it anywhere. If i didn't have a copy of the Access DB application block I wouldn't believe it ever existed either. Anyone know where to download either the DLL or the code-base from? --UPDATE: It is NOT included in either the v1,...
It seems like you’re looking for the ODBC Data Application Block, which was part of the earlier Data Application Blocks designed for .NET. However, it’s true that finding legacy components like this can be quite challenging, especially since they may not be included in the more recent versions of the Enterprise Library...
17,831
[ { "from": "human", "value": "I've found mention of a data application block existing for ODBC, but can't seem to find it anywhere. If i didn't have a copy of the Access DB application block I wouldn't believe it ever existed either.\nAnyone know where to download either the DLL or the code-base from?\n--UP...
Problem is described and demonstrated on the following links: Paul Stovell WPF: Blurry Text Rendering www.gamedev.net forum Microsoft Connect: WPF text renderer produces badly blurred text on small font sizes Explanation: Text Clarity in WPF. This link has font comparison. I would like to collect all possible solu...
The issue of blurry text rendering in WPF (Windows Presentation Foundation) has been a common challenge faced by developers, particularly with small font sizes and specific rendering contexts. You've already listed several solutions and workarounds to improve text clarity in WPF. Here’s a comprehensive collection of ad...
17,495
[ { "from": "human", "value": "Problem is described and demonstrated on the following links:\n\nPaul Stovell WPF: Blurry Text Rendering \nwww.gamedev.net forum\nMicrosoft Connect: WPF text renderer produces badly blurred text on small font sizes\n\nExplanation: Text Clarity in WPF. This link has font compar...
We have some very large data files (5 gig to 1TB) where we need quick read/write access. Since we have a fixed record size it seems like some form of ISAM would be the way to go. But would be happy to hear other suggestions. Ideally the solution would have an Apache or LGPL style license but we will pay if we have t...
Hello Terence, For your requirements of handling very large data files with quick read/write access while leveraging a fixed record size, several database or storage solutions could fit your needs. Below, I’ll outline a few options that meet your must-have and nice-to-have criteria. ### 1. **Apache Kudu** - **License...
15,090
[ { "from": "human", "value": "We have some very large data files (5 gig to 1TB) where we need quick read/write access. Since we have a fixed record size it seems like some form of ISAM would be the way to go. But would be happy to hear other suggestions. \nIdeally the solution would have an Apache or LGPL ...
The problem is following: I want to automate the way my emacs starts. It has to be split in two buffers and the slime-repl has to be started in the smallest (bottom) buffer. Plus, I want my file to be opened in the bigger (upper) buffer. In my .emacs there are lines: (slime) ... (split-window-vertically -6) (switch-to-...
To achieve the desired behavior of splitting your Emacs window and opening your file in the upper buffer while ensuring the SLIME REPL opens in the lower buffer, you can modify your Emacs configuration slightly. Below is an example of how to achieve this: 1. First, ensure you have SLIME set up properly. 2. Modify your...
16,928
[ { "from": "human", "value": "The problem is following: I want to automate the way my emacs starts.\nIt has to be split in two buffers and the slime-repl has to be started in the smallest (bottom) buffer. Plus, I want my file to be opened in the bigger (upper) buffer.\nIn my .emacs there are lines:\n(slime)\...
For those of you who have looked at Reddit's source code, where exactly is the logic where it manages the comments hierarchial structure? I downloaded the code, but couldn't even find the database structure let alone where the reads and writes are for the commenting. Is it doing updates on lots of comments if someone r...
Reddit's source code, especially in its earlier iterations, is quite complex, and the architecture has evolved over time. While I can't point you to a specific line or file in their current codebase (as it may have changed after my last update), I can provide a general overview of where you might look and what to consi...
14,779
[ { "from": "human", "value": "For those of you who have looked at Reddit's source code, where exactly is the logic where it manages the comments hierarchial structure?\nI downloaded the code, but couldn't even find the database structure let alone where the reads and writes are for the commenting.\nIs it doi...
I have a ASP.Net 2.0 website that is currently using a custom MembershipProvider and the standard login control. I would like to replace the login control with the one from DotNetOpenId. I override the ValidateUser which checks the username and password, but I shouldn't need to implement this when using OpenId. Is it ...
Yes, it is possible to use OpenID with a custom MembershipProvider in your ASP.NET 2.0 website, allowing you to still leverage the membership functionality to access the currently logged-in user. ### Overview 1. **OpenID Authentication**: When you implement OpenID authentication, users can log in using their OpenID c...
15,605
[ { "from": "human", "value": "I have a ASP.Net 2.0 website that is currently using a custom MembershipProvider and the standard login control. I would like to replace the login control with the one from DotNetOpenId.\nI override the ValidateUser which checks the username and password, but I shouldn't need t...
In my ASP.Net application I have a requirement that when a user clicks on an UI element we generate a PDF for them which they can download. This is currently implemented by doing a form post to an ashx page. This page essentially inspects the form and then executes the correct server side page which either results in H...
To display a "please wait" dialog while your ASP.NET application generates a PDF, you can use JavaScript to manage the display of the popup. You can open the dialog when the form is submitted, and then check the status of the response to close the dialog once the PDF download is initiated. Here’s a way to achieve that:...
16,410
[ { "from": "human", "value": "In my ASP.Net application I have a requirement that when a user clicks on an UI element we generate a PDF for them which they can download. This is currently implemented by doing a form post to an ashx page. This page essentially inspects the form and then executes the correct s...
Is it possible to gather performance statistics programmatically from inside a WCF application? For example, the number of connections open or requests received.
Yes, it is indeed possible to gather performance statistics programmatically from inside a Windows Communication Foundation (WCF) application. You can achieve this through several means, including using built-in performance counters, WCF diagnostics, and custom instrumentation. Here are some approaches to gather perfo...
15,446
[ { "from": "human", "value": "Is it possible to gather performance statistics programmatically from inside a WCF application? For example, the number of connections open or requests received.\n" }, { "from": "gpt", "value": "Yes, it is indeed possible to gather performance statistics programmatic...
Is there an easy way to cache things when using urllib2 that I am over-looking, or do I have to roll my own?
`urllib2` does not provide built-in support for caching HTTP requests. If you want to cache responses when using `urllib2`, you'll likely need to implement your own caching mechanism or use a third-party library that adds caching functionality. Here are a few approaches you might consider: 1. **Implementing a Simple ...
17,265
[ { "from": "human", "value": "Is there an easy way to cache things when using urllib2 that I am over-looking, or do I have to roll my own?\n" }, { "from": "gpt", "value": "`urllib2` does not provide built-in support for caching HTTP requests. If you want to cache responses when using `urllib2`, y...
I have done some searches looking for information about how to do logging with the Spring Framework. We currently have an application that has no logging in it except for system.out statements (very bad way). What I would like to do, is add logging, but also want to be able to control the logging at run time, with say ...
Switching from `System.out` statements to a structured logging framework is a great step in improving your application. Here are some thoughts on how to implement logging in your Spring Framework application and control it at runtime using JMX. ### Logging Frameworks 1. **Log4j2 or Logback**: - Both are popular lo...
12,457
[ { "from": "human", "value": "I have done some searches looking for information about how to do logging with the Spring Framework.\nWe currently have an application that has no logging in it except for system.out statements (very bad way).\nWhat I would like to do, is add logging, but also want to be able to...
I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable. I was thinking: String.Format("{0:###-###-####}", i["MyPhone"].ToString() ); but that does not seem to do...
To format a telephone number string without creating a new variable, you can use a combination of `String.Format` and string manipulation methods to ensure the formatting is done correctly. The approach you've chosen with `Convert.ToInt64()` is generally not recommended for formatting strings with leading zeros or exte...
17,001
[ { "from": "human", "value": "I have a string \"1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable.\nI was thinking:\nString.Format(\"{0:###-###-####}\", i[\"MyPhon...
Modules or software solutions for generating English pronounceable passwords? Are there similar modules for other languages? -Adam
There are several modules and software solutions that can help generate pronounceable passwords in English, as well as in other languages. Here are some options: ### English Pronounceable Password Generators 1. **Pwgen**: - A popular password generator that can create pronounceable passwords. - It has options t...
17,313
[ { "from": "human", "value": "Modules or software solutions for generating English pronounceable passwords?\nAre there similar modules for other languages?\n-Adam\n" }, { "from": "gpt", "value": "There are several modules and software solutions that can help generate pronounceable passwords in En...
I am looking for a method of reading emails using Pop3 in C# 2.0. Currently, I am using code found in CodeProject. However, this solution is less than ideal. The biggest problem is that it doesn't support emails written in unicode.
To read emails using POP3 in C#, especially in an older environment like C# 2.0, you can implement a simple POP3 client that supports Unicode. While the .NET Framework does not have built-in support for POP3, you can create your own implementation by directly communicating with the POP3 server using sockets. Here is a...
11,940
[ { "from": "human", "value": "I am looking for a method of reading emails using Pop3 in C# 2.0. Currently, I am using code found in CodeProject. However, this solution is less than ideal. The biggest problem is that it doesn't support emails written in unicode.\n" }, { "from": "gpt", "value": "To...
I have a C# object with a critical resource that needs to be flushed very specific points in time making it a bad candidate to leave around for the garbage collector to take care of whenever it gets around to it, how should I handle this? Is there something like C++'s delete operator that will let me manually kill th...
In C#, you don't manually control memory management in the same way you would in C++ with the `delete` operator. Instead, C# uses a garbage collector to manage memory automatically. However, you can implement a pattern that allows you to manage resources more explicitly, especially for critical resources that need to b...
16,921
[ { "from": "human", "value": "I have a C# object with a critical resource that needs to be flushed very specific points in time making it a bad candidate to leave around for the garbage collector to take care of whenever it gets around to it, how should I handle this? Is there something like C++'s delete o...
I am am trying to load a SQL table from a flat file. The flat i am talking about is a comma separated file. This has all the data required to populate a table will each column separated by a comma ",". I need some way by which i can load this content into the table faster.
Loading data from a CSV file into a SQL table can be done efficiently using various methods depending on the database system you are using. Here are some commonly used methods for different SQL databases: ### 1. **Using Bulk Insert (SQL Server)** If you are using SQL Server, you can use the `BULK INSERT` command. ``...
16,068
[ { "from": "human", "value": "I am am trying to load a SQL table from a flat file. The flat i am talking about is a comma separated file. This has all the data required to populate a table will each column separated by a comma \",\". I need some way by which i can load this content into the table faster.\n" ...
OK, probably best to give an example here of what I mean. Imagine a web based forum system, where the user authentication is done by some external method, which the system is aware of. Now, say for example, a user enters the URL for a thread that they do not have access to. For this should I return a 403 (Forbidden), l...
When designing your API or web application, the choice between returning a `403 Forbidden` and a `404 Not Found` status code depends on the specific context and what you want to communicate to the user. Here's a breakdown of when to use each status code based on your examples and considerations. ### 403 Forbidden - *...
14,606
[ { "from": "human", "value": "OK, probably best to give an example here of what I mean.\nImagine a web based forum system, where the user authentication is done by some external method, which the system is aware of.\nNow, say for example, a user enters the URL for a thread that they do not have access to. Fo...
What happens to exceptions raised while in myMethod: if it is invoked via NSObject's performSelectorOnMainThread:withObject:waitUntilDone:? In particular, can I catch them in the scope of the call to performSelectorOnMainThread like this... @try { [self performSelectorOnMainThread:@selector(myMethod) withObject:ni...
When you invoke a method using `performSelectorOnMainThread:withObject:waitUntilDone:`, the specified method (`myMethod` in your case) is executed asynchronously on the main thread. This means that the exception handling within the call to `performSelectorOnMainThread` does not extend to the method that is executed as ...
19,437
[ { "from": "human", "value": "What happens to exceptions raised while in myMethod: if it is invoked via NSObject's performSelectorOnMainThread:withObject:waitUntilDone:? \nIn particular, can I catch them in the scope of the call to performSelectorOnMainThread like this...\n@try {\n [self performSelectorOn...
How can I hide the title bar from a Windows Form but still have a Resizing Frame?
To hide the title bar from a Windows Forms application while still retaining a resizable frame, you can set the form's `FormBorderStyle` to `FormBorderStyle.None`, which will remove the title bar and window borders. However, by default, this will also make the window non-resizable. To allow for resizing while still hid...
11,071
[ { "from": "human", "value": "How can I hide the title bar from a Windows Form but still have a Resizing Frame?\n" }, { "from": "gpt", "value": "To hide the title bar from a Windows Forms application while still retaining a resizable frame, you can set the form's `FormBorderStyle` to `FormBorderS...
I am trying to write a web-app to manage references for my PhD thesis. I used to manage this information inside a personal Confluence (fantastic tool! - http://www.atlassian.com/software/confluence/) instance however I'm fed-up with the opening of PDF's and cutting and pasting values into fields that I wish to record. ...
Creating a selection rectangle over a PDF image in a web application can be accomplished using HTML5 features combined with JavaScript. Although RichFaces is mainly focused on server-side components, you can leverage JavaScript and CSS for the client-side interactivity needed to create a selection rectangle. Here's a ...
12,316
[ { "from": "human", "value": "I am trying to write a web-app to manage references for my PhD thesis.\nI used to manage this information inside a personal Confluence (fantastic tool! - http://www.atlassian.com/software/confluence/) instance however I'm fed-up with the opening of PDF's and cutting and pasting ...
But here's an example: Dim desiredType as Type if IsNumeric(desiredType) then ... EDIT: I only know the Type, not the Value as a string. Ok, so unfortunately I have to cycle through the TypeCode. But this is a nice way to do it: if ((desiredType.IsArray)) return 0; switch (Type.GetTypeCode(desiredType)) { ...
Based on your requirement to check if a given `Type` is numeric and your existing code structure, you can streamline it for better clarity and maintainability. Since you're working with `Type` and you want to check if it's a numeric type without using its string representation, you can use the `TypeCode` directly for t...
18,506
[ { "from": "human", "value": "But here's an example:\nDim desiredType as Type\nif IsNumeric(desiredType) then ...\n\nEDIT: I only know the Type, not the Value as a string.\nOk, so unfortunately I have to cycle through the TypeCode.\nBut this is a nice way to do it:\n if ((desiredType.IsArray))\n return ...
I would like to ask for some simple examples showing the uses of <div> and <span>. I've seen them both used to mark a section of a page with an id or class, but I'm interested in knowing if there are times when one is preferred over the other.
Certainly! The `<div>` and `<span>` elements in HTML are both used for grouping content, but they serve different purposes based on their display properties and typical usage contexts. Here are some simple examples to illustrate their differences and when one might be preferred over the other. ### `<div>` - **Block-l...
16,600
[ { "from": "human", "value": "I would like to ask for some simple examples showing the uses of <div> and <span>. I've seen them both used to mark a section of a page with an id or class, but I'm interested in knowing if there are times when one is preferred over the other.\n" }, { "from": "gpt", ...
I have some code which utilizes parameterized queries to prevent against injection, but I also need to be able to dynamically construct the query regardless of the structure of the table. What is the proper way to do this? Here's an example, say I have a table with columns Name, Address, Telephone. I have a web page ...
You're right to be concerned about the way you're dynamically constructing your SQL queries. Using string concatenation for SQL queries can lead to SQL injection vulnerabilities, especially when it comes to column names or table names, as they can't be parameterized using placeholders like `?`. Since you need to allow...
16,272
[ { "from": "human", "value": "I have some code which utilizes parameterized queries to prevent against injection, but I also need to be able to dynamically construct the query regardless of the structure of the table. What is the proper way to do this?\nHere's an example, say I have a table with columns Nam...
Is there any resource that provides a chart of CSS properties and their support through most browser/OS combinations? For example, if I want to know what browser supports overflow or min-height and any quirks to be aware of in the implementation of these properties and their values, what is the best place to get all th...
For checking CSS properties and their support across different browsers and operating systems, there are several reliable resources that provide comprehensive charts and compatibility tables. Here are some of the best: 1. **Can I Use** (caniuse.com): This is one of the most popular and widely used resources for checki...
19,642
[ { "from": "human", "value": "Is there any resource that provides a chart of CSS properties and their support through most browser/OS combinations? For example, if I want to know what browser supports overflow or min-height and any quirks to be aware of in the implementation of these properties and their val...
I've got some JSON data, but it's all on one line. Does anyone know of a web or Windows editor that will format (e.g. indent and insert new lines) this data for me, so I can read it better? Preferably one that uses a GUI to display the JSON—instead of a command-line tool that outputs a reformatted document, for example...
Yes, there are several web-based and Windows GUI tools that can help you format JSON data for better readability. Here are a few options: ### Web-Based Tools: 1. **JSON Formatter & Validator (jsonformatter.curiousconcept.com)**: - Simply paste your JSON data into the input area, and it will format it for you. It al...
19,913
[ { "from": "human", "value": "I've got some JSON data, but it's all on one line. Does anyone know of a web or Windows editor that will format (e.g. indent and insert new lines) this data for me, so I can read it better? Preferably one that uses a GUI to display the JSON—instead of a command-line tool that ou...
I'm trying to use CSS (under @media print) and JavaScript to print a one-page document with a given piece of text made as large as possible while still fitting inside a given width. The length of the text is not known beforehand, so simply using a fixed-width font is not an option. To put it another way, I'm looking f...
To achieve a responsive font size that fits within a specific width for printing, you’re on the right track with using JavaScript. However, as you've noticed, there are some complications when it comes to printing, mainly due to differences in DPI settings across devices and browsers. ### Understanding DPI in Browser...
14,068
[ { "from": "human", "value": "I'm trying to use CSS (under @media print) and JavaScript to print a one-page document with a given piece of text made as large as possible while still fitting inside a given width. The length of the text is not known beforehand, so simply using a fixed-width font is not an opt...
I am trying to figure out Messagebox( ownerWindow, ... ). Using reflector I see that the ownerWindow defaults to the ActiveWindow for the thread. So the only time I need the ownerWindow parameter is to call Show from another thread. However when I try this, I get a cross threading exception. private void button1_...
You are correct that `MessageBox.Show` can take an `IWin32Window` as the owner window, and that it is useful for modally displaying the message box relative to a specific window. However, as you've observed, if you try to call `MessageBox.Show` from a different thread than the one that created the window, you'll encoun...
20,281
[ { "from": "human", "value": "I am trying to figure out Messagebox( ownerWindow, ... ).\nUsing reflector I see that the ownerWindow defaults to the ActiveWindow for the thread.\nSo the only time I need the ownerWindow parameter is to call Show from another thread. \nHowever when I try this, I get a cross th...
Is there a way to recover the contents of a browser textarea? Say, you've typed a long post and then accidentally clicked on a link. Then when you come back, the textfields tantalizingly retain the text you typed in, but the textarea is blank. Where does IE and Firefox store the stuff that prepopulates? Can textareas b...
When you type text into a textarea in a web browser, that text is often temporarily stored in the browser’s memory, and in some cases, certain types of auto-saves can occur. However, if you accidentally navigate away from the page and the content disappears, recovering that text can be challenging. ### For Firefox: Fi...
17,671
[ { "from": "human", "value": "Is there a way to recover the contents of a browser textarea? Say, you've typed a long post and then accidentally clicked on a link. Then when you come back, the textfields tantalizingly retain the text you typed in, but the textarea is blank. Where does IE and Firefox store the...
I create a TextArea in actionscript: var textArea:TextArea = new TextArea(); I want it to have a black background. I've tried textArea.setStyle("backgroundColor", 0x000000); and I've tried textArea.opaqueBackground = 0x000000; but the TextArea stays white. What should I do?
To set a black background for a `TextArea` in ActionScript, you should use the `setStyle` method to apply the `backgroundColor` style correctly. However, you also need to ensure that the `backgroundAlpha` style is set to `1` to make the background color visible. Here's how you can do it: ```actionscript var textArea...
20,365
[ { "from": "human", "value": "I create a TextArea in actionscript:\nvar textArea:TextArea = new TextArea();\n\nI want it to have a black background. I've tried\ntextArea.setStyle(\"backgroundColor\", 0x000000);\n\nand I've tried\ntextArea.opaqueBackground = 0x000000;\n\nbut the TextArea stays white. What s...
We're looking at CouchdDB for a CMS-ish application. What are some common patterns, best practices and workflow advice surrounding backing up our production database? I'm particularly interested in the process of cloning the database for use in development and testing. Is it sufficient to just copy the files on disk ou...
When using CouchDB for a CMS-like application, implementing a robust backup strategy is critical to ensure data integrity and availability. Below, I’ll outline common patterns, best practices, and workflows related to backing up your production CouchDB database, along with advice on cloning for development and testing....
11,188
[ { "from": "human", "value": "We're looking at CouchdDB for a CMS-ish application. What are some common patterns, best practices and workflow advice surrounding backing up our production database?\nI'm particularly interested in the process of cloning the database for use in development and testing.\nIs it s...
How can I programmatically determine if I have access to a server (TCP) with a given IP address and port using C#?
To programmatically determine if you have access to a server via a given IP address and port using C#, you can use the `TcpClient` class, which is part of the `System.Net.Sockets` namespace. This class allows you to attempt to establish a TCP connection to the specified server. Here's a simple example demonstrating ho...
16,627
[ { "from": "human", "value": "How can I programmatically determine if I have access to a server (TCP) with a given IP address and port using C#?\n" }, { "from": "gpt", "value": "To programmatically determine if you have access to a server via a given IP address and port using C#, you can use the ...
As kind of a follow up to this question about prefixes, I agree with most people on the thread that prefixes are bad. But what about if you are using getters and setters? Then you need to differeniate the publicly accessible getter name from the privately stored variable. I normally just use an underscore, but is there...
Using prefixes for private variables can lead to code that is less readable and more difficult to maintain. However, there are a few widely accepted conventions that you can use to differentiate between public getters/setters and private variables without relying on prefixes. Here are some of the common approaches: 1....
16,287
[ { "from": "human", "value": "As kind of a follow up to this question about prefixes, I agree with most people on the thread that prefixes are bad. But what about if you are using getters and setters? Then you need to differeniate the publicly accessible getter name from the privately stored variable. I norm...
I want to get a System.Type given only the type name in a string. For instance, if I have an object: MyClass abc = new MyClass(); I can then say: System.Type type = abc.GetType(); But what if all I have is: string className = "MyClass";
If you have only the type name in a string and want to get a `System.Type` object for that class, you can use the `Type.GetType()` method. However, you need to provide the full name of the type, which includes the namespace. If the type is in the same assembly as your executing code, you can retrieve it like this: ```...
18,545
[ { "from": "human", "value": "I want to get a System.Type given only the type name in a string.\nFor instance, if I have an object:\nMyClass abc = new MyClass();\n\nI can then say:\nSystem.Type type = abc.GetType();\n\nBut what if all I have is:\nstring className = \"MyClass\";\n\n" }, { "from": "gpt...
Here's a problem I keep running into: I have a lot of situations where I need to display some text with a styled container like so: <mx:Canvas> <mx:Text text="{text}" left="5" verticalCenter="0" right="5" /> </mx:Canvas> As you can see - the text in constrained by the left and right margins of the canvas and ...
It sounds like you're running into an issue with the `Text` control within your `Canvas` not expanding vertically as expected. By default, the `mx:Text` control only displays a single line of text unless you specify the `multiline` property. To allow your `Text` control to display multiple lines of text, you can set t...
19,745
[ { "from": "human", "value": "Here's a problem I keep running into:\nI have a lot of situations where I need to display some text with a styled container like so:\n<mx:Canvas>\n <mx:Text text=\"{text}\" left=\"5\" verticalCenter=\"0\" right=\"5\" /> \n</mx:Canvas>\n\nAs you can see - the text in const...
I have an HTTP server that returns large bodies in response to POST requests (it is a SOAP server). These bodies are "streamed" via chunking. If I encounter an error midway through streaming the response how can I report that error to the client and still keep the connection open? The implementation uses a proprietary ...
When dealing with large HTTP responses, especially in cases like yours where the response is streamed and chunked, handling errors effectively without prematurely closing the connection can be challenging. Here are some approaches you could consider at the HTTP protocol level: 1. **Use HTTP 200 OK with Error Payload:*...
15,684
[ { "from": "human", "value": "I have an HTTP server that returns large bodies in response to POST requests (it is a SOAP server). These bodies are \"streamed\" via chunking. If I encounter an error midway through streaming the response how can I report that error to the client and still keep the connection o...
About a year ago, I picked up Scott Ambler's Refactoring Databases: Evolutionary Database Design. I was won over to the idea that just as you can develop your code with TDD, you probably should be covering your databases with unit tests (at least) or even writing database tests before you make a change to the schema so...
It's great to hear that you're embracing the idea of applying TDD principles to database design and management! There are several tools and frameworks that can help automate database change management and facilitate testing in a more structured way. Here are some popular options: 1. **Liquibase**: This is an open-sour...
18,861
[ { "from": "human", "value": "About a year ago, I picked up Scott Ambler's Refactoring Databases: Evolutionary Database Design. I was won over to the idea that just as you can develop your code with TDD, you probably should be covering your databases with unit tests (at least) or even writing database tests ...
I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't get them both to work with smtp.att.yahoo.com. I get the SMTP settings from my own Web.config keys. These settings work when I send using System.Web.Mail, but fail with System.Net.Mail. <add key="SmtpServer" value="smtp.att.yahoo.c...
Your code and settings for sending email using `System.Net.Mail` with Yahoo's SMTP server look mostly correct, but there are a few things you might want to check and adjust to resolve the issue. ### Possible Issues and Solutions: 1. **SMTP Port and SSL**: Yahoo's SMTP typically supports SSL on port 465 or TLS on port...
15,512
[ { "from": "human", "value": "I can get both System.Net.Mail and System.Web.Mail to work with GMail, but I can't get them both to work with smtp.att.yahoo.com.\nI get the SMTP settings from my own Web.config keys. These settings work when I send using System.Web.Mail, but fail with System.Net.Mail.\n <a...
The GoDiagram object model has a GoDocument. GoViews have a reference to a GoDocument. If the user does any modification on the diagramming surface, a GoDocument.Changed event is raised with the relevant information in the event arguments. I would like to be notified when some user-actions happen, so that I can conf...
In GoDiagram, you're correct that the `Changed` event is raised after modifications occur. If you want to intervene before changes take place, you can utilize a different approach since GoDiagram does not have built-in "before" events for editing or resizing. To implement a "BeforeEditing" or "BeforeResizing" notifica...
14,301
[ { "from": "human", "value": "\nThe GoDiagram object model has a GoDocument. \nGoViews have a reference to a GoDocument.\nIf the user does any modification on the diagramming surface, a GoDocument.Changed event is raised with the relevant information in the event arguments.\n\nI would like to be notified whe...
This problem has been afflicting me for quite a while and it's been really annoying. Every time I login after a reboot/power cycle the explorer takes some time to show up. I've taken the step of waiting for all the services to boot up and then I login, but it doesn't make any difference. The result is always the same: ...
It sounds like you're facing an issue with the system tray (notification area) icons not displaying correctly after booting into Windows. The approach you've tried with sending `WM_PAINT` to the system tray seems reasonable, but there are a few additional techniques you can try to refresh the system tray icons or force...
13,800
[ { "from": "human", "value": "This problem has been afflicting me for quite a while and it's been really annoying.\nEvery time I login after a reboot/power cycle the explorer takes some time to show up.\nI've taken the step of waiting for all the services to boot up and then I login, but it doesn't make any ...
I am trying to upload a file using to Flickr using JQuery. I have a form (which works if I dont use JQuery) which I am submitting using the Form Plugin. My code is as follows: <html> <head> <title>Test Upload</title> <script type="text/javascript" src="jquery-1.2.6.js"></script> <script type="text/javascript" src="jqu...
The issue you're encountering seems to stem from the fact that the `ajaxSubmit` call is not able to process the response correctly because of the nature of the response from Flickr's API. The response you are receiving indicates that your API key is invalid, which could be due to several reasons. Here are some steps t...
16,475
[ { "from": "human", "value": "I am trying to upload a file using to Flickr using JQuery. I have a form (which works if I dont use JQuery) which I am submitting using the Form Plugin. My code is as follows:\n<html>\n\n<head>\n<title>Test Upload</title>\n<script type=\"text/javascript\" src=\"jquery-1.2.6.js\"...
Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?
Deciding whether to upgrade your existing app or rewrite it from scratch involves weighing several factors. Here are some considerations to help you make the decision: ### Reasons to Upgrade: 1. **Time and Resource Constraints**: If you're under pressure to deliver updates quickly, upgrading the existing app can often...
17,641
[ { "from": "human", "value": "Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?\n" }, { "from": "gpt", "value": "Deciding whether to upgrade your existing app or rewrite it from scratch involves weighing several fa...
Any pointers on how to initiate serial communication with the iphone? Or any other idea to interact with external hardware?
Initiating serial communication with an iPhone can be a bit tricky because iOS devices typically do not support direct serial connections (like USB or RS-232). However, there are several methods to interact with external hardware. Here are some pointers: ### 1. **Bluetooth Communication** - **Bluetooth LE (Low Energy...
14,591
[ { "from": "human", "value": "Any pointers on how to initiate serial communication with the iphone? Or any other idea to interact with external hardware?\n" }, { "from": "gpt", "value": "Initiating serial communication with an iPhone can be a bit tricky because iOS devices typically do not suppo...
I have a folder that is my working copy. How do I remove all SVN functionality from this folder? There is a reason for me doing this, somehow my master folder that contains all my working copies of sites, has somehow been turned into a working copy itself, so I have a working copy within itself as such. So, is there an...
Yes, you can remove the Subversion (SVN) version control metadata from a working copy folder, effectively reverting it back to a regular directory. To do this, you need to delete the `.svn` directories that SVN uses to track version control information. Here’s how to do it: ### Method 1: Using Command Line 1. **Open...
16,290
[ { "from": "human", "value": "I have a folder that is my working copy. How do I remove all SVN functionality from this folder? There is a reason for me doing this, somehow my master folder that contains all my working copies of sites, has somehow been turned into a working copy itself, so I have a working co...
I'm developing an application targeting .NET Framework 2.0 using C# for which I need to be able to find the default application that is used for opening a particular file type. I know that, for example, if you just want to open a file using that application you can use something like: System.Diagnostics.Process.Start( ...
To find the default application associated with a particular file type on Windows, you can indeed use P/Invoke to access the Windows API. Specifically, you can use the `Association` and `ShellExecute` functions to achieve this. Here's a simple example of how you can retrieve the default application for a particular fi...
14,276
[ { "from": "human", "value": "I'm developing an application targeting .NET Framework 2.0 using C# for which I need to be able to find the default application that is used for opening a particular file type.\nI know that, for example, if you just want to open a file using that application you can use somethin...
How can I view the intermediate translation done to JSP and JSPX pages by WTP? I'm getting weird syntax errors in my Problems tab of Eclipse in a project that has plenty of .jspx pages. They don't affect anything in the running application (Tomcat 6.0) and they appeared only over the last 2 weeks, after an update. Th...
To view the intermediate translation of JSP and JSPX pages in Eclipse using the Web Tools Platform (WTP), you can enable the JSP compilation logging which may help you understand what's going wrong in your .jspx files. Here's how you can go about it: ### Enable JSP Compilation Logging 1. **Adjust Eclipse Logging Opti...
16,971
[ { "from": "human", "value": "How can I view the intermediate translation done to JSP and JSPX pages by WTP? I'm getting weird syntax errors in my Problems tab of Eclipse in a project that has plenty of .jspx pages. They don't affect anything in the running application (Tomcat 6.0) and they appeared only o...
Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx. Your site is secured using nothing but ASP.net forms authentication and an ASP.net Login server control on login.aspx. The details are as follows: The site is configured to use the SqlMembershipProvider The site denies all anonymous u...
The out-of-box experience provided by ASP.NET, particularly with forms authentication and the SqlMembershipProvider, is generally secure for typical web applications. However, no system is invulnerable, and the security of a system relies heavily on how it’s configured, deployed, and used. Let’s evaluate the specifics ...
12,599
[ { "from": "human", "value": "Imagine that you have a simple site with only 2 pages: login.aspx and secret.aspx. Your site is secured using nothing but ASP.net forms authentication and an ASP.net Login server control on login.aspx. The details are as follows:\n\nThe site is configured to use the SqlMembers...