instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
A UITableViewCell comes "pre-built" with a UILabel as its one and only subview after you've init'ed it. I'd really like to change the background color of said label, but no matter what I do the color does not change. The code in question: UILabel* label = (UILabel*)[cell.contentView.subviews objectAtIndex:0]; label.tex...
In a `UITableViewCell`, the UILabel that you are accessing via `cell.contentView.subviews` is most likely being created with some default settings that may not be conducive to changing its background color directly. Here are a few things you can try to change the background color of the label: 1. **Ensure the label'...
36,470
[ { "from": "human", "value": "A UITableViewCell comes \"pre-built\" with a UILabel as its one and only subview after you've init'ed it. I'd really like to change the background color of said label, but no matter what I do the color does not change. The code in question:\nUILabel* label = (UILabel*)[cell.cont...
I have a database where I store objects. I have the following (simplified) schema CREATE TABLE MyObjects ( UniqueIdentifier Id; BigInt GenerationId; BigInt Value; Bit DeleteAction; ) Each object has a unique identifier ("Id"), and a (set of) property ("Value"). Each time the va...
To achieve the desired outcome of retrieving the state of all active objects at a given generation, you can use a SQL query that employs a combination of `JOIN` and a subquery to find the latest generation for each object that does not exceed the specified generation ID. Here is a potential SQL query to accomplish this...
39,648
[ { "from": "human", "value": "I have a database where I store objects. I have the following (simplified) schema\nCREATE TABLE MyObjects\n(\n UniqueIdentifier Id;\n BigInt GenerationId;\n BigInt Value;\n Bit DeleteAction;\n)\n\nEach object has a unique identifier (\"Id\"),...
I need to alter a trigger in sql server 2005 and I want to do it using a table adapter and a sql statement, not a stored proc. I know I could run this in the query browser and execute it but I need to deploy it across several databases and use a table adapter in the update. Is this possible? Doing Add Query -> Update -...
In SQL Server, when you are using a TableAdapter or executing commands through a dataset in C#, you generally can't include certain SQL statements like `USE`, `GO`, or multi-statement batches directly in the SQL command. These statements are meant for SQL Server Management Studio and are not supported in a way that a T...
39,120
[ { "from": "human", "value": "I need to alter a trigger in sql server 2005 and I want to do it using a table adapter and a sql statement, not a stored proc. I know I could run this in the query browser and execute it but I need to deploy it across several databases and use a table adapter in the update. Is t...
I was watching Anders' talk about C# 4.0 and sneak preview of C# 5.0, and it got me thinking about when optional parameters are available in C# what is going to be the recommended way to declare methods that do not need all parameters specified? For example something like the FileStream class has about fifteen differen...
Your question touches on an important topic in API design, especially in the context of C# and its approach to method overloading versus using optional parameters. ### Advantages of Using Optional Parameters 1. **Simplified Interface**: Using optional parameters can lead to a more streamlined and user-friendly interf...
34,780
[ { "from": "human", "value": "I was watching Anders' talk about C# 4.0 and sneak preview of C# 5.0, and it got me thinking about when optional parameters are available in C# what is going to be the recommended way to declare methods that do not need all parameters specified?\nFor example something like the F...
I'd like to serialize some LINQ generated objects and store them in a table as a binary field (Never you mind why). I'd like to be able to write some code that looks something like this: SerialTestDataContext db = new SerialTestDataContext(); relation_table row = db.relation_tables.First(); MemoryStream memStream = n...
Serializing LINQ-to-SQL generated objects directly can be tricky because not all of the generated classes are serializable, even if you mark your own classes as `[Serializable]`. LINQ-to-SQL generates entities that inherit from various base classes and often include non-serializable types (like `DataContext`, `EntityRe...
39,461
[ { "from": "human", "value": "I'd like to serialize some LINQ generated objects and store them in a table as a binary field (Never you mind why). I'd like to be able to write some code that looks something like this:\nSerialTestDataContext db = new SerialTestDataContext();\n\nrelation_table row = db.relation...
I am working on an ASP.NET page with a GridView and an ObjectDataSource. I want to configure the ObjectDataSource against a class (decorated with DataObject()) in my business layer. A class amongst many others set up in a very similar fashion. I selected the class and clicked Next to pick the function for the SelectM...
The issue you are experiencing when trying to configure the `ObjectDataSource` using the GUI in Visual Studio could stem from a few different areas. Below are some possible reasons for the failure and solutions you can try: ### 1. **Check for Exception Handling** Make sure your `SelectMethod` (and any other methods yo...
38,532
[ { "from": "human", "value": "I am working on an ASP.NET page with a GridView and an ObjectDataSource.\nI want to configure the ObjectDataSource against a class (decorated with DataObject()) in my business layer. A class amongst many others set up in a very similar fashion. I selected the class and clicked...
We are deciding the naming convention for tables, columns, procedures, etc. at our development team at work. The singular-plural table naming has already been decided, we are using singular. We are discussing whether to use a prefix for each table name or not. I would like to read suggestions about using a prefix or no...
The decision to use a prefix for table names in your database design is a common topic of discussion among development teams. Below are some pros and cons to consider, along with some insights on security and maintainability: ### Pros of Using Prefixes 1. **Namespace Clarity**: Prefixes can help differentiate between...
39,075
[ { "from": "human", "value": "We are deciding the naming convention for tables, columns, procedures, etc. at our development team at work. The singular-plural table naming has already been decided, we are using singular. We are discussing whether to use a prefix for each table name or not. I would like to re...
I'm trying to add dll references to an ASP.NET 3.5 project(Web Forms not MVC), and all of the references I'm adding keep showing up as auto updating. I right clicked on the dll in the bin folder to specify copy local, but the option isn't there. I went back to one of 2.0 projects, and I have plenty of dll's that aren'...
In ASP.NET projects, especially with older versions like 3.5, managing DLL references can sometimes be a bit tricky. The behavior you are experiencing, where the references are marked as "Auto Update," is generally a result of how the references are added. Here’s how to troubleshoot and potentially resolve the issue: ...
37,476
[ { "from": "human", "value": "I'm trying to add dll references to an ASP.NET 3.5 project(Web Forms not MVC), and all of the references I'm adding keep showing up as auto updating. I right clicked on the dll in the bin folder to specify copy local, but the option isn't there.\nI went back to one of 2.0 proje...
I'm a bit confused about how MVC works and I can't find anything but basic examples. I want to make a kind of widget-based design; you can choose various widgets to go on your page. Each widget should be responsible for itself - it should have a controller and a view. But what about the main page? Suddenly I've got...
Your project involves a more modular approach to the MVC pattern by creating a widget-based design. You can definitely implement this without fully breaking the MVC paradigm, but it does require a thoughtful structure. Here’s how you can approach it: ### High-Level Structure 1. **Main Application Controller**: - T...
35,813
[ { "from": "human", "value": "I'm a bit confused about how MVC works and I can't find anything but basic examples.\nI want to make a kind of widget-based design; you can choose various widgets to go on your page. Each widget should be responsible for itself - it should have a controller and a view. But wh...
Why would someone use WHERE 1=1 AND <conditions> in a SQL clause (Either SQL obtained through concatenated strings, either view definition) I've seen somewhere that this would be used to protect against SQL Injection, but it seems very weird. If there is injection WHERE 1 = 1 AND injected OR 1=1 would have the same res...
The use of `WHERE 1=1` is a common SQL pattern that has a few purposes, primarily related to dynamic query building, but it is generally not meant to protect against SQL injection directly. Let's break down the reasoning and common use cases for this pattern: ### Purpose of `WHERE 1=1` 1. **Simplifies Dynamic Queries...
36,536
[ { "from": "human", "value": "Why would someone use WHERE 1=1 AND <conditions> in a SQL clause (Either SQL obtained through concatenated strings, either view definition)\nI've seen somewhere that this would be used to protect against SQL Injection, but it seems very weird.\nIf there is injection WHERE 1 = 1 ...
I have a GridView with several fields, one of which can potentially have a crazy wide value in it like this: aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa If that sort of thing is in the field, I want it to wrap. I can easily insert a character in code every 50 characters o...
To achieve a clean line wrap in a GridView when dealing with potentially long strings, you'll want to consider both CSS and possibly a small adjustment to your data presentation. Instead of manually inserting characters for wrapping, you can use CSS to ensure that long words wrap nicely without adding unnecessary space...
40,163
[ { "from": "human", "value": "I have a GridView with several fields, one of which can potentially have a crazy wide value in it like this:\naaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\nIf that sort of thing is in the field, I want it to wrap.\nI can easily inse...
The following code does not compile: public class GenericsTest { public static void main(String[] args) { MyList<?> list = new MyList<Object>(); Class<?> clazz = list.get(0); // Does not compile with reason // "Type mismatch: cannot convert from Object to Class" MyList ...
The issue you are facing with generics stems from how Java handles type parameters and type safety. Let's break down your example to clarify the behavior and what you can do to manage the migration towards generics without breaking your build. ### Original Problem You initially had the following structure: ```java p...
39,170
[ { "from": "human", "value": "The following code does not compile:\npublic class GenericsTest { \n public static void main(String[] args) {\n MyList<?> list = new MyList<Object>();\n Class<?> clazz = list.get(0);\n\n // Does not compile with reason \n // \"Type mismatch: can...
I've been using MVC frameworks for a short while now and I really like how the concerns are separated out. I've got into a bad habit of letting the controllers do quite a bit of work. So I'm really looking for some advice. When I first started using MVC I quite often had the controller doing manipulation on the model...
You're on the right track in terms of understanding the separation of concerns and how to structure your MVC application effectively. Let's break down your assumptions and refine your approach: ### Your Assumptions: 1. **Controller Calling the Repository Directly**: - This is acceptable for simple CRUD operations...
39,013
[ { "from": "human", "value": "I've been using MVC frameworks for a short while now and I really like how the concerns are separated out. I've got into a bad habit of letting the controllers do quite a bit of work. So I'm really looking for some advice.\nWhen I first started using MVC I quite often had the ...
Are there any libraries out there for Java that will accept two strings, and return a string with formatted output as per the *nix diff command? e.g. feed in test 1,2,3,4 test 5,6,7,8 test 9,10,11,12 test 13,14,15,16 and test 1,2,3,4 test 5,6,7,8 test 9,10,11,12,13 test 13,14,15,16 as input, and it would give you ...
To achieve a side-by-side diff representation similar to the `diff -y` command in Unix/Linux, you can use the `DiffUtils` library in Java, along with some custom code to format the output. `DiffUtils` is a popular library for comparing two sets of text. Here's a simple implementation that demonstrates how to do this: ...
37,754
[ { "from": "human", "value": "Are there any libraries out there for Java that will accept two strings, and return a string with formatted output as per the *nix diff command?\ne.g. feed in \ntest 1,2,3,4\ntest 5,6,7,8\ntest 9,10,11,12\ntest 13,14,15,16\n\nand \ntest 1,2,3,4\ntest 5,6,7,8\ntest 9,10,11,12,13\...
I have a .NET dll which needs to read it's config settings from it's config file. Usually, the config file is placed in the same directory as the DLL. But how do i read the config file if the DLL is GAC'ed, because I can put only the DLLs in the GAC, and not it's config files.
When a .NET assembly (DLL) is installed in the Global Assembly Cache (GAC), it does not have its own application-specific configuration file in the same way that a standalone application would. Instead, GAC'ed assemblies typically rely on the configuration file of the application that is using them. Here’s how you can ...
37,758
[ { "from": "human", "value": "I have a .NET dll which needs to read it's config settings from it's config file. Usually, the config file is placed in the same directory as the DLL. But how do i read the config file if the DLL is GAC'ed, because I can put only the DLLs in the GAC, and not it's config files.\n...
Boost is a great set of libraries and it really boosts productivity. But debugging code that uses it is a total nightmare. Sure, stepping through twenty thousand header files can be a valuable intellectual exercise, but what if you need to do it over and over again? Is there a developer-friendly way of just skipping th...
In native C++, there isn’t a direct equivalent to the `DebuggerStepThroughAttribute` that you would find in .NET, but there are several techniques you can use to make debugging more manageable when working with third-party libraries like Boost. Here are some approaches to consider: ### 1. **Use Debugger Settings** Mo...
38,698
[ { "from": "human", "value": "Boost is a great set of libraries and it really boosts productivity. But debugging code that uses it is a total nightmare. Sure, stepping through twenty thousand header files can be a valuable intellectual exercise, but what if you need to do it over and over again?\nIs there a ...
I am building a WPF application. Inside that application I am using the XmlReader class to parse several local XML files. The code I have written works perfectly during debugging, but fails once I publish the application and install it. I have the XML documents as CONTENT in build action, and I have them set to COPY AL...
It sounds like you're encountering an issue with the relative file path when your application is published. When you're debugging your WPF application, the current working directory is usually the output path of your project (e.g., `bin\Debug\`), but this can change when the application is published and run from a diff...
35,254
[ { "from": "human", "value": "I am building a WPF application. Inside that application I am using the XmlReader class to parse several local XML files. The code I have written works perfectly during debugging, but fails once I publish the application and install it.\nI have the XML documents as CONTENT in bu...
I have a thread that, when its function exits its loop (the exit is triggered by an event), it does some cleanup and then sets a different event to let a master thread know that it is done. However, under some circumstances, SetEvent() seems not to return after it sets the thread's 'I'm done' event. This thread is part...
It sounds like you've been through quite a journey debugging this issue, and it’s great to see that you've made progress in understanding the underlying problem. Indeed, trying to unload a thread while detaching a DLL can lead to a range of complex issues, including deadlocks, resource leaks, and crashes, since the DLL...
36,940
[ { "from": "human", "value": "I have a thread that, when its function exits its loop (the exit is triggered by an event), it does some cleanup and then sets a different event to let a master thread know that it is done.\nHowever, under some circumstances, SetEvent() seems not to return after it sets the thre...
We're running a lightweight web app on a single EC2 server instance, which is fine for our needs, but we're wondering about monitoring and restarting it if it goes down. We have a separate non-Amazon server we'd like to use to monitor the EC2 and start a fresh instance if necessary and shut down the old one. All our us...
Monitoring and automating the management of your EC2 instance can definitely be streamlined with some existing solutions and custom scripts. Here are some steps and resources to help you set up a system that monitors your EC2 instance and restarts it if necessary. ### 1. Monitoring the EC2 Instance You can use a vari...
34,416
[ { "from": "human", "value": "We're running a lightweight web app on a single EC2 server instance, which is fine for our needs, but we're wondering about monitoring and restarting it if it goes down.\nWe have a separate non-Amazon server we'd like to use to monitor the EC2 and start a fresh instance if neces...
I'm working on a project which makes substantial use of code generation. Some of the files it generates contain >0.25 million lines of code. VS (2K5) doesn't cope too badly, but R# (4.01) throws an out of memory exception every two minutes or so. Splitting them out into partial classes/separate files isn't an option in...
Dealing with large files in an IDE can indeed be challenging, especially when encountering limitations like memory exceptions. Here are several strategies that might help you manage and navigate your large file more effectively: 1. **Disable Syntax Highlighting**: If you're only viewing the file and not editing it, co...
37,232
[ { "from": "human", "value": "I'm working on a project which makes substantial use of code generation. Some of the files it generates contain >0.25 million lines of code. VS (2K5) doesn't cope too badly, but R# (4.01) throws an out of memory exception every two minutes or so.\nSplitting them out into partial...
I have a degrafa surface into a canvas container. I want to link both width and height. When i use binding like it works as expected: // binding BindingUtils.bindProperty(rect,"height",this,"height"); BindingUtils.bindProperty(rect,"width",this,"width"); Now, someone told me that i should do it on validateSize...
It seems that you're trying to synchronize the width and height of a DeGrafa rectangle with a canvas container in Flex. You're using the `BindingUtils.bindProperty` method for binding, which is a good approach for straightforward bindings. However, you want to adjust the relationship between the container dimensions an...
39,300
[ { "from": "human", "value": "I have a degrafa surface into a canvas container.\nI want to link both width and height.\nWhen i use binding like it works as expected:\n// binding\n BindingUtils.bindProperty(rect,\"height\",this,\"height\"); \n BindingUtils.bindProperty(rect,\"width\",this,\"width\"); \n\n...
I am looking for a redistributable component to convert HTML to PDF. I would - at the moment - like to avoid using a "PDF printer", as this requires a printer installation and some user "playing around" in the printers panel might break that feature. The HTML is available in a Browser control or as external file. The H...
There are several options available for converting HTML to PDF that can be used in automated processes from C++. Here are a few options that meet your criteria: ### 1. **wkhtmltopdf** - **Description:** A command-line utility that uses the WebKit rendering engine to convert HTML to PDF. It is quite powerful and suppor...
38,064
[ { "from": "human", "value": "I am looking for a redistributable component to convert HTML to PDF.\nI would - at the moment - like to avoid using a \"PDF printer\", as this requires a printer installation and some user \"playing around\" in the printers panel might break that feature.\nThe HTML is available ...
I am looking for a more sophisticated way of using Linq to SQL. I am leaning L2Q but I am only seeing simple examples of business objects and simple CRUD operations in them. Any sample application that includes these: 1- Business objects which get their data from more than 1 table and from many to many tables. 2- Keepi...
To dive into a more sophisticated use of LINQ to SQL (L2S), it is important to understand that while L2S is powerful, it may not provide all the features you need for complex applications. Here are some suggestions on how to implement your requirements, along with potential resources: ### 1. Business Objects from Mult...
31,147
[ { "from": "human", "value": "I am looking for a more sophisticated way of using Linq to SQL. I am leaning L2Q but I am only seeing simple examples of business objects and simple CRUD operations in them.\nAny sample application that includes these:\n1- Business objects which get their data from more than 1 t...
I will have around 200,000 images as part of my website. Each image will be stored 3 times: full size, thumbnail, larger thumbnail. Full size images are around 50Kb to 500Kb. Normal tech: Linux, Apache, MySQL, PHP on a VPS. What is the optimum way to store these for fast retrieval and display via a browser?? Should I s...
When dealing with a large number of images (such as 200,000), it's important to consider both organization and performance for efficient storage and retrieval. Here are some best practices for storing and organizing your images on a VPS with Linux, Apache, MySQL, and PHP: ### Folder Structure 1. **Hierarchical Folder...
39,395
[ { "from": "human", "value": "I will have around 200,000 images as part of my website. Each image will be stored 3 times: full size, thumbnail, larger thumbnail. Full size images are around 50Kb to 500Kb.\nNormal tech: Linux, Apache, MySQL, PHP on a VPS.\nWhat is the optimum way to store these for fast retri...
I have a simple app which is writing to an xml file on every button click. Once this is done, I read the Xml file soon after (as in, a couple of lines below with no methods to be stepped in to in between). When the app runs for the first time, the xml file is written to/read from fine, but if I press the button again I...
The issue you are experiencing, "File is in use by another process," usually occurs when you're trying to read from or write to a file that hasn't been fully released by a previous operation. This can be caused by not properly disposing of resources or trying to access the file concurrently in a multi-threaded context....
30,460
[ { "from": "human", "value": "I have a simple app which is writing to an xml file on every button click. Once this is done, I read the Xml file soon after (as in, a couple of lines below with no methods to be stepped in to in between).\nWhen the app runs for the first time, the xml file is written to/read fr...
Sometimes you have strings that must fit within a certain pixel width. This function attempts to do so efficiently. Please post your suggestions or refactorings below :) function fitStringToSize(str,len) { var shortStr = str; var f = document.createElement("span"); f.style.display = 'hidden'; f.style.pa...
Here’s a refactored version of your `fitStringToSize` function. I made a few improvements for clarity, efficiency, and to adhere to best practices: 1. **Use of `textContent`**: Instead of using `innerHTML`, which can introduce security risks and is less performant, we’ll use `textContent`. 2. **Avoid DOM manipulation ...
39,006
[ { "from": "human", "value": "Sometimes you have strings that must fit within a certain pixel width. This function attempts to do so efficiently. Please post your suggestions or refactorings below :)\nfunction fitStringToSize(str,len) {\n var shortStr = str;\n var f = document.createElement(\"span\");\...
How do I actually run a file on localhost? I know it is working, but how do I run a file on it, and how do I verify that the file is in fact running on localhost? Server newbie here, additional questions (I have xampp running Apache 2.2): From your responses it sounds like I have to type in the path in the browser in o...
Running files on localhost with XAMPP is a great way to develop and test your websites locally. Here's a step-by-step guide to help you get started, along with answers to your questions: ### Step-by-Step Guide to Running Files on localhost: 1. **Start XAMPP:** - Open the XAMPP Control Panel and start the Apache se...
35,811
[ { "from": "human", "value": "How do I actually run a file on localhost?\nI know it is working, but how do I run a file on it, and how do I verify that the file is in fact running on localhost?\nServer newbie here, additional questions (I have xampp running Apache 2.2):\nFrom your responses it sounds like I ...
The standard way to load an image in a J2ME application is using the Image.createImage method and the recommended image format is PNG. Now, the J2ME specs dont lay down any restrictions on the implementation of this method or the in memory representation of an Image so, each vendor has a different implementation. Moto...
Dealing with memory constraints in J2ME applications, especially with Motorola devices, can indeed be challenging. Given the memory inefficiency you are experiencing with PNG images on certain Motorola devices, here are a few suggestions and workarounds that might help: 1. **Image Optimization**: - **Use Lower Reso...
35,987
[ { "from": "human", "value": "The standard way to load an image in a J2ME application is using the Image.createImage method and the recommended image format is PNG.\nNow, the J2ME specs dont lay down any restrictions on the implementation of this method or the in memory representation of an Image so, each ve...
I'm trying to "single source" a form page which can be in edit mode or view mode. For various reasons, this isn't using the ASP.Net FormView or DetailsView controls. Since there is no way to disable a textbox without turning its contents gray (well, we could "eat" all of the keystrokes into it, but that isn't very eleg...
Your approach using jQuery to swap out input text boxes with labels (or in your case, `<div>` elements) is on the right track, and it can certainly be optimized for simplicity and effectiveness. To achieve the goal of replacing the input fields while retaining their styles and positions more succinctly, you can make ...
39,093
[ { "from": "human", "value": "I'm trying to \"single source\" a form page which can be in edit mode or view mode. For various reasons, this isn't using the ASP.Net FormView or DetailsView controls.\nSince there is no way to disable a textbox without turning its contents gray (well, we could \"eat\" all of th...
In SQLSERVER 2005, I'm using table-valued function as a convenient way to perform arbitrary aggregation on subset data from large table (passing date range or such parameters). I'm using theses inside larger queries as joined computations and I'm wondering if the query plan optimizer work well with them in every condit...
In SQL Server 2005, the optimizer does not "unnest" table-valued functions (TVFs) in the way it optimizes standard inline queries. There are two primary types of table-valued functions: **inline table-valued functions** (ITVF) and **multi-statement table-valued functions** (MSTVF). 1. **Inline Table-Valued Functions ...
37,564
[ { "from": "human", "value": "In SQLSERVER 2005, I'm using table-valued function as a convenient way to perform arbitrary aggregation on subset data from large table (passing date range or such parameters).\nI'm using theses inside larger queries as joined computations and I'm wondering if the query plan opt...
I'm working on a page using jQuery's accordion UI element. I modeled my HTML on that example, except that inside the <li> elements, I have some unordered lists of links. Like this: $(document).ready(function() { $(".ui-accordion-container").accordion( {active: "a.default", alwaysOpen: true, autoHeight: f...
Yes, the issue you're experiencing is likely due to event handling in jQuery's accordion component. When you click on the accordion label, it is triggering the accordion's collapsing functionality, which is preventing the links from being activated. To resolve this issue, you can prevent the default action of the anch...
39,454
[ { "from": "human", "value": "I'm working on a page using jQuery's accordion UI element. I modeled my HTML on that example, except that inside the <li> elements, I have some unordered lists of links. Like this:\n $(document).ready(function() {\n $(\".ui-accordion-container\").accordion(\n {active...
I'm developing an editing component (iframe-based) in JQuery. My intention is to make it easy to extend the functionality of the editor through plug-ins. So for example, you might make a plug-in that puts wavy underlines underneath spelling mistakes, or allows images to be inserted, etc. I'm happy to work out the techn...
Yes, jQuery allows you to create plugins within plugins, and there are several ways to achieve a plugin architecture for your iframe-based editing component. Below are some recommendations on how to structure your API for ease of extensibility while keeping the architecture clean and maintainable. ### Basic Plugin Arc...
36,991
[ { "from": "human", "value": "I'm developing an editing component (iframe-based) in JQuery.\nMy intention is to make it easy to extend the functionality of the editor through plug-ins. So for example, you might make a plug-in that puts wavy underlines underneath spelling mistakes, or allows images to be inse...
i've found how to bind an asp:Menu to XML. i've found how to bind an asp:Menu to a site map (which is really binding it to XML). How do you bind an asp:Menu to a database? The .NET Framework provides multiple data sources: HierarchicalDataSourceControl XmlDataSource SiteMapDataSource DataSourceControl SqlDataSour...
To bind an `asp:Menu` control to a database in ASP.NET, you can create a hierarchical data structure from your SQL Server table. You can achieve this by creating a custom data source or by transforming your SQL data into a hierarchical format that the `Menu` control can understand. Here’s a step-by-step guide on how t...
35,398
[ { "from": "human", "value": "i've found how to bind an asp:Menu to XML. i've found how to bind an asp:Menu to a site map (which is really binding it to XML). How do you bind an asp:Menu to a database?\nThe .NET Framework provides multiple data sources:\n\nHierarchicalDataSourceControl\n\nXmlDataSource\n\n\n...
When I delete a visual component in a base form, and forget any references in inherited forms, my application only breaks in runtime. What I normally do is to use a search tool to find references in .DFM, but I'm not completely satisfied with this method. Do you have any better recommendations?
When working with inherited forms in Delphi, deleting a visual component can indeed lead to runtime errors if any references to that component are still present in inherited forms. While using a search tool to find references in `.DFM` files is a common practice, there are several other strategies you can employ to min...
37,697
[ { "from": "human", "value": "When I delete a visual component in a base form, and forget any references in inherited forms, my application only breaks in runtime.\nWhat I normally do is to use a search tool to find references in .DFM, but I'm not completely satisfied with this method.\nDo you have any bette...
I have an application for which log4j logging is configured in a log4j.properties file. Currently, this application runs on UNIX and creates a log file in /tmp. This application needs to run on Windows, and on that platform I would like for it to select the correct temporary directory, which I believe is C:\temp. How...
You don't need to switch to an XML configuration file to achieve the desired behavior of setting the log directory based on the operating system. You can modify your `log4j.properties` file to dynamically set the log file location based on the operating system. One approach is to use system properties to determine the...
37,269
[ { "from": "human", "value": "I have an application for which log4j logging is configured in a log4j.properties file. Currently, this application runs on UNIX and creates a log file in /tmp. This application needs to run on Windows, and on that platform I would like for it to select the correct temporary d...
I'm searching for an easy to handle python native module to create python object representation from xml. I found several modules via google (one of them is XMLObject) but didn't want to try out all of them. What do you think is the best way to do such things? EDIT: I missed to mention that the XML I'd like to read is...
For creating Python object representations from XML, especially when dealing with an XML structure you don't control, there are a few libraries that you can consider. Here are some of the most popular and effective ones: ### 1. **xml.etree.ElementTree** This is a part of the Python Standard Library and is sufficient f...
39,993
[ { "from": "human", "value": "I'm searching for an easy to handle python native module to create python object representation from xml.\nI found several modules via google (one of them is XMLObject) but didn't want to try out all of them. \nWhat do you think is the best way to do such things?\nEDIT: I missed...
Given the following Flash method: function sendToJava(name:String, ... args) { ExternalInterface.call("sendCommand", name, args); } How do I ensure that ExternalInterface.call() interprets args in its expanded form? Right now, if I pass a list into "args", that list gets interpreted as a single argument of type "Obj...
To ensure that the `ExternalInterface.call()` method interprets the `args` variable as separate arguments rather than as a single object array, you can use the `apply` method in JavaScript. This allows you to expand the arguments of the `args` array into individual parameters when calling `sendCommand`. Here's how you...
40,198
[ { "from": "human", "value": "Given the following Flash method:\nfunction sendToJava(name:String, ... args)\n{\n ExternalInterface.call(\"sendCommand\", name, args);\n}\n\nHow do I ensure that ExternalInterface.call() interprets args in its expanded form? Right now, if I pass a list into \"args\", that list...
At the moment I'm creating a DateTime for each month and formatting it to only include the month. Is there another or any better way to do this?
If you're looking to represent months in a more efficient way without creating a DateTime object for each month, you might consider using a list or an enum to represent the months instead. Depending on the programming language you're using, here are some approaches you can take. ### Using a List (in Python as an examp...
38,246
[ { "from": "human", "value": "At the moment I'm creating a DateTime for each month and formatting it to only include the month.\nIs there another or any better way to do this?\n" }, { "from": "gpt", "value": "If you're looking to represent months in a more efficient way without creating a DateTim...
I use db2 v.9.1 on windows 2003 server so it can not use LPAD or RPAD functions scalar. because that functions support only z/OS right? Now, I use this way for pad zero when COLUMN1 type is VARCHAR RIGHT('0000' || COLUMN1 ,4) AS RPAD LEFT('0000' || COLUMN1 ,4) AS LPAD Have better way for replace LPAD or RPAD fun...
In DB2 version 9.1, especially on Windows and not on z/OS, you're correct that the `LPAD` and `RPAD` functions are not available. However, you can achieve the same result with other string manipulation functions like `RIGHT` and `LEFT`, as you have already demonstrated. Your current approach to padding zeros looks goo...
39,175
[ { "from": "human", "value": "I use db2 v.9.1 on windows 2003 server so it can not use LPAD or RPAD functions scalar.\nbecause that functions support only z/OS right?\nNow, I use this way for pad zero when COLUMN1 type is VARCHAR\n RIGHT('0000' || COLUMN1 ,4) AS RPAD\n LEFT('0000' || COLUMN1 ,4) AS LPAD\...
In NYTimes iPhone application, one bar exist in between table header and navigation bar on the top news screen. what bar is that? or it's just a label in between navigation bar and table header? Thanks in advance.
In the NYTimes iPhone application, the bar you see between the navigation bar and the table header is typically a status bar or a search bar, depending on the version of the app. This bar can serve various functions, such as displaying important notifications, search functionality, or providing context for the content ...
42,897
[ { "from": "human", "value": "In NYTimes iPhone application, one bar exist in between table header and navigation bar on the top news screen.\nwhat bar is that? or it's just a label in between navigation bar and table header?\nThanks in advance.\n" }, { "from": "gpt", "value": "In the NYTimes iPh...
Open source implementation will be preferred.
It looks like you're looking for open-source implementations for a specific task or technology, but you haven't provided details about what you're interested in. Could you please specify what kind of open-source implementation you're looking for? For example, are you looking for libraries or frameworks for machine lear...
43,765
[ { "from": "human", "value": "Open source implementation will be preferred.\n" }, { "from": "gpt", "value": "It looks like you're looking for open-source implementations for a specific task or technology, but you haven't provided details about what you're interested in. Could you please specify w...
In a program to find whether the given number is an Armstrong number, I stored the input no (3 digit) as string as follows. char input[10]; scanf("%s",&input); Now I have to calculate cube of each digit by using pow method of math.h as follows. int a; a = pow(input[0],3); By coding like this, I could not get correct ...
The issue you're encountering is due to the fact that when you read the input as a string, each character (digit) is stored as a character type (e.g., '1', '2', '3') instead of an integer type. The `pow` function expects numerical values (floats) rather than character values. To convert a character representing a dig...
38,073
[ { "from": "human", "value": "In a program to find whether the given number is an Armstrong number, I stored the input no (3 digit) as string as follows.\nchar input[10];\nscanf(\"%s\",&input);\n\nNow I have to calculate cube of each digit by using pow method of math.h as follows.\nint a;\na = pow(input[0],3...
I was wondering if someone would be able to help me write a CQL query for NDepend that will show me all the methods in my form class that handle the form events. So I would like to be able to find all the methods that look like this: Private Sub AddFolderButton_Click(ByVal sender As System.Object, ByVal e As System.Ev...
In NDepend, you can use CQLinq (Code Query LINQ) to write queries that help you analyze your codebase. To find methods in your form classes that handle events, you can look for methods that have a specific naming convention (like `ButtonName_Click`), have two parameters (`sender` and `e`), and also have the `Handles` k...
38,701
[ { "from": "human", "value": "I was wondering if someone would be able to help me write a CQL query for NDepend that will show me all the methods in my form class that handle the form events. So I would like to be able to find all the methods that look like this:\nPrivate Sub AddFolderButton_Click(ByVal sen...
I noticed that there is one change about ASP.NET Routing. I cannot understand why such change. In ASP.NET MVC Preview, the routing setting in Global.ascx is like "[controller]/[action]/[id]". Now, it is changed to be "{controller}/{action}/{id}". Why change [] to {} ? Is there some necessity to do that?
The change from square brackets `[]` to curly braces `{}` in ASP.NET routing is primarily a syntactical adjustment to clarify the intent and structure of the routing patterns. Here are some reasons for this change: 1. **Clarity and Readability**: Curly braces `{}` are commonly used in programming languages and templat...
40,820
[ { "from": "human", "value": "I noticed that there is one change about ASP.NET Routing. I cannot understand why such change.\nIn ASP.NET MVC Preview, the routing setting in Global.ascx is like \"[controller]/[action]/[id]\". Now, it is changed to be \"{controller}/{action}/{id}\". Why change [] to {} ? Is th...
Anyone come across this error when trying to import a WSDL in Flex builder 3? Seems it only occurs when trying to import a WCF based service which has 'virtual' endpoints... Some digging around makes me think Flex has trouble parsing the wsdl (however standard web services work fine). A bug has been opened for months a...
It seems like you're dealing with a compatibility issue between Flex Builder 3 and WCF services that utilize "virtual" endpoints. This problem may arise because of how Flex handles WSDL parsing, especially when it comes to more advanced features present in WCF. Here are a few suggestions you can try to work around thi...
39,618
[ { "from": "human", "value": "Anyone come across this error when trying to import a WSDL in Flex builder 3?\nSeems it only occurs when trying to import a WCF based service which has 'virtual' endpoints...\nSome digging around makes me think Flex has trouble parsing the wsdl (however standard web services wor...
I need to repeatedly remove the first line from a huge text file using a bash script. Right now I am using sed -i -e "1d" $FILE - but it takes around a minute to do the deletion. Is there a more efficient way to accomplish this?
If you need to repeatedly remove the first line from a large text file and the `sed` command is too slow, there are a couple of alternatives you can consider which may perform better. ### Method 1: `tail` Using `tail` can be faster for this task since it reads the file from the beginning but only outputs the lines yo...
40,771
[ { "from": "human", "value": "I need to repeatedly remove the first line from a huge text file using a bash script.\nRight now I am using sed -i -e \"1d\" $FILE - but it takes around a minute to do the deletion.\nIs there a more efficient way to accomplish this?\n" }, { "from": "gpt", "value": "I...
I was about to add an extra signal handler to an app we have here and I noticed that the author had used sigaction() to set up the other signal handlers. I was going to use signal(). To follow convention I should use sigaction() but if I was writing from scratch, which should I choose?
When deciding between `signal()` and `sigaction()`, it's generally recommended to use `sigaction()` for several reasons: 1. **Portability and Reliability**: The behavior of `signal()` can vary between different UNIX-like systems. For example, some implementations reset the signal handler to the default action after a ...
40,174
[ { "from": "human", "value": "I was about to add an extra signal handler to an app we have here and I noticed that the author had used sigaction() to set up the other signal handlers. I was going to use signal(). To follow convention I should use sigaction() but if I was writing from scratch, which should I ...
I have a screen with say 20 controls on it. I want to show all twenty, then hide only the ones that don't relate to what I'm working on. psudoCode. for each element show element for each element in hide list hide element. My problem is that between the loops the screen paints. It looks very ugly. I know ...
It sounds like you're looking for a way to prevent the UI from rendering until you've made all your updates, and then paint the UI only once afterward. Many UI frameworks have mechanisms to suspend painting, redraw, or batch updates to avoid flickering or unwanted intermediate states. Here’s a general approach in pseu...
38,834
[ { "from": "human", "value": "I have a screen with say 20 controls on it. \nI want to show all twenty, then hide only the ones that don't relate to what I'm working on. \npsudoCode.\nfor each element \n show element \n\nfor each element in hide list\n hide element.\n\nMy problem is that between the loo...
For months now I've been trying to find a code syntax formatting extension that works for BlogEngine.Net. I'm not fond of the behavior of the default formatting extension, and have tried a couple of others (manoli is among them), but they always seem to interact badly with the TinyMCE editor. Does anyone know of an e...
Finding a suitable code syntax highlighting extension for BlogEngine.Net that works well with the TinyMCE editor can be challenging. Here are some suggestions and alternatives that might help you achieve better code formatting without extensive HTML modifications: 1. **Prism.js**: This lightweight and flexible syntax ...
39,650
[ { "from": "human", "value": "For months now I've been trying to find a code syntax formatting extension that works for BlogEngine.Net. I'm not fond of the behavior of the default formatting extension, and have tried a couple of others (manoli is among them), but they always seem to interact badly with the ...
I have the following problem: # line is a line from a file that contains ["baa","beee","0"] line = TcsLine.split(",") NumPFCs = eval(line[2]) if NumPFCs==0: print line I want to print all the lines from the file if the second position of the list has a value == 0. I print the lines but after that the foll...
It looks like you are trying to read lines from a file, split each line into a list, and then check if the third element (at index 2) is equal to zero. However, you're encountering an error related to evaluating a string as a Python expression, especially since the line contains newline characters. Instead of using `...
39,649
[ { "from": "human", "value": "I have the following problem:\n # line is a line from a file that contains [\"baa\",\"beee\",\"0\"]\n line = TcsLine.split(\",\")\n NumPFCs = eval(line[2])\n if NumPFCs==0:\n print line\n\nI want to print all the lines from the file if the second position of the list has...
How can you express X of Y are true, in boolean logic? a rule like 2 of the following must be true (A, B, C, D, E, F) is it a form of multiplcation or set operations? the end result is all the permutations like AB OR AC OR AD, if you said 3 of following it is like ABC, ABD, ABE, etc.. so it is like (A,B,C)^2? thanks!
To express the idea that "X of Y are true" in Boolean logic, you're dealing with a combinatorial problem that can indeed be understood in terms of set operations and logical expressions. Specifically, when you say that "2 of the following must be true," you want to capture all combinations of any 2 true statements out ...
38,526
[ { "from": "human", "value": "How can you express X of Y are true, in boolean logic? a rule like 2 of the following must be true (A, B, C, D, E, F)\nis it a form of multiplcation or set operations?\nthe end result is all the permutations like AB OR AC OR AD, if you said 3 of following it is like ABC, ABD, A...
I'm trying to generate a JSON response that includes some HTML. Thus, I have /app/views/foo/bar.json.erb: { someKey: 'some value', someHTML: "<%= h render(:partial => '/foo/baz') -%>" } I want it to render /app/views/foo/_baz.html.erb, but it will only render /app/views/foo/_baz.json.erb. Passing :format => 'htm...
The issue you're encountering is due to the fact that Rails, by default, uses the request format to determine which partial to render. Since your response is being generated in JSON format, Rails looks for a JSON view, which is why it's attempting to render the `_baz.json.erb` partial instead of the `_baz.html.erb`. T...
40,429
[ { "from": "human", "value": "I'm trying to generate a JSON response that includes some HTML. Thus, I have /app/views/foo/bar.json.erb:\n{\n someKey: 'some value',\n someHTML: \"<%= h render(:partial => '/foo/baz') -%>\"\n}\n\nI want it to render /app/views/foo/_baz.html.erb, but it will only render /app/...
I just installed the SharePoint SDK on my machine, but I can't seem to find the location of Microsoft.Sharepoint.dll so I can add a reference to it. It's not in the GAC or C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\ and a search comes up with nothing. Any suggestions?
If you have installed the SharePoint SDK and are unable to find the `Microsoft.SharePoint.dll`, here are some suggestions to help you locate it: 1. **Check the SharePoint Installation Path**: The `Microsoft.SharePoint.dll` is usually located in the SharePoint installation directory. For SharePoint 2010, you can typica...
39,970
[ { "from": "human", "value": "I just installed the SharePoint SDK on my machine, but I can't seem to find the location of Microsoft.Sharepoint.dll so I can add a reference to it.\nIt's not in the GAC or C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\12\\ISAPI\\ and a search comes u...
What are some of the better AJAX Treeviews out there that support asynchronous JSON loading. YUI TreeView seems nice, but bloated with tables, etc.
There are several AJAX Treeview libraries that support asynchronous JSON loading and are more lightweight or streamlined compared to YUI TreeView. Here are some popular options: 1. **jQuery Treeview**: - A simple, lightweight plugin that allows you to create tree views easily. It can be customized to support asynch...
38,327
[ { "from": "human", "value": "What are some of the better AJAX Treeviews out there that support asynchronous JSON loading.\nYUI TreeView seems nice, but bloated with tables, etc.\n" }, { "from": "gpt", "value": "There are several AJAX Treeview libraries that support asynchronous JSON loading and ...
Windows Azure looks like a promising cloud platform. The big unknown right now is the pricing model. Microsoft says that they are still working on that, but it will be competitive. What do you think would make a good pricing model? Let's hope that Microsoft will take note of what a bunch of programmers want. Updat...
When designing a competitive pricing model for a cloud platform like Azure, there are several factors and strategies that could be considered to appeal to developers and businesses alike. Here are some thoughts on what could make a good pricing model: 1. **Pay-as-You-Go Pricing**: This model allows customers to pay on...
36,082
[ { "from": "human", "value": "Windows Azure looks like a promising cloud platform. The big unknown right now is the pricing model. Microsoft says that they are still working on that, but it will be competitive. What do you think would make a good pricing model? \nLet's hope that Microsoft will take note ...
In a Django form, how do I make a field read-only (or disabled)? When the form is being used to create a new entry, all fields should be enabled - but when the record is in update mode some fields need to be read-only. For example, when creating a new Item model, all fields must be editable, but while updating the reco...
In Django forms, you can make a field read-only or disabled by setting the field widget attributes appropriately. However, note that a disabled field will not be included in the form submission. If you want the field to be visible but not editable (read-only), you can set the `readonly` attribute. Here's how you can a...
39,614
[ { "from": "human", "value": "In a Django form, how do I make a field read-only (or disabled)?\nWhen the form is being used to create a new entry, all fields should be enabled - but when the record is in update mode some fields need to be read-only.\nFor example, when creating a new Item model, all fields mu...
I'm trying to reorder/group a set of results using SQL. I have a few fields (which for the example have been renamed to something a bit less specific), and each logical group of records has a field which remains constant - the address field. There are also fields which are present for each address, these are the same f...
Yes, you can achieve this using MySQL by employing conditional aggregation along with the `GROUP BY` clause. The idea is to aggregate the values for each person while grouping by the address. You will use `CASE` statements to pivot the data appropriately. Here’s a sample query that demonstrates how to transform your da...
40,344
[ { "from": "human", "value": "I'm trying to reorder/group a set of results using SQL. I have a few fields (which for the example have been renamed to something a bit less specific), and each logical group of records has a field which remains constant - the address field. There are also fields which are prese...
Background We are developing some in-house utilities using ASP.NET 2.0. One of which is extracting some information from databases and building an Excel workbook containing a number of spreadsheets with data based on queries into the database. Problem The proof-of-concept prototype (a simple ASP.NET page that queries a...
The error you are encountering typically arises from a few common issues when working with COM objects in a server environment, particularly when using Microsoft Office applications like Excel. Here are several steps and considerations that could help you troubleshoot and resolve the issue: 1. **Run under a proper con...
38,389
[ { "from": "human", "value": "Background\nWe are developing some in-house utilities using ASP.NET 2.0. One of which is extracting some information from databases and building an Excel workbook containing a number of spreadsheets with data based on queries into the database.\nProblem\nThe proof-of-concept pro...
Is there any way to print an OOXML document (.docx file) without having MS Word installed? It works nicely via the MS Word interface but I need to find a way to use it on servers where MS Word is not installed. I've been digging through the API and haven't found anything obvious so I'm inclined to believe there isn't ...
If you need to print an OOXML document (.docx) without having Microsoft Word installed on your server, you have several options using .NET libraries or other tools. Here are a few approaches you can consider: ### 1. **Using .NET Libraries:** #### a. **Open XML SDK** The Open XML SDK allows you to manipulate OOXML ...
36,175
[ { "from": "human", "value": "Is there any way to print an OOXML document (.docx file) without having MS Word installed? \nIt works nicely via the MS Word interface but I need to find a way to use it on servers where MS Word is not installed. I've been digging through the API and haven't found anything obvio...
I'm retrieving a gzipped web page via curl, but when I output the retrieved content to the browser I just get the raw gzipped data. How can I decode the data in PHP? One method I found was to write the content to a tmp file and then ... $f = gzopen($filename,"r"); $content = gzread($filename,250000); gzclose($f); .......
To decode gzipped content in PHP without writing to a temporary file, you can use the `gzdecode()` function, which is specifically designed to decode gzipped strings directly in memory. This is a much cleaner approach. Here's how you can do it: 1. Use `curl` to retrieve the gzipped content. 2. Use `gzdecode()` to deco...
37,102
[ { "from": "human", "value": "I'm retrieving a gzipped web page via curl, but when I output the retrieved content to the browser I just get the raw gzipped data. How can I decode the data in PHP?\nOne method I found was to write the content to a tmp file and then ...\n$f = gzopen($filename,\"r\");\n$content ...
For some reason the system admin changed my user name from XxXx to XxXx1 in the source control system. Then the problems started. I had to delete all local files and re-download them from source control just to open the project. And after I had rebooted the computer, I can't do much to my files. Whenever I try to undo ...
It sounds like you're dealing with a common issue related to user identity in Team Foundation Server (TFS) after your username change. When your username is changed, some settings, cached credentials, and permissions may not update correctly. Here are a few steps you can try to resolve the issues you're facing: ### 1....
37,007
[ { "from": "human", "value": "For some reason the system admin changed my user name from XxXx to XxXx1 in the source control system. Then the problems started. I had to delete all local files and re-download them from source control just to open the project.\nAnd after I had rebooted the computer, I can't do...
What is a good way to set up a single container div with some border images surrounding it (in my case only on the left, bottom, and right sides)? I have it centered at the top of the page, overlapping everything else (so like that OSX-style slide-down dialog). Here's the basic layout: Here's what I've got so far (can...
To create a content box with border images on the left, bottom, and right sides, and to have it centered and overlapping other elements, you can simplify your layout and avoid setting static heights and widths for the content areas. Instead, you can use `flexbox` for layout and allow the box to grow and shrink accordin...
36,424
[ { "from": "human", "value": "What is a good way to set up a single container div with some border images surrounding it (in my case only on the left, bottom, and right sides)? I have it centered at the top of the page, overlapping everything else (so like that OSX-style slide-down dialog).\nHere's the basic...
Topic: Programmatically manipulate web browser in OS X 10.4.x+ Tiger/Leopard. Subjects: Webkit, Safari, Firefox, APIs, Applescript, Automator, Javascript, Ruby, Ruby on Rails, OS X, Tiger Goal: Collect/Read/Extract URLs from Safari into text (Ruby on Rails code) file. Note: A solution that uses FF would be very appreci...
To extract URLs from Safari and save them to a text file on OS X 10.4.x Tiger or Leopard using AppleScript, you can use the following approach. This script will grab the URLs from all open tabs in Safari and save them to a text file: ### AppleScript Solution for Safari ```applescript tell application "Safari" set...
40,128
[ { "from": "human", "value": "Topic: Programmatically manipulate web browser in OS X 10.4.x+ Tiger/Leopard.\nSubjects: Webkit, Safari, Firefox, APIs, Applescript, Automator, Javascript, Ruby, Ruby on Rails, OS X, Tiger\nGoal: Collect/Read/Extract URLs from Safari into text (Ruby on Rails code) file.\nNote: A...
So, following a tutorial I found on MSDN I've created what you might call an "engine" using DirectX and C#. I haven't seen a lot of this sort of thing (Personally, that is) done in C# and the majority seem to favour C/C++ so I'm curious as to whether using C# will come back to bite me, or whether I should just go ahead...
Using C# for game development, particularly with DirectX, can be a great choice depending on your goals and the scope of your project. Here are some points to consider regarding the use of C# and its advantages and potential downsides in this context: ### Advantages of Using C# 1. **Ease of Use**: C# is generally con...
38,875
[ { "from": "human", "value": "So, following a tutorial I found on MSDN I've created what you might call an \"engine\" using DirectX and C#. I haven't seen a lot of this sort of thing (Personally, that is) done in C# and the majority seem to favour C/C++ so I'm curious as to whether using C# will come back to...
I am trying to export a Ruby framework via XML-RPC. However I am having some problems when trying to call a method from a class not directly added as a handler to the XML-RPC server. Please see my example below: I have a test Ruby XML-RPC server as follows: require "xmlrpc/server" class ExampleBar def bar() retu...
XML-RPC is designed to work with stateless communications where each request is independent. This means that when you call a method on the `ExampleFoo` object, it returns a new instance of `ExampleBar` (the object is not serialized or stored in a way that can be referenced later). When you try to call `bar()` on the re...
37,337
[ { "from": "human", "value": "I am trying to export a Ruby framework via XML-RPC. However I am having some problems when trying to call a method from a class not directly added as a handler to the XML-RPC server. Please see my example below:\nI have a test Ruby XML-RPC server as follows:\nrequire \"xmlrpc/se...
So I've got a program that needs to be multilingual. The only difference between what I'm needing and what I've found on the web is that all the computers my program will run on are set to the localization of EN. We have spanish speaking employees that will use the program just like the english speaking employees. So I...
Creating a multilingual application can be a bit of a challenge, but with the right approach, it can be manageable. Since you are considering using an XML file for localization, that's a feasible method, but there are also built-in features in .NET that can make your life easier. Here are two primary approaches you ca...
35,349
[ { "from": "human", "value": "So I've got a program that needs to be multilingual. The only difference between what I'm needing and what I've found on the web is that all the computers my program will run on are set to the localization of EN.\nWe have spanish speaking employees that will use the program just...
I have an application where I have potentially many processes must send a message to one process. I figured the most expedient way to do this would be to just send a UDP datagram. When opening a socket, I need to specify which port to listen to. As I just want to fire and forget the UDP datagram, I'd like to just hav...
Yes, you can indeed send a UDP datagram without explicitly binding to a local port by allowing the operating system to select one for you. In UDP, you don't have to listen on a socket to send messages; you can create a socket, send your datagram, and close the socket without keeping it open. Here's how you can do this ...
38,134
[ { "from": "human", "value": "I have an application where I have potentially many processes must send a message to one process. I figured the most expedient way to do this would be to just send a UDP datagram.\nWhen opening a socket, I need to specify which port to listen to. As I just want to fire and for...
This is probably pretty basic... but I don't seem to get it: How does (2 & 1) = 0 (3 & 1) = 1 (4 & 1) = 0 etc.. This pattern above seems to help find even numbers or (0 | 1) = 1 (1 | 1) = 1 (2 | 1) = 3 (3 | 1) = 4 (4 | 1) = 5 (5 | 1) = 5 I know how boolean algebra works between bits. But I don't understand how Bool...
In C# (and many other programming languages), integers can be manipulated at the binary level using bitwise operators. The operators you're referring to are `&` (bitwise AND) and `|` (bitwise OR). Let's break down how they work with the integers you've provided. ### Bitwise AND (`&`) The bitwise AND operator compares...
37,935
[ { "from": "human", "value": "This is probably pretty basic... but I don't seem to get it:\nHow does \n(2 & 1) = 0\n(3 & 1) = 1\n(4 & 1) = 0\n\netc..\nThis pattern above seems to help find even numbers\nor \n(0 | 1) = 1\n(1 | 1) = 1\n(2 | 1) = 3\n(3 | 1) = 4\n(4 | 1) = 5\n(5 | 1) = 5\n\nI know how boolean al...
I am working on a windows form application. How do i use the find method of a datatable to find a row if the datatable has a compound key? Table Structure Col A, Col B, Col C Col A and Col B make up the compound key. I want to find the row where the value in Col A is 6 and Col B is 5
In a Windows Forms application, when working with a `DataTable` that has a compound primary key, you can use the `Find` method to retrieve a specific row by providing the key values in an array. Given your example, you need to find the row where `Col A` is `6` and `Col B` is `5`. Here's how you can do this: ### Step 1...
37,345
[ { "from": "human", "value": "I am working on a windows form application. How do i use the find method of a datatable to find a row if the datatable has a compound key?\nTable Structure\nCol A, Col B, Col C\nCol A and Col B make up the compound key.\nI want to find the row where the value in Col A is 6 and C...
I'm creating an interface wrapper for a class. The member within the class is a reference(to avoid copying the large structure). If I create a private constructor, what is the best way to initialize that reference to appease the compiler? struct InterfaceWrapper { InterfaceWrapper( SomeHugeStructure& src ):m_inte...
To create a proper interface wrapper that can be initialized with a reference to a large structure, you need to ensure that your private constructor can still initialize the reference `m_internal` properly. One common approach to achieve this is to use a factory method, which can allow you to keep the constructor priva...
35,521
[ { "from": "human", "value": "I'm creating an interface wrapper for a class. The member within the class is a reference(to avoid copying the large structure). If I create a private constructor, what is the best way to initialize that reference to appease the compiler?\nstruct InterfaceWrapper {\n Interf...
I have the following very simple Javascript-compatible regular expression: <script type="text/javascript" id="(.+)" src="([^"]+)"> I am trying to match on script tags and gather both the ID and src attributes. I'd like to make the order of the attributes irrelevant, so that the following will still match: <script id="...
Yes, you can modify your regular expression to allow the `id` and `src` attributes to appear in any order. You can achieve this by creating a more flexible pattern that matches both attributes independently, regardless of their order. Here is an updated version of your regular expression that allows `id` and `src` to ...
38,881
[ { "from": "human", "value": "I have the following very simple Javascript-compatible regular expression:\n<script type=\"text/javascript\" id=\"(.+)\" src=\"([^\"]+)\">\n\nI am trying to match on script tags and gather both the ID and src attributes. I'd like to make the order of the attributes irrelevant, s...
How do I access the user R13 and R14 which are saved when supervisor mode is entered? I am using an ARM7TDMI. I.E. I do not want to access supervisor R14 which now contains the return address to user mode, instead want the value of user mode's link register. This is part of a debugger I am writing. Are there special a...
In the ARM architecture, when transitioning from User mode to Supervisor mode (or any other mode), the processor saves certain registers for the sake of security and context switching. Specifically, for the ARM7TDMI, the User mode's registers, including R13 (stack pointer) and R14 (link register), are not directly acce...
39,653
[ { "from": "human", "value": "How do I access the user R13 and R14 which are saved when supervisor mode is entered? I am using an ARM7TDMI. \nI.E. I do not want to access supervisor R14 which now contains the return address to user mode, instead want the value of user mode's link register. This is part of a ...
I did this in the past, and can't remember the correct command (I think I was using instring or soemthign?) I want to list all the windows services running that have the word 'sql' in them. Listing all the windows services is: Get-Service Is there a instring function that does this?
In PowerShell, you can filter the results of the `Get-Service` command using the `Where-Object` cmdlet to check if the service name contains a specific substring. Instead of `instring`, you can use the `-like` operator or the `-match` operator to achieve this. Here’s how you can list all the services that have the wor...
41,817
[ { "from": "human", "value": "I did this in the past, and can't remember the correct command (I think I was using instring or soemthign?)\nI want to list all the windows services running that have the word 'sql' in them.\nListing all the windows services is:\nGet-Service\n\nIs there a instring function that ...
First, I know about this: How would you organize a Subversion repository for in house software projects? Next, the actual question: My team is restructuring our repository and I'm looking for hints on how to organize it. (SVN in this case). Here's what we came up with. We have one repository, multiple projects and mult...
Your proposed SVN repository structure appears to be well thought out and addresses several important aspects of project organization. The use of `svn:externals` is a common practice in scenarios where projects are shared across multiple solutions, and it can be beneficial for maintaining a clean and manageable reposit...
38,015
[ { "from": "human", "value": "First, I know about this: How would you organize a Subversion repository for in house software projects?\nNext, the actual question:\nMy team is restructuring our repository and I'm looking for hints on how to organize it. (SVN in this case).\nHere's what we came up with. We hav...
In my php script which connects to mysql, I have to query 2 databases in the same script to get different information. More specifically Faxarchives in one database and Faxusers in the other. In my code I query faxusers and then foreach user, I query Faxarchives to get the user history. I might do something like: ...
Your current approach of querying two separate databases, especially in a loop, can lead to significant performance issues due to the overhead of opening and switching between database connections. Instead of querying the `Faxarchives` database for each user in a loop, you can improve the efficiency of your code by usi...
36,022
[ { "from": "human", "value": "In my php script which connects to mysql, I have to query 2 databases in the same script to get different information. More specifically Faxarchives in one database and Faxusers in the other. \nIn my code I query faxusers and then foreach user, I query Faxarchives to get the u...
Given two colors and n steps, how can one calculate n colors including the two given colors that create a fade effect? If possible pseudo-code is preferred but this will probably be implemented in Java. Thanks!
To create a fade effect between two colors over `n` steps, you can interpolate between the two colors to generate the intermediate colors. The fade effect can be achieved by blending the red, green, and blue components of the two colors. Here's a step-by-step explanation of how to do this: 1. **Extract RGB components...
37,873
[ { "from": "human", "value": "Given two colors and n steps, how can one calculate n colors including the two given colors that create a fade effect? \nIf possible pseudo-code is preferred but this will probably be implemented in Java.\nThanks!\n" }, { "from": "gpt", "value": "To create a fade eff...
I am working on a project that is replacing an old portal system (Plumtree) with sharepoint and we want to make the transition as smooth as possible. One thing we are look at currently is taking all the gadgets (Plumtree term for WebParts) and making sure they appear in the same place on the users new MySite. Plumtree ...
Migrating from Plumtree to SharePoint and ensuring a smooth transition for users can be complex, especially when it comes to replicating customized setups like gadgets (Web Parts in SharePoint). Given your constraints and the potential issues with directly modifying SharePoint's SQL database, here are several approache...
35,637
[ { "from": "human", "value": "I am working on a project that is replacing an old portal system (Plumtree) with sharepoint and we want to make the transition as smooth as possible.\nOne thing we are look at currently is taking all the gadgets (Plumtree term for WebParts) and making sure they appear in the sam...
I tried drag and drop from the explorer, but no luck with following error: "Folders cannot be dropped or pasted as solution items. Choose an individual document instead." I know we can create each folders/subfolders manually and add each file, but any quick way to do this on visual studio 2005? Updated: Thank you fo...
In Visual Studio 2005, there isn't a built-in feature to add folders as standalone nodes in the Solution Explorer without associating them with a project. If you want to structure your files within the solution and have them appear as distinct folders, you can try the following approaches: ### Option 1: Use a Dummy Pr...
37,042
[ { "from": "human", "value": "I tried drag and drop from the explorer, but no luck with following error:\n\n\"Folders cannot be dropped or pasted as solution items. Choose an individual document instead.\"\n\nI know we can create each folders/subfolders manually and add each file, but any quick way to do thi...
I want to pass an integer value to a form in .Net so that it can load the right data. I'm using this so that when I double click on a record in a list, a form opens with the data from that record loaded so it can be edited. What is the best way to do this? Should I create a property and set it before calling the Show()...
In C++/CLI (C++ for .NET), you can use either approach you mentioned: creating a property and setting it before calling the `Show()` method, or overloading the constructor to pass the integer value as an initialization parameter. Both methods are valid, but each has its own advantages. ### Option 1: Using a Property ...
35,857
[ { "from": "human", "value": "I want to pass an integer value to a form in .Net so that it can load the right data. I'm using this so that when I double click on a record in a list, a form opens with the data from that record loaded so it can be edited. What is the best way to do this? Should I create a prop...
Actually I have to find out the compatibility of the upgrade of MSSQL 2000 to MSSQL 2005. The MSSQL 2000 was installed inside the Citrix box . I did a side by side upgrade by backing up the database and restoring in my local machine. Now I have to figure out if the applications will work in MSSQL 2005.
When upgrading from SQL Server 2000 to SQL Server 2005, there are several compatibility considerations and testing steps you should take to ensure that your applications will function correctly after the upgrade. Here are some key points to consider and steps to follow: ### Compatibility Levels 1. **Database Compatibi...
37,610
[ { "from": "human", "value": "Actually I have to find out the compatibility of the upgrade of MSSQL 2000 to MSSQL 2005.\nThe MSSQL 2000 was installed inside the Citrix box . I did a side by side upgrade by backing\nup the database and restoring in my local machine. Now I have to figure out if the application...
Suppose I have a process which spawns exactly one child process. Now when the parent process exits for whatever reason (normally or abnormally, by kill, ^C, assert failure or anything else) I want the child process to die. How to do that correctly? Some similar question on stackoverflow: (asked earlier) How can I cau...
To ensure that a child process is terminated when its parent process exits, you need to employ some strategies depending on the operating system you are using—Unix/Linux or Windows. Here's how to approach this for each platform: ### For Unix/Linux Systems In Unix-like systems, when a parent process terminates, its ch...
35,351
[ { "from": "human", "value": "Suppose I have a process which spawns exactly one child process. Now when the parent process exits for whatever reason (normally or abnormally, by kill, ^C, assert failure or anything else) I want the child process to die. How to do that correctly?\n\nSome similar question on st...
Does anyone know of a definitive list of LINQ to SQL query limitations that are not trapped at compile time, along with (where possible) workarounds for the limitations? The list we have so far is: Calling methods such as .Date on DateTime no workaround found string.IsNullOrEmpty simple, just use == "" instead .La...
LINQ to SQL is a powerful tool, but it does have its limitations, especially when it comes to translating certain operations into SQL. Below are some notable limitations along with potential workarounds: ### 1. Calling Methods on DateTime - **Issue**: Methods like `.Date`, `.AddDays()`, etc., are not supported. - **Wo...
38,585
[ { "from": "human", "value": "Does anyone know of a definitive list of LINQ to SQL query limitations that are not trapped at compile time, along with (where possible) workarounds for the limitations?\nThe list we have so far is:\n\nCalling methods such as .Date on DateTime\n\nno workaround found\n\nstring.Is...
I am using standard 3G connection for video streaming. "Streaming Media" application works fine. However after I connect my WinMo 6.1 device to my laptop, it uses Internet connection over ActiveSync. And my laptop is behind firewall, etc. The video streaming stops working correctly. However I need ActiveSync connectio...
It looks like you've made some progress in resolving your issue with video streaming on your Windows Mobile 6.1 device while connected to your laptop via ActiveSync. Since you've already identified that using the `ConnMgrMapConRef` and `ConnMgrEstablishConnectionSync` functions has helped you in your application, I'll ...
38,415
[ { "from": "human", "value": "I am using standard 3G connection for video streaming. \"Streaming Media\" application works fine. \nHowever after I connect my WinMo 6.1 device to my laptop, it uses Internet connection over ActiveSync. And my laptop is behind firewall, etc. The video streaming stops working co...
When working in a big project that requires debugging (like every project) you realize how much people love "printf" before the IDE's built-in debugger. By this I mean Sometimes you need to render variable values to screen (specially for interactive debugging). Sometimes to log them in a file Sometimes you have to cha...
Creating a clear and consistent approach to debugging in large projects can indeed be challenging, especially when working with many developers. Here are several design techniques, patterns, and standards to consider when writing a debug-coding document for your team: ### 1. **Use a Logging Framework** - **Centrali...
35,872
[ { "from": "human", "value": "When working in a big project that requires debugging (like every project) you realize how much people love \"printf\" before the IDE's built-in debugger. By this I mean\n\nSometimes you need to render variable values to screen (specially for interactive debugging).\nSometimes t...
I've a form and I'm doing databinding of my datagridview in the event "form load", the problem is, that the form takes a little (or a lot depends on the size of information) to load, because my data has a lot of binary information (photos) to binding there. In some sites, we can see a picture saying "loading", which is...
Certainly! In a Windows Forms application, you can use a `BackgroundWorker` or `Task` to load your data in a separate thread, allowing you to show a loading indicator (like a `ProgressBar` or a `Label` with a "Loading..." message) while your data is being retrieved and bound to the DataGridView. This approach prevents ...
35,120
[ { "from": "human", "value": "I've a form and I'm doing databinding of my datagridview in the event \"form load\", the problem is, that the form takes a little (or a lot depends on the size of information) to load, because my data has a lot of binary information (photos) to binding there.\nIn some sites, we ...
I create new ASP.NET web application that use SMTP to send message. The problem is the smtp was not authenticated from who send the message. How can I make SMTP authenticated in my program? does C# have a class that have attribute for enter username and password?
Yes, you can authenticate with an SMTP server in your ASP.NET application using the `SmtpClient` class provided by the .NET framework. This class allows you to specify the SMTP server details, including the username and password for authentication. Here is a basic example of how to send an email with SMTP authenticati...
39,758
[ { "from": "human", "value": "I create new ASP.NET web application that use SMTP to send message. The problem is the smtp was not authenticated from who send the message. \nHow can I make SMTP authenticated in my program? does C# have a class that have attribute for enter username and password?\n" }, {...
i'm generating controls dynamically on my asp.net page by xslt transformation from an xml file. i will need to reference these controls from code behind later. i would like to add these references to the list/hashtable/whatever during creation (in xslt file i suppose) so that i could reach them later and i have no idea...
In ASP.NET, when you're dynamically generating controls, it's important to maintain a reference to those controls so you can access them later from your code-behind. Since you're using XSLT to transform your XML into ASP.NET controls, you’ll need a way to store these references during the transformation and make them a...
37,712
[ { "from": "human", "value": "i'm generating controls dynamically on my asp.net page by xslt transformation from an xml file. i will need to reference these controls from code behind later. i would like to add these references to the list/hashtable/whatever during creation (in xslt file i suppose) so that i ...
I need to store several date values in a database field. These values will be tied to a "User" such that each user will have their own unique set of these several date values. I could use a one-to-many relationship here but each user will have exactly 4 date values tied to them so I feel that a one-to-many table would ...
When designing a database schema to store a fixed number of related values (like dates in your case) for each user, you have a few options, and each comes with its pros and cons. Below are several approaches you can consider: ### 1. One-to-Many Relationship (Recommended) While you mentioned that a one-to-many relatio...
38,214
[ { "from": "human", "value": "I need to store several date values in a database field. These values will be tied to a \"User\" such that each user will have their own unique set of these several date values.\nI could use a one-to-many relationship here but each user will have exactly 4 date values tied to th...
I am extending Alfresco Web Client and in one page while expanding panels I get this error. I do not get it always. JSF : java.lang.IllegalStateException: Client-id : _idJsp35 is duplicated in the faces tree in Alfresco Web Client I tried to give every component possible unique id, but error still shows up. How can I ...
The `java.lang.IllegalStateException: Client-id : _idJsp35 is duplicated in the faces tree` error in a JSF application typically indicates that you have components in your JSF page with duplicate client IDs being generated. When JSF processes the view, it constructs a component tree and expects all component IDs to be ...
39,983
[ { "from": "human", "value": "I am extending Alfresco Web Client and in one page while expanding panels I get this error. I do not get it always.\nJSF : java.lang.IllegalStateException: Client-id : _idJsp35 is duplicated in the faces tree in Alfresco Web Client\n\nI tried to give every component possible uni...
Just started getting into jQuery and have an issue with a jQuery Post call working perfectly on my local dev box (VS 2008 built-in web server), but failing when I deploy to a windows 2003 server (IIS 6) box. The post works and the page being posted to process things correctly, but a response is never received by the ca...
It sounds like you're experiencing an issue where your jQuery `$.post` request is not handling the response correctly on your deployed environment. This issue can occur due to several reasons when moving from a development environment to a production environment like IIS 6 on Windows Server 2003. Here are some troubles...
39,559
[ { "from": "human", "value": "Just started getting into jQuery and have an issue with a jQuery Post call working perfectly on my local dev box (VS 2008 built-in web server), but failing when I deploy to a windows 2003 server (IIS 6) box.\nThe post works and the page being posted to process things correctly, ...
All, this is my code //declare string pointer BSTR markup; //initialize markup to some well formed XML <- //declare and initialize XML Document MSXML2::IXMLDOMDocument2Ptr pXMLDoc; HRESULT hr; hr = pXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40)); pXMLDoc->async = VARIANT_FALSE; pXMLDoc->validateOnParse = VARI...
It looks like you're dealing with an issue related to how you're handling BSTR and _bstr_t types in your code, particularly in conjunction with the MSXML2 library and potential encoding issues when working with larger XML strings. Here's a step-by-step approach to help resolve the issue: 1. **Using the Correct Type**...
39,078
[ { "from": "human", "value": "All,\nthis is my code\n//declare string pointer\nBSTR markup;\n\n//initialize markup to some well formed XML <-\n\n//declare and initialize XML Document\nMSXML2::IXMLDOMDocument2Ptr pXMLDoc;\nHRESULT hr;\nhr = pXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));\npXMLDoc->as...
How to delete a file which is in use/open by some process in runtime. I am using vb.net for my project and a image is shown in picturebox, and that should be deleted, without closing that file.
In VB.NET, deleting a file that is currently in use by another process is generally not possible directly, as files that are open in a process are locked, and attempting to delete them will result in an `IOException`. However, you can employ a workaround to achieve your goal. Here are a couple of strategies to consider...
38,265
[ { "from": "human", "value": "How to delete a file which is in use/open by some process in runtime.\nI am using vb.net for my project and a image is shown in picturebox,\nand that should be deleted, without closing that file.\n" }, { "from": "gpt", "value": "In VB.NET, deleting a file that is cur...
Someone within my organization has started pushing for us to pilot the CMU SEI's TSP process (see website here). I have an instinctual aversion to any attempts to cure software development illnesses with alphabet soup, but I would like to know if anyone has experience with this process and can provide tangible facts.
The Team Software Process (TSP) is a structured software development process developed by the Carnegie Mellon University's Software Engineering Institute (CMU SEI). It aims to improve software quality and team performance by promoting disciplined software engineering practices. Here are some key facts and insights abou...
39,245
[ { "from": "human", "value": "Someone within my organization has started pushing for us to pilot the CMU SEI's TSP process (see website here). I have an instinctual aversion to any attempts to cure software development illnesses with alphabet soup, but I would like to know if anyone has experience with this ...
I have this code in my aspx page; <a href="javascript:void(0);" onclick=<% Print(); %> title="Print listings">Print</a> which presents a link to print a listings to a pdf when the user clicks on it; as you can note the script calls a function from the behind code. The problem is that when I coded this it happens that ...
The issue you're experiencing arises from the way the `<% %>` syntax is interpreted in ASP.NET Web Forms. When you use `<% Print(); %>` in your `onclick` attribute, it executes the `Print()` method on the server side when the page is loaded, rather than waiting for the user to click the link. To achieve the desired f...
36,263
[ { "from": "human", "value": "I have this code in my aspx page;\n<a href=\"javascript:void(0);\" onclick=<% Print(); %> title=\"Print listings\">Print</a>\n\nwhich presents a link to print a listings to a pdf when the user clicks on it; as you can note the script calls a function from the behind code.\nThe p...
How can I search for specific value in the registry keys? For example I want to search for XXX in HKEY_CLASSES_ROOT\Installer\Products any code sample in C# will be appreciated, thanks
You can search for a specific value in the Windows Registry using C#. To achieve this, you'll need to access the registry keys and values using the `Microsoft.Win32` namespace. Here's an example that demonstrates how to search for a specific value (e.g., "XXX") in the `HKEY_CLASSES_ROOT\Installer\Products` registry pat...
36,388
[ { "from": "human", "value": "How can I search for specific value in the registry keys?\nFor example I want to search for XXX in \nHKEY_CLASSES_ROOT\\Installer\\Products\n\nany code sample in C# will be appreciated,\nthanks\n" }, { "from": "gpt", "value": "You can search for a specific value in t...
I'm seeing conflicting references in Oracles documentation. Is there any difference between how decimals are stored in a FLOAT and a NUMBER types in the database? As I recall from C, et al, a float has accuracy limitations that an int doesn't have. R.g., For 'float's, 0.1(Base 10) is approximated as 0.11001100110011001...
You're correct to note that there are differences in how decimal values are handled in floating-point types (like `FLOAT` in programming languages such as C) compared to Oracle's `NUMBER` type. Here's the breakdown: ### 1. Floating-point Representation in Programming Languages (e.g., C) - **FLOAT in C**: In languages...
39,552
[ { "from": "human", "value": "I'm seeing conflicting references in Oracles documentation. Is there any difference between how decimals are stored in a FLOAT and a NUMBER types in the database?\nAs I recall from C, et al, a float has accuracy limitations that an int doesn't have. R.g., For 'float's, 0.1(Base ...
I have written a program that gets input from a usb second keyboard (actually a barcode scanner). The problem is that if another window is active the data is input there rather than in my program. Could someone give me advice on what I'm doing wrong? #include <stdio.h> #include <string.h> int main(int argc, char * arg...
To intercept input from a USB device, such as a barcode scanner, in a Linux environment, there are a few important considerations and steps you can take to ensure the input is directed to your program and not to whichever window currently has focus. ### 1. **Understanding Input Device Types:** - USB barcode scanner...
38,390
[ { "from": "human", "value": "I have written a program that gets input from a usb second keyboard (actually a barcode scanner). The problem is that if another window is active the data is input there rather than in my program. Could someone give me advice on what I'm doing wrong?\n#include <stdio.h>\n#includ...
Is there a way of automatically generating a HTML-Map compatible list of coordinates of polygon-like objects (e.g. countries on a map) with very distinctive borders? Example image: Map of CEE countries http://www.bankaustria.at/landkarten/CEE_2007_w524.jpg Final output: <map id ="ceemap" name="ceemap"> <area shape=...
Generating an HTML map with `<area>` tags for polygonal regions (like countries) from an image can be a bit involved, but there are tools and techniques that can help you extract the coordinates needed for your `<map>` definition. Here are some steps and tools that can assist you in the process: ### Tools to Extract C...
36,727
[ { "from": "human", "value": "Is there a way of automatically generating a HTML-Map compatible list of coordinates of polygon-like objects (e.g. countries on a map) with very distinctive borders?\nExample image:\nMap of CEE countries http://www.bankaustria.at/landkarten/CEE_2007_w524.jpg\nFinal output:\n<map...
I'm working on developing a regular dump of our database. I'm using this script to create the backup and then feeding it through a regular cron job. In the end we end up with a text file as well as an email archive of everything. The problem we've encountered is the size of two of our tables. They each have 60k field...
Backing up and restoring large tables can certainly pose challenges, but there are strategies and best practices that can help streamline both processes. Here’s a breakdown of your questions: ### a) Is there a more straightforward way to back up huge tables on a daily basis? 1. **Incremental Backups**: You mentioned ...
38,898
[ { "from": "human", "value": "I'm working on developing a regular dump of our database. I'm using this script to create the backup and then feeding it through a regular cron job. In the end we end up with a text file as well as an email archive of everything.\nThe problem we've encountered is the size of tw...
I'm trying to do some abstraction in Haskell98 but doen't know how to do it. What I want to do is to define a class for types that may be converted into lists. toList :: a -> [b] But I don't know how to define a class for this method. I brought up the following three ideas: class ToList a b where toList :: a -> [b...
In Haskell98, you're correct that you can't have multi-parameter type classes, and the type system does not allow you to directly express relationships between the types in the way you have shown. However, you can achieve the desired abstraction by using a slightly different approach. ### Proposal for the `ToList` Cla...
35,909
[ { "from": "human", "value": "I'm trying to do some abstraction in Haskell98 but doen't know how to do it.\nWhat I want to do is to define a class for types that may be converted into lists.\ntoList :: a -> [b]\n\nBut I don't know how to define a class for this method. I brought up the following three ideas:...