instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I have a function in Python which is iterating over the attributes returned from dir(obj), and I want to check to see if any of the objects contained within is a function, method, built-in function, etc. Normally you could use callable() for this, but I don't want to include classes. The best I've come up with so far... | Your current approach using `isinstance` with the types from the `types` module is a good way to check for built-in functions, user-defined functions, and methods. However, if you want to ensure that your code remains future-proof and you are specifically looking to disqualify classes while including only functions and... | 12,933 | [
{
"from": "human",
"value": "I have a function in Python which is iterating over the attributes returned from dir(obj), and I want to check to see if any of the objects contained within is a function, method, built-in function, etc. Normally you could use callable() for this, but I don't want to include cl... |
I am working with jQuery Form and ASP.NET MVC. Preview 5 of ASP.NET MVC has an Extension Method on HttpRequest called IsAjaxMvcRequest that detects if the POST was an Ajax request. This Extension Method basically "sniffs" for a form value called __MVCASYNCPOST and (basically) returns true if it sees this element.
What ... | To inject the `__MVCASYNCPOST` value into your form submission using jQuery, you can use the `$.ajaxSubmit` method from the jQuery Form Plugin to add a hidden input value just before the form is submitted. You can do this by creating the input dynamically in your submit handler.
Here's how you can modify your script:
... | 12,386 | [
{
"from": "human",
"value": "I am working with jQuery Form and ASP.NET MVC. Preview 5 of ASP.NET MVC has an Extension Method on HttpRequest called IsAjaxMvcRequest that detects if the POST was an Ajax request. This Extension Method basically \"sniffs\" for a form value called __MVCASYNCPOST and (basically) ... |
Is there a way to mock object construction using JMock in Java?
For example, if I have a method as such:
public Object createObject(String objectType) {
if(objectType.equals("Integer") {
return new Integer();
} else if (objectType.equals("String") {
return new String();
}
}
...is there a ... | JMock is primarily a mocking framework designed for testing interactions between objects by creating mock objects that can have expectations set on them. However, JMock is not designed for mocking static method calls or object construction (like calling a constructor) out of the box.
In your case, where you want to m... | 7,599 | [
{
"from": "human",
"value": "Is there a way to mock object construction using JMock in Java? \nFor example, if I have a method as such:\npublic Object createObject(String objectType) {\n if(objectType.equals(\"Integer\") {\n return new Integer();\n } else if (objectType.equals(\"String\") {\n ... |
I understand what a Y Combinator is, but I don't understand this example of a "novel" combinator, from the Wikipedia page:
Yk = (L L L L L L L L L L L L L L L L L L L L L L L L L L)
Where:
L = λabcdefghijklmnopqstuvwxyzr. (r (t h i s i s a f i x e d p o i n t c o m b i n a t o r))
How does this work?
| To understand the example of the combinator \( Y_k \) on the Wikipedia page, let's break it down into its components.
### Definitions and Notation:
1. **Combinators**: In the context of the lambda calculus, a combinator is a function with no free variables. The most famous example is the **Y combinator**, which allow... | 10,389 | [
{
"from": "human",
"value": "I understand what a Y Combinator is, but I don't understand this example of a \"novel\" combinator, from the Wikipedia page:\n Yk = (L L L L L L L L L L L L L L L L L L L L L L L L L L)\n\nWhere:\n\n L = λabcdefghijklmnopqstuvwxyzr. (r (t h i s i s a f i x e d p o i n t c o m... |
I have an ArrayList<String> that I'd like to return a copy of. ArrayList has a clone method which has the following signature:
public Object clone()
After I call this method, how do I cast the returned Object back to ArrayList<String>?
| To return a copy of an `ArrayList<String>` using the `clone` method, you will need to cast the returned `Object` back to `ArrayList<String>`. Here’s how you can do that:
1. Call the `clone` method on your `ArrayList<String>`.
2. Cast the returned `Object` to `ArrayList<String>`.
Here is a sample code snippet demonstr... | 13,161 | [
{
"from": "human",
"value": "I have an ArrayList<String> that I'd like to return a copy of. ArrayList has a clone method which has the following signature:\npublic Object clone()\n\nAfter I call this method, how do I cast the returned Object back to ArrayList<String>?\n"
},
{
"from": "gpt",
"va... |
I'm trying to write a query that will pull back the two most recent rows from the Bill table where the Estimated flag is true. The catch is that these need to be consecutive bills.
To put it shortly, I need to enter a row in another table if a Bill has been estimated for the last two bill cycles.
I'd like to do this w... | To achieve the goal of finding two consecutive estimated bills from the `Bills` table without using a cursor, you can use a self-join approach along with common table expressions (CTEs) or subqueries. Here’s an example SQL query that retrieves the two most recent rows where the `Estimated` flag is true and where the ro... | 11,321 | [
{
"from": "human",
"value": "I'm trying to write a query that will pull back the two most recent rows from the Bill table where the Estimated flag is true. The catch is that these need to be consecutive bills. \nTo put it shortly, I need to enter a row in another table if a Bill has been estimated for the l... |
When an application is behind another applications and
I click on my application's taskbar icon, I expect the entire application to
come to the top of the z-order, even if an app-modal, WS_POPUP dialog box is
open.
However, some of the time, for some of my (and others') dialog boxes, only the dialog box comes to the fr... | This behavior you're observing when interacting with taskbar icons and dialog boxes in Windows can indeed be puzzling, especially given that both dialogs seem to have identical characteristics. Let's break down your situation and address some of the specifics you're encountering.
### Taskbar Click Behavior
When you c... | 8,627 | [
{
"from": "human",
"value": "When an application is behind another applications and\nI click on my application's taskbar icon, I expect the entire application to\ncome to the top of the z-order, even if an app-modal, WS_POPUP dialog box is\nopen.\nHowever, some of the time, for some of my (and others') dial... |
I'd like my application to have a full-screen mode. What is the easiest way to do this, do I need a third party library for this or is there something in the JDK that already offers this?
| In Java, you can achieve full-screen mode for your application using the `GraphicsDevice` class from the `java.awt` package, which is part of the Java Development Kit (JDK). This allows you to take advantage of the full-screen capabilities of the operating system without needing a third-party library.
Here's a simple ... | 10,599 | [
{
"from": "human",
"value": "I'd like my application to have a full-screen mode. What is the easiest way to do this, do I need a third party library for this or is there something in the JDK that already offers this?\n"
},
{
"from": "gpt",
"value": "In Java, you can achieve full-screen mode for ... |
I sometimes need to use Visual Studio when I have limited screen real estate (remote desktopping from a laptop for example). It would be really useful to be able to make the currently selected code tab maximise to take the whole screen for a limited time.
Is that possible? Is there a keyboard shortcut?
| Yes, Visual Studio offers a feature that allows you to maximize a document tab to take up the whole screen, which can be very useful when working with limited screen space.
To maximize a code tab (or any document tab), you can use the following keyboard shortcuts:
1. **Maximize the Current Document Window**:
- *... | 14,515 | [
{
"from": "human",
"value": "I sometimes need to use Visual Studio when I have limited screen real estate (remote desktopping from a laptop for example). It would be really useful to be able to make the currently selected code tab maximise to take the whole screen for a limited time. \nIs that possible? I... |
I've used MyGeneration, and I love it for generating code that uses Data Access Applicaiton Blocks from Microsoft for my Data Access Layer, and keeping my database concepts in sync with the domain I am modeling. Although, it took a steeper than expected learning curve one weekend to make it productive.
I'm wondering w... | Code generation can indeed be a powerful tool in software development, helping teams maintain consistency, reduce repetitive tasks, and improve overall productivity. Here are some insights into how developers and organizations are using code generation today:
### Popular Code Generation Tools
1. **MyGeneration**: As y... | 10,631 | [
{
"from": "human",
"value": "I've used MyGeneration, and I love it for generating code that uses Data Access Applicaiton Blocks from Microsoft for my Data Access Layer, and keeping my database concepts in sync with the domain I am modeling. Although, it took a steeper than expected learning curve one weeke... |
Is there an easy way to do any of the following things in awk?
Sorting array/hash by it's data
Sorting a hash by it's string key
| Yes, you can sort arrays (or hashes) in AWK, but AWK does not have built-in sorting functions. However, you can implement sorting logic by using arrays and additional helper functions.
### 1. Sorting an Array by Its Values
If you have a numeric array and you want to sort it by its values, you can do this by using a s... | 6,819 | [
{
"from": "human",
"value": "Is there an easy way to do any of the following things in awk?\n\nSorting array/hash by it's data\nSorting a hash by it's string key\n\n"
},
{
"from": "gpt",
"value": "Yes, you can sort arrays (or hashes) in AWK, but AWK does not have built-in sorting functions. Howe... |
In VisualStudio (Pro 2008), I have just noticed some inconsistent behaviour and wondered if there was any logical reasoning behind it
In a WinForms project, if I use the line
if(myComboBox.Items[i] == myObject)
I get a compiler warning that I might get 'Possible unintended references' as I am comparing type object to ... | The behavior you're observing in Visual Studio 2008 regarding the comparison of objects and interfaces indeed has logical reasoning behind it, mainly tied to how the compiler treats types and comparisons in C#.
### Explanation
1. **Type Comparison**:
When you compare objects of type `object` and a specific type (... | 11,482 | [
{
"from": "human",
"value": "In VisualStudio (Pro 2008), I have just noticed some inconsistent behaviour and wondered if there was any logical reasoning behind it\nIn a WinForms project, if I use the line\nif(myComboBox.Items[i] == myObject)\n\nI get a compiler warning that I might get 'Possible unintended ... |
I'm currently looking for ways to create automated tests for a JAX-RS (Java API for RESTful Web Services) based web service.
I basically need a way to send it certain inputs and verify that I get the expected responses. I'd prefer to do this via JUnit, but I'm not sure how that can be achieved.
What approach do you us... | To create automated tests for a JAX-RS based web service, you can use JUnit in conjunction with a library like Jersey Test Framework, RestAssured, or Mockito, depending on your testing needs. Below, I will outline a few approaches to accomplish this:
### 1. Using Jersey Test Framework
If you are using Jersey (the ref... | 9,758 | [
{
"from": "human",
"value": "I'm currently looking for ways to create automated tests for a JAX-RS (Java API for RESTful Web Services) based web service. \nI basically need a way to send it certain inputs and verify that I get the expected responses. I'd prefer to do this via JUnit, but I'm not sure how tha... |
Someone please correct me if I'm wrong, but parsing a yyyy/MM/dd (or other specific formats) dates in C# should be as easy as
DateTime.ParseExact(theDate, "yyyy/MM/dd");
but no, C# forces you to create an IFormatProvider.
Is there an app.config friendly way of setting this so I don't need to do this each time?
DateTi... | You're correct that parsing dates using `DateTime.ParseExact` in C# can be simplified, but the use of `IFormatProvider` is indeed necessary when you want to ensure that the parsing adheres to specific cultural formatting. However, there are ways to make this more convenient and maintainable without needing to specify t... | 9,260 | [
{
"from": "human",
"value": "Someone please correct me if I'm wrong, but parsing a yyyy/MM/dd (or other specific formats) dates in C# should be as easy as \nDateTime.ParseExact(theDate, \"yyyy/MM/dd\");\n\nbut no, C# forces you to create an IFormatProvider.\nIs there an app.config friendly way of setting th... |
Possible Duplicate:
Combine Gyroscope and Accelerometer Data
I have read a number of papers on Kalman filters, but there seem to be few good publically accessible worked examples of getting from mathematical paper to actual working code.
I have a system containing a three-axis accelerometer and a single gyro measuri... | To address your problem of combining data from a three-axis accelerometer and a single gyroscope, you can indeed use a Kalman filter or complementary filter to estimate orientation and compensate for the gyro bias. Here's a general approach to coding a filter for your scenario.
### Key Steps to Implementing the Filter... | 8,176 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nCombine Gyroscope and Accelerometer Data \n\nI have read a number of papers on Kalman filters, but there seem to be few good publically accessible worked examples of getting from mathematical paper to actual working code.\nI have a system containing a thre... |
I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets for unordered lists are hideous. Customising the rendering seems extremely difficult. Therefore I'm looking for a replacement with better HTML rendering.
Does this exist? (I asked Google, and found nothing except a promising dead lin... | If you're looking for a Java component that offers better HTML rendering than Swing's `JEditorPane`, there are a few alternatives you can consider:
1. **JavaFX WebView**: JavaFX includes a `WebView` component that uses WebKit for rendering HTML. It supports modern HTML and CSS, providing much better support for stylin... | 12,783 | [
{
"from": "human",
"value": "I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets for unordered lists are hideous. Customising the rendering seems extremely difficult. Therefore I'm looking for a replacement with better HTML rendering.\nDoes this exist? (I asked Google, and... |
I have an application that is installed and updated via ClickOnce. The application downloads files via FTP, and therefore needs to be added as an exception to the windows firewall. Because of the way that ClickOnce works, the path to the EXE changes with every update, so the exception needs to change also. What woul... | To handle the situation where a ClickOnce application needs to be added to the Windows Firewall with a dynamic executable path, you can implement a solution that programmatically adds a firewall exception each time the application runs or during its initialization process. Here's how you can approach this:
### Steps t... | 7,979 | [
{
"from": "human",
"value": "I have an application that is installed and updated via ClickOnce. The application downloads files via FTP, and therefore needs to be added as an exception to the windows firewall. Because of the way that ClickOnce works, the path to the EXE changes with every update, so the e... |
I defined a record named log. I want to create an mnesia table with name log_table. When I try to write a record to table, I get bad_type error as follows:
(node1@kitt)4> mnesia:create_table(log_table, [{ram_copies, [node()]},
{attributes, record_info(fields, log)}]).
{at... | The issue you are encountering is related to how the Mnesia table is defined in relation to the record structure you're trying to insert. When you create a Mnesia table, the way you specify the attributes in your table needs to match the way the record is structured.
In your code, you are trying to use `#log{id="hebel... | 10,842 | [
{
"from": "human",
"value": "I defined a record named log. I want to create an mnesia table with name log_table. When I try to write a record to table, I get bad_type error as follows:\n(node1@kitt)4> mnesia:create_table(log_table, [{ram_copies, [node()]}, \n {a... |
Can anyone recommend a book or a website that explains Internet Explorer Automation using VB.NET? I understand that mshtml and ShDocVw.dll can do this, but I need a resource that will explain it to me. I want to read/write values as well as click buttons.
The only book I have come across so far is .Net Test Automation ... | For automating Internet Explorer using VB.NET, you have a few resources that can help you get started with mshtml and ShDocVw.dll, although the landscape around these technologies is somewhat dated given the decline of Internet Explorer.
### Recommended Resources
1. **Books**:
- **".NET Test Automation Recipes"**:... | 10,124 | [
{
"from": "human",
"value": "Can anyone recommend a book or a website that explains Internet Explorer Automation using VB.NET? I understand that mshtml and ShDocVw.dll can do this, but I need a resource that will explain it to me. I want to read/write values as well as click buttons.\nThe only book I have c... |
There are lots of PHP articles about the subject so is this a PHP only problem.
I am sending emails using System.Net.Mail after some regular expression checks of course.
Similar to http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx
| The issue you're experiencing with sending emails is not exclusive to PHP; it can occur in any programming language or framework that interacts with email sending functionalities, including .NET, which uses the `System.Net.Mail` namespace as mentioned in your question.
When sending emails, several common issues can ar... | 13,133 | [
{
"from": "human",
"value": "There are lots of PHP articles about the subject so is this a PHP only problem.\nI am sending emails using System.Net.Mail after some regular expression checks of course.\nSimilar to http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx\n"
},
{
"from": "gpt",
... |
Argghh. I have a site that offers audio previews of songs hosted elsewhere. Some file names have an ampersand in them - see below where it passes "soundFile." Anytime there's an ampersand, Flash can't get the file - I think it drops the filename after the ampersand. It doesn't matter if I pass it as an "&" or an HTML e... | The issue you're encountering with the ampersand (`&`) in your URL is common because the ampersand is used as a delimiter in query strings. When you have an ampersand in a URL, you need to make sure that it is properly encoded so that it is treated as part of the parameter value rather than as a query string separator.... | 12,406 | [
{
"from": "human",
"value": "Argghh. I have a site that offers audio previews of songs hosted elsewhere. Some file names have an ampersand in them - see below where it passes \"soundFile.\" Anytime there's an ampersand, Flash can't get the file - I think it drops the filename after the ampersand. It doesn't... |
Without resorting to PInvoke, is there a way in .net to find out what windows are open? This is slightly different than asking what applications are running in memory. For example, Firefox could be running, but could be more than one window. Basically, I just want to be privy to the same information that the taskbar... | In .NET, particularly in the context of standard managed code, there isn't a direct, built-in way to enumerate open windows or set focus to them without using PInvoke or other interop techniques. However, you can accomplish these tasks by leveraging PInvoke to call the appropriate Windows API functions.
### 1. Enumer... | 8,147 | [
{
"from": "human",
"value": "Without resorting to PInvoke, is there a way in .net to find out what windows are open? This is slightly different than asking what applications are running in memory. For example, Firefox could be running, but could be more than one window. Basically, I just want to be privy... |
The questions says everything, take this example code:
<ul id="css-id">
<li>
<something:CustomControl ID="SomeThingElse" runat="server" />
<something:OtherCustomControl runat="server" />
</li>
</ul>
Now if an error gets thrown somewhere inside these controlls (that are located in a master page) they w... | To catch exceptions thrown by custom server controls in an ASP.NET application, especially when those controls are used within a master page, you can implement several strategies. Below are some approaches you can consider to ensure that an error in one of the controls does not take down the entire site:
### 1. Use `t... | 11,401 | [
{
"from": "human",
"value": "The questions says everything, take this example code: \n<ul id=\"css-id\">\n <li>\n <something:CustomControl ID=\"SomeThingElse\" runat=\"server\" />\n <something:OtherCustomControl runat=\"server\" />\n </li>\n</ul>\n\nNow if an error gets thrown somewhere inside t... |
I am working in Visual Basic 6 and need to sort by multiple columns in a ListView. For example, sorting a list of music tracks by artist, then album, then track number. As far as I know, VB6 does not support this out of the box. Here are the suggestions I have already heard:
Sort the data in a SQL table first and d... | Sorting multiple columns in a ListView control in Visual Basic 6 (VB6) can indeed be a bit tricky, as the ListView control itself does not support multi-column sorting out of the box. However, you can implement a custom sorting mechanism to achieve this.
### Custom Multi-Column Sorting Approach
Here’s a way to implem... | 3,576 | [
{
"from": "human",
"value": "I am working in Visual Basic 6 and need to sort by multiple columns in a ListView. For example, sorting a list of music tracks by artist, then album, then track number. As far as I know, VB6 does not support this out of the box. Here are the suggestions I have already heard:\... |
LRESULT result = ::SendMessage(hWnd, s_MaxGetTaskInterface, (WPARAM)&pUnkReturn, 0);
The value of result after the call is 0
I expect it to return with a valid value of pUnkReturn , but it returns with a NULL value .
Necessary Information before this call :
const UINT CMotionUtils::s_MaxGetTaskInterface = RegisterWi... | Based on the code and information you've provided, it seems you're attempting to use the `SendMessage` function to send a registered message (`s_MaxGetTaskInterface`) to a window (`hWnd`). You expect to receive a pointer to an interface in `pUnkReturn` after this call. However, you're getting a return value of `0`, whi... | 9,818 | [
{
"from": "human",
"value": "LRESULT result = ::SendMessage(hWnd, s_MaxGetTaskInterface, (WPARAM)&pUnkReturn, 0);\n\nThe value of result after the call is 0\nI expect it to return with a valid value of pUnkReturn , but it returns with a NULL value .\nNecessary Information before this call :\nconst UINT CMo... |
Can ANTLR output C# using StringTemplate or any text I want it to like Yacc/Bison or does it only output to java? From the examples I've looked at it appears to be a very java centric tool.
| ANTLR (ANother Tool for Language Recognition) primarily targets Java as its native output language, but it also supports generating code in several other programming languages, including C#.
### C# Target
As of ANTLR version 4, you can generate parsers in C# by specifying the target language when running the ANTLR to... | 6,653 | [
{
"from": "human",
"value": "Can ANTLR output C# using StringTemplate or any text I want it to like Yacc/Bison or does it only output to java? From the examples I've looked at it appears to be a very java centric tool.\n"
},
{
"from": "gpt",
"value": "ANTLR (ANother Tool for Language Recognitio... |
What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a database?
Ideally, this script could be run multiple times, as new tables were added to the database. SQL Server Management Studio generates scripts for... | To grant permissions to a database role on all user tables in a SQL Server database, you can use dynamic SQL to construct and execute the necessary GRANT statements. This approach will allow you to run the script multiple times without needing to modify it, as it will automatically apply to all current user tables.
He... | 12,718 | [
{
"from": "human",
"value": "What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a database?\nIdeally, this script could be run multiple times, as new tables were added to the database. SQL Serv... |
I'm still a little unclear and when to wrap a lock around some code. My general rule-of-thumb is to wrap an operation in a lock when it reads or writes to a static variable. But when a static variable is ONLY read (e.g. it's a readonly that is set during type initialization), accessing it doesn't need to be wrapped in... | Your understanding of when to use locks in multi-threaded scenarios is on the right track, but let's clarify a few points regarding thread safety, particularly for static variables and the examples you provided.
### Read-Only Static Variables
When dealing with static variables that are immutable (read-only), such as ... | 9,852 | [
{
"from": "human",
"value": "I'm still a little unclear and when to wrap a lock around some code. My general rule-of-thumb is to wrap an operation in a lock when it reads or writes to a static variable. But when a static variable is ONLY read (e.g. it's a readonly that is set during type initialization), a... |
I would like to test a function with a tuple from a set of fringe cases and normal values. For example, while testing a function which returns true whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values close-to being overflowed, etc.; what is more... | Generating test cases for a function that checks if three lengths can form a valid triangle can involve a variety of approaches. The triangle inequality theorem states that for three lengths \( a \), \( b \), and \( c \), the following conditions must hold:
1. \( a + b > c \)
2. \( a + c > b \)
3. \( b + c > a \)
To ... | 2,685 | [
{
"from": "human",
"value": "I would like to test a function with a tuple from a set of fringe cases and normal values. For example, while testing a function which returns true whenever given three lengths that form a valid triangle, I would have specific cases, negative / small / large numbers, values clos... |
function returnsAnArray ()
{
return array ('test');
}
echo returnsAnArray ()[0];
generates a syntax error in PHP. What's the most efficient way to directly obtain an element from a returned array without assigning the result to a temp variable?
| In PHP, you can directly obtain an element from a returned array without assigning the result to a temporary variable by using the syntax `function_name()[index]`. However, in your code snippet, there is an extra space before the parentheses when calling the function, which can cause a syntax error.
Here's the correct... | 15,854 | [
{
"from": "human",
"value": "function returnsAnArray ()\n{\n return array ('test');\n}\n\necho returnsAnArray ()[0];\n\ngenerates a syntax error in PHP. What's the most efficient way to directly obtain an element from a returned array without assigning the result to a temp variable?\n"
},
{
"from":... |
Say for instance I was writing a function that was designed to accept multiple argument types:
var overloaded = function (arg) {
if (is_dom_element(arg)) {
// Code for DOM Element argument...
}
};
What's the best way to implement is_dom_element so that it works in a cross-browser, fairly accurate way?
| To implement the `is_dom_element` function in a cross-browser way, you can check the type of the argument against the `Node` interface and also specifically against the `Element` interface, which are both standard in the DOM.
Here's a good way to implement the `is_dom_element` function:
```javascript
function is_dom_... | 12,888 | [
{
"from": "human",
"value": "Say for instance I was writing a function that was designed to accept multiple argument types:\nvar overloaded = function (arg) {\n if (is_dom_element(arg)) {\n // Code for DOM Element argument...\n }\n};\n\nWhat's the best way to implement is_dom_element so that it... |
I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word "dolor" in this text:
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
</p>
<p>
Quisque bibendum sem ut lacus. Integer dolor ullamcorper libero.
Aliquam rhoncus eros at augue.... | Yes, you can certainly use jQuery to highlight a specific word in a block of text. While jQuery does not have a direct method to select and replace text nodes, you can achieve this by iterating through the text nodes and wrapping the specified word in a `<span>` tag.
Here’s an example of how you can do this:
```html
... | 10,433 | [
{
"from": "human",
"value": "I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word \"dolor\" in this text:\n<p>\n Lorem ipsum dolor sit amet, consectetuer adipiscing elit.\n</p>\n<p>\n Quisque bibendum sem ut lacus. Integer dolor ullamc... |
Anyone have any idea? And any open source sofware which also seens to perform this kind of functionality?
| It seems like you are looking for open-source software that offers specific functionality, but you haven't specified what kind of functionality you need. Open-source software can range across a wide variety of categories such as:
1. **Content Management Systems (CMS)**: WordPress, Joomla, Drupal
2. **Data Analysis**: ... | 15,109 | [
{
"from": "human",
"value": "Anyone have any idea? And any open source sofware which also seens to perform this kind of functionality?\n"
},
{
"from": "gpt",
"value": "It seems like you are looking for open-source software that offers specific functionality, but you haven't specified what kind o... |
I am building an MFC application for both XP and Vista. I have Visual Studio 2008 installed on the XP machine but I need to debug the application on Vista. How can I do that? Do I really have to install Visual Studio on a Vista machine?
When using remote debugging I assume that all executable and library files must be ... | Debugging an MFC application across different versions of Windows (like XP and Vista) can be a bit tricky, especially if you want to avoid installing Visual Studio on the Vista machine. Here are some steps and tips to help you get the remote debugging set up:
### Remote Debugging Setup
1. **Remote Debugging Tools**: ... | 10,738 | [
{
"from": "human",
"value": "I am building an MFC application for both XP and Vista. I have Visual Studio 2008 installed on the XP machine but I need to debug the application on Vista. How can I do that? Do I really have to install Visual Studio on a Vista machine?\nWhen using remote debugging I assume that... |
Sometimes we deploy applications behind customer firewall and we need read only access to their DB for debugging issues as sometimes their IT people are not SQL savvy. We want to bundle our application with some web based application that will expose the database and allow us to fire adhoc SQL queries and show their ou... | For your use case, you can consider using an existing web-based database management tool that supports Oracle and provides an interface for executing SQL queries and displaying the results in HTML format. Here are a few options you can explore:
### 1. **Apache Superset**
- **Description**: A modern, enterprise-read... | 12,014 | [
{
"from": "human",
"value": "Sometimes we deploy applications behind customer firewall and we need read only access to their DB for debugging issues as sometimes their IT people are not SQL savvy. We want to bundle our application with some web based application that will expose the database and allow us to... |
So the official XML-RPC standard doesn't support 64-bit values. But in these modern times, 64-bit values are increasingly common.
How do you handle these? What XML-RPC extensions are the most common? What language bindings are there? I'm especially interested in Python and C++, but all information is appreciated.
| You're correct that the official XML-RPC specification only supports 32-bit integers, which can be limiting in modern applications where 64-bit integers are more common due to the need for large numbers. To handle 64-bit values, several approaches and extensions can be employed.
### Handling 64-bit Values in XML-RPC
... | 8,013 | [
{
"from": "human",
"value": "So the official XML-RPC standard doesn't support 64-bit values. But in these modern times, 64-bit values are increasingly common.\nHow do you handle these? What XML-RPC extensions are the most common? What language bindings are there? I'm especially interested in Python and ... |
There are various ways to maintain user state using in web development.
These are the ones that I can think of right now:
Query String
Cookies
Form Methods (Get and Post)
Viewstate (ASP.NET only I guess)
Session (InProc Web server)
Session (Dedicated web server)
Session (Database)
Local Persistence (Google Gears) (tha... | Maintaining user state in web development is crucial for creating a seamless user experience. The choice of method to use largely depends on the specific requirements of your application, such as security, scalability, usability, and performance. Below are some general recommendations and considerations for each method... | 9,082 | [
{
"from": "human",
"value": "There are various ways to maintain user state using in web development.\nThese are the ones that I can think of right now:\n\nQuery String\nCookies\nForm Methods (Get and Post)\nViewstate (ASP.NET only I guess)\nSession (InProc Web server)\nSession (Dedicated web server)\nSessio... |
Some programming languages such as Java and C# include encryption packages in their standard libraries. Others such as Python and Ruby make you download third-party modules to do strong encryption. I assume that this is for legal reasons; perhaps Sun Microsystems has enough lawyers that they aren't afraid of getting ... | The legal landscape surrounding encryption has evolved significantly since the 1990s, when many programming languages were first being developed and the availability of strong encryption was more contentious. There are a few key points to consider regarding the inclusion of encryption in programming languages' standard... | 9,032 | [
{
"from": "human",
"value": "Some programming languages such as Java and C# include encryption packages in their standard libraries. Others such as Python and Ruby make you download third-party modules to do strong encryption. I assume that this is for legal reasons; perhaps Sun Microsystems has enough la... |
I am trying to deploy our eRCP (embedded Rich Client Platform) application on a Windows CE5 Professional device. While the eRCP demo applications work fine on the J9 VM upon starting our application I get the following exception:
!ENTRY org.eclipse.osgi 4 0 2008-09-24 11:01:15.088
!MESSAGE An error occurred while autom... | The `UnsatisfiedLinkError` you're encountering indicates that the Java Virtual Machine (JVM) is having difficulty loading the native library (`eswt-converged.dll`). The specific error message "Operation Failed: 14" can indeed be confusing, but it usually suggests an issue related to the environment or compatibility of ... | 10,761 | [
{
"from": "human",
"value": "I am trying to deploy our eRCP (embedded Rich Client Platform) application on a Windows CE5 Professional device. While the eRCP demo applications work fine on the J9 VM upon starting our application I get the following exception:\n!ENTRY org.eclipse.osgi 4 0 2008-09-24 11:01:15.... |
Within SQL Server Integration Services (SSIS) there is the ability to setup a connection to a flat file that can hold millions of records and have that data pushed to a SQL DB. Furthermore, this process can be called from a C# app by referencing and using the Microsoft.SqlServer.Dts.Runtime namespace.
Would a flat fil... | In your scenario of loading a flat file with millions of records into a SQL Server database, using SQL Server Integration Services (SSIS) would generally be the preferred approach for several reasons:
### Advantages of SSIS:
1. **Performance**: As indicated by the timings you've shared, SSIS is designed for high-perf... | 12,351 | [
{
"from": "human",
"value": "Within SQL Server Integration Services (SSIS) there is the ability to setup a connection to a flat file that can hold millions of records and have that data pushed to a SQL DB. Furthermore, this process can be called from a C# app by referencing and using the Microsoft.SqlServer... |
I want to compare 2 arrays of objects in JavaScript code. The objects have 8 total properties, but each object will not have a value for each, and the arrays are never going to be any larger than 8 items each, so maybe the brute force method of traversing each and then looking at the values of the 8 properties is the ... | If you're looking to compare two arrays of objects based on their properties in JavaScript, there are a few ways you can approach it. Since the arrays won't be larger than 8 items, performance isn't a major concern, so a straightforward solution should suffice. Below are a couple of approaches you might consider:
### ... | 8,736 | [
{
"from": "human",
"value": "I want to compare 2 arrays of objects in JavaScript code. The objects have 8 total properties, but each object will not have a value for each, and the arrays are never going to be any larger than 8 items each, so maybe the brute force method of traversing each and then looking ... |
I've got such a simple code:
<div class="div1">
<div class="div2">Foo</div>
<div class="div3">
<div class="div4">
<div class="div5">
Bar
</div>
</div>
</div>
</div>
and this CSS:
.div1{
position: relative;
}
.div1 .div3 {
position: absolute;
top: 30px;
left: 0px;
wid... | The behavior you are encountering is due to how the hover state is managed in Internet Explorer 7 (IE7). The issue arises because when you move the cursor from `.div2` to `.div3`, it is possible that the mouse leaves the bounds of the `.div1` container, causing the hover state to disable.
In IE7, if the `display` prop... | 11,513 | [
{
"from": "human",
"value": "I've got such a simple code:\n<div class=\"div1\">\n <div class=\"div2\">Foo</div>\n <div class=\"div3\">\n <div class=\"div4\">\n <div class=\"div5\">\n Bar\n </div> \n </div>\n </div>\n</div>\n\nand this CSS:\n.div1{\n position: relative;\n}\n... |
Just found this out, so i am answering my own question :)
Use a comma where you would normally use a colon. This can be a problem for named instances, as you seem to need to specify the port even if it is the default port 1433.
Example:
Provider=SQLOLEDB;Data Source=192.168.200.123,1433; Initial Catalog=Northwind; User... | It looks like you’re clarifying the syntax for connecting to a SQL Server database using a connection string, specifically addressing how to specify the port for the database. In your example, you are correctly using a comma to separate the IP address from the port number.
Just to summarize:
- **Data Source format**... | 15,380 | [
{
"from": "human",
"value": "Just found this out, so i am answering my own question :)\nUse a comma where you would normally use a colon. This can be a problem for named instances, as you seem to need to specify the port even if it is the default port 1433.\nExample:\nProvider=SQLOLEDB;Data Source=192.168.2... |
Is there any way to get Python to use my ActiveTcl installation instead of having to copy the ActiveTcl libraries into the Python/tcl directory?
| Yes, you can configure Python to use your ActiveTcl installation without having to copy the ActiveTcl libraries into the Python `tcl` directory. This involves setting the `TCL_LIBRARY` and `TK_LIBRARY` environment variables to point to the ActiveTcl installation. Here’s how you can do it:
### Step-by-Step Instructions... | 12,626 | [
{
"from": "human",
"value": "Is there any way to get Python to use my ActiveTcl installation instead of having to copy the ActiveTcl libraries into the Python/tcl directory?\n"
},
{
"from": "gpt",
"value": "Yes, you can configure Python to use your ActiveTcl installation without having to copy t... |
I try to fetch a Wikipedia article with Python's urllib:
f = urllib.urlopen("http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes")
s = f.read()
f.close()
However instead of the html page I get the following response: Error - Wikimedia Foundation:
Request: GET http://en.wikipedia.org/w/in... | The error you're encountering indicates that Wikipedia is blocking requests that do not appear to come from a standard web browser. To work around this, you can modify your request to include a `User-Agent` header, which helps to identify the source of the request. This way, you can simulate a browser request.
Here is... | 12,789 | [
{
"from": "human",
"value": "I try to fetch a Wikipedia article with Python's urllib:\nf = urllib.urlopen(\"http://en.wikipedia.org/w/index.php?title=Albert_Einstein&printable=yes\") \ns = f.read()\nf.close()\n\nHowever instead of the html page I get the following response: Error - Wikimedia Found... |
What are the steps required to enable Hibernate's second-level cache, when using the Java Persistence API (annotated entities)? How do I check that it's working? I'm using JBoss 4.2.2.GA.
From the Hibernate documentation, it seems that I need to enable the cache and specify a cache provider in persistence.xml, like:
<p... | To enable Hibernate's second-level cache while using the Java Persistence API (JPA) with annotated entities, you'll need to follow several steps. Here's a comprehensive guide:
### Steps to Enable Second-Level Cache
1. **Add Hibernate Configuration to `persistence.xml`:**
You've already identified the necessary pro... | 7,058 | [
{
"from": "human",
"value": "What are the steps required to enable Hibernate's second-level cache, when using the Java Persistence API (annotated entities)? How do I check that it's working? I'm using JBoss 4.2.2.GA.\nFrom the Hibernate documentation, it seems that I need to enable the cache and specify a c... |
It's not a matter of life or death but I wonder if this could be possible:
I got a couple of events from one type of custom event (FormEvent) now I got a FormListener that listens to all those events and handles them according to the event type. Instead of adding one eventListener at the time I wish to add all events a... | In ActionScript 3 (AS3), you can't directly add an event listener to multiple events using a wildcard like `FormEvent.*`. However, you can simplify your event listener setup by creating an array of the events you want to listen to and then looping through that array to add the listeners. This achieves a similar result ... | 13,735 | [
{
"from": "human",
"value": "It's not a matter of life or death but I wonder if this could be possible:\nI got a couple of events from one type of custom event (FormEvent) now I got a FormListener that listens to all those events and handles them according to the event type. Instead of adding one eventListe... |
Friends/family/etc ask me what I do and it always causes me pause while I think of how to explain it. They know what a software developer is but how can I explain what SCM is in 10 words?
| "SCM manages software development processes, ensuring version control and collaboration." | 16,634 | [
{
"from": "human",
"value": "Friends/family/etc ask me what I do and it always causes me pause while I think of how to explain it. They know what a software developer is but how can I explain what SCM is in 10 words?\n"
},
{
"from": "gpt",
"value": "\"SCM manages software development processes, ... |
Here's what I am trying to do:
typedef enum { ONE, TWO, THREE } Numbers;
I am trying to write a function that would do a switch case similar to the following:
char num_str[10];
int process_numbers_str(Numbers num) {
switch(num) {
case ONE:
case TWO:
case THREE:
{
strcpy(num_str, num); //some... | In C, enums are simply integer constants, and you can't directly obtain the name of an enum constant as a string. However, you can create a mapping between the enum values and their corresponding string representations.
One common approach is to create a function that returns the string equivalent of the enum value. ... | 13,171 | [
{
"from": "human",
"value": "Here's what I am trying to do: \ntypedef enum { ONE, TWO, THREE } Numbers;\n\nI am trying to write a function that would do a switch case similar to the following: \nchar num_str[10];\nint process_numbers_str(Numbers num) {\n switch(num) {\n case ONE:\n case TWO:\n ca... |
In a server-side application running on Tomcat, I am generating full HTML pages (with header) based on random user-requested sites pulled down from the Internet. The client-side application uses asynchronous callbacks for requesting processing of a particular web page. Since processing can take a while, I want to infor... | Your approach of using a caching database (caching-DB) to store the processed HTML content is a viable solution. This can help you avoid the overhead of creating and managing temporary files, while also enabling you to efficiently retrieve the processed HTML when needed. Here are some suggestions and considerations tha... | 6,682 | [
{
"from": "human",
"value": "In a server-side application running on Tomcat, I am generating full HTML pages (with header) based on random user-requested sites pulled down from the Internet. The client-side application uses asynchronous callbacks for requesting processing of a particular web page. Since pro... |
What advantage, if any, is provided by formatting C code as follows:
while(lock_file(lockdir)==0)
{
count++;
if(count==20)
{
fprintf(stderr,"Can't lock dir %s\n",lockdir);
exit(1);
}
sleep(3);
}
if(rmdir(serverdir)!=0)
{
switch(errno)
{
case EE... | The main difference between the two formatting styles you provided lies in how they visually represent code blocks. The first style uses a line-by-line format for control structures, while the second uses braces (`{}`) to denote the beginning and end of those structures on the same line.
### Advantages of Each Style
... | 11,926 | [
{
"from": "human",
"value": "What advantage, if any, is provided by formatting C code as follows:\nwhile(lock_file(lockdir)==0)\n {\n count++;\n if(count==20)\n {\n fprintf(stderr,\"Can't lock dir %s\\n\",lockdir);\n exit(1);\n }\n sleep(3);\n }\nif(rmdir(serverdir... |
How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string?
Ex:
User: "abd"
Program:abdicate, abdomen, abduct...
Thanks!
Edit: I'm using python, but I assume that this is a fairly language-independent problem.
| Certainly! You can achieve this in Python by leveraging a word list (dictionary) and filtering out words that start with the user's input string. Here's a step-by-step guide, along with a sample implementation:
### Step-by-Step Approach
1. **Get User Input**: Prompt the user to enter a string.
2. **Load a Word List**... | 10,266 | [
{
"from": "human",
"value": "How would a go about making a program where the user enters a string, and the program generates a list of words beginning with that string?\nEx:\nUser: \"abd\"\nProgram:abdicate, abdomen, abduct...\nThanks!\n\nEdit: I'm using python, but I assume that this is a fairly language-... |
Wanted to convert
<br/>
<br/>
<br/>
<br/>
<br/>
into
<br/>
| To convert multiple line breaks (`<br/>`) into a single line break, you can simply replace all occurrences of multiple `<br/>` tags with a single `<br/>`. In HTML, you can achieve this with a simple JavaScript function or by using regular expressions in a programming language. Here's an example in JavaScript:
```javas... | 14,528 | [
{
"from": "human",
"value": "Wanted to convert\n<br/>\n<br/>\n<br/>\n<br/>\n<br/>\n\ninto\n<br/>\n\n"
},
{
"from": "gpt",
"value": "To convert multiple line breaks (`<br/>`) into a single line break, you can simply replace all occurrences of multiple `<br/>` tags with a single `<br/>`. In HTML, ... |
If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?
If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?
sorry if this is a dumb question... | It's not a dumb question at all! In fact, it's a great topic to explore, especially as it relates to concurrency in Python and the implications of the Global Interpreter Lock (GIL).
### Understanding the GIL
In CPython (the most common implementation of Python), the GIL is a mutex that protects access to Python objec... | 9,386 | [
{
"from": "human",
"value": "If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?\nIf the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to... |
Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says "locked by 'Ant Buildfile' content type.
The run-as menu is broken. Even if the editor association works run-as doesn't.
The ant bu... | It sounds like you're facing some issues with Eclipse 3.3.2 and MyEclipse when it comes to recognizing Ant build files that don't follow the default naming convention of `build.xml`. Here are some suggestions to troubleshoot and resolve the problem:
### 1. Check Editor Associations:
Make sure the editor is correctly a... | 9,865 | [
{
"from": "human",
"value": "Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says \"locked by 'Ant Buildfile' content type.\nThe run-as menu is broken. Even if the editor a... |
I have an Internet Explorer Browser Helper Object (BHO), written in c#, and in various places I open forms as modal dialogs. Sometimes this works but in some cases it doesn't. The case that I can replicate at present is where IE is running javascript to open other child windows... I guess it's getting a bit confused so... | To create a modal dialog in a Browser Helper Object (BHO) that works correctly even when Internet Explorer is busy with JavaScript, you need to ensure that the form is owned by the correct window. In Windows Forms, modal forms can only be shown in relation to their parent forms, which means you need to pass the correct... | 11,395 | [
{
"from": "human",
"value": "I have an Internet Explorer Browser Helper Object (BHO), written in c#, and in various places I open forms as modal dialogs. Sometimes this works but in some cases it doesn't. The case that I can replicate at present is where IE is running javascript to open other child windows.... |
From PyPubSub:
Pypubsub provides a simple way for
your Python application to decouple
its components: parts of your
application can publish messages (with
or without data) and other parts can
subscribe/receive them. This allows
message "senders" and message
"listeners" to be unaware of each
other:
one... | When it comes to Python modules for implementing the publish/subscribe pattern, several options are available, each with its own set of advantages and disadvantages. Below is a comparison of some popular libraries, including PyPubSub, PyDispatcher, and a few others. While specific benchmarks may not always be publicly ... | 9,315 | [
{
"from": "human",
"value": "From PyPubSub:\n\nPypubsub provides a simple way for\n your Python application to decouple\n its components: parts of your\n application can publish messages (with\n or without data) and other parts can\n subscribe/receive them. This allows\n message \"senders\" and messag... |
I want to add a comma in the thousands place for a number.
Would String.Format() be the correct path to take? What format would I use?
| Yes, using `String.Format()` is a good way to format a number with a comma in the thousands place in C#. You can use the format specifier `N` for this purpose. Here’s how you can do it:
### Example:
```csharp
int number = 1234567;
string formattedNumber = String.Format("{0:N0}", number);
Console.WriteLine(formattedNu... | 14,563 | [
{
"from": "human",
"value": "I want to add a comma in the thousands place for a number.\nWould String.Format() be the correct path to take? What format would I use?\n"
},
{
"from": "gpt",
"value": "Yes, using `String.Format()` is a good way to format a number with a comma in the thousands place ... |
I'm trying to get IKVM to build (see this question) but now have encountered a problem not having to do with IKVM so I'm opening up a new question:
When running nant on the IKVM directory with the Visual Studio 2008 Command Prompt (from the Start Menu), I get the following error:
ikvm-native-win32:
... | It looks like you've already identified the solution to your problem with the missing `windows.h` file during the compilation process. To recap and clarify for others who may encounter a similar issue:
When you receive an error like:
```
fatal error C1083: Cannot open include file: 'windows.h': No such file or direct... | 12,396 | [
{
"from": "human",
"value": "I'm trying to get IKVM to build (see this question) but now have encountered a problem not having to do with IKVM so I'm opening up a new question:\nWhen running nant on the IKVM directory with the Visual Studio 2008 Command Prompt (from the Start Menu), I get the following erro... |
We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much embraced the current webMVC pattern that is... | Both paths you’re considering for modernizing your Classic ASP application have their merits and challenges. Let’s break them down further to help you make an informed decision.
### Path 1: Porting to Classic ASP with JScript
**Pros:**
- **Incremental Transition:** By transitioning to JScript and maintaining Classic ... | 8,020 | [
{
"from": "human",
"value": "We are mainting a web application that is built on Classic ASP using VBScript as the primary language. We are in agreement that our backend (framework if you will) is out dated and doesn't provide us with the proper tools to move forward in a quick manner. We have pretty much em... |
I know that the #warning directive is not standard C/C++, but several compilers support it, including gcc/g++. But for those that don't support it, will they silently ignore it or will it result in a compile failure? In other words, can I safely use it in my project without breaking the build for compilers that don't... | The `#warning` directive is indeed non-standard, but it is supported by several compilers, including GCC and Clang. For compilers that do not support the `#warning` directive, the behavior can vary, but generally, the directive will be ignored rather than causing a compile failure.
In most cases, non-standard directiv... | 14,788 | [
{
"from": "human",
"value": "I know that the #warning directive is not standard C/C++, but several compilers support it, including gcc/g++. But for those that don't support it, will they silently ignore it or will it result in a compile failure? In other words, can I safely use it in my project without br... |
I wanted to "emulate" a popular flash game, Chrontron, in C++ and needed some help getting started. (NOTE: Not for release, just practicing for myself)
Basics:
Player has a time machine. On each iteration of using the time machine, a parallel state
is created, co-existing with a previous state. One of the states must ... | It sounds like an exciting project! Let's break down your questions and provide guidance on how to get started with your C++ game that emulates the mechanics of Chronotron.
### Data Structures
1. **Linked Lists vs. Hash Maps**:
- A linked list could work for maintaining a sequence of game states since you may wa... | 8,553 | [
{
"from": "human",
"value": "I wanted to \"emulate\" a popular flash game, Chrontron, in C++ and needed some help getting started. (NOTE: Not for release, just practicing for myself)\n\nBasics:\nPlayer has a time machine. On each iteration of using the time machine, a parallel state\nis created, co-existing... |
I have a document library with about 50 available content types. This document library is divided into several folders. When a user cliks the "New" button in a folder, all available content types are offered. I need to limit the content types according to the folder. For example, in the folder "Legal" a want to have o... | It looks like you're trying to limit the content types available in a specific folder of a SharePoint document library by using the `UniqueContentTypeOrder` property of the `SPFolder` object. However, the `UniqueContentTypeOrder` property doesn't work as you might expect when setting it directly on a folder. Instead, y... | 8,650 | [
{
"from": "human",
"value": "I have a document library with about 50 available content types. This document library is divided into several folders. When a user cliks the \"New\" button in a folder, all available content types are offered. I need to limit the content types according to the folder. For exam... |
I'm trying to write a piece of code that will do the following:
Take the numbers 0 to 9 and assign one or more letters to this number. For example:
0 = N,
1 = L,
2 = T,
3 = D,
4 = R,
5 = V or F,
6 = B or P,
7 = Z,
8 = H or CH or J,
9 = G
When I have a code like 0123, it's an easy job to encode it. It will obviously ma... | To accomplish your goal of converting numeric codes to their corresponding letter combinations in PHP, you'll want to generate all the possible combinations based on the mapping you've established. This is essentially a problem of generating Cartesian products of lists.
Here's a step-by-step outline of how you could i... | 10,288 | [
{
"from": "human",
"value": "I'm trying to write a piece of code that will do the following:\nTake the numbers 0 to 9 and assign one or more letters to this number. For example:\n0 = N,\n1 = L,\n2 = T,\n3 = D,\n4 = R,\n5 = V or F,\n6 = B or P,\n7 = Z,\n8 = H or CH or J,\n9 = G\n\nWhen I have a code like 012... |
Here's the last few frames of a typical Ruby on Rails traceback:
And here are the last few frames of a typical Nevow traceback in Python:
It's not just the web environment either, you can make similar comparisons between ipython and irb. How can I get more of these sorts of details in Ruby?
| To gain more detailed information during debugging in Ruby, especially within a Ruby on Rails application, you can utilize several techniques and tools that enhance the stack trace and error reporting.
Here are some strategies to obtain more detailed information similar to what you might find in a Python Nevow traceba... | 7,186 | [
{
"from": "human",
"value": "Here's the last few frames of a typical Ruby on Rails traceback:\n\nAnd here are the last few frames of a typical Nevow traceback in Python:\n\nIt's not just the web environment either, you can make similar comparisons between ipython and irb. How can I get more of these sorts ... |
I am trying to replace the current selection in Word (2003/2007) by some RTF string stored in a variable.
Here is the current code:
Clipboard.SetText(strRTFString, TextDataFormat.Rtf)
oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0)
Is there any way to do the same thing without going through the clipboard... | In Word 2003/2007, manipulating the clipboard can be a bit cumbersome, especially if you want to avoid interfering with the user's clipboard data. Unfortunately, Word does not provide a direct method to insert RTF strings without using the clipboard. However, you can temporarily store the clipboard contents, perform yo... | 5,285 | [
{
"from": "human",
"value": "I am trying to replace the current selection in Word (2003/2007) by some RTF string stored in a variable.\nHere is the current code:\nClipboard.SetText(strRTFString, TextDataFormat.Rtf)\noWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0)\n\nIs there any way to do the ... |
I am planning to create a web app that allows users to downgrade their visual studio project files. However, It seems Google App Engine accepts files uploading and flat file storing on the Google Server through db.TextProperty and db.BlobProperty.
I'll be glad anyone can provide code sample (both the client and the ser... | Creating a web app that allows users to upload files and store them in Google App Engine using `db.TextProperty` and `db.BlobProperty` involves a few steps. Below is a simplified example to get you started.
### Step 1: Set up your environment
1. **Install Google Cloud SDK**: Make sure you have the Google Cloud SDK in... | 6,683 | [
{
"from": "human",
"value": "I am planning to create a web app that allows users to downgrade their visual studio project files. However, It seems Google App Engine accepts files uploading and flat file storing on the Google Server through db.TextProperty and db.BlobProperty.\nI'll be glad anyone can provid... |
(MFC Question) What's the best way to determine the current displayed client area in a CScrollView? I only need the size of the visible portion, so GetClientRect() won't work here.
| To determine the size of the currently displayed client area in a `CScrollView`, you should use the `GetScrollPosition()` and `GetClientRect()` methods in conjunction with `GetScrollLimits()` to take into account the scrollable area. Here’s how you can do it:
1. **Get the current scroll position** using `GetScrollPosi... | 13,197 | [
{
"from": "human",
"value": "(MFC Question) What's the best way to determine the current displayed client area in a CScrollView? I only need the size of the visible portion, so GetClientRect() won't work here.\n"
},
{
"from": "gpt",
"value": "To determine the size of the currently displayed cli... |
What's the best way to import/export app internal settings into a file from within an app?
I have the Settings.settings file, winform UI tied to the settings file, and I want to import/export settings, similar to Visual Studio Import/Export Settings feature.
| To implement an import/export feature for your application settings in a WinForms app, you'll want to serialize your settings to a file and deserialize them back when importing. Below are the steps to achieve this using XML serialization, which is straightforward and human-readable. You can also consider JSON serializa... | 6,771 | [
{
"from": "human",
"value": "What's the best way to import/export app internal settings into a file from within an app?\nI have the Settings.settings file, winform UI tied to the settings file, and I want to import/export settings, similar to Visual Studio Import/Export Settings feature. \n"
},
{
"f... |
I have a .net assembly that has a COM+ ServicedCopmonent in it and at the moment I install it into the GAC to get everything working. This means that I need to have every assembly that it references in the GAC as well.
During development it is quite painful to make changes to thes assemblies, re-install them to the GA... | Yes, it is possible to develop a .NET COM+ Serviced Component without requiring all dependent assemblies to be installed in the Global Assembly Cache (GAC). While installing components in the GAC is common for deployed applications, especially when using COM+, it can indeed complicate the development process.
Here are... | 12,730 | [
{
"from": "human",
"value": "I have a .net assembly that has a COM+ ServicedCopmonent in it and at the moment I install it into the GAC to get everything working. This means that I need to have every assembly that it references in the GAC as well.\nDuring development it is quite painful to make changes to ... |
How do I target .NET 3.5 alone after installing SP1 in VS2008? This is because VS 2008 lists only .NET 3.5, .NET 3.0 & .NET 2.0 and does not specifically show .NET 3.5 SP1.
| Visual Studio 2008 does not differentiate between .NET Framework 3.5 and .NET Framework 3.5 SP1 in the project targeting options. When you install Service Pack 1 (SP1) for .NET Framework 3.5, it updates the framework, but the project properties will still list it as simply ".NET Framework 3.5".
If you want to target .... | 12,823 | [
{
"from": "human",
"value": "How do I target .NET 3.5 alone after installing SP1 in VS2008? This is because VS 2008 lists only .NET 3.5, .NET 3.0 & .NET 2.0 and does not specifically show .NET 3.5 SP1.\n"
},
{
"from": "gpt",
"value": "Visual Studio 2008 does not differentiate between .NET Frame... |
I am trying to create a Task Scheduler task to start my SQL Server 2005 instance every morning, because something stops it every night. This is a temporary solution until I can diagnose the stoppage.
I created a task to run under my admin user, and to start the program, cmd with the arguments /c net start mssqlserver.... | It sounds like you're on the right track to create a scheduled task to start your SQL Server instance, but the error code you're seeing indicates that the command is not executing successfully when run through Task Scheduler. Let's break down the potential reasons and some suggestions to help you resolve the issue.
##... | 10,821 | [
{
"from": "human",
"value": "I am trying to create a Task Scheduler task to start my SQL Server 2005 instance every morning, because something stops it every night. This is a temporary solution until I can diagnose the stoppage.\nI created a task to run under my admin user, and to start the program, cmd wi... |
I have been mulling over writing a peak-fitting library for a while. I know Python fairly well and plan on implementing everything in Python to begin with but envisage that I may have to re-implement some core routines in a compiled language eventually.
IIRC, one of Python's original remits was as a prototyping languag... | Designing a peak-fitting library in Python with the intention of later interfacing it with a compiled language involves a few considerations. Here's a breakdown of what you should keep in mind and how different libraries and tools can help you manage the interface between Python and compiled code.
### 1. Function and ... | 6,068 | [
{
"from": "human",
"value": "I have been mulling over writing a peak-fitting library for a while. I know Python fairly well and plan on implementing everything in Python to begin with but envisage that I may have to re-implement some core routines in a compiled language eventually.\nIIRC, one of Python's or... |
I use the right button>Refactor>Encapsultate field to have my accessor every time. The problem is when I create new class, I can have more than 10 attributes and it's long to do 1 by 1 every accessor. Is there a faster way to create them?
Thank you for your time.
| Yes, many modern IDEs offer features that can help you generate getters and setters more efficiently, especially when you have multiple fields in a class. Here are a few general strategies depending on the IDE you are using:
### 1. **Using IDE Features**
- **IntelliJ IDEA**: You can use the "Code Generation" feature. ... | 11,375 | [
{
"from": "human",
"value": "I use the right button>Refactor>Encapsultate field to have my accessor every time. The problem is when I create new class, I can have more than 10 attributes and it's long to do 1 by 1 every accessor. Is there a faster way to create them?\nThank you for your time.\n"
},
{
... |
From C# on a Windows box, is there a way to find out how a process was stopped?
I've had a look at the Process class, managed to get a nice friendly callback from the Exited event once I set EnableRaisingEvents = true; but I have not managed to find out whether the process was killed or whether it exited naturally?
| In C#, when you use the `Process` class and subscribe to the `Exited` event, you can determine if a process was stopped or exited, but unfortunately, the `Process` class does not provide detailed information about how the process exited (whether it was killed or exited naturally) directly.
However, there are some work... | 9,669 | [
{
"from": "human",
"value": "From C# on a Windows box, is there a way to find out how a process was stopped? \nI've had a look at the Process class, managed to get a nice friendly callback from the Exited event once I set EnableRaisingEvents = true; but I have not managed to find out whether the process was... |
Several questions about functional programming languages have got me thinking about whether XSLT is a functional programming language. If not, what features are missing? Has XSLT 2.0 shortened or closed the gap?
| XSLT (eXtensible Stylesheet Language Transformations) is primarily a declarative language designed for transforming XML documents. While it has some characteristics associated with functional programming languages, it is not considered a pure functional programming language.
### Features Common in Functional Programmi... | 8,192 | [
{
"from": "human",
"value": "Several questions about functional programming languages have got me thinking about whether XSLT is a functional programming language. If not, what features are missing? Has XSLT 2.0 shortened or closed the gap?\n"
},
{
"from": "gpt",
"value": "XSLT (eXtensible Style... |
I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5
| To extend a virtual hard disk in VMware Workstation 6.0.5, you need to follow these steps. Please note that VMware Workstation 6.0.5 is quite an old version, so the user interface may differ from newer versions, but the general process will be similar.
### Step 1: Back Up Your Virtual Machine
Before making any changes... | 11,631 | [
{
"from": "human",
"value": "I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5\n"
},
{
"from": "gpt",
"value": "To extend a virtual hard disk in VMware Workstation 6.0... |
If I have a table in MySQL which represents a base class, and I have a bunch of tables which represent the fields in the derived classes, each of which refers back to the base table with a foreign key, is there any way to get MySQL to enforce the one-to-one relationship between the derived table and the base table, or ... | To enforce a one-to-one relationship between your base table (`product`) and its derived tables (`product_cd` and `product_dvd`), you can utilize a combination of unique constraints and triggers, as MySQL does not directly support this kind of constraint natively. Below are the detailed explanations and implementations... | 8,089 | [
{
"from": "human",
"value": "If I have a table in MySQL which represents a base class, and I have a bunch of tables which represent the fields in the derived classes, each of which refers back to the base table with a foreign key, is there any way to get MySQL to enforce the one-to-one relationship between ... |
Is there a way to reload an entire frameset using Javascript onload() event?
function logout() {
/* ... */
// reload entire frame
top.location.reload();
}
<body onload="logout()">
This cause all frames to reload but the URL of the frame where this was called didn't changed to the URL specified in the fram... | If you want to reload an entire frameset and ensure that the URL of the main frameset (parent) reflects the URL of the loaded frame, you can manipulate the `top` property to change the location of the main frameset. However, using `top.location.reload();` will reload the entire frameset without changing its URL.
To ac... | 11,878 | [
{
"from": "human",
"value": "Is there a way to reload an entire frameset using Javascript onload() event?\nfunction logout() {\n /* ... */\n // reload entire frame\n top.location.reload();\n}\n\n<body onload=\"logout()\">\n\nThis cause all frames to reload but the URL of the frame where this was ca... |
I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I only took Maths through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors, quaternions, matrices, etc. My real pr... | It's great to hear that you're interested in learning about rigid body dynamics for implementing a 3D physics engine! Given your background in 3D development and familiarity with vectors, quaternions, and matrices, you have a solid foundation to build on. Here are some references that should help you understand rigid b... | 10,997 | [
{
"from": "human",
"value": "I'm not a math guy in the least but I'm interested in learning about rigid body physics (for the purpose of implementing a basic 3d physics engine). In school I only took Maths through Algebra II, but I've done 3d dev for years so I have a fairly decent understanding of vectors... |
I am introducing automated integration testing to a mature application that until now has only been manually tested.
The app is Windows based and talks to a MySQL database.
What is the best way (including details of any tools recommended) to keep tests independent of each other in terms of the database transactions tha... | Introducing automated integration testing to a mature application requires careful planning, especially when managing dependencies like a MySQL database. To keep tests independent of each other and to ensure that they do not interfere with one another, you can follow these best practices:
### 1. **Use Transaction Mana... | 6,006 | [
{
"from": "human",
"value": "I am introducing automated integration testing to a mature application that until now has only been manually tested.\nThe app is Windows based and talks to a MySQL database.\nWhat is the best way (including details of any tools recommended) to keep tests independent of each othe... |
Suppose I have a stored procedure that manages its own transaction
CREATE PROCEDURE theProc
AS
BEGIN
BEGIN TRANSACTION
-- do some stuff
IF @ThereIsAProblem
ROLLBACK TRANSACTION
ELSE
COMMIT TRANSACTION
END
If I call this proc from an existing transaction, the proc can ROLLBACK the external transaction.... | To properly scope transactions in your stored procedure so that it does not affect the transaction scope of an external caller, you can use the concept of a savepoint within the stored procedure. Here's how to modify your stored procedure accordingly:
1. **Use a savepoint**: Instead of starting a transaction directly,... | 10,766 | [
{
"from": "human",
"value": "Suppose I have a stored procedure that manages its own transaction\nCREATE PROCEDURE theProc\nAS\nBEGIN\n\n BEGIN TRANSACTION\n\n-- do some stuff\n\n IF @ThereIsAProblem\n ROLLBACK TRANSACTION\n ELSE\n COMMIT TRANSACTION\nEND\n\nIf I call this proc from an existing tran... |
How do I handle the window close event (user clicking the 'X' button) in a Python Tkinter program?
| In a Python Tkinter program, you can handle the window close event (when the user clicks the 'X' button) by binding a function to the window's protocol for the 'WM_DELETE_WINDOW' event. This allows you to define custom behavior when the window is closed, such as prompting the user for confirmation before closing.
Here... | 9,777 | [
{
"from": "human",
"value": "How do I handle the window close event (user clicking the 'X' button) in a Python Tkinter program?\n"
},
{
"from": "gpt",
"value": "In a Python Tkinter program, you can handle the window close event (when the user clicks the 'X' button) by binding a function to the w... |
We started some overseas merge replication 1 year ago and everything is going fine till now. My problem is that we have now so much data in our system that any crash on one of the subscriber's servers will be a disaster: reinitialising a subscription the standard way will take days (our connexions are definitely slow, ... | Your situation with overseas merge replication and the challenges of reinitializing a subscriber due to large volumes of data is quite common in scenarios where slow and expensive connections are a factor. Let's evaluate the two approaches you've outlined:
### 1. Copying the Original Database:
- **Pros**:
- This met... | 10,682 | [
{
"from": "human",
"value": "We started some overseas merge replication 1 year ago and everything is going fine till now. My problem is that we have now so much data in our system that any crash on one of the subscriber's servers will be a disaster: reinitialising a subscription the standard way will take d... |
I've seen questions for doing the reverse, but I have an 800MB PostgreSQL database that needs to be converted to MySQL. I'm assuming this is possible (all things are possible!), and I'd like to know the most efficient way of going about this and any common mistakes there are to look out for. I have next to no experienc... | Converting a PostgreSQL database to MySQL can be a complex task, but it is definitely possible. Below are steps, tips, and resources to help you efficiently convert your database, along with common pitfalls to watch out for.
### Steps for Converting PostgreSQL to MySQL
1. **Assess Compatibility**:
- Review the Pos... | 8,075 | [
{
"from": "human",
"value": "I've seen questions for doing the reverse, but I have an 800MB PostgreSQL database that needs to be converted to MySQL. I'm assuming this is possible (all things are possible!), and I'd like to know the most efficient way of going about this and any common mistakes there are to ... |
Is there a way in Delphi 7 to find out if a pop-up menu is visible (shown on the screen) or not, since it lacks a Visible property.
| In Delphi 7, since the `TPopupMenu` component does not have a `Visible` property, you can determine whether a popup menu is currently visible on the screen by checking for its associated window handle or checking for the presence of the menu in the system.
Here’s one approach you could use:
1. **Use `FindWindow` to c... | 11,471 | [
{
"from": "human",
"value": "Is there a way in Delphi 7 to find out if a pop-up menu is visible (shown on the screen) or not, since it lacks a Visible property.\n"
},
{
"from": "gpt",
"value": "In Delphi 7, since the `TPopupMenu` component does not have a `Visible` property, you can determine wh... |
Migrating a project from ASP.NET 1.1 to ASP.NET 2.0 and I keep hitting this error.
I don't actually need Global because I am not adding anything to it, but after I remove it I get more errors.
| Migrating from ASP.NET 1.1 to ASP.NET 2.0 can sometimes be tricky, especially with the differences in how global application state and configuration are handled. The `Global.asax` file is an integral part of ASP.NET applications that enables you to handle application-level events. If you're encountering issues after re... | 6,498 | [
{
"from": "human",
"value": "Migrating a project from ASP.NET 1.1 to ASP.NET 2.0 and I keep hitting this error. \nI don't actually need Global because I am not adding anything to it, but after I remove it I get more errors.\n"
},
{
"from": "gpt",
"value": "Migrating from ASP.NET 1.1 to ASP.NET 2... |
In Java, there is a practice of declaring every variable (local or class), parameter final if they really are.
Though this makes the code a lot more verbose, this helps in easy reading/grasping of the code and also prevents mistakes as the intention is clearly marked.
What are your thoughts on this and what do you foll... | The practice of declaring variables, parameters, and class members as `final` in Java when appropriate has several advantages, and it's worth considering both its benefits and potential downsides:
### Advantages of Using `final`:
1. **Intent Clarity**: Declaring a variable as `final` clearly indicates that its value ... | 11,171 | [
{
"from": "human",
"value": "In Java, there is a practice of declaring every variable (local or class), parameter final if they really are.\nThough this makes the code a lot more verbose, this helps in easy reading/grasping of the code and also prevents mistakes as the intention is clearly marked.\nWhat are... |
First of all, this question regards MySQL 3.23.58, so be advised.
I have 2 tables with the following definition:
Table A: id INT (primary), customer_id INT, offlineid INT
Table B: id INT (primary), name VARCHAR(255)
Now, table A contains in the range of 65k+ records, while table B contains ~40 records. In addition to... | To optimize your query further and potentially bring the execution time down to under 1 second, you can consider the following strategies:
1. **Review Indexes**: Ensure that both tables are indexed properly. Since you are joining on `offlineid`, and counting distinct `kundeid`, you may benefit from composite indexes.
... | 10,046 | [
{
"from": "human",
"value": "First of all, this question regards MySQL 3.23.58, so be advised.\nI have 2 tables with the following definition:\nTable A: id INT (primary), customer_id INT, offlineid INT\n\nTable B: id INT (primary), name VARCHAR(255)\n\nNow, table A contains in the range of 65k+ records, whi... |
I'm trying to draw a polygon using c# and directx
All I get is an ordered list of points from a file and I need to draw the flat polygon in a 3d world.
I can load the points and draw a convex shape using a trianglefan and drawuserprimitives.
This obviously leads to incorrect results when the polygon is very concave (wh... | Drawing a concave polygon correctly in 3D using DirectX requires you to decompose the concave polygon into simpler shapes (typically triangles) that can be rendered correctly using methods like `DrawUserPrimitives`. Here are some steps you can take, as well as resources that may assist you in achieving this:
### Steps... | 10,533 | [
{
"from": "human",
"value": "I'm trying to draw a polygon using c# and directx\nAll I get is an ordered list of points from a file and I need to draw the flat polygon in a 3d world.\nI can load the points and draw a convex shape using a trianglefan and drawuserprimitives.\nThis obviously leads to incorrect ... |
As an example, Google App Engine uses Google Datastore, not a standard database, to store data. Does anybody have any tips for using Google Datastore instead of databases? It seems I've trained my mind to think 100% in object relationships that map directly to table structures, and now it's hard to see anything diffe... | Transitioning from a traditional relational database model to a NoSQL database like Google Datastore can be challenging, especially when you've trained your mind to think in terms of object relationships and table structures. Here are some tips to help you effectively use Google Datastore:
### 1. Embrace Denormalizati... | 8,573 | [
{
"from": "human",
"value": "As an example, Google App Engine uses Google Datastore, not a standard database, to store data. Does anybody have any tips for using Google Datastore instead of databases? It seems I've trained my mind to think 100% in object relationships that map directly to table structures... |
When a previous Vim session crashed, you are greeted with the "Swap file ... already exists!" for each and every file that was open in the previous session.
Can you make this Vim recovery prompt smarter? (Without switching off recovery!) Specifically, I'm thinking of:
If the swapped version does not contain unsaved ch... | You can indeed enhance Vim's recovery prompt behavior to handle swap files more intelligently. While direct manipulation of swap files and automating responses to recovery prompts require some careful scripting, you can leverage Vim's autocommands along with certain built-in commands to minimize interaction when dealin... | 2,355 | [
{
"from": "human",
"value": "When a previous Vim session crashed, you are greeted with the \"Swap file ... already exists!\" for each and every file that was open in the previous session.\nCan you make this Vim recovery prompt smarter? (Without switching off recovery!) Specifically, I'm thinking of:\n\nIf t... |
How to get an assembler file to be compiled and linked into a driver build.
To clarify a bit
The SOURCES file :
TARGETTYPE=DRIVER
DRIVERTYPE=WDM
TARGETPATH=obj
TARGETNAME=bla
INCLUDES=$(DDK_INC_PATH)
TARGETLIBS=$(DDK_LIB_PATH)\ks.lib
SOURCES=x.cpp y.cpp z.asm
The problem occurs with the z.asm file. NMAKE complains ... | To include an assembly file (z.asm) in your driver build process using the NMAKE tool for a WDM driver, you need to ensure that the assembly file is correctly assembled and the resulting object file (z.obj) is linked into the final driver.
Here's a step-by-step approach to achieve this:
### Step 1: Define Rules for ... | 11,330 | [
{
"from": "human",
"value": "How to get an assembler file to be compiled and linked into a driver build.\nTo clarify a bit\nThe SOURCES file :\nTARGETTYPE=DRIVER\nDRIVERTYPE=WDM\nTARGETPATH=obj\n\nTARGETNAME=bla\n\nINCLUDES=$(DDK_INC_PATH)\nTARGETLIBS=$(DDK_LIB_PATH)\\ks.lib\n\nSOURCES=x.cpp y.cpp z.asm\n\n... |
In Oracle, the number of rows returned in an arbitrary query can be limited by filtering on the "virtual" rownum column. Consider the following example, which will return, at most, 10 rows.
SELECT * FROM all_tables WHERE rownum <= 10
Is there a simple, generic way to do something similar in Ingres?
| In Ingres, you can achieve a similar effect to Oracle's `rownum` by using the `LIMIT` clause in your SQL queries. This clause allows you to specify the maximum number of rows to return from your query.
Here's how you can use it to limit the results to 10 rows in a manner similar to your Oracle example:
```sql
SELECT... | 14,046 | [
{
"from": "human",
"value": "In Oracle, the number of rows returned in an arbitrary query can be limited by filtering on the \"virtual\" rownum column. Consider the following example, which will return, at most, 10 rows.\nSELECT * FROM all_tables WHERE rownum <= 10\nIs there a simple, generic way to do some... |
I have a requirement to be be able to embed scanned tiff images into some SSRS reports.
When I design a report in VS2005 and add an image control the tiff image displays perfectly however when I build it. I get the warning :
Warning 2 [rsInvalidMIMEType] The value of the MIMEType property for the image ‘image1’ is... | SSRS (SQL Server Reporting Services) has limited support for certain image formats, and unfortunately, TIFF is one of the formats that it does not handle natively. The error message you're encountering is related to the fact that SSRS does not recognize "image/tiff" as a valid MIME type.
To overcome this issue, you ha... | 11,162 | [
{
"from": "human",
"value": "I have a requirement to be be able to embed scanned tiff images into some SSRS reports.\nWhen I design a report in VS2005 and add an image control the tiff image displays perfectly however when I build it. I get the warning :\nWarning 2 [rsInvalidMIMEType] The value of the ... |
What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter?
| To copy a file from a network share to the local file system in a Windows batch file, you can indeed use the `net use` command to map a network drive, but instead of using `net use *`, which will assign the next available drive letter, you can specify a drive letter directly.
Here’s how you can do it:
1. **Map a netw... | 9,799 | [
{
"from": "human",
"value": "What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use \"net use *\" but using this approach how can I get the drive letter?\n"
},
{
"from": "gpt",
"value": "To copy a file from a network sh... |
When do you recommend integrating a custom view into Interface Builder with a plug-in? When skimming through Apple's Interface Builder Plug-In Programming Guide I found:
Are your custom objects going to be used by only one application?
Do your custom objects rely on state information found only in your application?
W... | Integrating a custom view into Interface Builder using a plug-in can be a powerful way to enhance the development experience, but it comes with its own set of considerations. Here are some insights into when it’s a good idea, the benefits, and the potential time investment involved.
### When to Consider Using a Plug-I... | 11,860 | [
{
"from": "human",
"value": "When do you recommend integrating a custom view into Interface Builder with a plug-in? When skimming through Apple's Interface Builder Plug-In Programming Guide I found:\n\n\nAre your custom objects going to be used by only one application?\nDo your custom objects rely on state ... |
In the WCF application that I am working on, I need to access the generated source of a particular webpage (after all the AJAX calls on the page are made).
I have tried using System.Net.WebRequest but it just brings me back the original source of the page. Is there a way to execute a page and then get the source?
Else,... | Accessing the generated source of a webpage after all AJAX calls have been made can be challenging when using traditional HTTP requests, like those made with `System.Net.WebRequest`, since those requests do not execute JavaScript. Instead, they simply fetch the raw HTML of the page.
To achieve your goal, you can use a... | 10,779 | [
{
"from": "human",
"value": "In the WCF application that I am working on, I need to access the generated source of a particular webpage (after all the AJAX calls on the page are made).\nI have tried using System.Net.WebRequest but it just brings me back the original source of the page. Is there a way to exe... |
I am looking for a regex that will match a string that starts with one substring and does not end with a certain substring.
Example:
// Updated to be correct, thanks @Apocalisp
^foo.*(?<!bar)$
Should match anything that starts with "foo" and doesn't end with "bar". I know about the [^...] syntax, but I can't find any... | To create a regex that matches a string starting with a certain substring and does not end with another specific substring, you can use a combination of a positive lookbehind and negative lookbehind assertions. In Java and many other regex engines, you can achieve this as follows:
1. **Start with the specific substrin... | 7,487 | [
{
"from": "human",
"value": "I am looking for a regex that will match a string that starts with one substring and does not end with a certain substring.\nExample:\n// Updated to be correct, thanks @Apocalisp\n^foo.*(?<!bar)$\n\nShould match anything that starts with \"foo\" and doesn't end with \"bar\". I ... |
first question here. I'm developing a program in C# (.NET 3.5) that displays files in a listview. I'd like to have the "large icon" view display the icon that Windows Explorer uses for that filetype, otherwise I'll have to use some existing code like this:
private int getFileTypeIconIndex(string fileName)
{... | To obtain the system file icons that Windows Explorer uses for different file types, you can use the Windows API instead of manually defining the icons for each file extension. This approach will allow you to retrieve the appropriate icon for any file type without having to hardcode them.
Here's how you can do this us... | 8,461 | [
{
"from": "human",
"value": "first question here. I'm developing a program in C# (.NET 3.5) that displays files in a listview. I'd like to have the \"large icon\" view display the icon that Windows Explorer uses for that filetype, otherwise I'll have to use some existing code like this:\n private int... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.