instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Running something like: @users = User.find(:first, :select => "name, lastname, salary") for @user in @users do @user.salary = 100000 @user.save end After this looking up in the Mysql table, the users aren't updated.
The code you've provided has some issues that may prevent the user records from being updated in the database. Let's go through them step by step: 1. **Method `find`**: The usage of `User.find(:first, ...)` is a bit outdated and may not behave as expected. Depending on the version of Rails you're using, you might need...
6,507
[ { "from": "human", "value": "Running something like:\n@users = User.find(:first, :select => \"name, lastname, salary\")\nfor @user in @users do\n @user.salary = 100000\n @user.save\nend\nAfter this looking up in the Mysql table, the users aren't updated.\n" }, { "from": "gpt", "value": "The co...
I have a test project using MbUnit and TestDriven.Net. If I right-click on an individual test method and say "Run Tests" the test runs successfully. Same thing if I click on a file name in the solution explorer. However, if I right click and say run tests on the project or the solution, TestDriven.Net reports "0 P...
The issue you're encountering with TestDriven.Net not recognizing or running all the tests in your project could be related to a few different factors. Here are some troubleshooting steps you can take to help resolve the issue: 1. **Check Project References**: Ensure that your test project correctly references the nec...
7,918
[ { "from": "human", "value": "I have a test project using MbUnit and TestDriven.Net. \nIf I right-click on an individual test method and say \"Run Tests\" the test runs successfully. Same thing if I click on a file name in the solution explorer. \nHowever, if I right click and say run tests on the project...
When a template is added using the add-template stsadm command, it becomes available to everyone when creating a subsite. Is there any way to make it only available when a site collection is being created?
In SharePoint, when you use the `stsadm` command to add a template, it becomes available to all site owners when they create subsites under the site collection. Unfortunately, there isn't a built-in way to restrict a site template's availability solely to site collection creation using the standard `stsadm` approach. ...
9,451
[ { "from": "human", "value": "When a template is added using the add-template stsadm command, it becomes available to everyone when creating a subsite. Is there any way to make it only available when a site collection is being created?\n" }, { "from": "gpt", "value": "In SharePoint, when you use ...
I have an absolutely positioned div that I want to show when the user clicks a link. The onclick of the link calls a js function that sets the display of the div to block (also tried: "", inline, table-cell, inline-table, etc). This works great in IE7, not at all in every other browser I've tried (FF2, FF3, Opera 9.5, ...
It sounds like you are encountering a very specific issue with the display of an absolutely positioned `div` in various browsers. Here are some steps you can take to troubleshoot and potentially resolve the issue: 1. **Check CSS Styles**: Ensure that there are no conflicting CSS styles affecting the visibility of the ...
5,166
[ { "from": "human", "value": "I have an absolutely positioned div that I want to show when the user clicks a link. The onclick of the link calls a js function that sets the display of the div to block (also tried: \"\", inline, table-cell, inline-table, etc). This works great in IE7, not at all in every othe...
I'm looking for good/working/simple to use PHP code for parsing raw email into parts. I've written a couple of brute force solutions, but every time, one small change/header/space/something comes along and my whole parser fails and the project falls apart. And before I get pointed at PEAR/PECL, I need actual code. My h...
Parsing raw email can indeed be tricky, especially given the variability in email formats and headers. However, you can achieve this using some simple PHP code without needing to rely on external libraries. Below is a basic approach that demonstrates how to parse the raw email into parts such as headers, body, and atta...
4,675
[ { "from": "human", "value": "I'm looking for good/working/simple to use PHP code for parsing raw email into parts.\nI've written a couple of brute force solutions, but every time, one small change/header/space/something comes along and my whole parser fails and the project falls apart.\nAnd before I get poi...
In Visual Studio 2005-2015 it is possible to find all lines containing certain references and display them in a "Find Results" window. Now that these result lines are displayed, is there any keyboard shortcut that would allow adding debug breakpoints to all of them?
In Visual Studio, there's no direct keyboard shortcut that allows you to add breakpoints to all lines found in the "Find Results" window at once. However, you can accomplish this using a combination of manual and keyboard shortcut actions. Here's a general approach to achieve that: 1. **Perform Your Find Operation:** ...
8,385
[ { "from": "human", "value": "In Visual Studio 2005-2015 it is possible to find all lines containing certain references and display them in a \"Find Results\" window.\nNow that these result lines are displayed, is there any keyboard shortcut that would allow adding debug breakpoints to all of them?\n" }, ...
A question that has pondered me for the last while. I am primarily a .net developer who dabbles in Objective-C for iPhone and Mac. How do you go about sending "datasets" between methods in objective-c. For example in C# you can populate a custom class with data and pass it around in a List of type custom class. EG if y...
In Objective-C, you're correct that you would typically use `NSArray` to hold a collection of custom objects, which is analogous to using a `List<T>` in C#. Here are some considerations and recommendations for working with datasets in Objective-C, especially when interfacing with SQLite: ### Using NSArray and NSMutabl...
3,760
[ { "from": "human", "value": "A question that has pondered me for the last while. I am primarily a .net developer who dabbles in Objective-C for iPhone and Mac.\nHow do you go about sending \"datasets\" between methods in objective-c. For example in C# you can populate a custom class with data and pass it ar...
I'm interested in writing eclipse plugins where do I start? What resources have helped you? I'm looking for: 1. Tutorials 2. Sites devoted to plugin development 3. Books
Writing Eclipse plugins can be an exciting and rewarding endeavor, especially if you're looking to extend the capabilities of the Eclipse IDE. Here are some resources that can help you get started: ### 1. Tutorials - **Eclipse Plugin Development Environment (PDE) Tutorials**: The official Eclipse documentation has a s...
6,162
[ { "from": "human", "value": "I'm interested in writing eclipse plugins where do I start? \nWhat resources have helped you?\nI'm looking for:\n 1. Tutorials\n 2. Sites devoted to plugin development\n 3. Books \n" }, { "from": "gpt", "value": "Writing Eclipse plugins can be an exciting and rew...
I want to draw user interfaces for web and desktop applications. I need something less print-oriented than omnigraffle. think pixels! Also, need good building blocks (aka stencils). Form elements, tableviews, etc.
If you're looking for user interface design tools that are more pixel-oriented and offer robust building blocks and stencils, here are some excellent options: 1. **Figma**: - **Description**: Figma is a web-based interface design tool that allows for real-time collaboration. It's perfect for UI/UX design and offers...
7,685
[ { "from": "human", "value": "I want to draw user interfaces for web and desktop applications.\nI need something less print-oriented than omnigraffle. think pixels!\nAlso, need good building blocks (aka stencils). Form elements, tableviews, etc.\n" }, { "from": "gpt", "value": "If you're looking ...
In this post I asked if there were any tools that compare the structure (not actual content) of 2 HTML pages. I ask because I receive HTML templates from our designers, and frequently miss minor formatting changes in my implementation. I then waste a few hours of designer time sifting through my pages to find my mistak...
It sounds like you're embarking on an interesting project! Comparing the structure of HTML documents rather than their content is indeed a different approach and can be quite valuable in ensuring consistency in your implementation. Here’s a step-by-step guide to help you get started: ### Step 1: Parse the HTML First,...
5,389
[ { "from": "human", "value": "In this post I asked if there were any tools that compare the structure (not actual content) of 2 HTML pages. I ask because I receive HTML templates from our designers, and frequently miss minor formatting changes in my implementation. I then waste a few hours of designer time s...
I'm working on a project where we're using a Java applet for part of the UI (a map, specifically), but building the rest of the UI around the applet in HTML/JavaScript, communicating with the applet through LiveConnect/NPAPI. A little bizarre, I know, but let's presume that setup is not under discussion. I started out ...
It sounds like you're running into some quirks with jQuery's handling of applets. Let's tackle both of your issues one at a time. ### Issue the First: Accessing Applet Methods with jQuery The reason you're unable to access the methods of your applet using jQuery is because jQuery wraps DOM elements in its own object,...
6,226
[ { "from": "human", "value": "I'm working on a project where we're using a Java applet for part of the UI (a map, specifically), but building the rest of the UI around the applet in HTML/JavaScript, communicating with the applet through LiveConnect/NPAPI. A little bizarre, I know, but let's presume that setu...
I want to create dynamic content based on this. I know it's somewhere, as web analytics engines can get this data to determine how people got to your site (referrer, search terms used, etc.), but I don't know how to get at it myself.
To create dynamic content based on user behavior and acquisition data, you can leverage various web analytics tools and techniques. Here's a step-by-step guide to help you get started: ### 1. **Choose an Analytics Tool** Select a web analytics tool that meets your needs. Popular options include: - **Google Analytics**...
6,188
[ { "from": "human", "value": "I want to create dynamic content based on this. I know it's somewhere, as web analytics engines can get this data to determine how people got to your site (referrer, search terms used, etc.), but I don't know how to get at it myself.\n" }, { "from": "gpt", "value": "...
I would like to offer a database connection prompt to the user. I can build my own, but it would be nice if I can use something that somebody else has already built (maybe something built into Windows or a free library available on the Internet). Anybody know how to do this in .Net? EDIT: I found this and thought it wa...
If you want to offer a database connection prompt to users in a .NET application and are looking for options beyond the built-in SQL Server prompt, there are a few approaches you can take. While Windows does not have a universal connection dialog for all databases, you can implement your own dialog or use libraries tha...
6,063
[ { "from": "human", "value": "I would like to offer a database connection prompt to the user. I can build my own, but it would be nice if I can use something that somebody else has already built (maybe something built into Windows or a free library available on the Internet). Anybody know how to do this in ....
What is your single favorite mocking library for Python?
I don't have personal preferences, but a popular and widely used mocking library in Python is `unittest.mock`. It is part of the standard library and provides a powerful and flexible way to create mock objects for testing. It allows you to replace parts of your system under test and make assertions about how they have ...
11,257
[ { "from": "human", "value": "What is your single favorite mocking library for Python?\n" }, { "from": "gpt", "value": "I don't have personal preferences, but a popular and widely used mocking library in Python is `unittest.mock`. It is part of the standard library and provides a powerful and fle...
See also How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Coment or long polling) I need to use push-technology with WCF through client firewalls. This must be a common problem, and I know for a fact it works in theory (see links below), but I have failed to ge...
To implement a WCF service that uses duplex communication to push updates from the server to the client over TCP through firewall constraints, you'll want to use `NetTcpBinding` and set it up correctly for duplex operations. Below is a simplified example that demonstrates how you can achieve this. ### Step 1: Define S...
5,298
[ { "from": "human", "value": "\nSee also How does a WCF server inform\n a WCF client about changes? (Better\n solution then simple polling, e.g.\n Coment or long polling)\n\nI need to use push-technology with WCF through client firewalls. This must be a common problem, and I know for a fact it works in th...
This should be simple. I'm trying to import data from Access into SQL Server. I don't have direct access to the SQL Server database - it's on GoDaddy and they only allow web access. So I can't use the Management Studio tools, or other third-party Access upsizing programs that require remote access to the database. I wr...
It sounds like you're dealing with a challenge related to data integrity when transferring records from Access to SQL Server over a web connection. Here are some strategies to troubleshoot and improve your process: ### 1. **Sanitize Data in Access:** Before exporting your data, ensure that you clean up any problematic...
5,410
[ { "from": "human", "value": "This should be simple. I'm trying to import data from Access into SQL Server. I don't have direct access to the SQL Server database - it's on GoDaddy and they only allow web access. So I can't use the Management Studio tools, or other third-party Access upsizing programs that re...
Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated. Msg 10314, Level 16, State 11, Line 1 An error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or the assembly may not be trusted with PERMIS...
The error message you are encountering indicates that SQL Server is having trouble loading a .NET assembly that you've deployed as part of a CLR stored procedure. Here are some steps to troubleshoot and resolve the issue: 1. **Check Permission Set**: The error suggests that your assembly does not have the appropriate ...
6,468
[ { "from": "human", "value": "Receiving the following error when attempting to run a CLR stored proc. Any help is much appreciated.\nMsg 10314, Level 16, State 11, Line 1\nAn error occurred in the Microsoft .NET Framework while trying to load assembly id 65752. The server may be running out of resources, or ...
Are there any ports to WPF of Silverlight's MultiScaleImage (aka DeepZoom)? Have Microsoft road-mapped this at all for WPF? I want to move from WinForms to WPF and require something like DeepZoom, using Silverlight isn't an option.
As of my last knowledge update in October 2023, Microsoft has not officially provided a port of Silverlight's MultiScaleImage (DeepZoom) to WPF. However, you can still achieve similar functionality in WPF using alternative approaches. ### Options for DeepZoom in WPF: 1. **DeepZoom Composer and DeepZoom Image Demos**:...
6,018
[ { "from": "human", "value": "Are there any ports to WPF of Silverlight's MultiScaleImage (aka DeepZoom)? Have Microsoft road-mapped this at all for WPF?\nI want to move from WinForms to WPF and require something like DeepZoom, using Silverlight isn't an option.\n" }, { "from": "gpt", "value": "...
I'm attracted to the neatness that a single file database provides. What driver/connector library is out there to connect and use SQLite with Java. I've discovered a wrapper library, http://www.ch-werner.de/javasqlite, but are there other more prominent projects available?
Yes, there are several options available for connecting and using SQLite with Java. Here are some of the most prominent libraries and drivers: 1. **SQLite JDBC Driver (xerial/sqlite-jdbc)**: - This is one of the most widely used SQLite JDBC drivers for Java. It provides a straightforward way to interact with SQLite...
6,177
[ { "from": "human", "value": "I'm attracted to the neatness that a single file database provides. What driver/connector library is out there to connect and use SQLite with Java.\nI've discovered a wrapper library, http://www.ch-werner.de/javasqlite, but are there other more prominent projects available?\n" ...
I need to sort a Map<Key, Value> on the values. Since the values are not unique, I find myself converting the keySet into an array, and sorting that array through array sort with a custom comparator that sorts on the value associated with the key. Is there an easier way?
Yes, there is a more straightforward approach to sorting a `Map<Key, Value>` by its values in Java. Instead of converting the key set to an array and using a custom comparator to sort, you can use Java's Stream API or entry set to accomplish this task more elegantly. Below are two common approaches: ### Using Stream A...
7,699
[ { "from": "human", "value": "I need to sort a Map<Key, Value> on the values.\nSince the values are not unique, I find myself converting the keySet into an array, and sorting that array through array sort with a custom comparator that sorts on the value associated with the key.\nIs there an easier way?\n" ...
I'm using C# in .Net 2.0, and I want to read in a PNG image file and check for the first row and first column that has non-transparent pixels. What assembly and/or class should I use?
In .NET 2.0, you can work with images, including PNG files, using the `System.Drawing` namespace, which is part of the `System.Drawing.dll` assembly. This namespace provides classes for working with graphics, images, and drawing. To read a PNG image file and check for non-transparent pixels in the first row and first ...
7,869
[ { "from": "human", "value": "I'm using C# in .Net 2.0, and I want to read in a PNG image file and check for the first row and first column that has non-transparent pixels. \nWhat assembly and/or class should I use?\n" }, { "from": "gpt", "value": "In .NET 2.0, you can work with images, including...
How can one detect being in a chroot jail without root privileges? Assume a standard BSD or Linux system. The best I came up with was to look at the inode value for "/" and to consider whether it is reasonably low, but I would like a more accurate method for detection. [edit 20080916 142430 EST] Simply looking around...
Detecting if you are in a chroot jail without root privileges can be tricky, especially since root can customize the environment and duplicate directories to make a jail look like a standard system. Here are some methods to consider for both Linux and BSD systems, while noting your constraints regarding `/proc`. ### 1...
6,194
[ { "from": "human", "value": "How can one detect being in a chroot jail without root privileges? Assume a standard BSD or Linux system. The best I came up with was to look at the inode value for \"/\" and to consider whether it is reasonably low, but I would like a more accurate method for detection.\n[edi...
Have you ever been in a situation where a menu function you really really want to use but can't cause it's disabled or worse gone all together? There is an argument for always leaving menus enabled and then display a message to a user explaining why a menu function can not be activated when they click on it. I think th...
You've raised an important point about user experience in software design, particularly regarding menu functions that may be disabled or missing. There are a few considerations and potential strategies that could address this situation effectively. ### 1. **Enable Feedback**: One of the simplest and most effective app...
5,212
[ { "from": "human", "value": "Have you ever been in a situation where a menu function you really really want to use but can't cause it's disabled or worse gone all together?\nThere is an argument for always leaving menus enabled and then display a message to a user explaining why a menu function can not be a...
Say I have an application that wants a persistent connection to a server. How do I implement connection/re-connection logic so that I'm not wasting resources (power/bandwidth) and I have fast reconnect time when connectivity appears/improves? If I only use connectivity notifications, I can get stuck on problems not rel...
Implementing robust connection/re-connection logic for a persistent connection to a server involves several strategies to ensure that resources aren't wasted while maintaining a quick reconnection time. Below, I outline a general approach and then provide a C# implementation example. ### Strategies for Connection/Reco...
2,390
[ { "from": "human", "value": "Say I have an application that wants a persistent connection to a server. How do I implement connection/re-connection logic so that I'm not wasting resources (power/bandwidth) and I have fast reconnect time when connectivity appears/improves? If I only use connectivity notificat...
I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. Restarting IIS or clearing out the Temp ASP.Net files or setting batch="f...
The issue you are encountering with the WCF service and the "Service is null" JavaScript error appears to be related to the retrieval of the JavaScript debugging support file over HTTPS, which results in a 404 error, while it works correctly over HTTP. Here are several steps to troubleshoot and resolve this issue: 1. ...
7,239
[ { "from": "human", "value": "I have a WCF service that gets called from client side JavaScript. The call fails with a Service is null JavaScript error. WebDevelopment helper trace shows that the calls to load the jsdebug support file results in a 404 (file not found) error. \nRestarting IIS or clearing out ...
In the code below I am using a recursive CTE(Common Table Expression) in SQL Server 2005 to try and find the top level parent of a basic hierarchical structure. The rule of this hierarchy is that every CustID has a ParentID and if the CustID has no parent then the ParentID = CustID and it is the highest level. DECLARE ...
To get only the top-level parent from your recursive CTE, you can modify the query to fetch only the last row generated in the recursion. Since you want the result that corresponds to the highest-level parent (where `ParentID` is equal to `CustID`), you can check for this condition in your final selection. Here is th...
4,072
[ { "from": "human", "value": "In the code below I am using a recursive CTE(Common Table Expression) in SQL Server 2005 to try and find the top level parent of a basic hierarchical structure. The rule of this hierarchy is that every CustID has a ParentID and if the CustID has no parent then the ParentID = Cus...
I'm using jmockit for unit testing (with TestNG), and I'm having trouble using the Expectations class to mock out a method that takes a primitive type (boolean) as a parameter, using a matcher. Here's some sample code that illustrates the problem. /******************************************************/ import static ...
The issue you're facing arises because the `Expectations` class and the matchers in JMockit can be somewhat tricky when dealing with primitive types. The `with` method you're using expects an `Object`, and since primitives like `boolean` are not objects, you end up with a `NullPointerException` when trying to use it in...
7,715
[ { "from": "human", "value": "I'm using jmockit for unit testing (with TestNG), and I'm having trouble using the Expectations class to mock out a method that takes a primitive type (boolean) as a parameter, using a matcher. Here's some sample code that illustrates the problem.\n/****************************...
I am primarily a .NET developer, and in that sphere alone there are at any given time probably close to a dozen fascinating emerging technologies, some of them real game-changers, that I would love to delve into. Sadly, this appears to be beyond the limits of human capacity. I read an article by Rocky Lhotka (.NET le...
It's true that the technology landscape is vast and continually evolving, which can be overwhelming even for seasoned professionals. Here are several strategies that can help you manage the rapid pace of change and keep your skills sharp as a .NET developer: ### 1. **Prioritize Learning Areas** Focus on specific techn...
7,983
[ { "from": "human", "value": "I am primarily a .NET developer, and in that sphere alone there are at any given time probably close to a dozen fascinating emerging technologies, some of them real game-changers, that I would love to delve into. \nSadly, this appears to be beyond the limits of human capacity. \...
I have the concept of NodeTypes and Nodes. A NodeType is a bunch of meta-data which you can create Node instances from (a lot like the whole Class / Object relationship). I have various NodeType implementations and various Node implementations. In my AbstractNodeType (top level for NodeTypes) I have ab abstract create...
The issue you're encountering stems from the way you're using generics in your `createInstance()` method. The return type `T` in your abstract method is a generic type placeholder, but when you implement it in `ThingType`, you are returning a specific type (`Thing`) that does not conform to the generic type `T`. To a...
7,548
[ { "from": "human", "value": "I have the concept of NodeTypes and Nodes. A NodeType is a bunch of meta-data which you can create Node instances from (a lot like the whole Class / Object relationship).\nI have various NodeType implementations and various Node implementations. \nIn my AbstractNodeType (top lev...
Is there a good way to see what format an image is, without having to read the entire file into memory? Obviously this would vary from format to format (I'm particularly interested in TIFF files) but what sort of procedure would be useful to determine what kind of image format a file is without having to read through ...
To determine the format of an image file, including TIFF files, without reading the entire file into memory, you can examine the file's header, which typically contains signature bytes or magic numbers specific to each format. Here’s a general approach to identify the image format: ### Image Format Detection by Readin...
4,417
[ { "from": "human", "value": "Is there a good way to see what format an image is, without having to read the entire file into memory? \nObviously this would vary from format to format (I'm particularly interested in TIFF files) but what sort of procedure would be useful to determine what kind of image format...
I want to apply an XSLT Stylesheet to an XML Document using C# and write the output to a File.
Applying an XSLT stylesheet to an XML document in C# can be accomplished using the `System.Xml.Xsl` namespace, which provides classes for working with XSLT transformations. Here's a step-by-step guide on how to do it: ### Step 1: Prepare Your XML and XSLT Files Let's assume you have the following XML file (`input.xml...
3,725
[ { "from": "human", "value": "I want to apply an XSLT Stylesheet to an XML Document using C# and write the output to a File.\n" }, { "from": "gpt", "value": "Applying an XSLT stylesheet to an XML document in C# can be accomplished using the `System.Xml.Xsl` namespace, which provides classes for w...
I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis. Using this method, however, leaves me with everything having the same precedence - it's evaluated left to right regardless of operator, although precedence ca...
To implement an equation parser that respects operator precedence and handles binary and unary operations, you can use the **Shunting Yard algorithm**, which was developed by Edsger Dijkstra. This algorithm converts an infix expression (like "1 + 2 * 3") into a postfix expression (like "1 2 3 * +"), which can then be e...
1,691
[ { "from": "human", "value": "I've developed an equation parser using a simple stack algorithm that will handle binary (+, -, |, &, *, /, etc) operators, unary (!) operators, and parenthesis.\nUsing this method, however, leaves me with everything having the same precedence - it's evaluated left to right rega...
I'm trying to create a dialog box using C++ and the windows API, but I don't want the dialog defined in a resource file. I can't find anything good on this on the web, and none of the examples I've read seem to define the dialog programmatically. How can I do this? A simple example is fine. I'm not doing anything compl...
Creating a dialog box programmatically in C++ using the Windows API involves using the `CreateDialog` function. Here's a simple example that demonstrates how to create a dialog without using a resource file. This example includes a button and an edit control, and it shows how to handle events in the dialog. ### Exampl...
3,173
[ { "from": "human", "value": "I'm trying to create a dialog box using C++ and the windows API, but I don't want the dialog defined in a resource file. I can't find anything good on this on the web, and none of the examples I've read seem to define the dialog programmatically.\nHow can I do this?\nA simple ex...
I would like to implement something similar to a c# delegate method in PHP. A quick word to explain what I'm trying to do overall: I am trying to implement some asynchronous functionality. Basically, some resource-intensive calls that get queued, cached and dispatched when the underlying system gets around to it. Whe...
In PHP, you can achieve callback functionality without using `eval` by utilizing **callable** type hinting. This allows you to pass a function or method as a callback, which can be executed later when your asynchronous operation completes. Here’s a simple way to implement a callback mechanism in PHP. ### Step 1: Defin...
6,794
[ { "from": "human", "value": "I would like to implement something similar to a c# delegate method in PHP. A quick word to explain what I'm trying to do overall: I am trying to implement some asynchronous functionality. Basically, some resource-intensive calls that get queued, cached and dispatched when the...
Also, how do LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN fit in?
In SQL, JOIN operations are used to combine rows from two or more tables based on a related column between them. LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN are types of outer joins that determine how rows from the tables are combined when there are no matching rows in one of the tables. Here's how they fit ...
6,036
[ { "from": "human", "value": "Also, how do LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL OUTER JOIN fit in?\n" }, { "from": "gpt", "value": "In SQL, JOIN operations are used to combine rows from two or more tables based on a related column between them. LEFT OUTER JOIN, RIGHT OUTER JOIN, and FULL O...
PHP's explode function returns an array of strings split on some provided substring. It will return empty strings when there are leading, trailing, or consecutive delimiters, like this: var_dump(explode('/', '1/2//3/')); array(5) { [0]=> string(1) "1" [1]=> string(1) "2" [2]=> string(0) "" [3]=> string(...
In PHP, if you want to split a string by a delimiter and omit any empty strings from the result, you can use the `explode` function in combination with `array_filter`. Here’s how you can achieve that: ```php function different_explode($delimiter, $string) { // Use explode to split the string $result = explode(...
8,070
[ { "from": "human", "value": "PHP's explode function returns an array of strings split on some provided substring. It will return empty strings when there are leading, trailing, or consecutive delimiters, like this:\nvar_dump(explode('/', '1/2//3/'));\narray(5) {\n [0]=>\n string(1) \"1\"\n [1]=>\n strin...
i need to fire an event (or start a workflow) when the permissions of a List-Element (ListItem) have been changed. "ItemUpdating" / "ItemUpdated" won't fire (since the ListItem itself is not updated, i suppose), so how can it be done?
In SharePoint, changing the permissions of a List Item (ListItem) does not trigger the `ItemUpdating` or `ItemUpdated` events, as these events are specifically related to the item content itself being modified. However, you can handle permission changes using the following approaches: ### 1. **Event Receivers (Using I...
9,142
[ { "from": "human", "value": "i need to fire an event (or start a workflow) when the permissions of a List-Element (ListItem) have been changed. \"ItemUpdating\" / \"ItemUpdated\" won't fire (since the ListItem itself is not updated, i suppose), so how can it be done?\n" }, { "from": "gpt", "valu...
Does the Multiview control contain the viewstate information for each of its views regardless of whether or not the view is currently visible?
Yes, in ASP.NET, the `Multiview` control does contain the view state information for each of its views, regardless of whether or not the view is currently visible. The `Multiview` control is designed to hold multiple `View` controls, and when the page is posted back, the state of all views is maintained in the view sta...
9,445
[ { "from": "human", "value": "Does the Multiview control contain the viewstate information for each of its views regardless of whether or not the view is currently visible?\n" }, { "from": "gpt", "value": "Yes, in ASP.NET, the `Multiview` control does contain the view state information for each o...
I'm trying to the the flv Flash player from here in a windows forms application. I currently have it playing 1 .flv file with no problems but I really need to be able to play multiple files. Has anyone had experienace of using the playlists that this control offers or is there a better way to do this?
To play multiple FLV files in a Windows Forms application using a Flash player, you can utilize the playlist functionality if the Flash player supports it. However, since Flash is deprecated, it's advisable to look for alternative solutions for video playback. If you still want to work with the Flash player and its pl...
3,861
[ { "from": "human", "value": "I'm trying to the the flv Flash player from here in a windows forms application. I currently have it playing 1 .flv file with no problems but I really need to be able to play multiple files. Has anyone had experienace of using the playlists that this control offers or is there a...
In my app i need to save changed values (old and new) when model gets saved. Any examples or working code? I need this for premoderation of content. For example, if user changes something in model, then administrator can see all changes in separate table and then decide to apply them or not.
To implement a system that tracks changes to your model values for premoderation, you can create a separate table to store the changes and then use signals to capture when a model is saved. Below is an example of how you might do this in a Django application, but similar concepts can be applied in other frameworks. ##...
8,175
[ { "from": "human", "value": "In my app i need to save changed values (old and new) when model gets saved. Any examples or working code?\nI need this for premoderation of content. For example, if user changes something in model, then administrator can see all changes in separate table and then decide to appl...
I've used the StAX API in Java quite a bit, and find it quite a clean way of dealing with XML files. Is there any equivalent library I could use for performing similar processing in C?
Yes, if you're looking for an equivalent to the StAX (Streaming API for XML) in C, there are several libraries that you can use to perform similar streaming XML processing. Here are a couple of popular ones: 1. **libxml2**: This is a widely used C library for parsing XML documents. It provides both a DOM and a SAX (Si...
1,378
[ { "from": "human", "value": "I've used the StAX API in Java quite a bit, and find it quite a clean way of dealing with XML files. Is there any equivalent library I could use for performing similar processing in C?\n" }, { "from": "gpt", "value": "Yes, if you're looking for an equivalent to the S...
I have been reading through the C++ FAQ and was curious about the friend declaration. I personally have never used it, however I am interested in exploring the language. What is a good example of using friend? Reading the FAQ a bit longer I like the idea of the << >> operator overloading and adding as a friend of tho...
The `friend` declaration in C++ is a powerful feature that allows a function or class to access the private and protected members of another class. While it may seem like a violation of encapsulation at first glance, it can actually be useful when you want to enable certain functions or classes to work closely with eac...
5,534
[ { "from": "human", "value": "I have been reading through the C++ FAQ and was curious about the friend declaration. I personally have never used it, however I am interested in exploring the language. \nWhat is a good example of using friend?\n\nReading the FAQ a bit longer I like the idea of the << >> operat...
I'm looking for a way to extract the audio part of a FLV file. I'm recording from the user's microphone and the audio is encoded using the Nellymoser Asao Codec. This is the default codec and there's no way to change this.
To extract the audio part of a FLV file that is encoded using the Nellymoser Asao codec, you can use various tools and libraries. One of the most common tools for handling multimedia files is **FFmpeg**, which is a powerful command-line tool that can process audio and video files. ### Steps to Extract Audio Using FFmp...
6,073
[ { "from": "human", "value": "I'm looking for a way to extract the audio part of a FLV file. \nI'm recording from the user's microphone and the audio is encoded using the Nellymoser Asao Codec. This is the default codec and there's no way to change this.\n" }, { "from": "gpt", "value": "To extrac...
Does ADOdb do data sanitation or escaping within the same functionality by default? Or am I just confusing it with Code Igniter's built-in processes? Does binding variables to parameters in ADOdb for PHP prevent SQL injection in any way?
ADOdb and CodeIgniter are two different libraries that handle database operations in PHP, and they have different approaches to data sanitation and escaping. ### ADOdb ADOdb is a database abstraction library for PHP that provides a consistent interface for various database systems. In ADOdb, when you use prepared stat...
8,927
[ { "from": "human", "value": "Does ADOdb do data sanitation or escaping within the same functionality by default? Or am I just confusing it with Code Igniter's built-in processes?\nDoes binding variables to parameters in ADOdb for PHP prevent SQL injection in any way? \n" }, { "from": "gpt", "val...
I'm trying to produce sheets of photographs with captions arranged in a grid using XSLT and XSL-FO. The photo URLs and captions are produced using a FOR XML query against an SQL Server database, and the number of photos returned varies from sheet to sheet. I want to lay the photos out in four columns, filling the grid ...
Yes, you can achieve a grid layout in XSL-FO similar to how you would use floating elements in HTML, but the approach is somewhat different due to the nature of XSL-FO's formatting model. XSL-FO doesn't have a direct equivalent to the CSS float property, but you can use the `table`, `table-row`, and `table-cell` elemen...
6,042
[ { "from": "human", "value": "I'm trying to produce sheets of photographs with captions arranged in a grid using XSLT and XSL-FO. The photo URLs and captions are produced using a FOR XML query against an SQL Server database, and the number of photos returned varies from sheet to sheet. I want to lay the phot...
What is the best method to parse multiple, discrete, custom XML documents with Java?
Parsing multiple, discrete, custom XML documents in Java can be done using several libraries and methods. The best approach depends on your specific requirements, including the complexity of the XML structure, performance considerations, and ease of use. Here are some recommended methods: ### 1. **DOM (Document Object...
2,842
[ { "from": "human", "value": "What is the best method to parse multiple, discrete, custom XML documents with Java?\n" }, { "from": "gpt", "value": "Parsing multiple, discrete, custom XML documents in Java can be done using several libraries and methods. The best approach depends on your specific ...
Are there any documented techniques for speeding up mySQL dumps and imports? This would include my.cnf settings, using ramdisks, etc. Looking only for documented techniques, preferably with benchmarks showing potential speed-up.
Yes, there are several documented techniques to speed up MySQL dumps and imports, and many of these have associated benchmarks showing the potential performance improvements. Below are some of the common methods, configurations, and practices: ### MySQL Configuration (`my.cnf` settings) 1. **Disable Keys During Impor...
4,156
[ { "from": "human", "value": "Are there any documented techniques for speeding up mySQL dumps and imports?\nThis would include my.cnf settings, using ramdisks, etc. \nLooking only for documented techniques, preferably with benchmarks showing potential speed-up.\n" }, { "from": "gpt", "value": "Ye...
I am used to writing C# Windows applications. However, I have some free hosted PHP webspace that I would like to make use of. I have a basic understanding of PHP but have never used its object-oriented capabilities. Is there an easy way to convert C# classes to PHP classes or is it just not possible to write a fully ob...
It's certainly possible to write fully object-oriented applications in PHP, and you can make use of many of the principles and structures from your C# experience. While you won't be able to directly convert C# classes to PHP classes due to the differences in the languages and their ecosystems, you can certainly re-impl...
911
[ { "from": "human", "value": "I am used to writing C# Windows applications. However, I have some free hosted PHP webspace that I would like to make use of. I have a basic understanding of PHP but have never used its object-oriented capabilities.\nIs there an easy way to convert C# classes to PHP classes or i...
I need to to print natural nos. 1,2,...n such that the parent process prints all odd numbers and the child process prints all even numbers, and all of this needs to be done using POSIX signals. How would I go about accomplishing this? The output should be: Parent : 1 Child : 2 Parent : 3 ...
To implement a solution in C where a parent process prints odd natural numbers and a child process prints even natural numbers using POSIX signals, you can follow the outline below. The parent will print odd numbers while the child will print even numbers. We'll use signals to synchronize the printing between the two p...
4,567
[ { "from": "human", "value": "I need to to print natural nos. 1,2,...n such that the parent process prints all odd numbers and the child process prints all even numbers, and all of this needs to be done using POSIX signals. How would I go about accomplishing this?\nThe output should be:\nParent : 1\nChild :...
I've created a script that runs every night on my Linux server that uses mysqldump to back up each of my MySQL databases to .sql files and packages them together as a compressed .tar file. The next step I want to accomplish is to send that tar file through email to a remote email server for safekeeping. I've been able ...
Yes, you can send a compressed `.tar` file as an email attachment using `mailx` or other similar tools. Here's how you can achieve this. Depending on your version of `mailx`, the command may vary slightly, but here's a general approach using `mutt`, which is another command-line email client that handles attachments ea...
5,014
[ { "from": "human", "value": "I've created a script that runs every night on my Linux server that uses mysqldump to back up each of my MySQL databases to .sql files and packages them together as a compressed .tar file. The next step I want to accomplish is to send that tar file through email to a remote emai...
I'm trying to do a basic "OR" on three fields using a hibernate criteria query. Example class Whatever{ string name; string address; string phoneNumber; } I'd like to build a criteria query where my search string could match "name" or "address" or "phoneNumber".
To perform a basic "OR" operation across multiple fields using Hibernate Criteria API, you can utilize the `Restrictions` class to create the necessary conditions. Below is an example of how to construct such a criteria query for your `Whatever` class: ```java import org.hibernate.Criteria; import org.hibernate.Sessio...
7,577
[ { "from": "human", "value": "I'm trying to do a basic \"OR\" on three fields using a hibernate criteria query.\nExample\nclass Whatever{\n string name;\n string address;\n string phoneNumber;\n}\n\nI'd like to build a criteria query where my search string could match \"name\" or \"address\" or \"phoneNumber...
I am using Tomcat as a server and Internet Explorer 6 as a browser. A web page in our app has about 75 images. We are using SSL. It seems to be very slow at loading all the content. How can I configure Tomcat so that IE caches the images?
To improve the caching behavior of images and other static resources in your web application served by Tomcat, particularly when using Internet Explorer 6, you can configure Tomcat to send appropriate HTTP headers that instruct the browser to cache these resources. Here are the steps you can take to configure caching ...
6,518
[ { "from": "human", "value": "I am using Tomcat as a server and Internet Explorer 6 as a browser. A web page in our app has about 75 images. We are using SSL. It seems to be very slow at loading all the content. How can I configure Tomcat so that IE caches the images?\n" }, { "from": "gpt", "valu...
We have our own ORM we use here, and provide strongly typed wrappers for all of our db tables. We also allow weakly typed ad-hoc SQL to be executed, but these queries still go through the same class for getting values out of a data reader. In tweaking that class to work with Oracle, we've come across an interesting que...
When deciding between using `DBNull.Value` and `null` in the context of an ORM or data access layer, it's important to understand the distinction between the two and the implications of each choice. ### Understanding `DBNull.Value` and `null` 1. **`DBNull.Value`**: - Represents a database null; a marker used in AD...
4,355
[ { "from": "human", "value": "We have our own ORM we use here, and provide strongly typed wrappers for all of our db tables. We also allow weakly typed ad-hoc SQL to be executed, but these queries still go through the same class for getting values out of a data reader.\nIn tweaking that class to work with Or...
Until recently we were using Inno Setup for our installations, something I would like to continue doing, unless we can get an uninstall option in the start menu (thanks Giovanni Galbo), however we now need to GAC some external libraries, something I suspect is only doable (or at least only supported) though the .NET Se...
Yes, it is possible to call a library for adding assemblies to the Global Assembly Cache (GAC) from an Inno Setup script, though it might require some additional steps since Inno Setup does not have built-in support for GAC. Here are some methods to accomplish this: ### Method 1: Using a Custom Action You can create...
3,229
[ { "from": "human", "value": "Until recently we were using Inno Setup for our installations, something I would like to continue doing, unless we can get an uninstall option in the start menu (thanks Giovanni Galbo), however we now need to GAC some external libraries, something I suspect is only doable (or at...
What is a good (and preferably simple) way to test the rendering performance of WPF custom controls? I have several complex controls in which rendering performance is highly crucial. I want to be able to make sure that I can have lots of them drawwing out in a designer with a minimal impact on performance.
Testing the rendering performance of WPF (Windows Presentation Foundation) custom controls can be approached in several straightforward ways. Here are a few methods you can use to effectively measure and evaluate the performance of your custom controls: ### 1. **Use Visual Studio's Performance Profiler:** - Visual ...
7,211
[ { "from": "human", "value": "What is a good (and preferably simple) way to test the rendering performance of WPF custom controls? I have several complex controls in which rendering performance is highly crucial. I want to be able to make sure that I can have lots of them drawwing out in a designer with a ...
I am using <input type="file" id="fileUpload" runat="server"> to upload a file in an ASP.NET application. I would like to limit the file type of the upload (example: limit to .xls or .xlsx file extensions). Both JavaScript or server-side validation are OK (as long as the server side validation would take place before ...
To restrict the file type for an `<input type="file">` element in an ASP.NET application, you can use both client-side validation (using JavaScript) and server-side validation (to ensure security). ### Client-Side Validation Using the `accept` attribute in your file input tag can help restrict users from selecting ce...
5,737
[ { "from": "human", "value": "I am using <input type=\"file\" id=\"fileUpload\" runat=\"server\"> to upload a file in an ASP.NET application. I would like to limit the file type of the upload (example: limit to .xls or .xlsx file extensions). \nBoth JavaScript or server-side validation are OK (as long as the...
I have a webservice that that uses message layer security with X.509 certificates in WSE 3.0. The service uses a X509v3 policy to sign various elements in the soapheader. I need to do some custom checks on the certificates so I've tried to implement a custom X509SecurityTokenManager and added a section in web.config. W...
It looks like you're trying to implement a custom `X509SecurityTokenManager` in WSE 3.0 to perform custom checks on X.509 certificates, but you're running into an issue where the NotImplementedException is not being thrown as you expected. Here are some troubleshooting steps and considerations to help resolve this is...
6,126
[ { "from": "human", "value": "I have a webservice that that uses message layer security with X.509 certificates in WSE 3.0. The service uses a X509v3 policy to sign various elements in the soapheader.\nI need to do some custom checks on the certificates so I've tried to implement a custom X509SecurityTokenMa...
How do I create a background process with Haskell on windows without a visible command window being created? I wrote a Haskell program that runs backup processes periodically but every time I run it, a command window opens up to the top of all the windows. I would like to get rid of this window. What is the simplest wa...
To create a background process in Haskell on Windows without a visible command window, you can use the `createProcess` function from the `System.Process` module, combined with the `detached` option to run your process without a console window. You will need to modify your program so that it runs as a Windows GUI applic...
7,107
[ { "from": "human", "value": "How do I create a background process with Haskell on windows without a visible command window being created?\nI wrote a Haskell program that runs backup processes periodically but every time I run it, a command window opens up to the top of all the windows. I would like to get r...
I am using a cross page postback for Page A to pass data to Page B. The button that causes the postback has its postbackurl set but is disabled until the user selects a value from a DDL at which point the button is enable using javascript. However this prevents the cross page postback from occurring, Page A just postba...
This is a common issue when dealing with cross-page postbacks in ASP.NET, particularly when enabling or disabling buttons using JavaScript. When the button is disabled, the postback URL may not be respected, resulting in a standard postback to the same page. ### Solution To solve this, you can follow these approaches...
5,259
[ { "from": "human", "value": "I am using a cross page postback for Page A to pass data to Page B.\nThe button that causes the postback has its postbackurl set but is disabled until the user selects a value from a DDL at which point the button is enable using javascript. However this prevents the cross page p...
In the past I had to develop a program which acted as a rule evaluator. You had an antecedent and some consecuents (actions) so if the antecedent evaled to true the actions where performed. At that time I used a modified version of the RETE algorithm (there are three versions of RETE only the first being public) for th...
The RETE algorithm is a well-known and efficient pattern matching algorithm, particularly well-suited for scenarios involving a large number of rules and shared conditions, as you've described. However, there are several other pattern matching algorithms that you might consider depending on your specific use case and r...
6,173
[ { "from": "human", "value": "In the past I had to develop a program which acted as a rule evaluator. You had an antecedent and some consecuents (actions) so if the antecedent evaled to true the actions where performed.\nAt that time I used a modified version of the RETE algorithm (there are three versions o...
I'm capturing data from a tablet using Java (JPen library rocks) and would like to be able to paint a penstroke in a more natural way. Currently I'm drawing the pen stroke as straight line segments each with a different Stroke thickness. There has to be something in Java's Graphics Library that lets me to this more e...
Yes, in Java's Graphics library, you can achieve a more natural appearance for pen strokes by using a technique that involves drawing curves rather than straight line segments. This can be done using the `Graphics2D` class, which provides advanced features for rendering shapes and text. To create smoother and more natu...
4,375
[ { "from": "human", "value": "I'm capturing data from a tablet using Java (JPen library rocks) and would like to be able to paint a penstroke in a more natural way.\nCurrently I'm drawing the pen stroke as straight line segments each with a different Stroke thickness. \nThere has to be something in Java's G...
I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on the client side when I press the Cancel button, which has the CausesValidation attribute set to "False". How can I get this to stop? I do not believe that Validation Groups are supported in 1.1. Here's a code sample: <asp:Te...
It sounds like you've already resolved your issue with the RequiredFieldValidators firing on the Cancel button in your ASP.NET 1.1 application. However, for others who may face a similar problem, I'll summarize how to ensure that validation is not triggered by a button with `CausesValidation` set to `False`. ### Summa...
3,068
[ { "from": "human", "value": "I have several RequiredFieldValidators in an ASP.NET 1.1 web application that are firing on the client side when I press the Cancel button, which has the CausesValidation attribute set to \"False\". How can I get this to stop? \nI do not believe that Validation Groups are supp...
(Jeopardy-style question, I wish the answer had been online when I had this issue) Using Java 1.4, I have a method that I want to run as a thread some of the time, but not at others. So I declared it as a subclass of Thread, then either called start() or run() depending on what I needed. But I found that my program wou...
In Java, when you call the `run()` method directly on a `Thread` instance, you are not actually starting a new thread; instead, you are executing the `run()` method in the current thread. This means that the code inside the `run()` method executes synchronously in the calling thread, which can lead to issues such as bl...
8,178
[ { "from": "human", "value": "(Jeopardy-style question, I wish the answer had been online when I had this issue)\nUsing Java 1.4, I have a method that I want to run as a thread some of the time, but not at others. So I declared it as a subclass of Thread, then either called start() or run() depending on what...
Are there any good books or website that go over creating a JTable? I want to make one column editable. I would like to actually put a inherited JCheckBox component (that we created here) into one of the table columns instead of just having the table put JCheckBox in based on it being an editable boolean field. I have...
Creating a `JTable` in Java Swing that includes a custom component (like a custom `JCheckBox`) in one of its columns can be a bit tricky, but there are plenty of resources available that can help you understand how to do this effectively. Here are some recommended books and websites you can explore: ### Books 1. **"J...
4,628
[ { "from": "human", "value": "Are there any good books or website that go over creating a JTable? I want to make one column editable. I would like to actually put a inherited JCheckBox component (that we created here) into one of the table columns instead of just having the table put JCheckBox in based on i...
Is there a .NET performance counter to show the rate of p/invoke calls made? I've just noticed that the application I'm debugging was making a call into native code from managed land within a tight loop. The intended implementation was for a p/invoke call to be made once and then cached. I'm wondering if I could hav...
In .NET, there isn't a specific built-in performance counter dedicated solely to tracking the rate of P/Invoke calls made from managed code to native code. However, you can still gain insights into how your application is interacting with native code through some indirect methods. ### Potential Approaches 1. **Profil...
8,255
[ { "from": "human", "value": "Is there a .NET performance counter to show the rate of p/invoke calls made? I've just noticed that the application I'm debugging was making a call into native code from managed land within a tight loop. The intended implementation was for a p/invoke call to be made once and t...
How do you customize the Copy/Paste behavior in Visual Studio 2008? For example I create a new <div id="MyDiv"></div> and then copy and paste it in the same file. VisualStudio pastes <div id="Div1"></div> instead of the original text I copied. It is even more frustrating when I'm trying to copy a group of related div's...
In Visual Studio 2008, the behavior you're encountering when copying and pasting HTML elements is due to the built-in functionality that automatically adjusts IDs to prevent duplicates in the same document. However, this behavior can be quite frustrating if you want to keep the original IDs for your HTML elements. Unf...
4,397
[ { "from": "human", "value": "How do you customize the Copy/Paste behavior in Visual Studio 2008?\nFor example I create a new <div id=\"MyDiv\"></div> and then copy and paste it in the same file.\nVisualStudio pastes <div id=\"Div1\"></div> instead of the original text I copied.\nIt is even more frustrating ...
What are all the valid self-closing elements (e.g. <br/>) in XHTML (as implemented by the major browsers)? I know that XHTML technically allows any element to be self-closed, but I'm looking for a list of those elements supported by all major browsers. See http://dusan.fora.si/blog/self-closing-tags for examples of so...
In XHTML, self-closing elements (also known as void elements) are those that do not require a closing tag and can be written in a self-contained format (e.g., `<element />`). While XHTML allows for any element to be self-closed, not all elements are meant to be treated that way. Below is a list of valid self-closing el...
9,923
[ { "from": "human", "value": "What are all the valid self-closing elements (e.g. <br/>) in XHTML (as implemented by the major browsers)?\nI know that XHTML technically allows any element to be self-closed, but I'm looking for a list of those elements supported by all major browsers. See http://dusan.fora.si...
I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework. JUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. Could you please recommend a unit testing f...
For testing servlets in a Tomcat environment, you have several options that can help you separate your test code from production code effectively. Here are some recommendations for testing frameworks that support testing servlets with Tomcat: ### 1. **JUnit with Mocking Frameworks** While JUnit itself is not a servlet...
6,884
[ { "from": "human", "value": "I have a bunch of servlets running under the Tomcat servlet container. I would like to separate test code from production code, so I considered using a test framework.\nJUnit is nicely integrated into Eclipse, but I failed to make it run servlets using a running Tomcat server. C...
I have a web report that uses a Django form (new forms) for fields that control the query used to generate the report (start date, end date, ...). The issue I'm having is that the page should work using the form's initial values (unbound), but I can't access the cleaned_data field unless I call is_valid(). But is_valid...
You're correct in noting that Django forms are primarily designed around the concepts of bound (filled in with data) and unbound forms (not yet filled with data), which can make it tricky to handle both cases cleanly. To improve the clarity of your code and make it more maintainable, you can consider the following app...
7,248
[ { "from": "human", "value": "I have a web report that uses a Django form (new forms) for fields that control the query used to generate the report (start date, end date, ...). The issue I'm having is that the page should work using the form's initial values (unbound), but I can't access the cleaned_data fie...
When I am working in .NET 2.0 projects with the newest version of ReSharper (4.1) I am getting warnings about using the var keyword and lambadas etc.. Any idea how I can disable this only for .NET 2.0 projects?
In ReSharper 4.1, you can customize the settings to disable certain inspections for specific project types, like .NET 2.0. However, ReSharper’s support for such specific configurations is somewhat limited in older versions. Here's how you can generally manage the inspection settings: 1. **Disable specific warnings in ...
8,594
[ { "from": "human", "value": "When I am working in .NET 2.0 projects with the newest version of ReSharper (4.1) I am getting warnings about using the var keyword and lambadas etc.. Any idea how I can disable this only for .NET 2.0 projects?\n" }, { "from": "gpt", "value": "In ReSharper 4.1, you c...
I am trying to implement an "out of proc" COM server written in C#. How do I do this? I need the C# code to be "out of proc" from my main C++ application, because I cannot load the .NET runtime into my main process space WHY?: My C++ code is in a DLL that is loaded into many different customer EXE's, some of which us...
Implementing an out-of-process COM server in C# can be a bit complex, but it is achievable. Below are steps and code examples to help you get started. ### Steps to Implement Out-of-Process COM Server in C# 1. **Set Up the C# Project:** - Create a new C# Class Library project in Visual Studio. - Add a reference...
1,677
[ { "from": "human", "value": "I am trying to implement an \"out of proc\" COM server written in C#. How do I do this?\nI need the C# code to be \"out of proc\" from my main C++ application, because I cannot load the .NET runtime into my main process space \nWHY?: \nMy C++ code is in a DLL that is loaded into...
There is no documentation on cakephp.org and I am unable to find one on google. Please link me some documentation or supply one!
If you're looking for documentation for CakePHP, the official website is typically the best resource. You can find the documentation for the latest version of CakePHP at the following link: - [CakePHP Documentation](https://book.cakephp.org/) This site contains comprehensive guides, tutorials, and API references for ...
9,700
[ { "from": "human", "value": "There is no documentation on cakephp.org and I am unable to find one on google. Please link me some documentation or supply one!\n" }, { "from": "gpt", "value": "If you're looking for documentation for CakePHP, the official website is typically the best resource. You...
Got this from some mysql queries, puzzled since error 122 is usually a 'out of space' error but there's plenty of space left on the server... any ideas?
Error 122 in MySQL, which corresponds to the "Incorrect key file for table" error, can be misleading. While it's commonly associated with running out of space, there are several other potential causes for this issue, especially if you're confident that there is enough disk space available on your server. Here are some ...
7,181
[ { "from": "human", "value": "Got this from some mysql queries, puzzled since error 122 is usually a 'out of space' error but there's plenty of space left on the server... any ideas?\n" }, { "from": "gpt", "value": "Error 122 in MySQL, which corresponds to the \"Incorrect key file for table\" err...
I have an Java desktop application which connects directly with the DB (an Oracle). The application has multiple user accounts. What is the correct method to send the user's password (not DB password) over the network? I don't want to send it in plain text.
When it comes to sending sensitive information like user passwords over the network, it is crucial to ensure that they are securely transmitted to prevent interception by malicious actors. Here are steps and best practices to securely handle and transmit user passwords in your Java desktop application: 1. **Use HTTPS*...
7,264
[ { "from": "human", "value": "I have an Java desktop application which connects directly with the DB (an Oracle). The application has multiple user accounts. What is the correct method to send the user's password (not DB password) over the network? I don't want to send it in plain text.\n" }, { "from...
Are there any open-source libraries that all programmers should know about? I'm thinking something general, a sort of extension to the standard java.util that contains basic functions that are useful for all kinds of application.
Yes, there are several open-source libraries in the Java ecosystem that are highly regarded and can be considered essential for various types of applications. While they may not directly extend `java.util`, they often provide additional functionalities that enhance Java's capabilities. Here’s a list of some important l...
6,328
[ { "from": "human", "value": "Are there any open-source libraries that all programmers should know about? I'm thinking\nsomething general, a sort of extension to the standard java.util that contains basic functions that are useful for all kinds of application.\n" }, { "from": "gpt", "value": "Yes...
I'm looking for some "Best Practices" for automating the deployment of Stored Procedures/Views/Functions/Table changes from source control. I'm using StarTeam & ANT so the labeling is taken care of; what I am looking for is how some of you have approached automating the pull of these objects from source - not necessari...
Automating the deployment of database objects like stored procedures, views, functions, and tables from source control can be challenging, but with careful planning and adherence to best practices, it can be accomplished effectively. Here are some approaches and ideas that have worked for others: ### 1. **Organize You...
3,916
[ { "from": "human", "value": "I'm looking for some \"Best Practices\" for automating the deployment of Stored Procedures/Views/Functions/Table changes from source control. I'm using StarTeam & ANT so the labeling is taken care of; what I am looking for is how some of you have approached automating the pull o...
There are three assembly version attributes. What are differences? Is it ok if I use AssemblyVersion and ignore the rest? MSDN says: AssemblyVersion: Specifies the version of the assembly being attributed. AssemblyFileVersion: Instructs a compiler to use a specific version number for the Win32 file version resour...
In .NET, there are indeed three version attributes you can use to define versions for your assembly, and they each serve different purposes. Here’s a detailed explanation of each attribute and its intended use: 1. **AssemblyVersion**: - This attribute specifies the version of the assembly itself. It is the version ...
8,681
[ { "from": "human", "value": "There are three assembly version attributes. What are differences? Is it ok if I use AssemblyVersion and ignore the rest?\n\nMSDN says:\n\nAssemblyVersion:\n\nSpecifies the version of the assembly being attributed. \n\nAssemblyFileVersion:\n\nInstructs a compiler to use a specif...
I was wondering; which logging libraries for Delphi do you prefer? CodeSite SmartInspect Log4Delphi TraceFormat Please try to add a reasoning why you prefer one over the other if you've used more than one. I'll add suggestions to this question to keep things readable.
Choosing a logging library for Delphi depends on the specific needs of your project, but I can provide insights based on the libraries you've mentioned: ### 1. **CodeSite** **Reasoning**: CodeSite is a highly regarded logging tool among Delphi developers, particularly for its real-time logging capabilities. It provide...
8,128
[ { "from": "human", "value": "I was wondering; which logging libraries for Delphi do you prefer?\n\nCodeSite\nSmartInspect\nLog4Delphi\nTraceFormat\n\nPlease try to add a reasoning why you prefer one over the other if you've used more than one.\nI'll add suggestions to this question to keep things readable.\...
How can I redirect the response to an IFrame?
To redirect a response to an iframe, you typically modify the content that the iframe is loading, rather than using a server-side redirection. You can do this with HTML and JavaScript. Below are a few methods to achieve this: ### Method 1: Using JavaScript to Change the `src` of the IFrame You can use JavaScript to c...
7,846
[ { "from": "human", "value": "How can I redirect the response to an IFrame?\n" }, { "from": "gpt", "value": "To redirect a response to an iframe, you typically modify the content that the iframe is loading, rather than using a server-side redirection. You can do this with HTML and JavaScript. Bel...
What is the preferred way to open a URL from a thick client application on Windows using C# and the .NET framework? I want it to use the default browser.
In a thick client application on Windows using C# and the .NET Framework, the preferred way to open a URL in the default web browser is to use the `System.Diagnostics.Process` class. This allows you to start a new process for the default browser with the specified URL. Here’s a simple example of how to do this: ```cs...
9,287
[ { "from": "human", "value": "What is the preferred way to open a URL from a thick client application on Windows using C# and the .NET framework? I want it to use the default browser.\n" }, { "from": "gpt", "value": "In a thick client application on Windows using C# and the .NET Framework, the p...
My company is currently using Sage MAS as their ERP system. While integrating our shopping cart is not going to be impossible, it uses COM and has it's own challenges. I was wondering if there was a more developer friendly ERP out there. I have looked into Microsoft Dynamics but getting information on ERP systems that ...
When considering a more developer-friendly ERP system, particularly one that integrates well with C# and .NET technologies, there are several options you can explore beyond Sage MAS and Microsoft Dynamics. Below are a few ERPs that are known for their developer-friendly APIs and extensibility: ### 1. **Odoo** - **Over...
3,811
[ { "from": "human", "value": "My company is currently using Sage MAS as their ERP system. While integrating our shopping cart is not going to be impossible, it uses COM and has it's own challenges.\nI was wondering if there was a more developer friendly ERP out there. I have looked into Microsoft Dynamics bu...
I would like to intercept the event in a .NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it). Do you have any idea of how I can do that?
To intercept a double-click event on the tabs of a `TabControl` in a Windows Forms application, you can utilize the `MouseDoubleClick` event of the `TabControl`. However, the `MouseDoubleClick` event will trigger on the entire `TabControl`, so you'll need to check which tab was clicked during the double-click event. H...
5,011
[ { "from": "human", "value": "I would like to intercept the event in a .NET Windows Forms TabControl when the user has changed tab by double-clicking the tab (instead of just single-clicking it).\nDo you have any idea of how I can do that?\n" }, { "from": "gpt", "value": "To intercept a double-cl...
For example which is better: select * from t1, t2 where t1.country='US' and t2.country=t1.country and t1.id=t2.id or select * from t1, t2 where t1.country'US' and t2.country='US' and t1.id=t2.id better as in less work for the database, faster results. Note: Sybase, and there's an index on both tables of country+id.
To determine which of the two SQL queries is better in terms of performance and efficiency when executed on a Sybase database, we need to analyze each query based on the specified conditions and the presence of indexes. ### Query Analysis 1. **First Query**: ```sql SELECT * FROM t1, t2 WHERE t1.country='US' AND...
7,310
[ { "from": "human", "value": "For example which is better:\nselect * from t1, t2 where t1.country='US' and t2.country=t1.country and t1.id=t2.id\n\nor\nselect * from t1, t2 where t1.country'US' and t2.country='US' and t1.id=t2.id\n\nbetter as in less work for the database, faster results.\nNote: Sybase, and ...
I've been using Window Home Server for my backups here at home for most of a year now, and I'm really pleased with it. It's far better than the software I was using previously (Acronis). I'm thinking about a backup strategy for my work machine and I'd like to know how WHS compares with Vista's built-in backup and res...
Windows Home Server (WHS) and Windows Vista's built-in backup and restore features both provide solid options for backing up data, but they have different strengths and functionalities. Here's a comparison of the two, particularly regarding your planned backup strategy of using an external hard drive for full backups a...
6,542
[ { "from": "human", "value": "I've been using Window Home Server for my backups here at home for most of a year now, and I'm really pleased with it. It's far better than the software I was using previously (Acronis). I'm thinking about a backup strategy for my work machine and I'd like to know how WHS comp...
I am trying to achieve better performance for my Java SWT application, and I just found out it is possible to use OpenGL in SWT. It seems there are more than one Java binding for OpenGL. Which one do you prefer? Note that I have never used OpenGL before, and that the application needs to work on Windows, Linux and Mac ...
When it comes to using OpenGL with Java SWT, you have a few binding options available. The two most common bindings for OpenGL in Java are: 1. **JOGL (Java OpenGL)**: JOGL is a robust and widely-used binding that allows Java applications to interface with OpenGL. It provides comprehensive support for OpenGL features, ...
6,352
[ { "from": "human", "value": "I am trying to achieve better performance for my Java SWT application, and I just found out it is possible to use OpenGL in SWT. It seems there are more than one Java binding for OpenGL. Which one do you prefer?\nNote that I have never used OpenGL before, and that the applicatio...
I want to implement a paperless filing system and was looking to use WIA with C# for the image acquisition. There are quite a few sample projects on CodeProject, etc. However, after downloading every one of them that I can find, I have run into a problem. In each and every one of them, the reference to WIALib is broken...
It looks like you're dealing with a common issue when migrating from WIA 1.x to WIA 2.0, especially since many resources and samples are still based on the older version. Here are some tips and steps to help you implement a paperless filing system using WIA 2.0 in C#: ### Step 1: Reference WIA 2.0 1. **Add Reference*...
5,604
[ { "from": "human", "value": "I want to implement a paperless filing system and was looking to use WIA with C# for the image acquisition. There are quite a few sample projects on CodeProject, etc. However, after downloading every one of them that I can find, I have run into a problem.\nIn each and every one ...
I am using SQL Server 2000 and I have two databases that both replicate (transactional push subscription) to a single database. I need to know which database the records came from. So I want to add a fixed column specified in the publication to my table so I can tell which database the row originated from. How do I go...
In SQL Server 2000, replication does not provide a built-in feature to automatically identify the source database of replicated records. However, there are a few approaches you can consider to achieve your goal of identifying the source of each record without altering your main databases extensively. ### Option 1: Use...
6,320
[ { "from": "human", "value": "I am using SQL Server 2000 and I have two databases that both replicate (transactional push subscription) to a single database. I need to know which database the records came from.\nSo I want to add a fixed column specified in the publication to my table so I can tell which dat...
I have the following C# code: byte rule = 0; ... rule = rule | 0x80; which produces the error: Cannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?) [Update: first version of the question was wrong ... I misread the compiler output] Adding the cast doesn't fix the p...
The issue you're encountering is due to the way C# handles type promotion and implicit conversions, especially with bitwise operations. Let's break it down: 1. **Implicit Type Conversion**: In C#, when you use a bitwise operator like `|`, both operands are implicitly converted to `int` if either operand is of type `in...
8,413
[ { "from": "human", "value": "I have the following C# code:\nbyte rule = 0;\n...\nrule = rule | 0x80;\n\nwhich produces the error: \n\nCannot implicitly convert type 'int' to 'byte'. An explicit conversion exists (are you missing a cast?)\n\n[Update: first version of the question was wrong ... I misread the ...
I have a group of checkboxes that I only want to allow a set amount to be checked at any one time. If the newly checked checkbox pushes the count over the limit, I'd like the oldest checkbox to be automatically unchecked. The group of checkboxes all use the same event handler shown below. I have achieved the functional...
It looks like you are trying to manage a limited number of selected checkboxes in a more elegant way. Instead of using a `Queue`, you could simply maintain a `List` to track the checked checkboxes, allowing you to easily manage the order and remove the oldest checkbox when necessary. Here’s an improved version of your...
8,524
[ { "from": "human", "value": "I have a group of checkboxes that I only want to allow a set amount to be checked at any one time. If the newly checked checkbox pushes the count over the limit, I'd like the oldest checkbox to be automatically unchecked. The group of checkboxes all use the same event handler sh...
Can anyone recommend a good server-side PDF generation tool that would work in a Linux environment. I want easy as possible, pass it a XHTML file (with images) and have it generate a PDF from the rendered source. I don't have a massive budget, but anything under $1000 should be alright. Andrew
There are several good server-side PDF generation tools that work well in a Linux environment and can convert XHTML files (with images) to PDF. Here are some recommendations that fall within your budget: 1. **wkhtmltopdf**: - **Description**: This is an open-source command-line tool that uses the WebKit rendering e...
7,189
[ { "from": "human", "value": "Can anyone recommend a good server-side PDF generation tool that would work in a Linux environment. I want easy as possible, pass it a XHTML file (with images) and have it generate a PDF from the rendered source.\nI don't have a massive budget, but anything under $1000 should be...
I would like to put a link to a webpage in an alert dialog box so that I can give a more detailed description of how to fix the error that makes the dialog box get created. How can I make the dialog box show something like this: There was an error. Go to this page to fix it. wwww.TheWebPageToFix.com Thanks.
You can create an alert dialog box that displays a message and includes a hyperlink for more information. However, keep in mind that traditional alert dialogs in JavaScript do not support HTML formatting, including clickable links. Instead, you can create a custom dialog using HTML and CSS or use a library like jQuery ...
6,758
[ { "from": "human", "value": "I would like to put a link to a webpage in an alert dialog box so that I can give a more detailed description of how to fix the error that makes the dialog box get created. \nHow can I make the dialog box show something like this:\nThere was an error. Go to this page to fix it...
I've started to work a bit with master pages for an ASP.net mvc site and I've come across a question. When I link in a stylesheet on the master page it seems to update the path to the sheet correctly. That is in the code I have <link href="../../Content/Site.css" rel="stylesheet" type="text/css" /> but looking at th...
In ASP.NET MVC, when you're working with views and master pages (or Layouts), it's important to manage your resource paths (like stylesheets and scripts) correctly so they can be accessed regardless of the URL structure of the site. The path resolution you've observed for stylesheets happens automatically for `<link>` ...
8,068
[ { "from": "human", "value": "I've started to work a bit with master pages for an ASP.net mvc site and I've come across a question. When I link in a stylesheet on the master page it seems to update the path to the sheet correctly. That is in the code I have\n<link href=\"../../Content/Site.css\" rel=\"styl...
I was happily using Eclipse 3.2 (or as happy as one can be using Eclipse) when for a forgotten reason I decided to upgrade to 3.4. I'm primarily using PyDev, Aptana, and Subclipse, very little Java development. I've noticed 3.4 tends to really give my laptop a hernia compared to 3.2 (vista, core2duo, 2G). Is memory usa...
It's not uncommon for newer versions of Eclipse to consume more memory and resources than older versions, as they often include new features and improvements that can contribute to increased overhead. In your case, upgrading from Eclipse 3.2 to 3.4 may indeed be causing higher memory usage, especially since you are usi...
7,722
[ { "from": "human", "value": "I was happily using Eclipse 3.2 (or as happy as one can be using Eclipse) when for a forgotten reason I decided to upgrade to 3.4. I'm primarily using PyDev, Aptana, and Subclipse, very little Java development.\nI've noticed 3.4 tends to really give my laptop a hernia compared t...
Does anybody know the logic behind making DataSourceSelectArguments sealed? I've implemented a custom DataSource (and related classes) for some custom business objects and custom WebControls. When thinking in filters (like in a grid) I discovered that the DataSourceSelectArguments is sealed. Surely, I'm missing somethi...
The `DataSourceSelectArguments` class in ASP.NET is designed to encapsulate the arguments that are used when querying data from a data source. The reason for making this class `sealed` is primarily related to design and stability concerns within the framework. Here are a few key points to help understand the logic behi...
8,661
[ { "from": "human", "value": "Does anybody know the logic behind making DataSourceSelectArguments sealed?\nI've implemented a custom DataSource (and related classes) for some custom business objects and custom WebControls. When thinking in filters (like in a grid) I discovered that the DataSourceSelectArgume...
The problem is simple, but I'm struggling a bit already. Server server = new Server(8080); Context context = new Context(server, "/", Context.NO_SESSIONS); context.addServlet(MainPageView.class, "/"); context.addServlet(UserView.class, "/signup"); server.start(); That's a pretty standard piece of code that you can f...
To ensure that your servlets are instantiated eagerly when you start your Jetty server, you can utilize the `ServletContextListener` interface. This allows you to perform initialization tasks at the context initialization stage, which happens when the server starts up. You can create a custom listener that explicitly i...
6,844
[ { "from": "human", "value": "The problem is simple, but I'm struggling a bit already.\nServer server = new Server(8080); \nContext context = new Context(server, \"/\", Context.NO_SESSIONS);\ncontext.addServlet(MainPageView.class, \"/\");\ncontext.addServlet(UserView.class, \"/signup\");\nserver.start();\n\...
in a DB2 trigger, I need to compare the value of a CLOB field. Something like: IF OLD_ROW.CLOB_FIELD != UPDATED_ROW.CLOB_FIELD but "!=" does not work for comparing CLOBs. What is the way to compare it? Edited to add: My trigger needs to do some action if the Clob field was changed during an update. This is the reason...
In IBM Db2, you cannot directly use the `!=` operator to compare CLOB fields due to their potentially large size and the way they are handled in SQL. Instead, you should use the built-in functions to compare the contents of the CLOBs. To compare two CLOB values in a trigger to check if they have changed, you can use t...
8,651
[ { "from": "human", "value": "in a DB2 trigger, I need to compare the value of a CLOB field.\nSomething like:\nIF OLD_ROW.CLOB_FIELD != UPDATED_ROW.CLOB_FIELD \n\nbut \"!=\" does not work for comparing CLOBs.\nWhat is the way to compare it?\nEdited to add:\nMy trigger needs to do some action if the Clob fiel...
The design for the website I am working on calls for a custom image on lists instead of a bullet. Using the image is fine, but I have been having difficulties ensuring that it is centered against the text of the list item across all browsers. Does anyone know of a standard solution for this?
To ensure that a custom image is centered against the text of a list item across all browsers, you can use a combination of CSS properties to achieve this. Here’s a step-by-step guide to help you set this up. ### HTML Structure You can use an unordered list (`<ul>`), and for each list item (`<li>`), include your cust...
6,398
[ { "from": "human", "value": "The design for the website I am working on calls for a custom image on lists instead of a bullet. Using the image is fine, but I have been having difficulties ensuring that it is centered against the text of the list item across all browsers. Does anyone know of a standard sol...
I have an application with multiple "pick list" entities, such as used to populate choices of dropdown selection boxes. These entities need to be stored in the database. How do one persist these entities in the database? Should I create a new table for each pick list? Is there a better solution?
Persisting "pick list" entities in a database can be approached in several ways, depending on your application requirements, the nature of the pick lists, and the level of complexity you expect in managing them. Here are some common strategies: ### 1. **Separate Tables for Each Pick List** #### Advantages: - **Simpli...
5,865
[ { "from": "human", "value": "I have an application with multiple \"pick list\" entities, such as used to populate choices of dropdown selection boxes. These entities need to be stored in the database. How do one persist these entities in the database?\nShould I create a new table for each pick list? Is the...
What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently use and develop for could really benefit from a more comprehensive way of tracking how records have changed over time. For instance, right now reco...
Maintaining a change history for complex databases can be a challenging but crucial task, especially in applications that require a clear audit trail or the ability to reconstruct historical states of records. Below are several strategies that can be employed to implement a comprehensive change history system in a Post...
4,061
[ { "from": "human", "value": "What are some strategies that people have had success with for maintaining a change history for data in a fairly complex database. One of the applications that I frequently use and develop for could really benefit from a more comprehensive way of tracking how records have change...
I used jQuery to set hover callbacks for elements on my page. I'm now writing a module which needs to temporarily set new hover behaviour for some elements. The new module has no access to the original code for the hover functions. I want to store the old hover functions before I set new ones so I can restore them when...
To temporarily replace hover callbacks in jQuery without modifying the original code and while also allowing you to restore the original hover behavior, you can utilize jQuery's internal handling of events. Unfortunately, jQuery does not provide a direct method to access the currently registered event handlers out of t...
7,651
[ { "from": "human", "value": "I used jQuery to set hover callbacks for elements on my page. I'm now writing a module which needs to temporarily set new hover behaviour for some elements. The new module has no access to the original code for the hover functions.\nI want to store the old hover functions before...