instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I'm writing a C# program that acts as a PowerPoint 2007 plugin. On some machines, some calls to the PowerPoint object model throw a COMException with the message RPC_E_SYS_CALL_FAILED. I couldn't find any specific advice on what to do regarding this error, or how to avoid it. From Googling it looks like something to do...
The `RPC_E_SYS_CALL_FAILED` error you're encountering can indeed be quite tricky to deal with, especially when you're developing a COM add-in for PowerPoint. It often indicates that there are underlying threading issues or problems related to the inter-process communication between your .NET application and the PowerPo...
14,516
[ { "from": "human", "value": "I'm writing a C# program that acts as a PowerPoint 2007 plugin. On some machines, some calls to the PowerPoint object model throw a COMException with the message RPC_E_SYS_CALL_FAILED. I couldn't find any specific advice on what to do regarding this error, or how to avoid it. Fr...
This I think is related to my use of the nlog C++ API (and my question on the nlog forum is here); the purpose of my asking this question here is to get a wider audience to my problem and perhaps to also get some more general ideas behind the VB6 IDE's failure to build in my particular scenario. Briefly, the problem th...
It sounds like you're dealing with a complex integration issue between VB6 and unmanaged C++ components, specifically related to the NLog library. Here are some points to consider that might help you troubleshoot the problem: ### General Considerations 1. **Dependencies and Versions**: - Ensure that all dependenci...
15,322
[ { "from": "human", "value": "This I think is related to my use of the nlog C++ API (and my question on the nlog forum is here); the purpose of my asking this question here is to get a wider audience to my problem and perhaps to also get some more general ideas behind the VB6 IDE's failure to build in my par...
Intermittently in our app, we encounter LockTimeoutExceptions being throw from SQL CE. We've recently upgraded to 3.5 SP 1, and a number of them seem to have gone away, but we still do see them occasionally. I'm certain it's a bug in our code (which is multi-threaded) but I haven't been able to pin it down precisely. D...
Debugging `LockTimeoutExceptions` in a multi-threaded application using SQL Server Compact Edition (SQL CE) can indeed be challenging. Here are some techniques and best practices to help you diagnose and resolve the issue: ### 1. Analyze Your Locking Strategy Since you're working in a multi-threaded environment, ensur...
9,010
[ { "from": "human", "value": "Intermittently in our app, we encounter LockTimeoutExceptions being throw from SQL CE. We've recently upgraded to 3.5 SP 1, and a number of them seem to have gone away, but we still do see them occasionally. I'm certain it's a bug in our code (which is multi-threaded) but I have...
ActiveReports seems like a powerful flexible tool, but if you make a mistake anywhere, you get an exception "data member not found. please check your datasource and datamember properties". There is no indication as to which datasource/datamember is at fault or what subreport the problem lies in, but Active Reports mus...
When working with ActiveReports, encountering a "data member not found" exception can indeed be frustrating, especially when the error message doesn't specify which data member is causing the issue. Here are some strategies you can use to troubleshoot and identify the source of the problem without having to comment out...
17,689
[ { "from": "human", "value": "ActiveReports seems like a powerful flexible tool, but if you make a mistake anywhere, you get an exception \"data member not found. please check your datasource and datamember properties\". \nThere is no indication as to which datasource/datamember is at fault or what subreport...
I have a custom server control that loads data from a web service into a GridView. Works fine on my page. I want to be able to click on a row and pop a popupcontrol with more detail on the clicked row. I am using the client side events of the DevExpress gridview to handle the onclick. And from JavaScript I am callin...
When working with custom server controls in ASP.NET, particularly when you want to retain the state of properties across callbacks, there are a few critical points to keep in mind: 1. **ViewState**: Ensure that your custom server control properly implements ViewState to store property values. ViewState is essential fo...
13,807
[ { "from": "human", "value": "I have a custom server control that loads data from a web service into a GridView. Works fine on my page. I want to be able to click on a row and pop a popupcontrol with more detail on the clicked row. I am using the client side events of the DevExpress gridview to handle the...
Is there a way to tell the debugger to stop just before returning, on whichever statement exits from the method, be it return, exception, or fall out the bottom? I am inspired by the fact that the Java editor shows me all the places that my method can exit - it highlights them when you click on the return type of the m...
In Eclipse, while there isn't a direct built-in feature to set a breakpoint that stops specifically just before a method exits (regardless of the exit point), you can effectively achieve this by setting breakpoints at all potential exit points in your method. Here's how you can do it: 1. **Set Breakpoints at Return St...
18,516
[ { "from": "human", "value": "Is there a way to tell the debugger to stop just before returning, on whichever statement exits from the method, be it return, exception, or fall out the bottom? I am inspired by the fact that the Java editor shows me all the places that my method can exit - it highlights them w...
I need your help in determining the best approach for analyzing industry-specific sentences (i.e. movie reviews) for "positive" vs "negative". I've seen libraries such as OpenNLP before, but it's too low-level - it just gives me the basic sentence composition; what I need is a higher-level structure: - hopefully with w...
For analyzing industry-specific sentences like movie reviews for sentiment (positive vs. negative), you can use higher-level libraries and frameworks that offer sentiment analysis capabilities, along with options for training on your own dataset. Here are some suggestions: ### 1. **Hugging Face Transformers** - **Des...
11,587
[ { "from": "human", "value": "I need your help in determining the best approach for analyzing industry-specific sentences (i.e. movie reviews) for \"positive\" vs \"negative\". I've seen libraries such as OpenNLP before, but it's too low-level - it just gives me the basic sentence composition; what I need is...
I am developping a (relatively small) website in ASP.Net 2.0. I am also using nAnt to perform some easy tweaking on my project before delivering executables. In its current state, the website is "precompiled" using aspnet_compiler.exe -nologo -v ${Appname} -u ${target} I have noticed that after the IIS pool is resta...
When precompiling an ASP.NET application for production, there are several considerations and techniques you can utilize to improve startup time, especially when you're experiencing long load times after an application pool recycle. Here are some options and best practices for precompiling your ASP.NET 2.0 application...
16,225
[ { "from": "human", "value": "I am developping a (relatively small) website in ASP.Net 2.0. I am also using nAnt to perform some easy tweaking on my project before delivering executables. In its current state, the website is \"precompiled\" using \n\naspnet_compiler.exe -nologo -v ${Appname} -u ${target}\n\n...
I am sure a responsive UI is something that everyone strives for and the reccomended way to do stuff is to use the BackgroundWorker for this. Do you find it easy to work with ? Do you use it often ? Or do you have your own frameworks for lengthy tasks and reporting process. I have found that I am using it quite a lot ...
The `BackgroundWorker` class in .NET is a useful tool for performing lengthy operations without blocking the user interface (UI), allowing for a responsive user experience. It provides built-in support for reporting progress and handling completion events, which can simplify the implementation of asynchronous operation...
15,654
[ { "from": "human", "value": "I am sure a responsive UI is something that everyone strives for and the reccomended way to do stuff is to use the BackgroundWorker for this. \nDo you find it easy to work with ? Do you use it often ? Or do you have your own frameworks for lengthy tasks and reporting process.\nI...
I would like to use VB9 but am not sure what syntax to use to say that I want a variable to be statically typed as in C#'s: var foo = new Whatever(); In previous versions of VB: Dim foo = New Whatever() created a dynamically typed variable. Is there a way to get static typing without actually writing the type in VB9?...
In VB.NET (also known as VB9), you can achieve static typing similar to C#'s `var` keyword by using the `As` clause with the `Dim` statement to explicitly define the type of the variable. However, if you prefer not to explicitly write out the type, you can use the `Option Strict` statement. In VB.NET, `Option Strict`...
19,271
[ { "from": "human", "value": "I would like to use VB9 but am not sure what syntax to use to say that I want a variable to be statically typed as in C#'s:\nvar foo = new Whatever();\n\nIn previous versions of VB:\nDim foo = New Whatever()\n\ncreated a dynamically typed variable.\nIs there a way to get static ...
I'm trying to select data from a table defined similar to the following : Column | Data Type ------------------------- Id | Int DataType | Int LoggedData | XML but I only want to select those rows with a specific DataType value, and that contain a string (or evaluates a piece of XPath) in the...
To select rows from your table based on a specific `DataType` value and filter the `LoggedData` XML column using an XPath expression, you can use SQL Server's XML capabilities. Given your requirements, you can use the `.exist()` method in SQL to determine if a specific node or attribute exists in the XML. Here's an ex...
19,315
[ { "from": "human", "value": "I'm trying to select data from a table defined similar to the following :\nColumn | Data Type\n-------------------------\nId | Int\nDataType | Int\nLoggedData | XML\n\nbut I only want to select those rows with a specific DataType value, and that contain...
Is there anyway to build a solution to target 64 bit environment in vs2003? My solution is native c++ not visual c++. Any help would be greatly appreciated. cheers, RWendi
Visual Studio 2003 does not natively support 64-bit development, as it was primarily designed for 32-bit applications. However, there are a few workarounds that you can consider if you want to target a 64-bit environment: ### 1. Use a Different Compiler The easiest way to build a 64-bit application would be to use a d...
18,839
[ { "from": "human", "value": "Is there anyway to build a solution to target 64 bit environment in vs2003? My solution is native c++ not visual c++. Any help would be greatly appreciated.\ncheers,\nRWendi\n" }, { "from": "gpt", "value": "Visual Studio 2003 does not natively support 64-bit developm...
I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up. Here are the specifics: Domain is registered with GoDaddy. Nameservers are pointing to DiscountASP.net where ASP.NET app has been happily running for couple of years. Would like blog.mydomain.ex...
Yes, it is feasible to set up a subdomain (like `blog.mydomain.example`) to point to DreamHost while keeping your primary domain hosted with DiscountASP.net. Here’s how you can do it step-by-step: ### Step 1: Create the Subdomain in DreamHost You’ve already completed this step, but just to summarize: 1. Log in to your...
16,795
[ { "from": "human", "value": "I'm trying to host a subdomain for my site with a different hosting company and I'm running into issues on how to set it up.\nHere are the specifics:\n\nDomain is registered with GoDaddy.\nNameservers are pointing to DiscountASP.net where ASP.NET app has been happily running for...
What do you think about this build tool? I'm thinking of migrating from maven2 to raven (my poms are getting bigger and bigger), but I'd like to hear some opinions first. Thanks! @andre: Thank's for writing but I was actually looking for real experiences using raven. Anyway, the fact that nobody wrote is an indicator b...
When considering a migration from Maven 2 to another build tool like Raven, it's essential to weigh the pros and cons, especially since Maven is quite popular and widely used. Here are some factors to consider based on general build tool principles, even if I don't have specific insights on Raven since it may not have ...
14,587
[ { "from": "human", "value": "What do you think about this build tool? I'm thinking of migrating from maven2 to raven (my poms are getting bigger and bigger), but I'd like to hear some opinions first.\nThanks!\n@andre:\nThank's for writing but I was actually looking for real experiences using raven. Anyway, ...
I have a table in my database which stores a tree structure. Here are the relevant fields: mytree (id, parentid, otherfields...) I want to find all the leaf nodes (that is, any record whose id is not another record's parentid) I've tried this: SELECT * FROM mytree WHERE `id` NOT IN (SELECT DISTINCT `parentid` FROM `my...
The issue with your original query is likely related to the presence of `NULL` values in the `parentid` column of your `mytree` table. When you use `NOT IN`, if there are any `NULL` values in the subquery result (the list of distinct `parentid`s), then the entire result of the `NOT IN` condition will be `false` for any...
19,724
[ { "from": "human", "value": "I have a table in my database which stores a tree structure. Here are the relevant fields:\nmytree (id, parentid, otherfields...)\n\nI want to find all the leaf nodes (that is, any record whose id is not another record's parentid)\nI've tried this:\nSELECT * FROM mytree WHERE `i...
How to allow TextBlock's text to be selectable? I tried to get it to work by displaying the text using a read-only TextBox styled to look like a textblock but this will not work in my case because a TextBox does not have inlines. In other words, how to make it selectable?
In WPF (Windows Presentation Foundation), a `TextBlock` does not support text selection by default. However, there are several ways to make text selectable while maintaining some of the capabilities of a `TextBlock`. ### Method 1: Use a `RichTextBox` One of the most straightforward ways to allow selectable text is to...
15,813
[ { "from": "human", "value": "How to allow TextBlock's text to be selectable?\nI tried to get it to work by displaying the text using a read-only TextBox styled to look like a textblock but this will not work in my case because a TextBox does not have inlines. In other words, how to make it selectable?\n" ...
This is a scenario I've seen in multiple places over the years; I'm wondering if anyone else has run across a better solution than I have... My company sells a relatively small number of products, however the products we sell are highly specialized (i.e. in order to select a given product, a significant number of detai...
It sounds like you are facing a classic case of a polymorphic association in a database design scenario, where you have diverse product types with their specific attributes, but want to maintain a unified order processing system. You have already attempted some common strategies, but here are a few additional options y...
16,635
[ { "from": "human", "value": "This is a scenario I've seen in multiple places over the years; I'm wondering if anyone else has run across a better solution than I have...\nMy company sells a relatively small number of products, however the products we sell are highly specialized (i.e. in order to select a gi...
I know this can be done in IE by creating an ActiveX object, but how do I do it in FF. The navigator.plugins['Adobe Acrobat'] object lets me know if it's installed or not, but it doesn't contain the version number. Any ideas?
In Firefox, the ability to retrieve detailed information about installed plugins, including version numbers, has changed over the years, especially with the focus on security and privacy. As of now, direct access to plugin details, such as version numbers, through JavaScript (like you could with ActiveX in Internet Exp...
19,051
[ { "from": "human", "value": "I know this can be done in IE by creating an ActiveX object, but how do I do it in FF. The navigator.plugins['Adobe Acrobat'] object lets me know if it's installed or not, but it doesn't contain the version number. Any ideas?\n" }, { "from": "gpt", "value": "In Firef...
Can MySql 5.0 views use tables that are located on another server? What is the syntax for creating such a view?
In MySQL 5.0, you cannot directly create a view that references tables located on a different MySQL server. Views in MySQL are defined within a specific database and can only reference tables that are also within that same database. However, you can achieve cross-server access by using a couple of alternative approac...
17,648
[ { "from": "human", "value": "Can MySql 5.0 views use tables that are located on another server? What is the syntax for creating such a view?\n" }, { "from": "gpt", "value": "In MySQL 5.0, you cannot directly create a view that references tables located on a different MySQL server. Views in MySQ...
If I create an event using CreateEvent in Windows, how can I check if that event is signaled or not using the debugger in Visual Studio? CreateEvent returns back a handle, which doesn't give me access to much information. Before I call WaitForSingleObject(), I want to check to see if the event is signaled before I st...
To check if a Windows event created with `CreateEvent` is signaled or not using the Visual Studio debugger, you'll need to examine the state of the event object associated with the handle returned by `CreateEvent`. Here's how to do that step by step: 1. **Create the Event**: When you create the event, you get a handle...
16,026
[ { "from": "human", "value": "If I create an event using CreateEvent in Windows, how can I check if that event is signaled or not using the debugger in Visual Studio? CreateEvent returns back a handle, which doesn't give me access to much information. Before I call WaitForSingleObject(), I want to check to...
I'm looking at the SOAP output from a web service I'm developing, and I noticed something curious: <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"> <soapenv:Body> <ns1:CreateEntityTypesResponse xmlns:ns1="http://somedomain.com/wsinterface"> <newKeys> <value>1234</...
To include the `xsi` namespace declaration in the `soapenv:Envelope` element so that it does not need to be repeated in each individual `newKeys` element, you will need to modify how the SOAP response is constructed. Since you are using WSDL2Java to generate your service skeleton, and if you do not have direct access t...
15,390
[ { "from": "human", "value": "I'm looking at the SOAP output from a web service I'm developing, and I noticed something curious:\n<soapenv:Envelope xmlns:soapenv=\"http://www.w3.org/2003/05/soap-envelope\">\n <soapenv:Body>\n <ns1:CreateEntityTypesResponse xmlns:ns1=\"http://somedomain.com/wsinterface...
I'm using subversion (TortoiseSVN) and I want to remove the .svn folders from my project for deployment, is there an automated way of doing this using subversion or do I have to create a custom script for this?
Subversion (SVN) itself does not provide a built-in command specifically for removing `.svn` folders from your working copy, as `.svn` directories are essential for SVN to track changes and manage the repository. However, if you want to deploy your project without these directories, you will need to create a custom sol...
18,796
[ { "from": "human", "value": "I'm using subversion (TortoiseSVN) and I want to remove the .svn folders from my project for deployment, is there an automated way of doing this using subversion or do I have to create a custom script for this?\n" }, { "from": "gpt", "value": "Subversion (SVN) itself...
Question Can I build a image database/library that has an e-commerce style checkout system and a powerful search in Oracle/Java? Are there existing elements out there I should be aware of? Or, is this better in another dev environment like PHP/MySQL? Overview I am working on an image database/library dev team on the UI...
Building an image database/library with an e-commerce style checkout system and a powerful search feature using Oracle and Java is certainly feasible. Both technologies have robust capabilities for handling databases, user interfaces, and web applications. Here’s a breakdown of your requirements and some considerations...
14,613
[ { "from": "human", "value": "Question\nCan I build a image database/library that has an e-commerce style checkout system and a powerful search in Oracle/Java? Are there existing elements out there I should be aware of? Or, is this better in another dev environment like PHP/MySQL?\nOverview\nI am working on ...
If I do not specify the following in my web.xml file: <session-config> <session-timeout>10</session-timeout> </session-config> What will be my default session timeout? (I am running Tomcat 6.0)
If you do not specify a `<session-config>` element with a `<session-timeout>` setting in your `web.xml` file for a web application running on Tomcat 6.0, the default session timeout will be 30 minutes. This means that if a user is inactive for 30 minutes, their session will expire. Keep in mind that this default behav...
20,980
[ { "from": "human", "value": "If I do not specify the following in my web.xml file:\n<session-config>\n <session-timeout>10</session-timeout>\n</session-config>\n\nWhat will be my default session timeout? (I am running Tomcat 6.0)\n" }, { "from": "gpt", "value": "If you do not specify a `<sess...
I got a Function that returns a Collection<string>, and that calls itself recursively to eventually return one big Collection<string>. Now, i just wonder what the best approach to merge the lists? Collection.CopyTo() only copies to string[], and using a foreach() loop feels like being inefficient. However, since I also...
To improve the efficiency of your recursive function that collects unique strings (users) without duplicates, you can leverage a `HashSet<string>` instead of a `Collection<string>`. A `HashSet` provides O(1) time complexity for lookups, which is significantly better than O(n) for a list when checking for duplicates. Th...
14,552
[ { "from": "human", "value": "I got a Function that returns a Collection<string>, and that calls itself recursively to eventually return one big Collection<string>.\nNow, i just wonder what the best approach to merge the lists? Collection.CopyTo() only copies to string[], and using a foreach() loop feels lik...
What is the best way to graphically represent page flow, as applicable to an action oriented web application? What model do you use to represent page flows (page flow diagrams) encompassing pages (views), user actions on those views (events) and processes? These diagrams should act as a starting point for understanding...
### Page Flow Diagram Scheme **Purpose:** This scheme is designed to create clear and effective page flow diagrams for action-oriented web applications, facilitating communication between business domain experts, technical analysts, and web developers. #### Notation: 1. **Page Representation:** - **Shape:** Recta...
18,175
[ { "from": "human", "value": "What is the best way to graphically represent page flow, as applicable to an action oriented web application?\nWhat model do you use to represent page flows (page flow diagrams) encompassing pages (views), user actions on those views (events) and processes?\nThese diagrams shoul...
Suppose I use the [RemoteClass] tag to endow a custom Flex class with serialization intelligence. What happens when I need to change my object (add a new field, remove a field, rename a field, etc)? Is there a design pattern for handling this in an elegant way?
When using the `[RemoteClass]` metadata tag in a Flex application, it enables serialization of your custom class to/from a remote service. However, any modifications to the structure of your class—such as adding, removing, or renaming fields—can pose challenges, particularly in maintaining compatibility with existing s...
15,161
[ { "from": "human", "value": "Suppose I use the [RemoteClass] tag to endow a custom Flex class with serialization intelligence. \nWhat happens when I need to change my object (add a new field, remove a field, rename a field, etc)?\nIs there a design pattern for handling this in an elegant way?\n" }, { ...
I'm creating a networked server for a boggle-clone I wrote in python, which accepts users, solves the boards, and scores the player input. The dictionary file I'm using is 1.8MB (the ENABLE2K dictionary), and I need it to be available to several game solver classes. Right now, I have it so that each class iterates th...
It's great that you're thinking about efficiency and memory usage in your Boggle clone! When it comes to sharing the dictionary across multiple instances of your solver classes, there are a few approaches you can take, and I'll discuss the pros and cons of each. ### Option 1: Global Variable You could read the dictio...
13,945
[ { "from": "human", "value": "I'm creating a networked server for a boggle-clone I wrote in python, which accepts users, solves the boards, and scores the player input. The dictionary file I'm using is 1.8MB (the ENABLE2K dictionary), and I need it to be available to several game solver classes. Right now,...
Just wondering if a .NET app can be compiled down to native machine code ahead of time? I'm not planning on doing so even if I could; I'm just curious. Thanks
Yes, .NET applications can be compiled down to native machine code ahead of time (AOT) using various tools and technologies. The primary way to achieve AOT compilation in the .NET ecosystem is through the use of **Native AOT** and **ReadyToRun** (R2R) compilation. 1. **Native AOT**: With .NET 6 and later versions, Mic...
16,949
[ { "from": "human", "value": "Just wondering if a .NET app can be compiled down to native machine code ahead of time? I'm not planning on doing so even if I could; I'm just curious.\nThanks\n" }, { "from": "gpt", "value": "Yes, .NET applications can be compiled down to native machine code ahead ...
I would like MATLAB to tell me if I have an input file (.m file) that contains some variables with their numbers (i.e., a = 5, b = 6, c = 7) so that I can then use that .m file in another program (main .m file) that uses these variables to calculate S = a + b + c. How can I then read the input file from the main file? ...
To read and use variables defined in an input file (`INP.m`) from another main file (`MAIN.m`), you can utilize the `run` command in MATLAB. The `run` command executes the script and makes all variables defined in it accessible in the workspace of the script that calls it. Here’s how you can do it step by step: 1. **C...
17,079
[ { "from": "human", "value": "I would like MATLAB to tell me if I have an input file (.m file) that contains some variables with their numbers (i.e., a = 5, b = 6, c = 7) so that I can then use that .m file in another program (main .m file) that uses these variables to calculate S = a + b + c. How can I then...
I am trying to write a simple networked chat program in Java. I have almost no networking experience. I was wondering what resources I should begin looking at (beside here of course). Sticking with the core Java API would be best for now.
Creating a simple networked chat program in Java is a great way to learn about networking in the language. Since you prefer to stick with the core Java API, you'll want to explore the following resources and concepts: ### 1. Java Networking Basics - **Java Networking Documentation:** Familiarize yourself with the [...
15,782
[ { "from": "human", "value": "I am trying to write a simple networked chat program in Java. I have almost no networking experience. I was wondering what resources I should begin looking at (beside here of course).\nSticking with the core Java API would be best for now.\n" }, { "from": "gpt", "v...
I have a series of performance tests I would like to show as a graph. I have a set of tests (about 10) which I run on a set of components (currently 3), and get throughput results. The Y-axis would be the throughput result from the test, and the X-axis should have an abbreviated name of the test, with the results from...
Yes, you can definitely create a graph with a non-numeric X-axis in Gnuplot. Gnuplot supports categorical axes, which allows you to plot non-numeric labels on the X-axis while showing the throughput results on the Y-axis. Here's how you can create such a graph based on your requirements. ### Step-by-Step Instructions ...
15,533
[ { "from": "human", "value": "I have a series of performance tests I would like to show as a graph. I have a set of tests (about 10) which I run on a set of components (currently 3), and get throughput results.\nThe Y-axis would be the throughput result from the test, and the X-axis should have an abbreviat...
I would like to start tagging my deployed binaries with the latest SVN revision number. However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number. Using svn info on the root doesn't work (it j...
It's great that you've identified the issue with using `svn info` without updating your working copy first. This can indeed lead to outdated revision information. To answer your original question, if you want to find the highest revision number across all files in a directory and its subdirectories in SVN, there isn'...
15,407
[ { "from": "human", "value": "I would like to start tagging my deployed binaries with the latest SVN revision number.\nHowever, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.\nUs...
I am trying to execute some stored procedures in groovy way. I am able to do it quite easily by using straight JDBC but this does not seem in the spirit of Grails. I am trying to call the stored procedure as: sql.query( "{call web_GetCityStateByZip(?,?,?,?,?)}",[params.postalcode, sql.out(java.sql.Types.VARCHAR), sql...
To call a stored procedure in Grails using Groovy and handle output parameters correctly, you'll want to follow a structured approach. The error message you're encountering, `Cannot register out parameter`, usually suggests that the JDBC call isn't correctly set up to handle the output parameters. Here is a typical w...
14,018
[ { "from": "human", "value": "I am trying to execute some stored procedures in groovy way. I am able to do it quite easily by using straight JDBC but this does not seem in the spirit of Grails.\nI am trying to call the stored procedure as:\nsql.query( \"{call web_GetCityStateByZip(?,?,?,?,?)}\",[params.post...
Probably a really simple one this - I'm starting out with C# and need to add values to an array, for example: int[] terms; for(int runs = 0; runs < 400; runs++) { terms[] = runs; } For those who have used PHP, here's what I'm trying to do in C#: $arr = array(); for ($i = 0; $i < 10; $i++) { $arr[] = $i; }
Welcome to C#! It looks like you're trying to add values to an array dynamically, which works a bit differently in C# compared to PHP. In C#, arrays have a fixed size once they are initialized, so you can't add elements to them after they're created. Instead, you can use a `List<int>`, which is a dynamic collection tha...
19,376
[ { "from": "human", "value": "Probably a really simple one this - I'm starting out with C# and need to add values to an array, for example:\nint[] terms;\n\nfor(int runs = 0; runs < 400; runs++)\n{\n terms[] = runs;\n}\n\nFor those who have used PHP, here's what I'm trying to do in C#:\n$arr = array();\nf...
I'm trying to run SQuirreL SQL. I've downloaded it and installed it, but when I try to run it I get this error message: Java Virtual Machine Launcher. Could not find the main class. Program will exit. I get the gist of this, but I have not idea how to fix it. Any help? more info: I'm on Windows XP pro. I...
The error message you're encountering typically indicates that the Java Virtual Machine (JVM) is unable to find the class that contains the `main` method to start the SQuirreL SQL application. Here are several steps you can take to resolve the issue: 1. **Check Java Installation**: - Make sure that Java is properly...
15,808
[ { "from": "human", "value": "I'm trying to run SQuirreL SQL.\nI've downloaded it and installed it, but when I try to run it I get this error message: \n\nJava Virtual Machine Launcher.\n Could not find the main class.\n Program will exit. \n\nI get the gist of this, but I have not idea how to fix it. An...
I've got a siluation where i need to access a SOAP web service with WSE 2.0 security. I've got all the generated c# proxies (which are derived from Microsoft.Web.Services2.WebServicesClientProtocol), i'm applying the certificate but when i call a method i get an error: System.Net.WebException : The request failed with ...
The HTTP 405: Method Not Allowed error generally indicates that the web server is refusing to accept the request method used in your SOAP call. In the context of a SOAP web service, this is most likely related to the HTTP method (GET or POST) used to make the request. Here are some steps you can take to troubleshoot a...
18,131
[ { "from": "human", "value": "I've got a siluation where i need to access a SOAP web service with WSE 2.0 security. I've got all the generated c# proxies (which are derived from Microsoft.Web.Services2.WebServicesClientProtocol), i'm applying the certificate but when i call a method i get an error:\nSystem.N...
I have been looking for documentation related to interacting with MSPaint from the command line. I have only found references to /p, /pt and /wia, but no guidance as to how to use them and their limitations. I am trying to send some graphics files to the printer and when I drop the file on my printer driver I get a dif...
Interacting with Microsoft Paint (MSPaint) from the command line can be somewhat limited, but the command-line options you mentioned do exist and can be helpful for specific tasks. Here’s a brief overview of how to use them and their limitations: ### Command-Line Options for MSPaint 1. **/p**: This option allows you ...
15,847
[ { "from": "human", "value": "I have been looking for documentation related to interacting with MSPaint from the command line. I have only found references to /p, /pt and /wia, but no guidance as to how to use them and their limitations.\nI am trying to send some graphics files to the printer and when I drop...
Is there a PHP function to find out the name of the caller function in a given function?
Yes, in PHP, you can find out the name of the caller function using the `debug_backtrace()` function. This function provides a backtrace of the current call stack, allowing you to inspect the function calls leading up to the current point in the program. Here's an example of how to use `debug_backtrace()` to get the n...
17,526
[ { "from": "human", "value": "Is there a PHP function to find out the name of the caller function in a given function?\n" }, { "from": "gpt", "value": "Yes, in PHP, you can find out the name of the caller function using the `debug_backtrace()` function. This function provides a backtrace of the c...
I found an example of implementing the repository pattern in NHibernate on the web, and one of the methods uses this code to get the first result of a query: public IEnumerable<T> FindAll(DetachedCriteria criteria, int firstResult, int numberOfResults, params Order[] orders) { criteria.SetFirstResult(firstResult)....
In NHibernate 1.2.1, the `DetachedCriteria` class does not have built-in methods like `SetFirstResult` or `SetMaxResults`. Instead, pagination (setting the starting position and limiting the number of results) in queries usually happens at the level of the `IQueryable` or `ISession` when executing the criteria. If you...
17,464
[ { "from": "human", "value": "I found an example of implementing the repository pattern in NHibernate on the web, and one of the methods uses this code to get the first result of a query:\npublic IEnumerable<T> FindAll(DetachedCriteria criteria, int firstResult, int numberOfResults, params Order[] orders)\n\...
After applying a CSS reset, I want to get back to 'normal' behavior for html elements like: p, h1..h6, strong, ul and li. Now when I say normal I mean e.g. the p element adds spacing or a carriage return like result when used, or the size of the font and boldness for a h1 tag, along with the spacing. I realize it is to...
After applying a CSS reset, many of the default styles for HTML elements are removed, which can lead to a blank slate for styling. If you're looking to restore "normal" behavior for common HTML elements like `<p>`, `<h1>` through `<h6>`, `<strong>`, `<ul>`, and `<li>`, you can create a simple set of styles that emulate...
15,740
[ { "from": "human", "value": "After applying a CSS reset, I want to get back to 'normal' behavior for html elements like: p, h1..h6, strong, ul and li.\nNow when I say normal I mean e.g. the p element adds spacing or a carriage return like result when used, or the size of the font and boldness for a h1 tag, ...
What is the difference between ROWNUM and ROW_NUMBER ?
`ROWNUM` and `ROW_NUMBER()` are both used in SQL to assign a unique sequential integer to rows within a result set, but they are used in different contexts and have different behaviors. Here are the key differences: ### ROWNUM 1. **Definition**: `ROWNUM` is a pseudo-column in Oracle that is used to assign a unique num...
15,760
[ { "from": "human", "value": "What is the difference between ROWNUM and ROW_NUMBER ? \n" }, { "from": "gpt", "value": "`ROWNUM` and `ROW_NUMBER()` are both used in SQL to assign a unique sequential integer to rows within a result set, but they are used in different contexts and have different be...
I want to add same field to multiple tables. Can I do this with single query in MySql?
In MySQL, you cannot directly add a new column to multiple tables in a single `ALTER TABLE` statement. However, you can execute multiple `ALTER TABLE` statements within a single query execution by separating each statement with a semicolon. If you want to add the same column to multiple tables, you would need to writ...
18,324
[ { "from": "human", "value": "I want to add same field to multiple tables. Can I do this with single query in MySql?\n" }, { "from": "gpt", "value": "In MySQL, you cannot directly add a new column to multiple tables in a single `ALTER TABLE` statement. However, you can execute multiple `ALTER TAB...
I'm looking for a way to create an online form that will update an Access database that has just a few tables. Does anyone know of a simple solution for this?
Creating an online form that updates an Access database can be accomplished through a few different approaches. Below are some options you can consider, depending on your technical expertise and the resources available to you. ### Option 1: Microsoft Forms and Power Automate (Flow) If you have access to Microsoft 365...
16,548
[ { "from": "human", "value": "I'm looking for a way to create an online form that will update an Access database that has just a few tables. Does anyone know of a simple solution for this?\n" }, { "from": "gpt", "value": "Creating an online form that updates an Access database can be accomplished...
We run a medium-size site that gets a few hundred thousand pageviews a day. Up until last weekend we ran with a load usually below 0.2 on a virtual machine. The OS is Ubuntu. When deploying the latest version of our application, we also did an apt-get dist-upgrade before deploying. After we had deployed we noticed that...
It sounds like you’re experiencing a performance issue that may not be directly tied to your application code but rather something deeper in the system, possibly stemming from the recent updates. Here are several steps and methods you can take to diagnose and potentially fix the problem: ### 1. **Check Logs** - Look i...
15,200
[ { "from": "human", "value": "We run a medium-size site that gets a few hundred thousand pageviews a day. Up until last weekend we ran with a load usually below 0.2 on a virtual machine. The OS is Ubuntu.\nWhen deploying the latest version of our application, we also did an apt-get dist-upgrade before deploy...
Is there a generic way, without creating and managing your own CLR host, to take over locating and loading a type if that type is not found? The following is just an example. In your rush to be the first answer, don't suggest the new add-in framework or the MEF as a solution to my question. An example would be a sampl...
It sounds like you've been able to achieve what you were looking for regarding handling the loading of types dynamically in your application. For others who may have a similar question, here's a broader explanation of how to address the scenario of handling type loading failures in .NET without delving into custom CLR ...
11,308
[ { "from": "human", "value": "Is there a generic way, without creating and managing your own CLR host, to take over locating and loading a type if that type is not found?\nThe following is just an example. In your rush to be the first answer, don't suggest the new add-in framework or the MEF as a solution t...
I am trying to add an unhandled exception handler in .net (c#) that should be as helpfull for the 'user' as possible. The end users are mostly programers so they just need a hint of what object are they manipulating wrong. I'm developing a windows similar to the windows XP error report when an application crashes but t...
In .NET, directly obtaining the values of the arguments for each function in the call stack is not straightforward due to the nature of managed code and the CLR (Common Language Runtime). However, you can use some strategies and techniques to improve your exception handling and provide more insightful information to yo...
13,585
[ { "from": "human", "value": "I am trying to add an unhandled exception handler in .net (c#) that should be as helpfull for the 'user' as possible. The end users are mostly programers so they just need a hint of what object are they manipulating wrong.\nI'm developing a windows similar to the windows XP erro...
The question says it all. I can't seem to find any recent rails tutorials or whatever to set up an OpenID authentication system. I found RestfulOpenIDAuthentication but it's so much older than the vanilla Restful Authentication and the docs don't even mention Rails 2 that I am pretty wary. Does anyone have any tips?...
Setting up OpenID authentication in a Ruby on Rails application can be a bit tricky, especially since some libraries may be outdated. However, there are still ways to implement OpenID authentication in modern versions of Rails. Here are some steps and tips to get you started: ### Step-by-Step Guide to Set Up OpenID Au...
14,628
[ { "from": "human", "value": "The question says it all. I can't seem to find any recent rails tutorials or whatever to set up an OpenID authentication system. I found RestfulOpenIDAuthentication but it's so much older than the vanilla Restful Authentication and the docs don't even mention Rails 2 that I am...
I have a page being loaded with jQuery. The initial load includes 100 records with 6 icons per record. Needless to say, it takes a few seconds to load and I want to give the user a "loading" prompt/animation. Any ideas?
Absolutely! Providing a loading prompt or animation is a great way to enhance user experience, especially for pages that take a bit longer to load. Here's a simple way to achieve this using jQuery and CSS. ### Step 1: Create a Loading Animation First, you'll need to create a loading animation using HTML and CSS. Here...
17,158
[ { "from": "human", "value": "I have a page being loaded with jQuery. The initial load includes 100 records with 6 icons per record. Needless to say, it takes a few seconds to load and I want to give the user a \"loading\" prompt/animation. \nAny ideas?\n" }, { "from": "gpt", "value": "Absolut...
Is there an easy way to convert the number 1, 2, 3, ... to "1st", "2nd", "3rd", ..., and in such a way that I can give the function a language and have it return me the correct form for the language I'm targeting? Either standard C++ (stl or boost OK), MFC or ATL, win32 api or a small, single-purpose and free library t...
To create a function that converts integers to their ordinal representations (like "1st", "2nd", "3rd", etc.) based on a specified language, you can use standard C++ without the need for external libraries. Below, I will provide a simple implementation that handles English, and you can extend it to other languages as n...
13,752
[ { "from": "human", "value": "Is there an easy way to convert the number 1, 2, 3, ... to \"1st\", \"2nd\", \"3rd\", ..., and in such a way that I can give the function a language and have it return me the correct form for the language I'm targeting? Either standard C++ (stl or boost OK), MFC or ATL, win32 ap...
I have a series of macros and toolbars that I developed for Word 2003. Now that my office is upgrading to Word 2007, I need to migrate them. The macros themselves migrate with zero effort, but the toolbars are a different issue. A random subset of the toolbars show up in the "Add-Ins" ribbon tab, but I haven't found...
Migrating custom toolbars from Word 2003 to Word 2007 can indeed be a challenge due to the shift in the user interface design and the introduction of the Ribbon system in Word 2007. Here's a step-by-step guide to help you replicate your custom macro toolbars in Word 2007: ### 1. Convert Toolbars to Ribbon Word 2007 d...
14,191
[ { "from": "human", "value": "I have a series of macros and toolbars that I developed for Word 2003. Now that my office is upgrading to Word 2007, I need to migrate them. The macros themselves migrate with zero effort, but the toolbars are a different issue. A random subset of the toolbars show up in the ...
I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access) that needs to work as follows: Upload file Record and save info regarding file to database Import data from file into database Redirect to different page When run sequentially like this, everything works fine. However, since the files being...
The issue you are facing stems from the way the ASP.NET environment works with regards to threading and resource access. When you start a new thread in an ASP.NET application, it runs in a different context from the main thread that handles the HTTP request. This can lead to complications, particularly when dealing wit...
13,334
[ { "from": "human", "value": "I have a process in a website (Asp.net 3.5 using Linq-to-Sql for data access) that needs to work as follows:\n\nUpload file\nRecord and save info regarding file to database\nImport data from file into database\nRedirect to different page\n\nWhen run sequentially like this, every...
I'm in a small business of hosting my clients' websites, and a lot of times they ask me to create one from scratch. I'm no designer, but I can code CSS/HTML, AJAX, PHP. However, I'm not willing to create sites from scratch, knowing how much is involved. In the past, I've tried using design templates, but they proved to...
Yes, there are several web-based software solutions that allow for easy creation of custom websites using templates, which also provide the ability for non-technical users to manage and modify content. Given your requirements, WordPress is indeed a strong contender, but let's explore a few options: ### 1. **WordPress*...
15,923
[ { "from": "human", "value": "I'm in a small business of hosting my clients' websites, and a lot of times they ask me to create one from scratch. I'm no designer, but I can code CSS/HTML, AJAX, PHP. However, I'm not willing to create sites from scratch, knowing how much is involved.\nIn the past, I've tried ...
How can I reset the @@FETCH_STATUS variable or set it to 0 in a stored procedure? Also, can you bind FETCH_STATUS to a particular cursor?
In SQL Server, the `@@FETCH_STATUS` variable is a system variable that returns the status of the last cursor fetch operation. It indicates whether the fetch was successful, whether it reached the end of the cursor, or if there was an error. The possible values are: - `0`: The last fetch was successful. - `-1`: The las...
14,215
[ { "from": "human", "value": "How can I reset the @@FETCH_STATUS variable or set it to 0 in a stored procedure?\nAlso, can you bind FETCH_STATUS to a particular cursor?\n" }, { "from": "gpt", "value": "In SQL Server, the `@@FETCH_STATUS` variable is a system variable that returns the status of th...
Can anyone recommend a MySQL front end client or OS X that is AppleScriptable? Preferably low cost or free.
There are several MySQL front-end clients for macOS that are either low-cost or free, and some of them offer AppleScript support or can be automated with AppleScript. Here are a few recommendations: 1. **Sequel Pro**: - **Cost**: Free - **Description**: Sequel Pro is a fast and easy-to-use MySQL database managem...
18,141
[ { "from": "human", "value": "Can anyone recommend a MySQL front end client or OS X that is AppleScriptable? Preferably low cost or free.\n" }, { "from": "gpt", "value": "There are several MySQL front-end clients for macOS that are either low-cost or free, and some of them offer AppleScript supp...
I currently filter some message from my inbox with these steps: select inbox pick messages set \Deleted tag and then repeat the process after selecting Trash. Is there a more direct way of disposing of these messages? Or is it just the feature of the Mail server that deleting a message puts it in the trash, and delet...
The process you're following is common for many email clients and servers, where messages are first marked as deleted (often by moving them to a Trash folder) before they are permanently removed. This behavior is usually designed to prevent accidental deletions, allowing users to recover messages if needed. However, t...
16,661
[ { "from": "human", "value": "I currently filter some message from my inbox with these steps:\nselect inbox\npick messages\nset \\Deleted tag\n\nand then repeat the process after selecting Trash.\nIs there a more direct way of disposing of these messages? Or is it just the feature of the Mail server that de...
There are so many reasons why using an MVC framework in Flex rocks, but picking the right one seems tricky. I am interested in what you all think from your experiences of implementing either of these (or another). Sam
Choosing the right MVC (Model-View-Controller) framework for Flex applications can indeed be challenging given the variety of options available. Here are some popular frameworks and my thoughts on each based on their features and ease of implementation: 1. **Cairngorm**: - **Pros**: Cairngorm is one of the most we...
10,114
[ { "from": "human", "value": "There are so many reasons why using an MVC framework in Flex rocks, but picking the right one seems tricky. I am interested in what you all think from your experiences of implementing either of these (or another).\nSam\n" }, { "from": "gpt", "value": "Choosing the r...
When displaying the value of a decimal currently with .ToString(), it's accurate to like 15 decimal places, and since I'm using it to represent dollars and cents, I only want the output to be 2 decimal places. Do I use a variation of .ToString() for this?
Yes, you can use a variation of `.ToString()` to format your decimal value to show only two decimal places. In C#, you can achieve this by using format specifiers. Here are a few common ways to format a decimal to two decimal places: 1. **Using a format string:** You can use `"F2"` format specifier to get a fixed-...
16,676
[ { "from": "human", "value": "When displaying the value of a decimal currently with .ToString(), it's accurate to like 15 decimal places, and since I'm using it to represent dollars and cents, I only want the output to be 2 decimal places. \nDo I use a variation of .ToString() for this?\n" }, { "from...
On Sql Server 2000, is there a way to find out the date and time when a stored procedure was last executed?
In SQL Server 2000, there is no built-in feature that directly tracks the last execution date and time of a stored procedure. However, you can implement a couple of approaches to achieve this: ### 1. **Using a Logging Table** You can create a logging table to store the execution details of your stored procedures. For ...
14,862
[ { "from": "human", "value": "On Sql Server 2000, is there a way to find out the date and time when a stored procedure was last executed? \n" }, { "from": "gpt", "value": "In SQL Server 2000, there is no built-in feature that directly tracks the last execution date and time of a stored procedure....
I'm running some java processes on Windows 2003 server R2 I'm using Apache log4j-1.2.8. All my processes called via one jar file with different parameter example java -jar process.jar one java -jar process.jar two java -jar process.jar three And I config log4j.properties follow #========================...
It looks like you are experiencing an issue with log4j's file rotation when your Java processes are being executed via Windows Scheduler. There could be several reasons for this, and I will outline some common scenarios that you might want to investigate: 1. **File Locks**: When running multiple instances of your Java...
16,309
[ { "from": "human", "value": "I'm running some java processes on Windows 2003 server R2\nI'm using Apache log4j-1.2.8. All my processes called via\none jar file with different parameter example\n java -jar process.jar one \n java -jar process.jar two\n java -jar process.jar three\n\nAnd I config l...
How does one dynamically load a new report from an embedded resource? I have created a reporting project that contains a report as an embedded resource. I added a second report file and use the following code to switch reports: this.reportViewer1.LocalReport.ReportEmbeddedResource = "ReportsApplication2.Report2.rdlc"; ...
To dynamically load a new report from an embedded resource in a ReportViewer, it’s important to ensure that you're handling the report loading process correctly. Below are the steps you should follow to dynamically load a new report. ### Steps to Load a New Report 1. **Ensure the Report is Embedded Properly**: Check ...
15,915
[ { "from": "human", "value": "How does one dynamically load a new report from an embedded resource? I have created a reporting project that contains a report as an embedded resource. I added a second report file and use the following code to switch reports:\nthis.reportViewer1.LocalReport.ReportEmbeddedResou...
In the 'DBUtility' project of Petshop 4.0,the abstract class SqlHelper has a method 'GetCachedParameters': public static SqlParameter[] GetCachedParameters(string cacheKey) { SqlParameter[] cachedParms = (SqlParameter[])parmCache[cacheKey]; if (cachedParms == null) return null; ...
In the `GetCachedParameters` method of the `SqlHelper` class, the purpose of cloning the `cachedParms` array before returning it is to ensure that the caller of the method cannot modify the original cached parameters. Here's why this is important: 1. **Encapsulation**: By returning a cloned array, the method encapsula...
16,879
[ { "from": "human", "value": "In the 'DBUtility' project of Petshop 4.0,the abstract class SqlHelper has a method 'GetCachedParameters':\n public static SqlParameter[] GetCachedParameters(string cacheKey) {\n SqlParameter[] cachedParms = (SqlParameter[])parmCache[cacheKey];\n\n if (cache...
Here's the very dumb way: def divisorGenerator(n): for i in xrange(1,n/2+1): if n%i == 0: yield i yield n The result I'd like to get is similar to this one, but I'd like a smarter algorithm (this one it's too much slow and dumb :-) I can find prime factors and their multiplicity fast enough. I've an g...
To generate all divisors of a number efficiently using the prime factors and their multiplicities, you can utilize the following approach: 1. **Factorize the number**: Use your existing factor generator to obtain the prime factors and their multiplicities. 2. **Use the prime factors to compute all divisors**: For each...
15,127
[ { "from": "human", "value": "Here's the very dumb way:\ndef divisorGenerator(n):\n for i in xrange(1,n/2+1):\n if n%i == 0: yield i\n yield n\n\nThe result I'd like to get is similar to this one, but I'd like a smarter algorithm (this one it's too much slow and dumb :-)\nI can find prime factor...
I need to simulate a low bandwidth, high latency connection to a server in order to emulate the conditions of a VPN at a remote site. The bandwidth and latency should be tweakable so I can discover the best combination in order to run our software package.
Simulating a low bandwidth, high latency connection can be achieved using a few tools available on different operating systems. Below are several methods to create such a simulation. ### 1. Using `tc` (Traffic Control) on Linux `tc` is a powerful tool available in Linux to control the network traffic. You can use it ...
13,530
[ { "from": "human", "value": "I need to simulate a low bandwidth, high latency connection to a server in order to emulate the conditions of a VPN at a remote site. The bandwidth and latency should be tweakable so I can discover the best combination in order to run our software package.\n" }, { "from"...
I want to compress some files (into the ZIP format) and encrypt them if possible using C#. Is there some way to do this? Can encryption be done as a part of the compression itself?
Yes, you can compress and encrypt files into a ZIP format using C#. While the built-in .NET libraries for ZIP compression do not natively support encryption, you can achieve this using third-party libraries such as `DotNetZip` or `System.IO.Compression` in combination with a separate encryption library like `System.Sec...
13,885
[ { "from": "human", "value": "I want to compress some files (into the ZIP format) and encrypt them if possible using C#. Is there some way to do this?\nCan encryption be done as a part of the compression itself?\n" }, { "from": "gpt", "value": "Yes, you can compress and encrypt files into a ZIP f...
I am trying to animate a change in backgroundColor using jQuery on mouseover. I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error. The element I am working with is a div. $(".usercontent").mouseover(functio...
The issue you're encountering with animating `backgroundColor` in jQuery is because jQuery's `.animate()` method doesn't support color properties by default. To animate colors, you need to include an additional jQuery UI library that enables color animations. Here's how you can achieve the desired effect: 1. **Includ...
17,605
[ { "from": "human", "value": "I am trying to animate a change in backgroundColor using jQuery on mouseover.\nI have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and \"Invalid Property\" js error.\nThe element I am working with ...
I'm trying to create a named_scope that uses a join, but although the generated SQL looks right, the result are garbage. For example: class Clip < ActiveRecord::Base named_scope :visible, { :joins => "INNER JOIN series ON series.id = clips.owner_id INNER JOIN shows on shows.id = series.show_id", :condi...
The issue you're encountering is likely related to how ActiveRecord handles the selection of attributes when performing joins. When you perform a join in ActiveRecord and the resulting dataset includes columns from multiple tables (in your case, `clips`, `series`, and `shows`), it can cause confusion regarding which ta...
19,181
[ { "from": "human", "value": "I'm trying to create a named_scope that uses a join, but although the generated SQL looks right, the result are garbage. For example:\nclass Clip < ActiveRecord::Base \n named_scope :visible, {\n :joins => \"INNER JOIN series ON series.id = clips.owner_id INNER JOIN sho...
How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line.
You can read the first line of a text file in a Windows batch file using a simple loop along with the `SET` command. Here's a small script that accomplishes this: ```batch @echo off setlocal enabledelayedexpansion set "firstLine=" set "filePath=yourfile.txt" REM Change this to the path of your file for /f "usebackq...
13,263
[ { "from": "human", "value": "How can I read the first line from a text file using a Windows batch file? Since the file is large I only want to deal with the first line.\n" }, { "from": "gpt", "value": "You can read the first line of a text file in a Windows batch file using a simple loop along w...
I just wanted some opinions from people that have run Selenium (http://selenium.openqa.org) I have had a lot of experience with WaTiN and even wrote a recording suite for it. I had it producing some well-structured code but being only maintained by me it seems my company all but abandoned it. If you have run selenium ...
Selenium is a popular choice for web application testing, and many users have found it to be a powerful and flexible tool for automation. Here are some opinions and insights based on the questions you raised: ### 1. Experience with Selenium Many users have had success with Selenium, finding it effective for both funct...
16,327
[ { "from": "human", "value": "I just wanted some opinions from people that have run Selenium (http://selenium.openqa.org) I have had a lot of experience with WaTiN and even wrote a recording suite for it. I had it producing some well-structured code but being only maintained by me it seems my company all but...
In almost all projects, the choice of the database system is 'almost' automatic .. if you're coding "in the Microsoft stack" you'll go with SQLServer, in the Linux world the default is MySQL, and for corporate in-house project most shops have decided on some default like Oracle or IBM DB2. What are your thoughts?
Your observations about the tendency to default to specific database systems based on the technology stack are quite accurate. The choice of a database often aligns with the overall technology ecosystem in which a project is being developed. Here are some points to consider regarding this tendency: 1. **Ecosystem Comp...
16,028
[ { "from": "human", "value": "In almost all projects, the choice of the database system is 'almost' automatic .. if you're coding \"in the Microsoft stack\" you'll go with SQLServer, in the Linux world the default is MySQL, and for corporate in-house project most shops have decided on some default like Oracl...
I am trying to take a rather large CSV file and insert it into a MySQL database for referencing in a project. I would like to use the first line of the file to create the table using proper data types and not varchar for each column. The ultimate goal is to automate this process as I have several similar files but the ...
To achieve your goal of creating a MySQL table from the first line of a CSV file while automatically determining the data types of each column, you'll need to read the CSV data properly and then analyze the actual data instead of just relying on the header line (which is just column names). This is because `gettype()` ...
14,989
[ { "from": "human", "value": "I am trying to take a rather large CSV file and insert it into a MySQL database for referencing in a project. I would like to use the first line of the file to create the table using proper data types and not varchar for each column. The ultimate goal is to automate this process...
I'm not a full-time software guy. In fact, in the last ten years, 90 % of my work was either on the hardware or doing low-level (embedded) code. But the other 10% involves writing shell scripts for development tools, making kernel changes to add special features, and writing GUI applications for end-users. The problem...
It sounds like you're dealing with a common challenge faced by many developers who don't work with certain technologies or languages regularly. Here are some methods that can help you refresh your knowledge and quickly learn when diving back into an area you haven't touched in a while: ### 1. **Targeted Learning with ...
14,954
[ { "from": "human", "value": "I'm not a full-time software guy. In fact, in the last ten years, 90 % of my work was either on the hardware or doing low-level (embedded) code.\nBut the other 10% involves writing shell scripts for development tools, making kernel changes to add special features, and writing G...
Ok, Regex wizards. I want to be able to search through my logfile and find any sessions with the word 'error' in it and then return the entire session log entry. I know I can do this with a string/array but I'd like to learn how to do it with Regex but here's the question. If I decide to do this with Regex do I have o...
To accomplish your goal of finding sessions with the word "error" in your logfile using Perl regex, you will indeed have two challenges: 1. **Identifying the Session Blocks**: You need to capture entire session blocks, which are defined by their start and end markers. 2. **Searching for the Keyword**: Within these cap...
15,640
[ { "from": "human", "value": "Ok, Regex wizards. I want to be able to search through my logfile and find any sessions with the word 'error' in it and then return the entire session log entry.\nI know I can do this with a string/array but I'd like to learn how to do it with Regex but here's the question. If ...
One of the things that always bugs me about using Readers and Streams in Java is that the close() method can throw an exception. Since it's a good idea to put the close method in a finally block, that necessitates a bit of an awkward situation. I usually use this construction: FileReader fr = new FileReader("SomeFile.t...
Both constructions you’ve shared are valid for handling exceptions while working with `Readers` and `Streams` in Java, particularly when dealing with `close()`, which can throw an `IOException`. Each approach has its own benefits, and the choice often comes down to personal preference and code readability. Let's break ...
16,518
[ { "from": "human", "value": "One of the things that always bugs me about using Readers and Streams in Java is that the close() method can throw an exception. Since it's a good idea to put the close method in a finally block, that necessitates a bit of an awkward situation. I usually use this construction:\n...
What assemblies are loaded by default when you create a new ASP.NET 2.0 Web Application Project ?
When you create a new ASP.NET 2.0 Web Application Project, a number of assemblies are loaded by default. The key assemblies that are typically included are: 1. **mscorlib.dll** - This is the core assembly that contains the fundamental classes and base classes that define commonly-used types. 2. **System.dll** - This ...
15,015
[ { "from": "human", "value": "What assemblies are loaded by default when you create a new ASP.NET 2.0 Web Application Project ?\n" }, { "from": "gpt", "value": "When you create a new ASP.NET 2.0 Web Application Project, a number of assemblies are loaded by default. The key assemblies that are typ...
I have an MVC-based site, which is using a Repository/Service pattern for data access. The Services are written to be using in a majority of applications (console, winform, and web). Currently, the controllers communicate directly to the services. This has limited the ability to apply proper caching. I see my option...
When it comes to caching in an MVC application that utilizes the Repository/Service pattern, it's important to consider both performance and maintainability. Each of the options you mentioned has its pros and cons. Let's discuss them in detail, along with some best practices. ### Option 1: Write a Wrapper for the Web ...
12,949
[ { "from": "human", "value": "I have an MVC-based site, which is using a Repository/Service pattern for data access.\nThe Services are written to be using in a majority of applications (console, winform, and web). Currently, the controllers communicate directly to the services. This has limited the abilit...
I know there is a Jackpot API http://jackpot.netbeans.org/docs/org-netbeans-modules-jackpot/overview-summary.html for programmatic access the the rules engine, has anyone had success seperating this from NetBeans itself? So it can operate on any Java source files?
The Jackpot API, part of the NetBeans ecosystem, is primarily designed to work within the context of the NetBeans IDE, which means it often relies on the environment and infrastructure provided by NetBeans itself, such as its project structure, indexing, and more. However, using the API independently of the NetBeans en...
13,608
[ { "from": "human", "value": "I know there is a Jackpot API http://jackpot.netbeans.org/docs/org-netbeans-modules-jackpot/overview-summary.html for programmatic access the the rules engine, has anyone had success seperating this from NetBeans itself? So it can operate on any Java source files?\n" }, { ...
In MATLAB 2008a, is there a way to allow a class method to act as a uicontrol callback function without having to make the method public? Conceptually, the method should not be public because it should never be called by a user of the class. It should only be called as a result of a UI event triggering a callback. H...
In MATLAB 2008a, when you create a callback for a UI control using a class method, it requires that the method must be accessible when the callback is invoked. Unfortunately, due to the way the callback mechanism works, it cannot access private or protected methods directly. This restriction prevents you from using the...
16,844
[ { "from": "human", "value": "In MATLAB 2008a, is there a way to allow a class method to act as a uicontrol callback function without having to make the method public? Conceptually, the method should not be public because it should never be called by a user of the class. It should only be called as a resul...
JavaScript allows functions to be treated as objects--if you first define a variable as a function, you can subsequently add properties to that function. How do you do the reverse, and add a function to an "object"? This works: var foo = function() { return 1; }; foo.baz = "qqqq"; At this point, foo() calls the funct...
To achieve the desired behavior where `bar` has a property `baz` with a value, and `bar` itself can also be called as a function, you can create a function and assign it to `bar`. In JavaScript, you can use a function constructor or a regular function declaration to achieve this. Here's an example of how you can do i...
18,054
[ { "from": "human", "value": "JavaScript allows functions to be treated as objects--if you first define a variable as a function, you can subsequently add properties to that function. How do you do the reverse, and add a function to an \"object\"?\nThis works:\nvar foo = function() { return 1; };\nfoo.baz =...
I'm building a simple Todo List application where I want to be able to have multiple lists floating around my desktop that I can label and manage tasks in. The relevant UIElements in my app are: Window1 (Window) TodoList (User Control) TodoStackCard (User Control) Window1 looks like this: <Window x:Class="TaskHole.App....
Yes, you can accomplish this in C# and WPF, and it can be done using the Drag-and-Drop functionality provided by WPF. To achieve the dragging of controls (such as your `TodoStackCard`) between multiple windows, you'll need to use the Drag-and-Drop API effectively. ### Step-by-Step Implementation 1. **Initiate the Dra...
13,869
[ { "from": "human", "value": "I'm building a simple Todo List application where I want to be able to have multiple lists floating around my desktop that I can label and manage tasks in.\nThe relevant UIElements in my app are:\nWindow1 (Window)\nTodoList (User Control)\nTodoStackCard (User Control)\nWindow1 l...
My web application sends email fairly often, and it sends 3 kinds of emails: initiated by user, in response to an event in the system, and in automatic response to an email received by the application. I would like to make sure that the third type of email does not get stuck in an endless loop of auto-responders talkin...
To avoid triggering junk filters and infinite auto-responder loops while still allowing human recipients to see and interact with your auto-responses, using the `Precedence` header effectively is important. Here are some guidelines and best practices: ### Recommended Practices 1. **Avoid `Precedence: junk`**: This se...
15,677
[ { "from": "human", "value": "My web application sends email fairly often, and it sends 3 kinds of emails: initiated by user, in response to an event in the system, and in automatic response to an email received by the application.\nI would like to make sure that the third type of email does not get stuck in...
I am trying to use Difflib.SequenceMatcher to compute the similarities between two files. These two files are almost identical except that one contains some extra whitespaces, empty lines and other doesn't. I am trying to use s=difflib.SequenceMatcher(isjunk,text1,text2) ratio =s.ratio() for this purpose. So, the ques...
To effectively ignore whitespace, empty lines, and other minor formatting differences when calculating the similarity between two texts using `difflib.SequenceMatcher`, you can create a more comprehensive `isjunk` function. The goal is to identify not just single spaces but also strings composed primarily of whitespace...
13,347
[ { "from": "human", "value": "I am trying to use Difflib.SequenceMatcher to compute the similarities between two files. These two files are almost identical except that one contains some extra whitespaces, empty lines and other doesn't. I am trying to use\ns=difflib.SequenceMatcher(isjunk,text1,text2)\nratio...
I am trying to write a test which, in it's fixtures Setup, it backs up a file and deletes the original, runs the test without the original present, then in the teardown, restores the original from the backup. The file is located in my %ProgramFiles% folder. I get an UnauthorizedAccessException on the fileInfo.Delete(...
It sounds like you encountered an issue with permissions when trying to delete a file located in the `%ProgramFiles%` directory while running tests in the ReSharper Test Runner. This is indeed a common scenario, especially when dealing with files that are part of installed applications, like `ssapi.dll` for Visual Sour...
16,764
[ { "from": "human", "value": "I am trying to write a test which, in it's fixtures Setup, it backs up a file and deletes the original, runs the test without the original present, then in the teardown, restores the original from the backup. The file is located in my %ProgramFiles% folder. I get an Unauthoriz...
coming back to postgresql after several years of oracle ... what are the state-of-the art postgresql administrative/ddl generating/data inserting frontends on windows? it would be nice if it had integration for postgis as well. it should be standalone or alternatively a plugin for intellij idea thinking back, all the ...
Welcome back to PostgreSQL! Since you last worked with it, there have been significant improvements and additional tools that you might find useful. Here are some state-of-the-art frontends for PostgreSQL on Windows that you can consider: ### 1. **DBeaver** - **Description:** DBeaver is a powerful and versatile databa...
14,791
[ { "from": "human", "value": "coming back to postgresql after several years of oracle ... \nwhat are the state-of-the art postgresql administrative/ddl generating/data inserting frontends on windows? it would be nice if it had integration for postgis as well. it should be standalone or alternatively a plugin...
This is for a small scheduling app. I need an algorithm to efficiently compare two "schedules", find differences, and update only the data rows which have been changed, as well as entries in another table having this table as a foreign key. This is a big question, so I'll say right away I'm looking for either general...
To solve your problem of efficiently comparing schedules in Table A and Table B and applying the necessary changes based on user edits, we can break the algorithm down into several steps. Here's a high-level approach followed by more detailed steps and considerations. ### High-Level Steps 1. **Load Data**: Load the c...
15,604
[ { "from": "human", "value": "This is for a small scheduling app. I need an algorithm to efficiently compare two \"schedules\", find differences, and update only the data rows which have been changed, as well as entries in another table having this table as a foreign key. This is a big question, so I'll sa...
I am looking for a reference that covers using ActiveX to open and manipulate Excel (and possibly Word) documents. I'd prefer an online reference but book suggestions are helpful too.
For using ActiveX to open and manipulate Excel and Word documents, you can find several online references and books that provide detailed information. Here are some suggestions: ### Online References 1. **Microsoft Documentation** - **Excel Object Model Reference**: [Excel VBA Reference](https://docs.microso...
17,667
[ { "from": "human", "value": "I am looking for a reference that covers using ActiveX to open and manipulate Excel (and possibly Word) documents. I'd prefer an online reference but book suggestions are helpful too.\n" }, { "from": "gpt", "value": "For using ActiveX to open and manipulate Excel an...
What is the best way to track down a memory leak that is only found on one customer's test/release box, and no where else?
Tracking down a memory leak that only occurs on a specific customer's test or release box can be challenging, especially if the issue isn't reproducible in your own environment. Here are some steps to help you investigate and resolve the issue: ### 1. **Gather Information** - **Environment Details**: Collect detail...
14,845
[ { "from": "human", "value": "What is the best way to track down a memory leak that is only found on one customer's test/release box, and no where else?\n" }, { "from": "gpt", "value": "Tracking down a memory leak that only occurs on a specific customer's test or release box can be challenging, e...
Is there a way to keep the "Loading..." graphic from appearing when cfdiv refreshes? I'd like to prevent the flicker of loading the graphic then loading the new html.
Yes, you can prevent the "Loading..." graphic from appearing during the refresh of a `cfdiv` in ColdFusion by manipulating the way the loading graphic is displayed. The flicker usually occurs because the loading graphic appears before the new content is fully loaded. Here are a few strategies you could employ: ### 1....
16,523
[ { "from": "human", "value": "Is there a way to keep the \"Loading...\" graphic from appearing when cfdiv refreshes? I'd like to prevent the flicker of loading the graphic then loading the new html.\n" }, { "from": "gpt", "value": "Yes, you can prevent the \"Loading...\" graphic from appearing d...
I know there are things like doing manual check to make sure the codes committed is fundamentally correct. But beside that? Reason i asking is because a big project there are so many commits everyday.
In a large project with numerous commits every day, it's crucial to implement automated processes and best practices to maintain code quality and ensure that new changes do not introduce issues. Here are some strategies you can consider, in addition to manual code reviews: 1. **Automated Testing**: - **Unit Tests**...
16,955
[ { "from": "human", "value": "I know there are things like doing manual check to make sure the codes committed is fundamentally correct. But beside that? Reason i asking is because a big project there are so many commits everyday.\n" }, { "from": "gpt", "value": "In a large project with numerous ...
I have a Windows Workflow application that uses classes I've written for COM automation. I'm opening Word and Excel from my classes using COM. I'm currently implementing IDisposable in my COM helper and using Marshal.ReleaseComObject(). However, if my Workflow fails, the Dispose() method isn't being called and the Word...
When dealing with COM automation in a .NET application, particularly when using classes for Word and Excel, it is crucial to ensure that all COM objects are properly released to avoid memory leaks and dangling references. The `IDisposable` interface, along with the `Marshal.ReleaseComObject()`, is essential, but there ...
9,115
[ { "from": "human", "value": "I have a Windows Workflow application that uses classes I've written for COM automation. I'm opening Word and Excel from my classes using COM.\nI'm currently implementing IDisposable in my COM helper and using Marshal.ReleaseComObject(). However, if my Workflow fails, the Dispos...
I've been using JSch for a couple of weeks now. It seems to work okay, but its API is a little bit cumbersome. I'm also a little off put by its total lack of documentation (not even javadoc style comments). Has anyone used a good Java SSH2 library that they'd recommend. I'm particularly interested in SCP file trans...
If you're looking for alternatives to JSch for SSH and SCP operations in Java, here are a few libraries that you might find more user-friendly and better documented: 1. **Apache MINA SSHD**: - **Description**: This is a pure Java implementation of the SSH2 protocol. It offers a high-level API that is easier to work...
15,881
[ { "from": "human", "value": "I've been using JSch for a couple of weeks now. It seems to work okay, but its API is a little bit cumbersome. I'm also a little off put by its total lack of documentation (not even javadoc style comments). Has anyone used a good Java SSH2 library that they'd recommend. I'm ...
Is there any way to set the same icon to all my forms without having to change one by one? Something like when you setup GlobalAssemblyInfo for all your projects inside your solution.
Yes, there are ways to set the same icon for all your forms in a Windows Forms application without having to change each one individually. However, the approach depends on how your forms are structured and your development environment. Here are some common methods: ### 1. Custom Base Form One effective method is to c...
17,469
[ { "from": "human", "value": "Is there any way to set the same icon to all my forms without having to change one by one?\nSomething like when you setup GlobalAssemblyInfo for all your projects inside your solution.\n" }, { "from": "gpt", "value": "Yes, there are ways to set the same icon for all ...
Consider this code... using System.Threading; //... Timer someWork = new Timer( delegate(object state) { //Do some work here... }, null, 0, 60000); HttpContext.Current.Application["SomeWorkItem"] = someWork; Could this be dangerous? Caching a timer in the Application to perform some work in the ba...
Using a `System.Threading.Timer` to perform background work in an ASP.NET application by storing it in the `Application` state can certainly seem like a quick and straightforward solution, but it carries several risks and potential pitfalls. ### Potential Issues 1. **Application Domain Recycling**: ASP.NET applicatio...
17,409
[ { "from": "human", "value": "Consider this code...\nusing System.Threading;\n//...\nTimer someWork = new Timer(\n delegate(object state) {\n //Do some work here...\n },\n null, 0, 60000);\n\nHttpContext.Current.Application[\"SomeWorkItem\"] = someWork;\n\nCould this be dangerous? Caching a t...
I am using my own db for phpbb3 forum, and I wish to insert some data from the forum into my own tables. Now, I can make my own connection and it runs my query but in trying to use the $db variable(which I think is what you're meant to use??) it gives me an error. I would like someone to show me the bare bones which i ...
To execute a custom query in phpBB3 using the `$db` object, you'll need to ensure that you properly include the necessary phpBB framework files, as the `$db` variable is part of phpBB's database abstraction layer. Here's a simple example of how you might structure your code to insert data into your own custom table us...
15,552
[ { "from": "human", "value": "I am using my own db for phpbb3 forum, and I wish to insert some data from the forum into my own tables. Now, I can make my own connection and it runs my query but in trying to use the $db variable(which I think is what you're meant to use??) it gives me an error.\nI would like ...
Given an array of characters which forms a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it. Example input and output: >>> reverse_words("this is a string") 'string a is this' It should be O(N) time and O(1) space (split() and pushing on / popping off the stack ar...
To reverse the order of words in a given string in O(N) time and O(1) space, we can use a three-step approach. First, we reverse the entire string, then we reverse each individual word, and finally, we handle the spaces to maintain the correct formatting. Here is a step-by-step breakdown of the algorithm: 1. **Revers...
14,457
[ { "from": "human", "value": "Given an array of characters which forms a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.\nExample input and output:\n>>> reverse_words(\"this is a string\")\n'string a is this'\n\nIt should be O(N) time and O(1) space (s...
In SQL Server you can use the IsNull() function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#. For example, I want to do something like: myNewValue = IsNull(myValue, new MyValue()); instead of: if (myValue == null) myValue = new MyValue(); myNe...
In C#, you can achieve similar functionality to SQL Server's `IsNull()` using the null-coalescing operator `??`. This operator allows you to provide a default value in case a nullable type (like a reference type) is `null`. Here’s how you can do it: ```csharp myNew
16,288
[ { "from": "human", "value": "In SQL Server you can use the IsNull() function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#.\nFor example, I want to do something like:\nmyNewValue = IsNull(myValue, new MyValue());\n\ninstead of:\nif (my...
What is an elegant way to sort objects in PHP? I would love to accomplish something similar to this. $sortedObjectArary = sort($unsortedObjectArray, $Object->weight); Basically specify the array I want to sort as well as the field I want to sort on. I looked into multidimensional array sorting and there might be somet...
In PHP, you can achieve elegant sorting of an array of objects based on a specific property by using the `usort()` function. This function allows you to define a custom comparison function, which gives you control over how the sorting is done. Here’s a simple example to illustrate how to sort an array of objects based...
17,547
[ { "from": "human", "value": "What is an elegant way to sort objects in PHP? I would love to accomplish something similar to this.\n$sortedObjectArary = sort($unsortedObjectArray, $Object->weight);\n\nBasically specify the array I want to sort as well as the field I want to sort on. I looked into multidimens...
I have created an SSIS package and it works great on my dev machine. But, when I try to run it on the production server, it errors out on me. Here is the error: Error: The AcquireConection method call to the connection manager "DestinationConnectionOLEDB" failed with error code 0xC0202009. I have figured out the caus...
The issue you're encountering is quite common when deploying SSIS packages, especially when dealing with connection managers that require authentication. It seems like the SSIS package is not retaining the password when deployed to the production server. Here are some steps you can take to resolve the issue: 1. **Ensu...
17,228
[ { "from": "human", "value": "I have created an SSIS package and it works great on my dev machine. But, when I try to run it on the production server, it errors out on me.\nHere is the error:\nError: The AcquireConection method call to the connection manager \n\"DestinationConnectionOLEDB\" failed with error...
What is the difference between bool and Boolean types in C#?
In C#, `bool` and `Boolean` refer to the same underlying type, but they are used in different contexts. Here are the key differences: 1. **Type Definition**: - `bool` is a C# keyword that is a primitive type representing a Boolean value (true or false). - `Boolean` is a structure defined in the `System` namespac...
19,424
[ { "from": "human", "value": "What is the difference between bool and Boolean types in C#?\n" }, { "from": "gpt", "value": "In C#, `bool` and `Boolean` refer to the same underlying type, but they are used in different contexts. Here are the key differences:\n\n1. **Type Definition**:\n - `bool`...
From managed C++, I am calling an unmanaged C++ method which returns a double. How can I convert this double into a managed string?
To convert a `double` value returned from an unmanaged C++ method into a managed `System::String` in a C++/CLI environment, you can follow these steps: 1. Call the unmanaged C++ method to get the `double` value. 2. Convert the `double` to a string using `System::String::Format` or `System::Convert::ToString`. 3. Retur...
15,157
[ { "from": "human", "value": "From managed C++, I am calling an unmanaged C++ method which returns a double. How can I convert this double into a managed string?\n" }, { "from": "gpt", "value": "To convert a `double` value returned from an unmanaged C++ method into a managed `System::String` in a...