instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Possible Duplicate:
How can I pre-set arguments in JavaScript function call? (Partial Function Application)
I need to able to pass a reference to a function with a given set of parameters.
Here is an example of passing a reference without parameters:
var f = function () {
//Some logic here...
};
var fr = f; //H... | Yes, you can achieve this in JavaScript by creating a utility function, often referred to as a "partial application" function. This allows you to "preset" some parameters for another function. As you've mentioned, you found a solution for partial application, which is a good approach.
Here's a brief overview of how yo... | 46,495 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nHow can I pre-set arguments in JavaScript function call? (Partial Function Application) \n\nI need to able to pass a reference to a function with a given set of parameters.\nHere is an example of passing a reference without parameters:\nvar f = function ()... |
We all write reusable classes and code.
We factor in configurability to allow us to reuse this fantastic new class again and again.
We tell our bosses that spending this extra time now will save us time and money later.
But in reality, for those of us who don't write third party libraries, and spend our time work... | The question of how many reusable classes actually get reused in practice is a common concern among developers. While the intention behind writing reusable, configurable classes is often sound, the reality can be quite different, especially in the context of specific applications rather than third-party libraries.
Her... | 43,479 | [
{
"from": "human",
"value": "We all write reusable classes and code. \nWe factor in configurability to allow us to reuse this fantastic new class again and again. \nWe tell our bosses that spending this extra time now will save us time and money later. \nBut in reality, for those of us who don't write th... |
I've been scanning through all the popular js libraries, but I can't find one that has a width function for a DOM element that actually accounts for quirks mode in Internet Explorer. The issue is that padding and borders don't get counted in the the width when quirks mode is engaged. As far as I can tell this happens w... | Detecting quirks mode and adjusting the width calculation for elements accordingly can be a bit tricky, especially when dealing with older versions of Internet Explorer. Below are solutions to help you detect quirks mode and calculate the width of a DOM element correctly.
### 1. Detect Quirks Mode
You can detect whet... | 42,980 | [
{
"from": "human",
"value": "I've been scanning through all the popular js libraries, but I can't find one that has a width function for a DOM element that actually accounts for quirks mode in Internet Explorer. The issue is that padding and borders don't get counted in the the width when quirks mode is eng... |
I have a web application that needs to fire off a long-running SQL Server procedure (to rebuild a table) when certain criteria are met. What is the recommended procedure to do this?
I was thinking, when the criteria are met a record would be inserted into the database and a scheduled SQL server job would check that tab... | Your idea of inserting a record into a database table to trigger a long-running SQL Server procedure is a common approach but can be made more efficient and robust through better practices and patterns. Here’s a more structured approach to handling both long-running tasks and future event scheduling, along with how mes... | 42,038 | [
{
"from": "human",
"value": "I have a web application that needs to fire off a long-running SQL Server procedure (to rebuild a table) when certain criteria are met. What is the recommended procedure to do this?\nI was thinking, when the criteria are met a record would be inserted into the database and a sch... |
I'm attempting to use Python to convert a multi-page PDF into a series of JPEGs. I can split the PDF up into individual pages easily enough with available tools, but I haven't been able to find anything that can covert PDFs to images.
PIL does not work, as it can't read PDFs. The two options I've found are using either... | Yes, you can convert PDF pages to JPEG images using a few Python libraries that do not rely on external tools like GhostScript or ImageMagick. One popular option is `pdf2image`, which is a wrapper around the `poppler` utility. This package works well for converting PDF pages to images in Python and is quite easy to use... | 39,079 | [
{
"from": "human",
"value": "I'm attempting to use Python to convert a multi-page PDF into a series of JPEGs. I can split the PDF up into individual pages easily enough with available tools, but I haven't been able to find anything that can covert PDFs to images.\nPIL does not work, as it can't read PDFs. T... |
I've been looking into improving SQLite performance for my site, especially with regard to transactions. In essence what I'm looking for is a way to defer database writes in a process so that they can all be done at once. However, while I'm accumulating update queries, I would like other processes to be able to both re... | In SQLite, transactions are designed to ensure data integrity, which often means that certain locks can prevent concurrent write operations from happening simultaneously. The behavior you've described regarding the `RESERVED` lock is correct: when a transaction starts and issues an update command, it obtains a `RESERVE... | 42,822 | [
{
"from": "human",
"value": "I've been looking into improving SQLite performance for my site, especially with regard to transactions. In essence what I'm looking for is a way to defer database writes in a process so that they can all be done at once. However, while I'm accumulating update queries, I would l... |
I am using UIImagePickerController to take photo, there are two steps involved, "Take photo" and "Use photo". Is there any way to override the behavior, merge these two action in one? Say "Take and use photo".
Thanks.
| In iOS, the `UIImagePickerController` provides a standard interface for capturing images and does not allow for customization of its built-in buttons or the workflow. The separation of the "Take Photo" and "Use Photo" actions is part of the default UI design.
However, if you want to create a more seamless experience w... | 41,548 | [
{
"from": "human",
"value": "I am using UIImagePickerController to take photo, there are two steps involved, \"Take photo\" and \"Use photo\". Is there any way to override the behavior, merge these two action in one? Say \"Take and use photo\". \nThanks.\n"
},
{
"from": "gpt",
"value": "In iOS,... |
Before I write my own I will ask all y'all.
I'm looking for a C++ class that is almost exactly like a STL vector but stores data into an array on the stack. Some kind of STL allocator class would work also, but I am trying to avoid any kind of heap, even static allocated per-thread heaps (although one of those is my s... | It sounds like you've already found a solution that works for you using Chromium's `stack_container.h` and the `StackAllocator` template. That's great!
For others who might be looking for a similar solution or if you're still interested in developing your own stack-based vector, here's a simple implementation you cou... | 43,277 | [
{
"from": "human",
"value": "Before I write my own I will ask all y'all.\nI'm looking for a C++ class that is almost exactly like a STL vector but stores data into an array on the stack. Some kind of STL allocator class would work also, but I am trying to avoid any kind of heap, even static allocated per-t... |
I have an ASP.NET application that's connecting to an oracle database.
Performance on some queries in dev is very slow - on the order of 90 seconds to connect to the database, run a a query (actually, call a SP in a package) and return a single row of results.
I've run a profiler on the app, and just about 100% of the ... | When you're experiencing slow performance in your ASP.NET application when connecting to an Oracle database, especially when the same query runs fast in production, there are several areas to investigate. Here are some steps you can take to troubleshoot and potentially resolve the issue:
### 1. **Network Latency**
... | 38,923 | [
{
"from": "human",
"value": "I have an ASP.NET application that's connecting to an oracle database.\nPerformance on some queries in dev is very slow - on the order of 90 seconds to connect to the database, run a a query (actually, call a SP in a package) and return a single row of results.\nI've run a profi... |
My project has collected CSS entropy (unused classes) during its course of development.
Now in order to keep the CSS file small, I want to remove all unused CSS references. But doing that manually involves searching for each class in the entire project. That takes time.
Do you know of any way/tool which I can adopt to ... | Yes, there are several tools and approaches you can use to find and remove unused CSS classes from your project in ASP.NET while working in Visual Studio. Here are some options:
### 1. **PurgeCSS**
PurgeCSS is a popular tool that analyzes your content files (HTML, JS, etc.) to find CSS classes that are used and remov... | 39,745 | [
{
"from": "human",
"value": "My project has collected CSS entropy (unused classes) during its course of development.\nNow in order to keep the CSS file small, I want to remove all unused CSS references. But doing that manually involves searching for each class in the entire project. That takes time.\nDo you... |
We are in the process of selecting BI stack for our data warehouse. The top contenders are OBIEE = Oracle BI Enterprise Edition (formerly Siebel Analytics) and Microstrategy.
Has anyone worked with OBIEE? Lessons learned? General impressions? Flaws, strengths?
| Certainly! Here’s an overview of Oracle BI Enterprise Edition (OBIEE) based on user experiences, strengths, weaknesses, and general impressions:
### Strengths of OBIEE:
1. **Integration with Oracle Ecosystem**: If you're using other Oracle products, OBIEE integrates seamlessly with Oracle databases and applications, ... | 43,089 | [
{
"from": "human",
"value": "We are in the process of selecting BI stack for our data warehouse. The top contenders are OBIEE = Oracle BI Enterprise Edition (formerly Siebel Analytics) and Microstrategy.\nHas anyone worked with OBIEE? Lessons learned? General impressions? Flaws, strengths?\n"
},
{
"... |
Here is what I have:
JAVA_HOME=C:\Software\Java\jdk1.5.0_12 (points to JDK 5.0)
In Eclipse "Installed Runtimes" I have:
jre 1.5.0_12 (points to JRE 5.0)
jre 1.6.0_3 (points to JRE 6.0) (this one is default)
I do not have "javac" on my PATH (i.e. I cannot run javac -version from command line if I am not in JDK/bin).
My ... | Eclipse can compile your Java project using the Java Compiler from the JDK that is associated with the installed JRE in your Eclipse settings, even if the default JRE is set to a JRE version. Here’s how it works in your case:
### Explanation of How Eclipse Compiles Your Project:
1. **Installed Runtimes in Eclipse**: ... | 43,150 | [
{
"from": "human",
"value": "Here is what I have:\nJAVA_HOME=C:\\Software\\Java\\jdk1.5.0_12 (points to JDK 5.0)\nIn Eclipse \"Installed Runtimes\" I have:\njre 1.5.0_12 (points to JRE 5.0)\njre 1.6.0_3 (points to JRE 6.0) (this one is default)\nI do not have \"javac\" on my PATH (i.e. I cannot run javac -v... |
config file :
<system.net>
<mailSettings>
<smtp from="YYYYY@xxxxxx.com">
<network
host="mail.xxxxxx.com"
port="25"
password="password"
userName="user@xxxxxx.com"
defaultCredentials="false"
/>
</smtp>
</mailSettings>
</system.net>
I've already tried defaultCredentials="true" but i recieved following message:
System.For... | The error message "System.FormatException: Smtp server returned an invalid response" suggests that the SMTP server is not properly responding to the requests from your application. Here are some steps and considerations that may help you resolve this issue:
1. **Check SMTP Server Details**:
- Verify that the `host`... | 42,131 | [
{
"from": "human",
"value": "config file :\n<system.net>\n<mailSettings>\n<smtp from=\"YYYYY@xxxxxx.com\">\n<network\nhost=\"mail.xxxxxx.com\"\nport=\"25\"\npassword=\"password\"\nuserName=\"user@xxxxxx.com\"\ndefaultCredentials=\"false\"\n/>\n</smtp>\n</mailSettings>\n</system.net>\n\nI've already tried de... |
I have an MPI program which compiles and runs, but I would like to step through it to make sure nothing bizarre is happening. Ideally, I would like a simple way to attach GDB to any particular process, but I'm not really sure whether that's possible or how to do it. An alternative would be having each process write deb... | Debugging MPI programs can be a bit tricky because they often run across multiple processes, making it more challenging to trace and inspect state as you would with a single-threaded application. Here are several approaches you can consider to debug your MPI program:
### 1. Attaching GDB to MPI Processes
You can attac... | 41,774 | [
{
"from": "human",
"value": "I have an MPI program which compiles and runs, but I would like to step through it to make sure nothing bizarre is happening. Ideally, I would like a simple way to attach GDB to any particular process, but I'm not really sure whether that's possible or how to do it. An alternati... |
In the early days of .NET, I believe there was an attribute you could decorate a class with to specify a default property.
According to some articles I've found, this appears to have been yanked from the framework at some point, because it was a little confusing, and I can see how that is the case.
Still, is there ano... | You're correct that the `<DefaultProperty>` attribute was used in earlier versions of .NET, particularly in VB.NET, to define a default property for a class. This would allow you to reference an object without explicitly specifying the default property. However, this attribute has indeed been deprecated as it caused co... | 44,629 | [
{
"from": "human",
"value": "In the early days of .NET, I believe there was an attribute you could decorate a class with to specify a default property.\nAccording to some articles I've found, this appears to have been yanked from the framework at some point, because it was a little confusing, and I can see ... |
I have the following makefile that I use to build a program (a kernel, actually) that I'm working on. Its from scratch and I'm learning about the process, so its not perfect, but I think its powerful enough at this point for my level of experience writing makefiles.
AS = nasm
CC = gcc
LD = ld
TARGET = ... | To enable automatic dependency generation for your C files in your Makefile, you can leverage the built-in capabilities of GCC to output dependencies in a format that Make can understand. Specifically, you can use the `-MMD` flag when compiling your C files, which tells GCC to generate dependency files (`.d` files) tha... | 42,452 | [
{
"from": "human",
"value": "I have the following makefile that I use to build a program (a kernel, actually) that I'm working on. Its from scratch and I'm learning about the process, so its not perfect, but I think its powerful enough at this point for my level of experience writing makefiles.\nAS = nas... |
What's the best way to get a function like the following to work:
def getNearest(zipCode, miles):
That is, given a zipcode (07024) and a radius, return all zipcodes which are within that radius?
| To implement the `getNearest(zipCode, miles)` function that returns all zip codes within a given radius, you would typically need to use a dataset that contains zip codes along with their geographical coordinates (latitude and longitude). Here's a step-by-step guide on how to do that:
### Steps to Implement `getNeares... | 42,153 | [
{
"from": "human",
"value": "What's the best way to get a function like the following to work:\ndef getNearest(zipCode, miles):\n\nThat is, given a zipcode (07024) and a radius, return all zipcodes which are within that radius?\n"
},
{
"from": "gpt",
"value": "To implement the `getNearest(zipCod... |
This is intended to be a more concrete, easily expressable form of my earlier question.
Take a list of words from a dictionary with common letter length.
How to reorder this list tto keep as many letters as possible common between adjacent words?
Example 1:
AGNI, CIVA, DEVA, DEWA, KAMA, RAMA, SIVA, VAYU
reorders to: ... | The problem you’re describing resembles a type of Hamiltonian path problem, which is about finding a path through a set of vertices (in this case, words) such that the edges (shared letters) are maximized. The challenge lies in determining the order that maximizes the number of common letters between adjacent words.
... | 38,161 | [
{
"from": "human",
"value": "This is intended to be a more concrete, easily expressable form of my earlier question.\nTake a list of words from a dictionary with common letter length.\nHow to reorder this list tto keep as many letters as possible common between adjacent words? \nExample 1:\nAGNI, CIVA, DEV... |
I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this:
String s = new String("silly");
Because it creates unnecessary String objects. But instead it should be written like this:
String s = "No longer silly";
Ok fine so far...However, given this class:... | In Java, string literals (like `"Polish"`) are special in that they are interned, meaning that they are stored in a special area of memory (the string pool) to save space and improve performance. When you use a string literal, you don't create a new `String` object unless that specific literal doesn't already exist in ... | 43,591 | [
{
"from": "human",
"value": "I'm a C++ guy learning Java. I'm reading Effective Java and something confused me. It says never to write code like this:\nString s = new String(\"silly\");\n\nBecause it creates unnecessary String objects. But instead it should be written like this:\nString s = \"No longer sill... |
Is there any real reason not to make a member function virtual in C++? Of course, there's always the performance argument, but that doesn't seem to stick in most situations since the overhead of virtual functions is fairly low.
On the other hand, I've been bitten a couple of times with forgetting to make a function vi... | Making member functions virtual in C++ is a design decision that carries both advantages and disadvantages. While there are compelling reasons to use virtual functions for polymorphism, there are also valid reasons to refrain from making every member function virtual by default. Here are some considerations:
### Reaso... | 43,801 | [
{
"from": "human",
"value": "Is there any real reason not to make a member function virtual in C++? Of course, there's always the performance argument, but that doesn't seem to stick in most situations since the overhead of virtual functions is fairly low.\nOn the other hand, I've been bitten a couple of t... |
I have the following solution project structure:
Application.Core.Entities
Application.Xtend.CustomerName.Entities
In the Core project I have an entity Customer defiend. In the XTend project, I have an entity defined that subclasses Customer named xCustomer (for lack of a better name at this time...).
The idea here i... | Yes, it is possible to span different assemblies with NHibernate mapping, but you need to ensure that the mappings correctly reference the types in the appropriate assemblies. The error you're encountering is due to the way you've defined the mappings. NHibernate cannot find the `xCustomer` type because it is not in th... | 41,119 | [
{
"from": "human",
"value": "I have the following solution project structure:\n\nApplication.Core.Entities\nApplication.Xtend.CustomerName.Entities\n\nIn the Core project I have an entity Customer defiend. In the XTend project, I have an entity defined that subclasses Customer named xCustomer (for lack of a... |
When building a multi-lingual website (with ASP.NET web forms), I'll use an HTTP module to rewrite the URLs to end up with something friendly (for humans & search engines) like:
uk/products/product_category_one/sub_category_one/index.aspx
uk/products/product_category_one/sub_category_one/widget_mk5.aspx
es/productos/ca... | You're on the right track with your understanding of both ASP.NET Web Forms and ASP.NET MVC. Let’s address your questions regarding URL structure and routing in ASP.NET MVC.
### 1. Inserting a Country Code into the URL
Yes, you can insert a country code into the URL before the controller segment. You can achieve this... | 38,796 | [
{
"from": "human",
"value": "When building a multi-lingual website (with ASP.NET web forms), I'll use an HTTP module to rewrite the URLs to end up with something friendly (for humans & search engines) like:\nuk/products/product_category_one/sub_category_one/index.aspx\nuk/products/product_category_one/sub_c... |
Can anyone point out what technologies would be best suited for an application that backs up data from clients to a server?
The client should choose folders to backup and schedule backups to a server
I would also be interested in how would you start developing/designing, how would you build in the shortest time possi... | When developing a data backup application, there are several technologies and design principles you can use to create a solution that meets your requirements efficiently. Here’s a breakdown of the technologies, design considerations, and a rough roadmap for development.
### 1. Technologies
#### Client-side Technologi... | 33,878 | [
{
"from": "human",
"value": "Can anyone point out what technologies would be best suited for an application that backs up data from clients to a server?\n\nThe client should choose folders to backup and schedule backups to a server\n\nI would also be interested in how would you start developing/designing, h... |
I have some code on my PHP powered site that creates a random hash (using sha1()) and I use it to match records in the database.
What are the chances of a collision? Should I generate the hash, then check first if it's in the database (I'd rather avoid an extra query) or automatically insert it, based on the probabilit... | When it comes to using hash functions like `sha1()` for generating unique identifiers, it's important to understand the potential for hash collisions. A hash collision occurs when two different inputs produce the same hash output.
### Collision Probability
The SHA-1 hashing algorithm produces a 160-bit (20-byte) hash... | 37,993 | [
{
"from": "human",
"value": "I have some code on my PHP powered site that creates a random hash (using sha1()) and I use it to match records in the database.\nWhat are the chances of a collision? Should I generate the hash, then check first if it's in the database (I'd rather avoid an extra query) or automa... |
In a progression of languages, I have been learning C and C++. Now I would like to learn C#. I know there are some drastic differences between them - such as the removal of pointers and garbage collection. However, I don't know many of the differences between the two.
What are the major differences that a C++ progra... | Transitioning from C++ to C# can be a smooth process, especially since you already have a grounding in programming concepts through C and C++. However, there are several important differences and features in C# that you'll need to be aware of. Here are the major differences and considerations:
### 1. **Memory Manageme... | 41,375 | [
{
"from": "human",
"value": "In a progression of languages, I have been learning C and C++. Now I would like to learn C#. I know there are some drastic differences between them - such as the removal of pointers and garbage collection. However, I don't know many of the differences between the two.\nWhat a... |
J2ME lacks the java.util.Properties class. Although it is possible to put application settings in the JAD file this is not recommended for many properties. (Since, some platforms limits the size of JAD file.) I want to put a configuration file inside my jar file and parse it. And I do not want to go with XML because it... | J2ME does indeed have limitations when it comes to handling configuration data, especially due to the absence of the `java.util.Properties` class and constraints on JAD file sizes. Since you want a lightweight solution and prefer not to use XML, here are some suggestions to handle configuration data in J2ME:
### Optio... | 45,480 | [
{
"from": "human",
"value": "J2ME lacks the java.util.Properties class. Although it is possible to put application settings in the JAD file this is not recommended for many properties. (Since, some platforms limits the size of JAD file.) I want to put a configuration file inside my jar file and parse it. An... |
What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?
It's possible to determine if a path string is UNC using the following:
new Uri(path).IsUnc
That works great for paths that start with C:\ or other drive letter, but what about paths lik... | To determine if a file path string is on the local machine or a remote server in a .NET application, you can use a combination of checking if the path is a UNC path and if it refers to the local machine.
Here’s a step-by-step approach to achieve this:
1. **Check if the path is a UNC path** using the `Uri` class.
2. *... | 43,299 | [
{
"from": "human",
"value": "What's the best way, using C# or other .NET language, to determine if a file path string is on the local machine or a remote server?\nIt's possible to determine if a path string is UNC using the following:\nnew Uri(path).IsUnc\n\nThat works great for paths that start with C:\\ o... |
I have a dll that was written in c++, I need to use this dll in my c# code. After searching I found that using P/Invoke would give me access to the function I need, but these functions are defined with in a class and use non-static private member variables. So I need to be able to create an instance of this class to pr... | To use a C++ class that is defined in a DLL from C#, you'll typically run into a few challenges, especially when the C++ class has non-static member variables. P/Invoke (Platform Invocation Services) is mainly designed for calling functions that are exported with `extern "C"` and does not provide a straightforward way ... | 37,591 | [
{
"from": "human",
"value": "I have a dll that was written in c++, I need to use this dll in my c# code. After searching I found that using P/Invoke would give me access to the function I need, but these functions are defined with in a class and use non-static private member variables. So I need to be able ... |
The company I work for is thinking of developing a LAMP SaaS Web application that would be plan based. We want to monitor usage because it involves external references, and would draw bandwidth through the placement of an iframe or JavaScript snippet on a third-party site. My first thought was relying only on a page im... | Monitoring usage for a LAMP (Linux, Apache, MySQL, PHP) SaaS web application that involves bandwidth consumption through iframes or JavaScript snippets can be approached in a few effective ways. Here’s a structured approach to help you implement the monitoring and notification mechanism.
### 1. Define the Usage Caps
F... | 41,891 | [
{
"from": "human",
"value": "The company I work for is thinking of developing a LAMP SaaS Web application that would be plan based. We want to monitor usage because it involves external references, and would draw bandwidth through the placement of an iframe or JavaScript snippet on a third-party site. My fi... |
How can I create a table that has its first row and first column both locked, as in Excel, when you activate 'freeze panes'? I need the table to both scroll horizontally and vertically (a lot of solutions for this exist, but only allow vertical scrolling).
So, when you scroll down in the table, the first row will stay... | Creating a table with a fixed header (first row) and a fixed first column that can scroll both vertically and horizontally can be accomplished with a combination of HTML, CSS, and JavaScript. The implementation involves creating a wrapper div around your table and adjusting the position of the header and first column u... | 41,498 | [
{
"from": "human",
"value": "How can I create a table that has its first row and first column both locked, as in Excel, when you activate 'freeze panes'? I need the table to both scroll horizontally and vertically (a lot of solutions for this exist, but only allow vertical scrolling).\nSo, when you scroll ... |
I am using SqlMemberShipProvider and it works well, but I wish that the MembershipUser had some additional properties such as FirstName, LastName, Phone Number, etc. What is the best way to go about this? Do I have to create a custom membership provider or is there a better way to add additional functionality to users?... | To extend the functionality of the `MembershipUser` class with additional properties like `FirstName`, `LastName`, and `Phone Number`, you have a couple of options. You don’t necessarily have to create a custom membership provider, but doing so may give you more control and flexibility. Here are some approaches you can... | 41,412 | [
{
"from": "human",
"value": "I am using SqlMemberShipProvider and it works well, but I wish that the MembershipUser had some additional properties such as FirstName, LastName, Phone Number, etc. What is the best way to go about this? Do I have to create a custom membership provider or is there a better way ... |
A co-worker has a C program that fails in a predictable manner because of some corrupted memory. He'd like to use dbx to monitor the memory location once it's allocated in order to pinpoint the code that causes the corruption.
Is this possible? If so what is the syntax to produce a breakpoint at the moment of corrupt... | Monitoring memory corruption in a C program using `dbx` can be challenging, but it is possible to set up breakpoints to help identify where the corruption occurs. Here’s how you can approach the problem:
### Using dbx for Monitoring Memory
1. **Set a Breakpoint After Allocation**:
First, you want to set a breakpoi... | 44,022 | [
{
"from": "human",
"value": "A co-worker has a C program that fails in a predictable manner because of some corrupted memory. He'd like to use dbx to monitor the memory location once it's allocated in order to pinpoint the code that causes the corruption.\nIs this possible? If so what is the syntax to pro... |
while exploring jQuery I came up with the following weird script. I don't see myself doing this really however concatenating strings to achieve a variable name is not unusual in JavaScript.
Any feedback welcome.
...
<script type="text/javascript">
var a = 'y';
$(document).ready(function() {
... | Your script demonstrates a creative use of jQuery and string concatenation, but it also introduces some potential confusion and maintenance issues. Let’s break it down and provide feedback.
### Breakdown of the Script
1. **Variable Declaration**:
```javascript
var a = 'y';
```
Here, you are declaring a va... | 42,968 | [
{
"from": "human",
"value": "while exploring jQuery I came up with the following weird script. I don't see myself doing this really however concatenating strings to achieve a variable name is not unusual in JavaScript. \nAny feedback welcome.\n...\n <script type=\"text/javascript\">\n var a = 'y';... |
I'm trying to get a user control working asynchronously, yet no matter what I do it continues to work synchronously. I've stripped it down to its bare minimum as a test web application. This would be the user control:
<%@ Control Language="C#" %>
<script runat="server">
SqlConnection m_oConnection;
SqlCommand ... | When working with asynchronous operations in ASP.NET Web Forms, it's important to understand how asynchronous tasks are executed and managed. The code you provided looks like it's set up correctly to use asynchronous operations with `SqlCommand`, but there are a few considerations to ensure that your user control is tr... | 41,765 | [
{
"from": "human",
"value": "I'm trying to get a user control working asynchronously, yet no matter what I do it continues to work synchronously. I've stripped it down to its bare minimum as a test web application. This would be the user control:\n<%@ Control Language=\"C#\" %>\n<script runat=\"server\">\n ... |
A related question to one I asked earlier...
Just checking on something: Should the order of the xmlns, xmlns:xsi and xsi:schemaLocation attributes in an XML file matter?
I'm finding that it does - at least when using XML Notepad 2007 to view the XML file. For example (assuming that my XML file is legal according to m... | In XML, the order of attributes is not significant according to the XML specification. This means that technically, the order of `xmlns`, `xmlns:xsi`, and `xsi:schemaLocation` should not affect the validity of your XML document.
However, when you're dealing with XML processing tools, validators, or editors (like XML ... | 45,959 | [
{
"from": "human",
"value": "A related question to one I asked earlier...\nJust checking on something: Should the order of the xmlns, xmlns:xsi and xsi:schemaLocation attributes in an XML file matter?\nI'm finding that it does - at least when using XML Notepad 2007 to view the XML file. For example (assumi... |
I don't need this, obviously; I'm just curious about what's going on here. Am I missing
something simple? Can I rely on this behaviour in all versions of Perl?)
Perl v5.8.8:
%h = ( 0=>'zero', 1=>'one', 2=>'two' );
while ($k = each %h) {
$v = delete $h{$k};
print "deleted $v; remaining: @h{0..2}\n";
}
outputs
d... | The behavior you're observing in your Perl code has to do with how the `each` function operates in conjunction with the loop control in a `while` statement. Let's break this down:
### `each` Function Behavior
The `each` function in Perl returns a key/value pair from the hash on each call. Specifically, it returns a l... | 40,554 | [
{
"from": "human",
"value": "I don't need this, obviously; I'm just curious about what's going on here. Am I missing\nsomething simple? Can I rely on this behaviour in all versions of Perl?)\nPerl v5.8.8:\n%h = ( 0=>'zero', 1=>'one', 2=>'two' );\nwhile ($k = each %h) {\n $v = delete $h{$k};\n print \"... |
I have an object.
fp = open(self.currentEmailPath, "rb")
p = email.Parser.Parser()
self._currentEmailParsedInstance= p.parse(fp)
fp.close()
self.currentEmailParsedInstance, from this object I want to get the body of an email, text only no HTML....
How do I do it?
something like this?
newmsg=... | You're on the right track, and you can indeed get the text body of an email while navigating through its multipart structure. Given that you want to extract the plain text body from a MIME-encoded email that may contain both plain text and HTML versions, you will typically want to look for the `text/plain` part.
Here'... | 42,212 | [
{
"from": "human",
"value": "I have an object.\n fp = open(self.currentEmailPath, \"rb\")\n p = email.Parser.Parser()\n self._currentEmailParsedInstance= p.parse(fp)\n fp.close()\n\nself.currentEmailParsedInstance, from this object I want to get the body of an email, text only no HTML....\nHow d... |
I'm writing a GreaseMonkey script where I'm iterating through a bunch of elements. For each element, I need a string ID that I can use to reference that element later. The element itself doesn't have an id attribute, and I can't modify the original document to give it one (although I can make DOM changes in my script).... | You are correct in your understanding that browsers do not expose an internal ID for elements that you can use to reference them later in a GreaseMonkey script. However, there are effective ways to manage and reference elements in a way that suits your needs, especially given that you can modify the DOM in your script.... | 37,677 | [
{
"from": "human",
"value": "I'm writing a GreaseMonkey script where I'm iterating through a bunch of elements. For each element, I need a string ID that I can use to reference that element later. The element itself doesn't have an id attribute, and I can't modify the original document to give it one (altho... |
I have ListView with Grouping Items. Grouping uses custom GroupStyle (Expander). I would like to have check box which will Expand and collapse all groups when. It works fine untill I click manually on the group header and expand or collapse that group. After clicking that particular group stops to respond on check ... | The issue you're encountering is due to the fact that once you manually expand or collapse a group using the `Expander`, the binding to the `IsChecked` property of the `CheckBox` is lost. This is because the `Expander` is no longer using the `IsChecked` property to manage its state once it is manipulated directly.
To ... | 41,325 | [
{
"from": "human",
"value": "I have ListView with Grouping Items. Grouping uses custom GroupStyle (Expander). I would like to have check box which will Expand and collapse all groups when. It works fine untill I click manually on the group header and expand or collapse that group. After clicking that pa... |
I need to create a form with, half linear view (textboxes and dropdownlists in separate line) and the other half, non linear view i.e. the textboxes will appear next to each other, like first name and last name will be next to each other.
I am aware how to acomplish the linear view with CSS. I am using
fieldset {
cl... | To create a form that has a combination of both linear and non-linear views using CSS, you can use a grid or flexbox layout for the non-linear section. Below is an example of how to implement both styles effectively.
### HTML Structure
You can create two sections within your form: one for the linear view and one for t... | 41,464 | [
{
"from": "human",
"value": "I need to create a form with, half linear view (textboxes and dropdownlists in separate line) and the other half, non linear view i.e. the textboxes will appear next to each other, like first name and last name will be next to each other. \nI am aware how to acomplish the linear... |
Edit: This code is fine. I found a logic bug somewhere that doesn't exist in my pseudo code. I was blaming it on my lack of Java experience.
In the pseudo code below, I'm trying to parse the XML shown. A silly example maybe but my code was too large/specific for anyone to get any real value out of seeing it and lear... | It looks like you're encountering an issue where your `Vector` of `Cow` objects is filled with uninitialized `Cow` instances after parsing your XML. Based on your provided pseudo code, let's look at a few possible reasons for this behavior and how to address them.
### Common Issues and Fixes
1. **Character Data Handl... | 36,172 | [
{
"from": "human",
"value": "Edit: This code is fine. I found a logic bug somewhere that doesn't exist in my pseudo code. I was blaming it on my lack of Java experience.\nIn the pseudo code below, I'm trying to parse the XML shown. A silly example maybe but my code was too large/specific for anyone to ge... |
I have a huge text file (~1GB) and sadly the text editor I use won't read such a large file. However, if I can just split it into two or three parts I'll be fine, so, as an exercise I wanted to write a program in python to do it.
What I think I want the program to do is to find the size of a file, divide that number... | Certainly! Here are some key filesystem-related operations you might find useful for your task, specifically in reading a large file in chunks and writing them to smaller files. I’ll break down the components you'll need to implement your splitting logic.
### 1. Get the File Size
You can get the size of a file using ... | 41,959 | [
{
"from": "human",
"value": "I have a huge text file (~1GB) and sadly the text editor I use won't read such a large file. However, if I can just split it into two or three parts I'll be fine, so, as an exercise I wanted to write a program in python to do it. \nWhat I think I want the program to do is to f... |
can anyone show me how to get the users within a certain group using sharepoint?
so i have a list that contains users and or groups. i want to retrieve all users in that list. is there a way to differentiate between whether the list item is a group or user. if its a group, i need to get all the users within that group.... | To achieve your goal of retrieving users from a SharePoint list, differentiating between users and groups, and fetching users from groups if necessary, you can follow these steps in C#. Below is a high-level outline and some sample code to help you get started.
### Prerequisites
1. **Install the SharePoint Client Com... | 41,356 | [
{
"from": "human",
"value": "can anyone show me how to get the users within a certain group using sharepoint?\nso i have a list that contains users and or groups. i want to retrieve all users in that list. is there a way to differentiate between whether the list item is a group or user. if its a group, i ne... |
I need to access an excel spreadsheet and insert the data from the spreadsheet into a SQL Database. However the Primary Keys are mixed, most are numeric and some are alpha-numeric.
The problem I have is that when the numeric and alpha-numeric Keys are in the same spreadsheet the alpha-numeric cells return blank values,... | This is a common issue when working with Excel files and OLEDB, especially when mixing numeric and alphanumeric primary keys. Excel tends to infer data types based on the data present in the first few rows of the column, which can lead to issues when subsequent rows contain different types (for example, alphanumeric st... | 41,703 | [
{
"from": "human",
"value": "I need to access an excel spreadsheet and insert the data from the spreadsheet into a SQL Database. However the Primary Keys are mixed, most are numeric and some are alpha-numeric.\nThe problem I have is that when the numeric and alpha-numeric Keys are in the same spreadsheet th... |
Many times I saw logging of errors like these:
System.out.println("Method aMethod with parameters a:"+a+" b: "+b);
print("Error in line 88");
so.. What are the best practices to log an error?
EDIT:
This is java but could be C/C++, basic, etc.
| Logging errors effectively is crucial for understanding issues in your code and for debugging. Here are some best practices for logging errors that can be applied across different programming languages, including Java, C, and C++:
### 1. Use a Logging Framework
Instead of using `System.out.println` or similar approach... | 42,229 | [
{
"from": "human",
"value": "Many times I saw logging of errors like these:\nSystem.out.println(\"Method aMethod with parameters a:\"+a+\" b: \"+b);\nprint(\"Error in line 88\");\n\nso.. What are the best practices to log an error?\nEDIT:\nThis is java but could be C/C++, basic, etc.\n"
},
{
"from":... |
I am pretty new to both Struts and Spring. I need to know how to access a Spring Service in a Struts ActionForm. Even a pointer in the right direction would be appreciated.
| Integrating Spring with Struts can seem a bit daunting if you are new to both frameworks, but with a little guidance, you can set up a Spring service within a Struts application quite easily. Here’s how you can access a Spring service in a Struts `ActionForm`.
### Step-by-Step Guide
1. **Add Dependencies**: Ensure yo... | 43,062 | [
{
"from": "human",
"value": "I am pretty new to both Struts and Spring. I need to know how to access a Spring Service in a Struts ActionForm. Even a pointer in the right direction would be appreciated.\n"
},
{
"from": "gpt",
"value": "Integrating Spring with Struts can seem a bit daunting if you... |
Im having a problem with a final part of my assignment. We get in a stream of bits, etc etc, in the stream is an integer with the number of 1's in the text portion. I get that integer and its 24 which is correct, now i loop through the text data i get and i try to count all the 1's in there. But my proc is always retur... | The code you provided is intended to count the number of 1 bits in each byte of the input text, but it has a few issues that need to be addressed for it to work correctly. Below are the key issues along with the corrected approach.
### Issues in the Existing Code
1. **Initialization of Registers**: You are not proper... | 43,347 | [
{
"from": "human",
"value": "Im having a problem with a final part of my assignment. We get in a stream of bits, etc etc, in the stream is an integer with the number of 1's in the text portion. I get that integer and its 24 which is correct, now i loop through the text data i get and i try to count all the ... |
I've got an RSA private key in PEM format, is there a straight forward way to read that from .NET and instantiate an RSACryptoServiceProvider to decrypt data encrypted with the corresponding public key?
| Yes, you can use the `RSACryptoServiceProvider` in .NET to instantiate an RSA object from a private key in PEM format. However, `RSACryptoServiceProvider` itself does not directly support PEM format. Instead, you will need to convert the PEM format into a format that .NET can understand, typically a byte array, and the... | 42,899 | [
{
"from": "human",
"value": "I've got an RSA private key in PEM format, is there a straight forward way to read that from .NET and instantiate an RSACryptoServiceProvider to decrypt data encrypted with the corresponding public key?\n"
},
{
"from": "gpt",
"value": "Yes, you can use the `RSACrypto... |
I'm already familiar with the standard Java package naming convention of using a domain name to create a unique package name (i.e. package com.stackoverflow.widgets). However, I've never seen any recommendations for how to choose package names for personal projects. I assume because this is because this is really a mat... | Choosing package names for personal projects can indeed be a matter of personal preference, but having a consistent system can help keep your projects organized and easily navigable. Your approach of using a hierarchical naming convention is quite reasonable and can be extended in various ways. Here are some options an... | 43,934 | [
{
"from": "human",
"value": "I'm already familiar with the standard Java package naming convention of using a domain name to create a unique package name (i.e. package com.stackoverflow.widgets). However, I've never seen any recommendations for how to choose package names for personal projects. I assume bec... |
I am thinking on deploying multiple (and different) web applications on the same server using the following schema:
www.mydomain.com/app1
www.mydomain.com/app2
Is this a good practice? Any recommendations?
| Deploying multiple web applications on the same server under different subdirectories (like `www.mydomain.com/app1` and `www.mydomain.com/app2`) can be a valid and effective approach, especially for smaller projects or when resources are limited. However, there are several factors to consider to ensure that this is don... | 37,330 | [
{
"from": "human",
"value": "I am thinking on deploying multiple (and different) web applications on the same server using the following schema:\nwww.mydomain.com/app1\nwww.mydomain.com/app2\nIs this a good practice? Any recommendations?\n"
},
{
"from": "gpt",
"value": "Deploying multiple web ap... |
I have an abstract class:
type
TInterfaceMethod = class abstract
public
destructor Destroy; virtual; abstract;
function GetBasePlan: Word; virtual; abstract;
procedure CountBasePlan; virtual; abstract;
procedure Calculate; virtual; abstract;
procedure PrepareForWork; virtual;... | Yes, you can absolutely place the implementation of `GetBasePlan` and `CountBasePlan` methods in the base class and declare them as `virtual` rather than `abstract`. This is a common practice in object-oriented design and can lead to better code reuse and reduced duplication.
Here’s how you can implement it:
1. **Dec... | 42,132 | [
{
"from": "human",
"value": "I have an abstract class:\ntype\n TInterfaceMethod = class abstract\n public\n destructor Destroy; virtual; abstract;\n function GetBasePlan: Word; virtual; abstract;\n procedure CountBasePlan; virtual; abstract;\n procedure Calculate; virtual; ab... |
I'm trying to pick a perforamnce analyzer to use. I'm a beginner developer and not sure what to look for in a performance analyzer. What are the most important features?
| When choosing a performance analyzer (or performance profiling tool), especially as a beginner developer, there are several key features you should consider to ensure it meets your needs. Here are the most important ones:
### 1. **User-Friendly Interface**
- Look for tools that have an intuitive interface. A well-d... | 43,487 | [
{
"from": "human",
"value": "I'm trying to pick a perforamnce analyzer to use. I'm a beginner developer and not sure what to look for in a performance analyzer. What are the most important features?\n"
},
{
"from": "gpt",
"value": "When choosing a performance analyzer (or performance profiling... |
I'm seeing some wierd behaviour when throwing exceptions and catching them in the Application.ThreadException event handler.
Basically whats happening in the sample below is that an exception is thrown in the DoWork event handler of a BackgroundWorker. The RunWorkerCompleted event handler rethrows a new exception with ... | The behavior you're observing stems from how exceptions are propagated in the context of the `BackgroundWorker` and how the `Application.ThreadException` event handler captures and processes exceptions.
### Key Points
1. **BackgroundWorker Exception Handling**:
- When an exception is thrown in the `DoWork` event ... | 44,321 | [
{
"from": "human",
"value": "I'm seeing some wierd behaviour when throwing exceptions and catching them in the Application.ThreadException event handler.\nBasically whats happening in the sample below is that an exception is thrown in the DoWork event handler of a BackgroundWorker. The RunWorkerCompleted ev... |
I'm working with asp.net (I'm a designer) and at some point during debugging it'll throw me and I'll get to an Exception objErr in the code - and when I hover it says "file not found". I assume it's an image but I've been searching and can't find anyway to pinpoint which file is missing. I hope this is enough informati... | When you're encountering a "file not found" exception in your ASP.NET application while debugging, it can be challenging to pinpoint which specific file is missing. Here are some steps and tips that may help you identify the missing file:
1. **Check Exception Details**: When you hover over the `objErr`, check if there... | 44,517 | [
{
"from": "human",
"value": "I'm working with asp.net (I'm a designer) and at some point during debugging it'll throw me and I'll get to an Exception objErr in the code - and when I hover it says \"file not found\". I assume it's an image but I've been searching and can't find anyway to pinpoint which file ... |
Why one would use one of the following packages instead of the other?
Java Logging
Commons Logging
Log4j
SLF4j
Logback
| The choice between different logging frameworks in Java depends on various factors, such as your project's requirements, performance considerations, and desired logging features. Here's a breakdown of each of the logging options you mentioned, along with the reasons one might choose one over the others:
### 1. **Java ... | 43,555 | [
{
"from": "human",
"value": "Why one would use one of the following packages instead of the other?\n\nJava Logging\nCommons Logging\nLog4j\nSLF4j\nLogback\n\n"
},
{
"from": "gpt",
"value": "The choice between different logging frameworks in Java depends on various factors, such as your project's... |
Sorry answer found while typing
I am trying to connect to an external webservice that requires username/password authentication through a proxy. I am using Visual Studio Express 2008 to generate a service reference
I have connected to the same
webservice using a web reference.We
only had to set a larger timeout
becau... | It looks like you encountered a common situation when integrating with a web service that requires authentication. Let's summarize the solution for clarity, and others who might face similar issues can benefit from your experience.
### Situation
You were attempting to connect to a web service through a proxy with user... | 40,329 | [
{
"from": "human",
"value": "Sorry answer found while typing \nI am trying to connect to an external webservice that requires username/password authentication through a proxy. I am using Visual Studio Express 2008 to generate a service reference\n\nI have connected to the same\nwebservice using a web refere... |
I have an interface that defines some methods I would like certain classes to implement.
public interface IMyInterface
{
MethodA;
MethodB;
}
Additionally I would like all classes implementing this interface to be serializable. If I change the interface definition to implement ISerializable as below...:
publi... | To achieve your goal of ensuring that all classes implementing your interface are serializable, without forcing them to implement custom serialization logic, you can use the `[Serializable]` attribute along with the regular `ISerializable` interface implementation. However, to maintain a clean design and avoid requirin... | 44,670 | [
{
"from": "human",
"value": "I have an interface that defines some methods I would like certain classes to implement.\n\npublic interface IMyInterface\n{\n MethodA;\n MethodB;\n}\n\nAdditionally I would like all classes implementing this interface to be serializable. If I change the interface definiti... |
Using Visual Studio 2008 / C# / VS Unit Testing.
I have a very straightforward extension method, that will tell me if an object is of a specific type:
public static bool IsTypeOf<T, O>(this T item, O other)
{
if (!(item.GetType() is O))
return false;
else
return true;
}
It would be called like:... | It looks like you've resolved the initial problem regarding the `MissingMethodException` when running unit tests for your extension method. However, let's clarify and refine both the original issue and the final solution for future reference.
### The Issue
You encountered a `MissingMethodException` when running your ... | 43,923 | [
{
"from": "human",
"value": "Using Visual Studio 2008 / C# / VS Unit Testing.\nI have a very straightforward extension method, that will tell me if an object is of a specific type:\npublic static bool IsTypeOf<T, O>(this T item, O other)\n{\n if (!(item.GetType() is O))\n return false;\n else\n... |
My requirement is just to display a set of values retrieved from database on a spread. I am using jquery.
| To display a set of values retrieved from a database in a spreadsheet-like format using jQuery, you'll typically follow these steps:
1. **Retrieve Data from the Database**: You will need to fetch the data from your database, typically via an AJAX call to a server-side script (like PHP, Node.js, etc.).
2. **Format the... | 41,621 | [
{
"from": "human",
"value": "My requirement is just to display a set of values retrieved from database on a spread. I am using jquery.\n"
},
{
"from": "gpt",
"value": "To display a set of values retrieved from a database in a spreadsheet-like format using jQuery, you'll typically follow these st... |
At work we recently upgraded from Microsoft SQL Server 7 to SQL 2005. The database engine is a lot more advanced, but the management studio is pretty awful in a number of ways. Most of our developers decided they preferred to stick with the old Query Analyzer tool, even though it had a lot of limitations.
In my spare... | It’s great to hear that you’ve taken the initiative to develop a tool like Versabanq Squel! The transition from SQL Server 7 to SQL Server 2005 brought numerous enhancements in the database engine, but many users did express dissatisfaction with changes to the Management Studio interface. Your observation that some dev... | 44,964 | [
{
"from": "human",
"value": "At work we recently upgraded from Microsoft SQL Server 7 to SQL 2005. The database engine is a lot more advanced, but the management studio is pretty awful in a number of ways. Most of our developers decided they preferred to stick with the old Query Analyzer tool, even though... |
I was reading about self-referential has_many :through data situations today, because I'm trying to build a Rails application that uses them. I found this example situation on the Internet, and I have a question about it. Let me post this example code from this guy's blog:
create_table :animals do |t|
t.string :speci... | In the scenario you described, you do not necessarily need a separate table for `CapturePercent`. The `capture_percent` attribute is already included in the `hunts` table, which you have defined. Here's how you can think through the design and implement it effectively in your Rails application.
### Understanding the E... | 45,163 | [
{
"from": "human",
"value": "I was reading about self-referential has_many :through data situations today, because I'm trying to build a Rails application that uses them. I found this example situation on the Internet, and I have a question about it. Let me post this example code from this guy's blog:\ncrea... |
I’ve started using the MVP pattern in a Windows forms app for a couple of my forms. These forms create a presenter and pass themselves back to the presenter.
I’m not using any particular framework and forms are still able to open other forms.
Should I change this setup so that presenters can open other forms (via view... | Your current implementation of the MVP (Model-View-Presenter) pattern is on the right track, but you can definitely enhance it further for better separation of concerns and maintainability. Here are some considerations and recommendations based on your description:
### Current Setup
- **Forms as Views**: Your forms ac... | 38,037 | [
{
"from": "human",
"value": "I’ve started using the MVP pattern in a Windows forms app for a couple of my forms. These forms create a presenter and pass themselves back to the presenter.\nI’m not using any particular framework and forms are still able to open other forms. \nShould I change this setup so tha... |
I am writing code for uploading a file from a client to my server and the performance isn't as fast as I think it should be.
I have the current code snippet that is doing the file transfer and I was wondering how I could speed up the transfer.
Sorry about all of the code:
InputStream fileItemInputStream ;
OutputStream ... | There are several performance improvements you can make to your file upload code. The primary issues in your current implementation relate to the way you're reading from the input stream and writing to the output stream. Here are some suggestions to improve the performance:
### 1. Use a byte buffer instead of an int a... | 44,868 | [
{
"from": "human",
"value": "I am writing code for uploading a file from a client to my server and the performance isn't as fast as I think it should be.\nI have the current code snippet that is doing the file transfer and I was wondering how I could speed up the transfer.\nSorry about all of the code:\nInp... |
As I stated in this question, I am using SDL for a small game I'm developing. Now I am having problems with SDL_DisplayFormatAlpha. I am trying to create a surface with an alpha channel from a PNG image. It was working before, but now that I've done some slight refactoring something got broken. I've narrowed it dow... | The issue you're experiencing with `SDL_DisplayFormatAlpha` and the segmentation fault you're encountering is likely due to how you're managing the surfaces in your code, especially regarding memory and pixel formats.
1. **Understanding SDL_DisplayFormatAlpha**: The function `SDL_DisplayFormatAlpha` is designed to con... | 44,182 | [
{
"from": "human",
"value": "As I stated in this question, I am using SDL for a small game I'm developing. Now I am having problems with SDL_DisplayFormatAlpha. I am trying to create a surface with an alpha channel from a PNG image. It was working before, but now that I've done some slight refactoring so... |
I've decided to make a big push towards MVC for all new sites I make. I have a question about whether or not you can have any processing on the model level.
The case that brought up this question is a video site. I have a Video class (model) and one of the things I need to do when a user views the video I need the vi... | In the MVC (Model-View-Controller) architecture, models play a crucial role in encapsulating the application's data and business logic. While it's true that models often contain accessor (getter) and mutator (setter) methods for managing state, they can also include more complex methods that deal with business logic an... | 44,754 | [
{
"from": "human",
"value": "I've decided to make a big push towards MVC for all new sites I make. I have a question about whether or not you can have any processing on the model level.\nThe case that brought up this question is a video site. I have a Video class (model) and one of the things I need to do... |
I have a view user control that can post form. This control can be used on multiple views.
If user enters invalid data i add errors to ModelState - as simple as that. The problem is
that i don't know which view/actionresult to return since i don't know from where user post form. Ok, i can get urlreferer - but that do... | Handling form submissions in a reusable user control in ASP.NET can indeed present challenges when it comes to returning to the appropriate view after validating input. While using `UrlReferrer` can work, there are more straightforward and maintainable approaches.
Here are a few strategies you could consider:
### 1. ... | 43,194 | [
{
"from": "human",
"value": "I have a view user control that can post form. This control can be used on multiple views. \nIf user enters invalid data i add errors to ModelState - as simple as that. The problem is \nthat i don't know which view/actionresult to return since i don't know from where user post f... |
I have some data that has a detail table. I want the data to be presented in a ListView. I want the detail data to appear as a nested ListView when you select an item in the original list. I can't seem to figure out how to get the data binding to work.
Here's what I have so far, (the problem is the {Binding Path=FK_His... | To ensure that your detail data displays correctly in a nested `ListView` when you select an item in the original `ListView`, you need to make sure that the data binding for your detail items is set up properly. Let's go over your XAML and correct the issues related to the data binding.
Here are a few key points to co... | 42,495 | [
{
"from": "human",
"value": "I have some data that has a detail table. I want the data to be presented in a ListView. I want the detail data to appear as a nested ListView when you select an item in the original list. I can't seem to figure out how to get the data binding to work.\nHere's what I have so far... |
Ok, so I'm binding a DataGridView to a BindingSource in a background thread while a little, "Please Wait" model window keeps the user entertained. No problem.
However, I need to change some of the rows background colors based on the row's databounditem type. Like this:
for (int i = 0; i < dgItemMaster.Rows.Count; i++... | To avoid locking up the GUI while changing the background colors of the rows in your `DataGridView`, you can leverage a more efficient approach. One common method to handle such scenarios is to defer the styling updates until after the control is fully rendered and then update the row colors in a more optimized way. In... | 39,448 | [
{
"from": "human",
"value": "Ok, so I'm binding a DataGridView to a BindingSource in a background thread while a little, \"Please Wait\" model window keeps the user entertained. No problem. \nHowever, I need to change some of the rows background colors based on the row's databounditem type. Like this:\nfor... |
ASP.NET master pages - essential things.
However, I have a lot of very similar UserControls in my projects - it might be a standard layout for an AJAX ModalPopup, or something more involved.
I wish I could get rid of some of my duplicated code (both in ascx files and code-behind) with some Master UserControls.
Does any... | Certainly! In ASP.NET, if you're finding yourself with a lot of duplicated code in your UserControls and you want to streamline your development process, you can consider the following strategies to create Master UserControls. These approaches focus on reusability and maintaining a clean code structure:
### 1. **Use B... | 40,117 | [
{
"from": "human",
"value": "ASP.NET master pages - essential things.\nHowever, I have a lot of very similar UserControls in my projects - it might be a standard layout for an AJAX ModalPopup, or something more involved.\nI wish I could get rid of some of my duplicated code (both in ascx files and code-behi... |
I am using BeautifulSoup in Python to parse some HTML. One of the problems I am dealing with is that I have situations where the colspans are different across header rows. (Header rows are the rows that need to be combined to get the column headings in my jargon) That is one column may span a number of columns above ... | You can improve the readability and Pythonic style of your code by using list comprehensions, breaking down logic into functions, and utilizing more descriptive variable names. Below is a revised version of your routine with these enhancements:
```python
longHeader = ['', '', 'bananas', '', '', '', '', '', '', '', '',... | 44,197 | [
{
"from": "human",
"value": "I am using BeautifulSoup in Python to parse some HTML. One of the problems I am dealing with is that I have situations where the colspans are different across header rows. (Header rows are the rows that need to be combined to get the column headings in my jargon) That is one c... |
I created two tables:
Publisher
PK, PublisherId, int, not null, indentity +1
PublisherName, varchar(50), not null
Product
PK, ProductId, int, not null, identity +1
ProductName, varchar(50), not null
PublisherId, int, not null
Then I created a foreign key constraint FK__Product__Publisher between those tables conn... | It sounds like you're on the right track with creating your tables and setting up the typed dataset and TableAdapters. However, the issue you're encountering (the `this.Table.ParentRelations` returning null) suggests that there may be a problem with the way the relationships were defined in the dataset or with the unde... | 42,225 | [
{
"from": "human",
"value": "I created two tables:\nPublisher \n\nPK, PublisherId, int, not null, indentity +1 \nPublisherName, varchar(50), not null\n\nProduct\n\nPK, ProductId, int, not null, identity +1\nProductName, varchar(50), not null\nPublisherId, int, not null\n\nThen I created a foreign key constr... |
I'm trying to start iexplore.exe let it run for 5 seconds and then close it again.
iexplore opens just fine however it doesn't close when I call the PostThreadMessage.
Can anyone see what I'm doing wrong? Here is my code:
CString IEPath = "C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE";//GetIEPath();
//IEPath += ... | Your approach to closing Internet Explorer (IExplorer) using `PostThreadMessage` is not working because `PostThreadMessage` only sends a message to the thread's message queue, and the Internet Explorer process does not necessarily handle the `WM_QUIT` message in a way that would terminate it.
Here's how you can succes... | 43,188 | [
{
"from": "human",
"value": "I'm trying to start iexplore.exe let it run for 5 seconds and then close it again.\niexplore opens just fine however it doesn't close when I call the PostThreadMessage. \nCan anyone see what I'm doing wrong? Here is my code:\nCString IEPath = \"C:\\\\Program Files\\\\Internet Ex... |
I'm a non-computer science student doing a history thesis that involves determining the frequency of specific terms in a number of texts and then plotting these frequencies over time to determine changes and trends. While I have figured out how to determine word frequencies for a given text file, I am dealing with a (r... | You can certainly achieve your goal using command-line tools and a simple scripting approach. Here, I'll suggest a straightforward method using Python, which is open-source and available on Linux. This solution will allow you to count the frequency of specific words from a predefined list across multiple text files and... | 40,538 | [
{
"from": "human",
"value": "I'm a non-computer science student doing a history thesis that involves determining the frequency of specific terms in a number of texts and then plotting these frequencies over time to determine changes and trends. While I have figured out how to determine word frequencies for ... |
How can I detect if another host is using the same MAC address as the current host, e.g. because the other host is spoofing?
I'm working in an embedded environment, so looking for answers on a protocol level, rather than “use such and such a tool”.
Edit: RARP does not solve this problem. For RARP to get any reply at al... | In an embedded environment where you're concerned about MAC address spoofing, there are a few methods you can employ at a protocol level to detect if another host is using the same MAC address as your current host. Here are several approaches:
### 1. **ARP Monitoring**
Use ARP requests to check for duplicate MAC addre... | 42,447 | [
{
"from": "human",
"value": "How can I detect if another host is using the same MAC address as the current host, e.g. because the other host is spoofing?\nI'm working in an embedded environment, so looking for answers on a protocol level, rather than “use such and such a tool”.\nEdit: RARP does not solve th... |
could someone provide working example (full maven plugin configuration) how to copy built jar file to a specific server(s) at the time of deploy phase?
I have tried to look at wagon plugin, but it is hugely undocumented and I was not able to set it up. The build produces standard jar that is being deployed to Nexus, bu... | Certainly! You can use the Maven Wagon Plugin to copy the built JAR file to a specific server during the deploy phase. Below is a sample configuration that demonstrates how to set up the Maven Wagon Plugin in your `pom.xml`.
This example assumes you are copying the JAR file to a network share (e.g., `\\someserver\test... | 30,913 | [
{
"from": "human",
"value": "could someone provide working example (full maven plugin configuration) how to copy built jar file to a specific server(s) at the time of deploy phase?\nI have tried to look at wagon plugin, but it is hugely undocumented and I was not able to set it up. The build produces standa... |
I have created a client-server program with Perl using IO::Socket::INET. I access server through CGI based site. My server program will run as daemon and will accept multiple simultaneous connections. My server process consumes about 100MB of memory space (9 large arrays, many arrays...). I want these hashes to reside... | To address the memory consumption and performance issues of your Perl client-server application, you can explore a few different approaches to share the large data structures (hashes) among multiple child processes without duplicating the memory footprint. Here are a few strategies you could consider:
### 1. Use `Shar... | 43,851 | [
{
"from": "human",
"value": "I have created a client-server program with Perl using IO::Socket::INET. I access server through CGI based site. My server program will run as daemon and will accept multiple simultaneous connections. My server process consumes about 100MB of memory space (9 large arrays, many a... |
Does combining an Enterprise Messaging solution with Web Services result in a real performance gain over simple HTTP requests over sockets?
(if implementation details will help, interested in JMS with a SOAP webservice)
| Combining an Enterprise Messaging solution, such as Java Message Service (JMS), with Web Services (like SOAP) can provide performance and architectural advantages over using simple HTTP requests over sockets, but the effectiveness depends on several factors, including the specific use case, architecture requirements, a... | 41,878 | [
{
"from": "human",
"value": "Does combining an Enterprise Messaging solution with Web Services result in a real performance gain over simple HTTP requests over sockets?\n(if implementation details will help, interested in JMS with a SOAP webservice)\n"
},
{
"from": "gpt",
"value": "Combining an ... |
How do I create an ASP.NET web service that returns JSON formatted data?
| Creating an ASP.NET web service that returns JSON-formatted data involves several steps. You can choose between ASP.NET Web API and ASP.NET Core. Below, I'll guide you through both approaches.
### Using ASP.NET Web API
1. **Create an ASP.NET Web API Project:**
- Open Visual Studio and select "Create a new project.... | 41,619 | [
{
"from": "human",
"value": "How do I create an ASP.NET web service that returns JSON formatted data?\n"
},
{
"from": "gpt",
"value": "Creating an ASP.NET web service that returns JSON-formatted data involves several steps. You can choose between ASP.NET Web API and ASP.NET Core. Below, I'll gui... |
I have an enumeration value marked with the following attribute. The second parameter instructs the compiler to error whenever the value is used. I want this behavior for anyone that implements my library, but I need to use this enumeration value within my library. How do I tell the compiler to ignore the Obsolete e... | The approach you proposed is a clever workaround to retain the functionality of an obsolete enum value while preventing the compiler from issuing warnings for its use within your library. Let's break down and expand upon your solution for clarity:
### Your Proposed Solution
1. **Enum Declaration**: You have an enum `... | 41,480 | [
{
"from": "human",
"value": "I have an enumeration value marked with the following attribute. The second parameter instructs the compiler to error whenever the value is used. I want this behavior for anyone that implements my library, but I need to use this enumeration value within my library. How do I t... |
When the "New" menu item on a Document Library expands the default seems to be to list the document templates for that list and the "New folder" as the final element (if "New folder" has not been disabled).
I have added a new custom menu item but it is displayed after "New folder" and I would like it to be shown at in... | To ensure your custom menu item appears as the first item in the "New" menu of a Document Library in SharePoint (or similar platforms), you'll generally need to manage the order in which these items are registered. Here are some approaches you can take to achieve this:
### 1. Custom Action Order
When adding custom ac... | 44,227 | [
{
"from": "human",
"value": "When the \"New\" menu item on a Document Library expands the default seems to be to list the document templates for that list and the \"New folder\" as the final element (if \"New folder\" has not been disabled). \nI have added a new custom menu item but it is displayed after \"... |
A quick search for currency regex brings up a lot of results.
The problem I have in choosing one is that regex is difficult to verify without testing all the edge cases. Does anyone have a regex for U.S. currency that has been thoroughly tested?
My only requirement is that the matched string is U.S. currency and parses... | Creating a robust regex for U.S. currency that adheres to your specified format is indeed a challenging task. The regex needs to accommodate various scenarios, including optional whitespace, optional signs, thousands separators, and decimal points. Below is a regex pattern that meets your requirements, along with a bri... | 42,871 | [
{
"from": "human",
"value": "A quick search for currency regex brings up a lot of results.\nThe problem I have in choosing one is that regex is difficult to verify without testing all the edge cases. Does anyone have a regex for U.S. currency that has been thoroughly tested?\nMy only requirement is that the... |
So like many people, I'm excited about Ruby on Rails. Being a Windows user, I downloaded InstantRails, got it going, and followed along with the screencast on how to make a blog with RoR 2.0 in fifteen minutes. I used Notepad++ as my text editor, because that's what I've traditionally used for writing the PHP-based web... | It's great to hear that you're diving into Ruby on Rails (RoR)! Many people start with some confusion, especially when transitioning from languages like PHP, due to differences in structure, conventions, and the framework's philosophy.
### Here are some suggestions to help you get started:
1. **Understand the MVC Str... | 42,310 | [
{
"from": "human",
"value": "So like many people, I'm excited about Ruby on Rails. Being a Windows user, I downloaded InstantRails, got it going, and followed along with the screencast on how to make a blog with RoR 2.0 in fifteen minutes. I used Notepad++ as my text editor, because that's what I've traditi... |
I need to be able to get all keypress events before they are passed up to the Word document. I want to do special handling of the keys and depending on what mode the add in is in, the keys may or may not be sent to the Word document. I only want the keypress events that belong to the document, I don't want to hook ev... | To achieve your goal of intercepting keypress events in a Word document before they are processed by Word, you'll need to use some advanced programming techniques. Here’s an overview of how you might implement this in a Word add-in, including the use of subclassing, if necessary.
### General Approach
1. **Create a Wo... | 33,477 | [
{
"from": "human",
"value": "I need to be able to get all keypress events before they are passed up to the Word document. I want to do special handling of the keys and depending on what mode the add in is in, the keys may or may not be sent to the Word document. I only want the keypress events that belong... |
Sometimes two image files may be different on a file level, but a human would consider them perceptively identical. Given that, now suppose you have a huge database of images, and you wish to know if a human would think some image X is present in the database or not. If all images had a perceptive hash / fingerprint, t... | To achieve perceptual hashing of images, you can use several existing libraries and tools. Here are some recommendations:
### Libraries and Tools for Perceptual Hashing
1. **ImageMagick with Perl or Python**:
ImageMagick can be used in conjunction with a programming language like Perl or Python to generate percept... | 40,330 | [
{
"from": "human",
"value": "Sometimes two image files may be different on a file level, but a human would consider them perceptively identical. Given that, now suppose you have a huge database of images, and you wish to know if a human would think some image X is present in the database or not. If all imag... |
Is there a way to detect the true border, padding and margin of elements from Javascript code? If you look at the following code:
<html>
<head>
<style>
<!--
.some_class {
padding-left: 2px;
border: 2px solid green;
}
-->
</style>
<sc... | Yes, you can retrieve the computed styles of an element in JavaScript using the `getComputedStyle` function. This function allows you to access the final computed values of all CSS properties, regardless of whether they were set inline, in a stylesheet, or via other means. Here's how you can modify your `showDetails` f... | 45,886 | [
{
"from": "human",
"value": "Is there a way to detect the true border, padding and margin of elements from Javascript code? If you look at the following code:\n<html>\n <head>\n <style>\n <!--\n .some_class {\n padding-left: 2px;\n border: 2px solid green;\n ... |
I have several controls on a page. It happens to be a Silverlight page but I don't think that it matters for this question.
When a control's value changes, a change event is raised. In this event I do a calculation and change the value of one of the other controls. This in turn causes the other control to raise a chang... | To handle this situation effectively, you want to avoid redundant calculations triggered by the change events of your controls. There are a few approaches you can consider:
### 1. Use a Boolean Flag:
While you mentioned that using a boolean flag didn’t work as expected, it can be an effective solution if implemented c... | 41,855 | [
{
"from": "human",
"value": "I have several controls on a page. It happens to be a Silverlight page but I don't think that it matters for this question.\nWhen a control's value changes, a change event is raised. In this event I do a calculation and change the value of one of the other controls. This in turn... |
I'm trying to watch the execution of a VB6 app and I'm running into an issue because once I enter the debugger and then hit Continue, it no longer lets me step through the code until I hit another break point. I want to be able to execute a program without stepping through something until I hit a point where I want t... | In VB6, the debugger does have some limitations when it comes to stepping through code in a flexible way. However, there are a few strategies you can use to achieve a similar result to what you're describing. Here are some methods you could try:
### 1. Use the **Debug.Print** Method
You can insert `Debug.Print` statem... | 44,375 | [
{
"from": "human",
"value": "I'm trying to watch the execution of a VB6 app and I'm running into an issue because once I enter the debugger and then hit Continue, it no longer lets me step through the code until I hit another break point. I want to be able to execute a program without stepping through som... |
I need to upload images using FileUpload without postback(using Ajax).I tried many examples.But in all postback is coming or they are using PHP.Can anyone help me to do single file upload or multi file upload using ajax in ASP.Net with C#.
| Certainly! To perform file uploads using AJAX in ASP.NET without causing a postback, you can use the following steps. This example will cover both single and multiple file uploads.
### Frontend (HTML + JavaScript)
We'll use an HTML form with an `<input>` for file uploads, and then use JavaScript (with jQuery) to hand... | 41,406 | [
{
"from": "human",
"value": "I need to upload images using FileUpload without postback(using Ajax).I tried many examples.But in all postback is coming or they are using PHP.Can anyone help me to do single file upload or multi file upload using ajax in ASP.Net with C#.\n"
},
{
"from": "gpt",
"val... |
I am using mysql (5.0.32-Debian_7etch6-log) and i've got a nightly running bulk load php (5.2.6) script (using Zend_DB (1.5.1) via PDO) which does the following:
truncating a set of 4 'import' tables
bulk inserting data into these 4 'import' tables (re-using ids that have previously been in the tables as well, but i t... | It sounds like you're encountering a perplexing issue with your MySQL setup, especially given the truncation and the subsequent operations you've described. Here are a few suggestions and considerations that may help you troubleshoot and resolve the problem:
1. **Ensure Consistency**:
- Since you truncate your 'imp... | 43,181 | [
{
"from": "human",
"value": "I am using mysql (5.0.32-Debian_7etch6-log) and i've got a nightly running bulk load php (5.2.6) script (using Zend_DB (1.5.1) via PDO) which does the following:\n\ntruncating a set of 4 'import' tables\nbulk inserting data into these 4 'import' tables (re-using ids that have pr... |
I am designing a error logging feature so our servers (each donig different things) can have a central data store for logging errors.
Would it be a good idea to have the various applications writing to the error log file using a WCF service, or is that a bad idea?
they can do it just by ADO.NET to the database, which I... | When designing an error logging feature with a central data store, there are several factors to consider when choosing between using a WCF service or direct database access with ADO.NET. Let's explore the pros and cons of both approaches:
### Using WCF Service
**Pros:**
1. **Abstraction**: WCF provides a layer of abs... | 43,408 | [
{
"from": "human",
"value": "I am designing a error logging feature so our servers (each donig different things) can have a central data store for logging errors.\nWould it be a good idea to have the various applications writing to the error log file using a WCF service, or is that a bad idea?\nthey can do ... |
What usability evaluation methods do you use?
GOMS?
Cognitive Walkthrough?
Think aloud protocol?
Others? (apart from 'ask your mum' tips that are well covered elsewhere on SO)
| Usability evaluation methods are essential for assessing how well a product meets user needs and to identify areas for improvement. Here’s an overview of several commonly used methods, including the ones you've mentioned:
### 1. GOMS (Goals, Operators, Methods, and Selection Rules)
- **Overview:** GOMS is a model used... | 41,523 | [
{
"from": "human",
"value": "What usability evaluation methods do you use? \n\nGOMS? \nCognitive Walkthrough?\nThink aloud protocol?\n\nOthers? (apart from 'ask your mum' tips that are well covered elsewhere on SO)\n"
},
{
"from": "gpt",
"value": "Usability evaluation methods are essential for a... |
This sounds really stupid, but I was told that you could drag-and-drop visual components (including JavaScript or AJAX components?) onto a web page view in ASP.NET MVC and then "customize" the components by editing code behind them once they were in place. Either I misunderstood what I was told or I'm blind and don't s... | What you’re describing sounds more like a feature associated with ASP.NET Web Forms rather than ASP.NET MVC. In ASP.NET Web Forms, there’s a designer view in Visual Studio that allows developers to drag and drop controls onto a web page, which automatically generates the corresponding HTML and code-behind files for you... | 45,625 | [
{
"from": "human",
"value": "This sounds really stupid, but I was told that you could drag-and-drop visual components (including JavaScript or AJAX components?) onto a web page view in ASP.NET MVC and then \"customize\" the components by editing code behind them once they were in place. Either I misundersto... |
I'm trying to add a pojo to a collection in another pojo. I'm sure I'm making a really stupid mistake somewhere along the lines but I can't figure out how to solve it.
I have a pojo LookupTable which contains a list of Columns:
public class LookupTable {
private long id;
// More properties go here...
private List... | The error message you're encountering, `org.hibernate.HibernateException: Illegal attempt to associate a collection with two open sessions`, typically arises when you attempt to manipulate an entity that is associated with a different Hibernate session than the one currently active. In your case, it seems that you are ... | 41,503 | [
{
"from": "human",
"value": "I'm trying to add a pojo to a collection in another pojo. I'm sure I'm making a really stupid mistake somewhere along the lines but I can't figure out how to solve it.\nI have a pojo LookupTable which contains a list of Columns:\npublic class LookupTable {\n private long id;\n ... |
I am refering to the question on changing the classpath programmatically.
I read and found out that there is some function under System class as getproperties where we can retrieve the properties and then also can set it using setProperties().
The answers however I got was that It Wont work. I have not tried this mysel... | The `System.getProperty(String key)` and `System.setProperty(String key, String value)` methods in Java are indeed used to retrieve and set system properties at runtime. However, there is a distinction to make regarding the classpath property and other properties.
### Classpath Property
The classpath is typically set... | 33,011 | [
{
"from": "human",
"value": "I am refering to the question on changing the classpath programmatically.\nI read and found out that there is some function under System class as getproperties where we can retrieve the properties and then also can set it using setProperties().\nThe answers however I got was tha... |
What would be the basic and obvious security considerations and recommendations in a Java EE Web application?
| When developing a Java EE web application, security is a paramount concern. Here are some basic and obvious security considerations and recommendations:
### 1. **Input Validation**
- **Sanitize Inputs:** Ensure that all user inputs are validated and sanitized to prevent attacks such as SQL Injection and Cross-Site ... | 42,885 | [
{
"from": "human",
"value": "What would be the basic and obvious security considerations and recommendations in a Java EE Web application?\n"
},
{
"from": "gpt",
"value": "When developing a Java EE web application, security is a paramount concern. Here are some basic and obvious security conside... |
The long of it is I built an installer in visual studio that gave me this cheery error when I tried to use the program:
Retrieving the COM class factory for
component with CLSID
{EC10E7E8-797E-4495-A86D-3E9EADA6D5BB}
failed due to the following error:
80040154.
From that it seems I need to embed the manifest... | It sounds like you're encountering a couple of issues here: the COM error you're facing, and the post-build event not executing as expected. Let's tackle both of these issues step by step.
### 1. Resolving the COM Error
The error code `80040154` typically indicates a "Class not registered" issue, which often means th... | 35,294 | [
{
"from": "human",
"value": "The long of it is I built an installer in visual studio that gave me this cheery error when I tried to use the program: \n\nRetrieving the COM class factory for\n component with CLSID\n {EC10E7E8-797E-4495-A86D-3E9EADA6D5BB}\n failed due to the following error:\n 80040154.\n... |
I'd like to have an application monitor written in C# monitoring a set of Forex trading positions. It would be connected via USB to a real set of "traffic lights" sat on a desk which it would use to indicate system status. Can anybody suggest a good solution?
| Creating a Forex trading position monitor that integrates with physical traffic lights via USB can be an interesting project. Below is a step-by-step approach on how to accomplish this using C#:
### Step 1: Define the Requirements
- **Monitor Forex Positions:** Gather real-time data about your Forex positions from a t... | 41,174 | [
{
"from": "human",
"value": "I'd like to have an application monitor written in C# monitoring a set of Forex trading positions. It would be connected via USB to a real set of \"traffic lights\" sat on a desk which it would use to indicate system status. Can anybody suggest a good solution?\n"
},
{
... |
I have the need of a click tab event. I am using the following code.
<script type="text/javascript">
$(function() {
$('#container-1').tabs();
$('#start').bind('tabsselect', function(event, ui) {
alert('tab label ' + ui.tab.text());
});
});
</script>
.....
<div id="c... | It looks like you're using an outdated version of jQuery (1.2.6) and the jQuery UI tabs functionality might not be compatible with that version. Moreover, the event you're trying to use, `tabsselect`, is an old event that was deprecated and replaced with the `activate` event in more recent versions of jQuery UI.
To ac... | 43,768 | [
{
"from": "human",
"value": "I have the need of a click tab event. I am using the following code.\n<script type=\"text/javascript\">\n $(function() {\n $('#container-1').tabs();\n $('#start').bind('tabsselect', function(event, ui) {\n alert('tab label ' + ui.tab.text());\n ... |
I'm just getting into unit testing, and have written some short tests to check if function called isPrime() works correctly.
I've got a test that checks that the function works, and have some test data in the form of some numbers and the expected return value.
How many should I test? How do I decide on which to test? W... | When it comes to unit testing a function like `isPrime()`, the goal is to ensure that the function behaves correctly for a wide range of inputs. Here are some best practices and guidelines on how to determine how many tests to write and which cases to include:
### 1. **Understand the Requirements:**
- Make sure you... | 39,976 | [
{
"from": "human",
"value": "I'm just getting into unit testing, and have written some short tests to check if function called isPrime() works correctly.\nI've got a test that checks that the function works, and have some test data in the form of some numbers and the expected return value.\nHow many should ... |
I am writing helper classes for a large project in PHP and I have written a class called Command. It is essentially an OOP wrapper around running system commands from PHP in a controlled way. It has methods like addOption() to add -a type options and addArgument() to add other arguments.
I will need to do a lot of sc... | In your scenario, extending the `Command` class to create a `ScpCommand` class can be a sensible approach, especially since you have specific requirements for how SCP commands should be constructed and executed. Here's a breakdown of why this makes sense and some alternatives to consider:
### Why Extend `Command` to C... | 41,656 | [
{
"from": "human",
"value": "I am writing helper classes for a large project in PHP and I have written a class called Command. It is essentially an OOP wrapper around running system commands from PHP in a controlled way. It has methods like addOption() to add -a type options and addArgument() to add other... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.