instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Can someone explain how XSS works in plain english? Maybe with an example. Googling didn't help much.
| Sure! XSS, which stands for Cross-Site Scripting, is a type of security vulnerability that allows an attacker to inject malicious scripts into web pages that are viewed by other users. Let's break this down in simple terms.
### How XSS Works
1. **Injection of Malicious Code**: An attacker finds a way to input or inje... | 27,130 | [
{
"from": "human",
"value": "Can someone explain how XSS works in plain english? Maybe with an example. Googling didn't help much.\n"
},
{
"from": "gpt",
"value": "Sure! XSS, which stands for Cross-Site Scripting, is a type of security vulnerability that allows an attacker to inject malicious sc... |
if Form.Release is called after using the form, it will free all related memory but not set the form variable to nil.
if not assigned (Form1) then
begin
Application.CreateForm(Tform1, Form1);
try
// Do something
finally
Form1.Release
end;
end;
To be able to call the same code again, For... | In Delphi, `Form.Release` schedules the form for destruction, but it does not immediately free the memory or set the form variable to `nil`. If you want to ensure that the form variable is set to `nil` after it has been destroyed, you can use an `OnClose` event for the form or create a custom destructor to achieve this... | 31,515 | [
{
"from": "human",
"value": "if Form.Release is called after using the form, it will free all related memory but not set the form variable to nil.\nif not assigned (Form1) then\n begin\n Application.CreateForm(Tform1, Form1);\n try\n // Do something\n finally\n Form1.Release\n end;\n ... |
Due to legacy issues I have two folders under App_Code directory. One for VB.Net and another for C#. Problem is, I have a service in the C# folder that needs to leverage a class in the VB.Net folder but they dont seem to know about each other. Any ideas are welcome :)
Thanks in advance!
Trev
| To enable a C# class to leverage a VB.NET class in your project, you need to ensure that both languages can reference and interact with each other. Here are several steps you can take to achieve this:
### 1. Use a Shared Assembly
One way to share classes between VB.NET and C# is to create a shared assembly (DLL) that ... | 31,790 | [
{
"from": "human",
"value": "Due to legacy issues I have two folders under App_Code directory. One for VB.Net and another for C#. Problem is, I have a service in the C# folder that needs to leverage a class in the VB.Net folder but they dont seem to know about each other. Any ideas are welcome :)\nThanks in... |
I'm trying to access a remote ejb which is not available yet. But the lookup takes 5 min before I get the NameNotFoundException. Is there a way I can set the lookup timeout to a lesser value so that the client application doesn't hang for 5 mins?
Thanks in advance...
| When working with remote EJBs, the lookup timeout for JNDI (Java Naming and Directory Interface) can sometimes lead to long waiting times if the resource is not available. Unfortunately, the JNDI lookup itself does not have a direct timeout setting. However, there are several strategies you can employ to avoid the long... | 30,338 | [
{
"from": "human",
"value": "I'm trying to access a remote ejb which is not available yet. But the lookup takes 5 min before I get the NameNotFoundException. Is there a way I can set the lookup timeout to a lesser value so that the client application doesn't hang for 5 mins? \nThanks in advance...\n"
},
... |
Say I have a list of all Projects, and that I group them by Category like this:
var projectsByCat = from p in Projects
group p by p.Category into g
orderby g.Count() descending
select new { Category = g.Key, Projects = g };
Now I want to display this as a lis... | The issue you're encountering arises from the fact that LINQ to Objects, which you are likely using with the `projectsByCat` query, does not support using the `Where` method with an index parameter when the source is not in-memory. The `Where` method in LINQ to Entities, for example, cannot process the index parameter,... | 35,232 | [
{
"from": "human",
"value": "Say I have a list of all Projects, and that I group them by Category like this:\nvar projectsByCat = from p in Projects\n group p by p.Category into g\n orderby g.Count() descending\n select new { Category = g.Key, Project... |
As good developers we keep our code as standard compliant as possible to help in porting between platforms. But what tools are available that help us build the code in a uniform way across multiple platforms.
*nix family has make but Windows needs nmake.
I have read about SCons but never used it in anger. What is your ... | When it comes to cross-platform build tools, there are several effective options available. Each tool has its strengths and weaknesses, making them suitable for different scenarios. Here are some of the most popular cross-platform build systems, along with their advantages, disadvantages, and some notes on their effect... | 25,942 | [
{
"from": "human",
"value": "As good developers we keep our code as standard compliant as possible to help in porting between platforms. But what tools are available that help us build the code in a uniform way across multiple platforms.\n*nix family has make but Windows needs nmake.\nI have read about SCon... |
I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes.
How do I resize the iframes to fit the height of the iframes' content?
I've tried to decipher the javascript Google uses but it's obfuscated, and searching the web has been fruitless so far.
Update: ... | When dealing with iframes containing content from other domains, the same-origin policy limits your ability to directly manipulate or access the content within those iframes due to security restrictions. This means that you cannot directly measure or modify the height of the content loaded within iframes from other dom... | 27,290 | [
{
"from": "human",
"value": "I am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes. \nHow do I resize the iframes to fit the height of the iframes' content?\nI've tried to decipher the javascript Google uses but it's obfuscated, and searching ... |
I have a page with many forms on it. could be 1..200. None of these forms have buttons and they are built programatically. I am using jquery to submit all the forms that are checked.
function FakeName()
{
$("input:checked").parent("form").submit();
}
My forms look like:
<form name="Fa... | When you submit a form programmatically using jQuery's `.submit()` method, the `onSubmit` event handler does not get called because jQuery bypasses the traditional form submission process. To ensure that the `processRow` function is called for each form when submitting checked forms, you can trigger the function manual... | 34,087 | [
{
"from": "human",
"value": "I have a page with many forms on it. could be 1..200. None of these forms have buttons and they are built programatically. I am using jquery to submit all the forms that are checked.\n function FakeName()\n {\n\n $(\"input:checked\").parent(\"form\").submit();\n\n ... |
I'm developing an application that runs on a machine that has several usb keyboards attached. Occasionally keyboards will added or removed. Each time a key is pressed, the application needs to find out which key was pressed, and which keyboard was used.
I have got a working version of the application which uses RawInp... | To achieve your goal of detecting key presses along with the keyboard from which they originated on multiple operating systems, you have a few options. Here are potential solutions for both macOS and Linux, as well as a brief mention of other platforms.
### macOS (Cocoa)
On macOS, you can use the `NSEvent` class to l... | 26,502 | [
{
"from": "human",
"value": "I'm developing an application that runs on a machine that has several usb keyboards attached. Occasionally keyboards will added or removed. Each time a key is pressed, the application needs to find out which key was pressed, and which keyboard was used.\nI have got a working ve... |
A co worker of mine asked me to review some of my code and he sent me a diff file. I'm not new to diffs or version control in general but the diff file was very difficult to read because of the changes he made. Specifically, he used the "extract method" feature and reordered some methods. Conceptually, very easy to ... | Refactoring can indeed make code diffs difficult to read because it often involves moving code around rather than making direct, linear changes. Unfortunately, traditional version control systems (like Git, SVN, etc.) typically focus on changes to the text itself and do not inherently capture higher-level intentions be... | 24,802 | [
{
"from": "human",
"value": "A co worker of mine asked me to review some of my code and he sent me a diff file. I'm not new to diffs or version control in general but the diff file was very difficult to read because of the changes he made. Specifically, he used the \"extract method\" feature and reordered... |
We are migrationg from CVS to SVN and embracing some kind of revision management in order to enforce order to development/testing/release cycle. We are currently testing, developing and releasing on the same code line, we know its a bad practice and we want to make end to it.
What are your experience, know how, suggest... | Migrating from CVS to SVN is a great step towards better version control management, and it sounds like you are ready to embrace a more structured development and release cycle. Here’s a strategy for organizing your source code and managing your development/test/deploy lifecycle using SVN (and principles that can be ap... | 28,333 | [
{
"from": "human",
"value": "We are migrationg from CVS to SVN and embracing some kind of revision management in order to enforce order to development/testing/release cycle. We are currently testing, developing and releasing on the same code line, we know its a bad practice and we want to make end to it.\nW... |
I am looking for a data structure that operates similar to a hash table, but where the table has a size limit. When the number of items in the hash reaches the size limit, a culling function should be called to get rid of the least-retrieved key/value pairs in the table.
Here's some pseudocode of what I'm working on:
... | You're on the right track with your solution! Using a `LinkedHashMap` to implement an LRU (Least Recently Used) cache is a well-known approach. The custom `removeEldestEntry` method allows you to specify the maximum size of the cache and automatically evict the least recently accessed entries when the size limit is exc... | 31,294 | [
{
"from": "human",
"value": "I am looking for a data structure that operates similar to a hash table, but where the table has a size limit. When the number of items in the hash reaches the size limit, a culling function should be called to get rid of the least-retrieved key/value pairs in the table.\nHere'... |
I have a colleague who insists that his code doesn't need comments, it's "self documenting."
I've reviewed his code, and while it's clearer than code which I've seen others produce, I still disagree that self-documenting code is as complete and useful as well commented and documented code.
Help me understand his point ... | Understanding your colleague's perspective on self-documenting code involves delving into several key concepts and values that proponents of this approach hold. Here are some points that might help clarify the viewpoint of someone who advocates for self-documenting code:
### What is Self-Documenting Code?
Self-docume... | 34,263 | [
{
"from": "human",
"value": "I have a colleague who insists that his code doesn't need comments, it's \"self documenting.\"\nI've reviewed his code, and while it's clearer than code which I've seen others produce, I still disagree that self-documenting code is as complete and useful as well commented and do... |
I'm currently attempting to create a tabbed interface in a web application, and based on my search, there aren't any 'built in' tab controls in ASP.NET. There are some in the ASP.NET AJAX downloadable toolkit, as well as a wealth of 'pay for use' third party Tab Controls.
My question is: What Tab control have you use... | Creating a tabbed interface in an ASP.NET application can indeed be achieved in several ways, and there are various controls and libraries available. Here’s a rundown of some popular options, along with their advantages:
1. **ASP.NET AJAX Control Toolkit**:
- **TabContainer Control**: This is part of the AJAX Contr... | 31,677 | [
{
"from": "human",
"value": "I'm currently attempting to create a tabbed interface in a web application, and based on my search, there aren't any 'built in' tab controls in ASP.NET. There are some in the ASP.NET AJAX downloadable toolkit, as well as a wealth of 'pay for use' third party Tab Controls.\nMy q... |
What is it about fgets() implementation that makes it so horrible on large files vs fread?
To demonstrate, run this code:
<?php
$line = str_repeat('HelloWorld', 100000) . "\n";
for($i=0; $i<10000; ++$i)
file_put_contents('myfile', $line, FILE_APPEND);
//now we have roughly a 1gig file
// We'll even let fread go fi... | The difference in performance between `fgets()` and `fread()` can be attributed to how each function handles the reading of data and how they process the file's contents.
Here’s a breakdown of the differences that can contribute to `fgets()` being slower than `fread()`:
### 1. **Buffering and Overhead:**
- `fread()` ... | 31,428 | [
{
"from": "human",
"value": "What is it about fgets() implementation that makes it so horrible on large files vs fread?\nTo demonstrate, run this code:\n<?php\n$line = str_repeat('HelloWorld', 100000) . \"\\n\";\nfor($i=0; $i<10000; ++$i)\n file_put_contents('myfile', $line, FILE_APPEND);\n//now we have ... |
I was reading an article on MSDN Magazine about using the Enumerable class in LINQ to generate a random array. The article uses VB.NET and I'm not immediately sure what the equivalent is in C#:
Dim rnd As New System.Random()
Dim numbers = Enumerable.Range(1, 100). _
OrderBy(Function() rnd.Next)
| In C#, you can achieve the same functionality using LINQ and the `Random` class. The VB.NET code you provided generates a list of numbers from 1 to 100 and then shuffles them randomly using `OrderBy` and a random number generator. Here’s the equivalent C# code:
```csharp
using System;
using System.Linq;
class Program... | 32,035 | [
{
"from": "human",
"value": "I was reading an article on MSDN Magazine about using the Enumerable class in LINQ to generate a random array. The article uses VB.NET and I'm not immediately sure what the equivalent is in C#:\nDim rnd As New System.Random()\nDim numbers = Enumerable.Range(1, 100). _\n Order... |
I've generated a pdf using iTextSharp and I can preview it very well in ASP.NET but I need to send it directly to printer without a preview. I want the user to click the print button and automatically the document prints.
I know that a page can be sent directly to printer using the javascript window.print() but I don't... | To print a PDF document directly without a preview in an ASP.NET application, you typically have to involve the client's environment, since web applications cannot directly control printers on client machines for security and user experience reasons.
The most common approach involves sending the PDF to the client's br... | 30,613 | [
{
"from": "human",
"value": "I've generated a pdf using iTextSharp and I can preview it very well in ASP.NET but I need to send it directly to printer without a preview. I want the user to click the print button and automatically the document prints.\nI know that a page can be sent directly to printer using... |
My application is a viewer for a custom format, a zip file with a well defined XML manifest and resources, such as images and movies. I use zlib to open up the zip file in memory and then proceed to display said resources.
One problem I've ran into is that I'm unable to properly display videos, apparently because QTMo... | To access the internal mapping of file extensions to MIME types in macOS, you are on the right track by using Uniform Type Identifiers (UTIs). The approach you're using with `UTTypeCreatePreferredIdentifierForTag` and `UTTypeCopyPreferredTagWithClass` is generally correct. However, it looks like you're missing a couple... | 34,511 | [
{
"from": "human",
"value": "My application is a viewer for a custom format, a zip file with a well defined XML manifest and resources, such as images and movies. I use zlib to open up the zip file in memory and then proceed to display said resources. \nOne problem I've ran into is that I'm unable to proper... |
We are in the process of upgrading our VS2008 to the new SP1, but noticed a change in the csproj files for something that we can't find information on. Seems that the ProductVersion in the csproj file is changed from:
<ProductVersion>9.0.21022</ProductVersion>
to
<ProductVersion>9.0.30729</ProductVersion>
It looks li... | When you upgrade from Visual Studio 2008 to Visual Studio 2008 SP1, the change in the `<ProductVersion>` tag in the `.csproj` files is primarily a marker to indicate that the project file was created or modified with Service Pack 1. This versioning helps with compatibility and allows tools like the Solution Selector to... | 33,228 | [
{
"from": "human",
"value": "We are in the process of upgrading our VS2008 to the new SP1, but noticed a change in the csproj files for something that we can't find information on. Seems that the ProductVersion in the csproj file is changed from:\n<ProductVersion>9.0.21022</ProductVersion>\n\nto\n<ProductVe... |
HP NonStop systems (previously known as "Tandem") are known for their high availability and reliability, and higher price.
How do Linux or Unix based clusters compare with them, in these respects and others?
| HP NonStop systems, previously known as Tandem systems, are renowned for their high availability and fault tolerance. They are typically used in environments where uptime is critical, such as in financial services, telecommunications, and other mission-critical applications. In contrast, Linux and Unix-based clusters o... | 33,013 | [
{
"from": "human",
"value": "HP NonStop systems (previously known as \"Tandem\") are known for their high availability and reliability, and higher price. \nHow do Linux or Unix based clusters compare with them, in these respects and others? \n"
},
{
"from": "gpt",
"value": "HP N... |
I'm using Asp.Net 2.0. I have a scenario where i need to check a user input against any of two ranges. For e.g. I need to check a textbox value against ranges 100-200 or 500-600. I know that i can hook up 2 Asp.Net RangeValidators to the TextBox, but that will try to validate the input against both the ranges, an AND ... | In your scenario, since you need to validate a user input against multiple ranges using an OR condition (meaning the input can fall into either of two specified ranges), using a `CustomValidator` is indeed a good approach. You can easily set the valid ranges from the server side, which gives you the flexibility to dyna... | 34,278 | [
{
"from": "human",
"value": "I'm using Asp.Net 2.0. I have a scenario where i need to check a user input against any of two ranges. For e.g. I need to check a textbox value against ranges 100-200 or 500-600. I know that i can hook up 2 Asp.Net RangeValidators to the TextBox, but that will try to validate t... |
I would like to display some smiley's inbetween text in my chatbox but when i add an image it gets displayed on a seperate line...
Any ideas?
<mx:TextArea id="myChat" width="271" height="238" backgroundColor="#ffffff" borderThickness="0" editable="false" enabled="true" horizontalScrollPolicy="off" wordWrap="true">
... | It looks like you're trying to add inline images (emojis) within a `TextArea` component in ActionScript (likely from Adobe Flex). Unfortunately, the `<mx:TextArea>` component treats `<img>` tags as block elements, which is why your image gets rendered on a new line.
To solve this issue and ensure that the image appear... | 32,038 | [
{
"from": "human",
"value": "I would like to display some smiley's inbetween text in my chatbox but when i add an image it gets displayed on a seperate line...\nAny ideas?\n<mx:TextArea id=\"myChat\" width=\"271\" height=\"238\" backgroundColor=\"#ffffff\" borderThickness=\"0\" editable=\"false\" enabled=\"... |
I am looking for a backend solution for an application written in Ruby on Rails or Merb to handle data with several billions of records. I have a feeling that I'm supposed to go with a distributed model and at the moment I looked at
HBase with Hadoop
Couchdb
Problems with HBase solution as I see it -- ruby support is... | When dealing with a backend solution for an application that needs to handle billions of records, you're right to consider distributed data models. Here are a few suggestions that could work well with Ruby on Rails or Merb, while keeping your requirements in mind:
### 1. **PostgreSQL with Partitioning**
PostgreSQL is... | 28,967 | [
{
"from": "human",
"value": "I am looking for a backend solution for an application written in Ruby on Rails or Merb to handle data with several billions of records. I have a feeling that I'm supposed to go with a distributed model and at the moment I looked at \nHBase with Hadoop \nCouchdb\nProblems with H... |
I'm trying to get CellID using AT commands, but I dont get any response from the modem, mine code looks like below, I send AT+CCED command, but never get any response.
HANDLE hCom;
char * xpos;
char rsltstr[5];
DWORD returnValue;
DWORD LAC;
DWORD CellId;
int bufpos;
DCB dcb;
COMMTIMEOUTS to;
DWORD nWritten;
DWORD event... | It looks like you're trying to send an AT command to retrieve the Cell ID from a modem via a serial port, but you're not receiving any response. There are several potential reasons for this issue, and I'll outline some troubleshooting steps and suggestions to help you resolve it.
### 1. Confirm Modem Connection
- Ensu... | 30,040 | [
{
"from": "human",
"value": "I'm trying to get CellID using AT commands, but I dont get any response from the modem, mine code looks like below, I send AT+CCED command, but never get any response.\nHANDLE hCom;\nchar * xpos;\nchar rsltstr[5];\nDWORD returnValue;\nDWORD LAC;\nDWORD CellId;\nint bufpos;\nDCB ... |
Is there any way in a Win32 environment to "tune" the timeout on a socket connect() call? Specifically, I would like to increase the timeout length. The sockets in use are non-blocking. Thanks!
| In a Win32 environment, when working with non-blocking sockets, you can’t directly set a timeout on the `connect()` call like you would with blocking sockets. Instead, you can achieve the desired functionality by utilizing the following approach:
### Method 1: Use `select()`
1. **Set the socket to non-blocking mode**... | 33,149 | [
{
"from": "human",
"value": "Is there any way in a Win32 environment to \"tune\" the timeout on a socket connect() call? Specifically, I would like to increase the timeout length. The sockets in use are non-blocking. Thanks!\n"
},
{
"from": "gpt",
"value": "In a Win32 environment, when workin... |
I'm re-designing an app I inherited that sends digital photos from a laptop to a web server. The idea is to take photos "out on the field" and have them instantly published on a web page (with some more fancy features).
Typical scenario
1. Photos are transferred from the camera to the laptop using standard USB.
2. The ... | It sounds like you've made significant improvements to the app already! Transitioning to a more robust design is crucial for handling unreliable network connections, especially in mobile scenarios. Here are a few additional suggestions that may enhance your current design further:
### 1. **Use a Queuing Mechanism**
Im... | 34,285 | [
{
"from": "human",
"value": "I'm re-designing an app I inherited that sends digital photos from a laptop to a web server. The idea is to take photos \"out on the field\" and have them instantly published on a web page (with some more fancy features).\nTypical scenario\n1. Photos are transferred from the cam... |
I'm using Java's Transformer class to process an XML Document object.
This is the code that creates the Transformer:
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
Transformer transformer = TransformerFactory.newInstance().newTransformer();... | To modify the output of an XML document so that each element includes its namespace prefix (e.g., `<svg:svg ... />` instead of `<svg ... />`), you can use the `Namespace` feature when processing XML.
Unfortunately, the standard `Transformer` does not automatically add prefixes to elements based on their namespace. To ... | 29,602 | [
{
"from": "human",
"value": "I'm using Java's Transformer class to process an XML Document object.\nThis is the code that creates the Transformer:\nimport javax.xml.transform.TransformerFactory;\nimport javax.xml.transform.OutputKeys;\nimport javax.xml.transform.Transformer;\n\nTransformer transformer = Tra... |
What would you consider "worst practices" to follow when developing an embedded system?
Some of my ideas of what not to do are:
Avoid abstracting the hardware layer, instead spreading hardware accesses throughout the code.
Not having any type of emulation environment, having only the actual hardware to exe/cute on.
Avo... | Your insights on "worst practices" in embedded system development are quite comprehensive. Below are additional points that expand on the themes you've already identified, focusing on what to avoid to ensure a smoother and more efficient development process:
1. **Ignoring Power Management**: Failing to account for pow... | 32,500 | [
{
"from": "human",
"value": "What would you consider \"worst practices\" to follow when developing an embedded system?\nSome of my ideas of what not to do are:\nAvoid abstracting the hardware layer, instead spreading hardware accesses throughout the code.\nNot having any type of emulation environment, havin... |
I'm starting to develop a web application in PHP that I hope will become incredibly popular and make me famous and rich. :-)
If that time comes, my decision whether to parse the API's data as XML with SimpleXML or to use json_decode could make a difference in the app's scalability.
Does anyone know which of these appro... | It's great to hear you're developing a web application and considering performance implications from the start! Your preliminary test comparing `simplexml_load_string` and `json_decode` provides useful insights, but there are a few additional factors to consider when deciding between XML and JSON for your API data hand... | 29,909 | [
{
"from": "human",
"value": "I'm starting to develop a web application in PHP that I hope will become incredibly popular and make me famous and rich. :-)\nIf that time comes, my decision whether to parse the API's data as XML with SimpleXML or to use json_decode could make a difference in the app's scalabil... |
Currently this expression "I ([a-zA-z]\d]{3} " returns when the following pattern is true:
I AAA
I Z99
I need to modify this so it will return a range of alphanumerics after the I from 2 to 13 that do not have a space.
Example:
I AAA
I A321
I ASHG310310
Thanks,
Dave
| To modify the expression so that it matches alphanumeric strings of length 2 to 13 characters after the letter "I", while ensuring there are no spaces, you can use the following regular expression:
```regex
I [A-Za-z0-9]{2,13}
```
### Explanation:
- `I`: Matches the literal character "I".
- ` `: Matches a single spac... | 35,966 | [
{
"from": "human",
"value": "Currently this expression \"I ([a-zA-z]\\d]{3} \" returns when the following pattern is true:\n\nI AAA \nI Z99 \n\nI need to modify this so it will return a range of alphanumerics after the I from 2 to 13 that do not have a space.\nExample:\n\nI AAA \nI A321 \nI ASHG310310 \n\nT... |
It's just so much HRESULT E_FAIL, if you know what I'm talking about.
And if you use Visual Studio, you know what I'm talking about.
Similar thread, but not a duplicate: Is the design view for aspx pages in Visual Studio useful?
Any insight, including input from Microsoft MVPs (oh, I know you're out there) would be s... | Yes, the HRESULT E_FAIL error is a common frustration when working with Visual Studio, particularly when dealing with design view for ASPX pages or Windows Forms. This error typically indicates an unspecified failure and can stem from various underlying issues. Here are some insights and potential solutions that you mi... | 31,764 | [
{
"from": "human",
"value": "It's just so much HRESULT E_FAIL, if you know what I'm talking about. \nAnd if you use Visual Studio, you know what I'm talking about.\nSimilar thread, but not a duplicate: Is the design view for aspx pages in Visual Studio useful?\nAny insight, including input from Microsoft M... |
I want to assert that a method is called exactly one time. I'm using RhinoMocks 3.5.
Here's what I thought would work:
[Test]
public void just_once()
{
var key = "id_of_something";
var source = MockRepository.GenerateStub<ISomeDataSource>();
source.Expect(x => x.GetSomethingThatTakesALotOfResources(key))
... | Your test is mostly correct, but there is a minor mistake in the way you are setting up the expectations using Rhino Mocks. Instead of using `Repeat.Once()` on the expectation for the method call, you should specify that the method will be called exactly once by utilizing the `VerifyAllExpectations()` method at the end... | 33,750 | [
{
"from": "human",
"value": "I want to assert that a method is called exactly one time. I'm using RhinoMocks 3.5.\nHere's what I thought would work:\n[Test]\npublic void just_once()\n{\n var key = \"id_of_something\";\n\n var source = MockRepository.GenerateStub<ISomeDataSource>();\n source.Expect(... |
When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"?
| In C, when printing a single character using the `printf` function, you should use the format specifier `%c`, not `%1s`. The `%c` format specifier is specifically designed for printing a single character.
Here's a simple example:
```c
#include <stdio.h>
int main() {
char ch = 'A';
printf("The character is: %... | 36,449 | [
{
"from": "human",
"value": "When printing a single character in a C program, must I use \"%1s\" in the format string? Can I use something like \"%c\"?\n"
},
{
"from": "gpt",
"value": "In C, when printing a single character using the `printf` function, you should use the format specifier `%c`, n... |
We have a page that ordinarily has two elements arranged side-by-side. Despite exploring a few angles for this, we can't seem to make it work. We're not averse to using JavaScript, it just feels that a CSS based solution ought to be possible. Is there a way of using just CSS (and possibly extra markup if necessary) to ... | Yes, you can achieve this using only CSS with a responsive approach. The idea is to use CSS Flexbox for layout. You can apply flex properties to the container so that it can align its children elements (in this case, `element1` and `element2`) side by side when both are present, and center `element2` when it is the onl... | 32,849 | [
{
"from": "human",
"value": "We have a page that ordinarily has two elements arranged side-by-side. Despite exploring a few angles for this, we can't seem to make it work. We're not averse to using JavaScript, it just feels that a CSS based solution ought to be possible. Is there a way of using just CSS (an... |
i'm using vs installer to build a setup package for my vb6 app.
and the problem is i can see that under the project explorer there's a list of dependencies attached to my exe file.
alt text http://img505.imageshack.us/img505/9696/croppercapture259lr8.png
and under the file system on target machine treeview, i can actua... | When using Visual Studio Installer (or any setup project), understanding the distinction between project dependencies and explicitly added files is crucial for ensuring that your application runs correctly on the target machine. Here’s a breakdown of the two concepts:
1. **Dependencies**:
- Dependencies in the proj... | 35,908 | [
{
"from": "human",
"value": "i'm using vs installer to build a setup package for my vb6 app.\nand the problem is i can see that under the project explorer there's a list of dependencies attached to my exe file.\nalt text http://img505.imageshack.us/img505/9696/croppercapture259lr8.png\nand under the file sy... |
I have one std::list<> container and these threads:
One writer thread which adds elements indefinitely.
One reader/writer thread which reads and removes elements while available.
Several reader threads which access the SIZE of the container (by using the size() method)
There is a normal mutex which protects the acces... | When working with a multithreaded environment and shared data structures like `std::list<>`, it's crucial to ensure that access to that data structure is synchronized to avoid race conditions, which can lead to undefined behavior and incorrect results.
### Understanding the Problem:
In your case, you have:
1. One wri... | 25,380 | [
{
"from": "human",
"value": "I have one std::list<> container and these threads:\n\nOne writer thread which adds elements indefinitely.\nOne reader/writer thread which reads and removes elements while available.\nSeveral reader threads which access the SIZE of the container (by using the size() method)\n\nT... |
When you use DllImport to import a function you can specify a CharSet to use. I noticed that in C#, C++ and visual basic the .Net runtime defaults to using Ansi instead of Unicode for this. So for any system call that has an A and a W version the A version will be called by default. .Net uses unicode internally and if ... | When using `DllImport` in .NET to call native functions, specifying the `CharSet` is important to control how string parameters are marshaled between managed and unmanaged code. By default, the .NET runtime uses `CharSet.Ansi` for string marshalling in `DllImport`, which means that it will call the ANSI versions of fun... | 32,218 | [
{
"from": "human",
"value": "When you use DllImport to import a function you can specify a CharSet to use. I noticed that in C#, C++ and visual basic the .Net runtime defaults to using Ansi instead of Unicode for this. So for any system call that has an A and a W version the A version will be called by defa... |
Say I have a string of 16 numeric characters (i.e. 0123456789012345) what is the most efficient way to delimit it into sets like : 0123-4567-8901-2345, in PHP?
Note: I am rewriting an existing system that is painfully slow.
| To efficiently delimit a string of 16 numeric characters into sets like `0123-4567-8901-2345` in PHP, you can use the `implode()` function along with `str_split()` for a clean and concise solution. This avoids the overhead of looping through characters manually. Here's how you can do it:
```php
function formatNumericS... | 34,843 | [
{
"from": "human",
"value": "Say I have a string of 16 numeric characters (i.e. 0123456789012345) what is the most efficient way to delimit it into sets like : 0123-4567-8901-2345, in PHP?\nNote: I am rewriting an existing system that is painfully slow.\n"
},
{
"from": "gpt",
"value": "To effici... |
I have been trying to include a file in a included file e.g
main.cpp file
#include <includedfile.cpp>
int main(){
cout<<name<<endl;
}
includedfile.cpp
#include <iostream>
using namespace std;
string name;
name = "jim";
this code does not work, the debuger says that name is not defined.
| The issue you're encountering is due to the way the C++ language handles variable initialization and the inclusion of source files. There are a few mistakes in your code that need to be addressed:
1. **Variable Initialization**: In C++, you cannot assign a value to a variable at the global scope like you're trying to ... | 32,880 | [
{
"from": "human",
"value": "I have been trying to include a file in a included file e.g\nmain.cpp file\n#include <includedfile.cpp>\nint main(){\n cout<<name<<endl;\n}\n\nincludedfile.cpp\n#include <iostream>\nusing namespace std;\nstring name;\nname = \"jim\";\n\nthis code does not work, the debuger s... |
We (apparently) had poorly executed of our Solaris MySQL database engine last night. At least some of the InnoDB tables are corrupted, with timestamp out of order errors in the transaction log, and a specific error about the index being corrupted.
We know about the tools available for MyISAM table repairs, but cannot f... | Dealing with corrupted InnoDB tables can be a challenging situation, but there are several steps you can take to attempt recovery. Unfortunately, InnoDB does not have the same repair tools as MyISAM, and it relies heavily on its transaction logs and other mechanisms to maintain data integrity.
Here are steps you can c... | 32,912 | [
{
"from": "human",
"value": "We (apparently) had poorly executed of our Solaris MySQL database engine last night. At least some of the InnoDB tables are corrupted, with timestamp out of order errors in the transaction log, and a specific error about the index being corrupted.\nWe know about the tools availa... |
Do end users really care if a SSL EV certificate is from VeriSign, Thwate, DigiCert, or etc.? A certificate from VeriSign can cost up to 3x the cost from DigiCert for the same basic features. VeriSign is probably the most recognizable brand name though.
I've had many discussions with people about this topic, but I've n... | The topic of whether end users care about the specific brand of an SSL Extended Validation (EV) certificate—such as VeriSign, DigiCert, Thawte, etc.—is complex and often varies based on demographics, industry, and user familiarity with web security.
1. **Brand Recognition**: VeriSign is one of the most recognized name... | 32,850 | [
{
"from": "human",
"value": "Do end users really care if a SSL EV certificate is from VeriSign, Thwate, DigiCert, or etc.? A certificate from VeriSign can cost up to 3x the cost from DigiCert for the same basic features. VeriSign is probably the most recognizable brand name though.\nI've had many discussion... |
Although I've been getting more and more familiar with Xcode while developing for the iPhone, there are times I just wished I had a better IDE, something like Eclipse.
So I was wondering does anyone know how to migrate iPhone projects to Eclipse, and if it's worth it?
| Migrating iPhone projects to Eclipse is generally not a straightforward process, primarily because Xcode and Eclipse are tailored to different development environments and languages. Xcode is specifically designed for developing iOS (and macOS) applications using Swift and Objective-C, while Eclipse is more commonly us... | 35,173 | [
{
"from": "human",
"value": "Although I've been getting more and more familiar with Xcode while developing for the iPhone, there are times I just wished I had a better IDE, something like Eclipse.\nSo I was wondering does anyone know how to migrate iPhone projects to Eclipse, and if it's worth it?\n"
},
... |
I want to use the php simple HTML DOM parser to grab the image, title, date, and description from each article on a page full of articles. When looking at the API I notice it has a set_callback which Sets a callback function. However im not sure what this does or how I would use it? In one of the examples its used to c... | The PHP Simple HTML DOM Parser is a popular library that allows you to easily manipulate HTML documents. The `set_callback` method is indeed part of this library, and it allows you to set a function that will be called whenever an element is processed. This can be particularly useful for modifying or filtering content ... | 33,402 | [
{
"from": "human",
"value": "I want to use the php simple HTML DOM parser to grab the image, title, date, and description from each article on a page full of articles. When looking at the API I notice it has a set_callback which Sets a callback function. However im not sure what this does or how I would use... |
I want to set registry keys in following way
if OS is Vista then
HKLM\MyKey1\MyValue=1
else
HKLM\MyKey2\MyValue=1
I know how to set Registry keys in WIX but it seems the condition cannot be set on element.
| In WiX, you cannot directly apply conditions to individual `RegistryKey` elements based on the operating system version. However, you can achieve your goal by using the `<Condition>` element within the context of the `Component` that contains the `RegistryKey`. This allows you to set a different registry key depending ... | 33,157 | [
{
"from": "human",
"value": "I want to set registry keys in following way\nif OS is Vista then\n HKLM\\MyKey1\\MyValue=1 \nelse \n HKLM\\MyKey2\\MyValue=1\nI know how to set Registry keys in WIX but it seems the condition cannot be set on element. \n"
},
{
"from": "gpt",
"value": "In WiX, y... |
I used to have a custom preferences class for my applications. For my next hobby project i wanted to switch to the Preferences API. But the put and get functions require a default value and i do not want to spread default values all over the source files. Even though my project is small i can not imagine changing defau... | It sounds like you're weighing the pros and cons of using the Android Preferences API versus a custom preferences solution, and you've raised a valid concern about managing default values.
Here are a few thoughts and suggestions on how to effectively use the Preferences API while keeping your code clean and maintainab... | 31,937 | [
{
"from": "human",
"value": "I used to have a custom preferences class for my applications. For my next hobby project i wanted to switch to the Preferences API. But the put and get functions require a default value and i do not want to spread default values all over the source files. Even though my project ... |
I'm currently creating an application for a customer that will allow them to automatically bill their customers credit cards.
I'm curious as to what are some best practices to safely store and access the credit card information, and for that matter, any other sensitive information, like social security numbers, accou... | Storing and accessing sensitive information such as credit card details, Social Security numbers, and account numbers involves serious security considerations. Below are best practices for handling this kind of sensitive information in your application:
### General Best Practices for Handling Sensitive Information
1.... | 31,052 | [
{
"from": "human",
"value": "I'm currently creating an application for a customer that will allow them to automatically bill their customers credit cards. \nI'm curious as to what are some best practices to safely store and access the credit card information, and for that matter, any other sensitive inform... |
A co-worker recently ran into a situation where a query to look up security permissions was taking ~15 seconds to run using an = comparison on UserID (which is a UNIQUEIDENTIFIER). Needless to say, the users were less than impressed.
Out of frustration, my co-worker changed the = comparison to use a LIKE and the query ... | It's indeed an interesting situation when a change from an equality (`=`) comparison to a `LIKE` comparison results in significant performance improvement, especially when dealing with a `UNIQUEIDENTIFIER` data type. Here are several broad and potentially relevant factors that could explain this performance difference:... | 33,775 | [
{
"from": "human",
"value": "A co-worker recently ran into a situation where a query to look up security permissions was taking ~15 seconds to run using an = comparison on UserID (which is a UNIQUEIDENTIFIER). Needless to say, the users were less than impressed.\nOut of frustration, my co-worker changed the... |
The size of the generated hash and the speed of the algorithm are not important. I'm really only interested in it being the most secure option. I don't want to use any third party libraries either.
The version of the .NET framework I'm using if 3.5 if that makes any difference.
| If you're focused solely on security and want to implement a hash function in .NET Framework 3.5 without using third-party libraries, you can consider using the built-in cryptographic libraries provided by .NET for secure hashing.
For this purpose, SHA-256 is currently one of the most secure hashing algorithms availab... | 33,992 | [
{
"from": "human",
"value": "The size of the generated hash and the speed of the algorithm are not important. I'm really only interested in it being the most secure option. I don't want to use any third party libraries either.\nThe version of the .NET framework I'm using if 3.5 if that makes any difference.... |
I am wondering what is the "best practice" to break long strings in C# source code. Is this string
"string1"+
"string2"+
"string3"
concatenated during compiling or in run time?
| In C#, string literals that are concatenated using the `+` operator, like your example:
```csharp
string longString = "string1" +
"string2" +
"string3";
```
are concatenated at compile time, provided that the compiler can determine the complete string at that time. The C# compi... | 34,874 | [
{
"from": "human",
"value": "I am wondering what is the \"best practice\" to break long strings in C# source code. Is this string \n\"string1\"+\n\"string2\"+\n\"string3\"\n\nconcatenated during compiling or in run time?\n"
},
{
"from": "gpt",
"value": "In C#, string literals that are concatenat... |
Already implemented performance boosters :
- Get compatible image of GraphicsConfiguration to draw on
- Enable OpenGL pipeline in 1.5: Not possible due to severe artifacts
So far I am fine, the main profiled bottleneck of the program is drawing an image with several thousand tiles. Unfortunately it is not regular, else... | To achieve better performance while rendering images in Java, especially when dealing with complex tiles, while also ensuring that standard Swing components like `JMenu` display correctly, you may need to consider the following approaches:
### 1. Layered Approach with Swing
One of the main problems with `VolatileImag... | 31,235 | [
{
"from": "human",
"value": "Already implemented performance boosters :\n- Get compatible image of GraphicsConfiguration to draw on\n- Enable OpenGL pipeline in 1.5: Not possible due to severe artifacts\nSo far I am fine, the main profiled bottleneck of the program is drawing an image with several thousand ... |
I wish to convert a single string with multiple delimiters into a key=>value hash structure. Is there a simple way to accomplish this? My current implementation is:
sub readConfigFile() {
my %CONFIG;
my $index = 0;
open(CON_FILE, "config");
my @lines = <CON_FILE>;
close(CON_FILE);
my @array = s... | To simplify the task of converting a single string with multiple delimiters into a key-value hash structure, you can enhance your existing implementation by using regular expressions to directly extract the key-value pairs from each line of your configuration file. You can also separate the values for 'adv' into a diff... | 33,368 | [
{
"from": "human",
"value": "I wish to convert a single string with multiple delimiters into a key=>value hash structure. Is there a simple way to accomplish this? My current implementation is:\nsub readConfigFile() {\n my %CONFIG;\n my $index = 0;\n open(CON_FILE, \"config\");\n my @lines = <CO... |
I'm using .NET typed datasets on a project, and I often get into situations where I prefetch data from several tables into a dataset and then pass that dataset to several methods for processing. It seems cleaner to let each method decide exactly which data it needs and then load the data itself. However, several of the... | Managing data dependencies in an application that heavily relies on typed datasets can indeed be challenging, especially when dealing with multiple methods or classes that may require different subsets of the same data. Here are some approaches and design patterns you can consider to improve your management of data dep... | 27,769 | [
{
"from": "human",
"value": "I'm using .NET typed datasets on a project, and I often get into situations where I prefetch data from several tables into a dataset and then pass that dataset to several methods for processing. It seems cleaner to let each method decide exactly which data it needs and then load... |
I'm just in the process of upgrading my Preview 5 application to Beta 1, and I'm nearly there save for this one error when trying to render a control:
'System.Web.Mvc.HtmlHelper' does not
contain a definition for
'RenderPartial' and no extension
method 'RenderPartial' accepting a
first argument of type
'Syst... | The error you are encountering indicates that the method `RenderPartial` cannot be found within the `HtmlHelper` class in the ASP.NET MVC framework version you are using.
Here are a few steps to resolve the issue:
1. **Check the MVC Version**: Make sure you are using the correct version of the ASP.NET MVC framework t... | 31,678 | [
{
"from": "human",
"value": "I'm just in the process of upgrading my Preview 5 application to Beta 1, and I'm nearly there save for this one error when trying to render a control:\n\n'System.Web.Mvc.HtmlHelper' does not\n contain a definition for\n 'RenderPartial' and no extension\n method 'RenderPartial... |
I am new to jmock and trying to mock an HttpSession. I am getting:
java.lang.AssertionError: unexpected invocation: httpServletRequest.getSession()
no expectations specified: did you...
- forget to start an expectation with a cardinality clause?
- call a mocked method to specify the parameter of an expectation?
the t... | You're on the right track, but there are a couple of issues in your test that need to be addressed.
1. **Mocking the behavior of `getSession()`:** The method `getSession()` should be mocked before you call it. You need to set expectations on the mock object (`request`) for `getSession()` and return the mocked `HttpSe... | 24,116 | [
{
"from": "human",
"value": "I am new to jmock and trying to mock an HttpSession. I am getting:\njava.lang.AssertionError: unexpected invocation: httpServletRequest.getSession()\nno expectations specified: did you...\n - forget to start an expectation with a cardinality clause?\n - call a mocked method to s... |
What are the current best practices in the Rails world for displaying a calendar month view with event items bound to the days in the month (like in Backpack or Google Calendar, for example)?
I don't need anything like fancy stuff like drag and drop support. I'm just looking for code to let me get a list of events in ... | Creating a monthly calendar view in a Ruby on Rails application can indeed be accomplished in several ways, and while there are some gems and plugins available, the best approach depends on your specific requirements and preferences. Here are some current best practices and recommendations for displaying a calendar mon... | 31,176 | [
{
"from": "human",
"value": "What are the current best practices in the Rails world for displaying a calendar month view with event items bound to the days in the month (like in Backpack or Google Calendar, for example)?\nI don't need anything like fancy stuff like drag and drop support. I'm just looking f... |
I want to tune a production SQL server. After making adjustments (such as changing the degree of parallelism) I want to know if it helped or hurt query execution times.
This seems like an obvious performance counter, but for the last half hour I've been searching Google and the counter list in perfmon, and I have not ... | SQL Server does not have a single performance counter that directly provides the average execution time for all queries hitting a server. However, there are several ways to monitor query execution times and overall performance that you can use to assess the impact of your tuning adjustments.
### 1. **SQL Server Dynami... | 28,192 | [
{
"from": "human",
"value": "I want to tune a production SQL server. After making adjustments (such as changing the degree of parallelism) I want to know if it helped or hurt query execution times.\nThis seems like an obvious performance counter, but for the last half hour I've been searching Google and th... |
So I have the following:
public class Singleton
{
private Singleton(){}
public static readonly Singleton instance = new Singleton();
public string DoSomething(){ ... }
public string DoSomethingElse(){ ... }
}
Using reflection how can I invoke the DoSomething Method?
Reason I ask is because I store the me... | To invoke a method using reflection in C#, you can use the `MethodInfo` class and the `Invoke` method. Below, I'll provide an example of how you can achieve this with your `Singleton` class.
### Step-by-Step Explanation
1. **Get the Type**: You need to get the `Type` of the `Singleton` class.
2. **Get the Instance**:... | 32,074 | [
{
"from": "human",
"value": "So I have the following:\npublic class Singleton\n{\n\n private Singleton(){}\n\n public static readonly Singleton instance = new Singleton();\n\n public string DoSomething(){ ... }\n\n public string DoSomethingElse(){ ... }\n\n}\n\nUsing reflection how can I invoke the DoSo... |
is there an easy way to reset ALL text fields in an asp.net form - like the reset button for html controls?
| In ASP.NET Web Forms, you can achieve a similar functionality to the HTML reset button, which resets all input fields to their default values, by writing a custom method to clear or reset all text fields in your form. Here's how you can implement this in a simple way.
### Option 1: Using a Button to Clear Text Fields
... | 32,968 | [
{
"from": "human",
"value": "is there an easy way to reset ALL text fields in an asp.net form - like the reset button for html controls?\n"
},
{
"from": "gpt",
"value": "In ASP.NET Web Forms, you can achieve a similar functionality to the HTML reset button, which resets all input fields to their... |
I would like to have my warnings set to the highest level using Microsoft Visual C++ compiler. Similar to using -pedantic on gcc. What compiler switches do you use to have the most warnings enabled?
| In Microsoft Visual C++, you can enable a high level of warnings by using specific compiler options. The equivalent of `-pedantic` in GCC is not directly available, but you can achieve a similar effect by using the following switches:
1. **/W4**: This option sets the warning level to 4, which is the highest level of w... | 34,070 | [
{
"from": "human",
"value": "I would like to have my warnings set to the highest level using Microsoft Visual C++ compiler. Similar to using -pedantic on gcc. What compiler switches do you use to have the most warnings enabled?\n"
},
{
"from": "gpt",
"value": "In Microsoft Visual C++, you can en... |
In our code base we have a dependency on the ant version used in eclipse.
In the the ant.jar has been set up as a library which the project uses
This is a pain when moving versions of eclipse as the Ant plugin folder name changes (although I see it is now just called Ant1.7)
Is there a way to access eclipses reference ... | Yes, you can access Eclipse's reference to the Ant Home by utilizing the built-in variables and preferences available in Eclipse. This can help you avoid hard-coded paths in your projects, making it easier to manage dependencies when changing Eclipse versions.
### Accessing Ant Home in Eclipse
1. **Use Eclipse Variab... | 34,143 | [
{
"from": "human",
"value": "In our code base we have a dependency on the ant version used in eclipse.\nIn the the ant.jar has been set up as a library which the project uses\nThis is a pain when moving versions of eclipse as the Ant plugin folder name changes (although I see it is now just called Ant1.7)\n... |
How do you go about verifying the type of an uploaded file reliably without using the extension? I'm guessing that you have to examine the header / read some of the bytes, but I really have no idea how to go about it. Im using c# and asp.net.
Thanks for any advice.
ok, so from the above links I now know that I am look... | To verify the type of an uploaded file by examining the first few bytes, you'll want to read the bytes you have into an array and then check for specific byte patterns that identify file types. In your case, you're checking for the JPEG file signature, which is `0xFF, 0xD8, 0xFF, 0xE0`.
Here's a step-by-step approach... | 26,104 | [
{
"from": "human",
"value": "How do you go about verifying the type of an uploaded file reliably without using the extension? I'm guessing that you have to examine the header / read some of the bytes, but I really have no idea how to go about it. Im using c# and asp.net.\nThanks for any advice.\n\nok, so fr... |
Hopefully this still falls within StackOverflow's umbrella!
I'm looking to create a quick boot linux laptop for my wife. All it really needs is to be able to do is browse the internet (with flash and video etc.).
Are there any distros that are made for this, or any guides out there that show good ways to speed stuff up... | Creating a quick boot Linux laptop for browsing the internet is a great idea! There are several lightweight Linux distributions designed for this purpose, and many of them come with a good set of tools and applications for web browsing, including support for multimedia.
Here are some lightweight Linux distros you can ... | 34,135 | [
{
"from": "human",
"value": "Hopefully this still falls within StackOverflow's umbrella!\nI'm looking to create a quick boot linux laptop for my wife. All it really needs is to be able to do is browse the internet (with flash and video etc.).\nAre there any distros that are made for this, or any guides out ... |
Is there a better way to do the following:
$array = array('test1', 'test2', 'test3', 'test4', 'test5');
// do a bunch of other stuff, probably a loop
$array[] = 'test6';
end($array);
echo key($array); // gives me 6
This will give the key of the most recently add array element.
Is there a better way to do this?
| Yes, there's a more straightforward way to retrieve the key of the last added element in an array in PHP. Instead of using `end()` and `key()`, you can directly access the last element of the array using the `count()` function or by using the `array_key_last()` function (introduced in PHP 7.3).
Here's an example using... | 33,063 | [
{
"from": "human",
"value": "Is there a better way to do the following:\n$array = array('test1', 'test2', 'test3', 'test4', 'test5');\n// do a bunch of other stuff, probably a loop\n$array[] = 'test6';\nend($array);\necho key($array); // gives me 6\n\nThis will give the key of the most recently add array el... |
My class contains a Dictionary<T, S> dict, and I want to expose a ReadOnlyCollection<T> of the keys. How can I do this without copying the Dictionary<T, S>.KeyCollection dict.Keys to an array and then exposing the array as a ReadOnlyCollection?
I want the ReadOnlyCollection to be a proper wrapper, ie. to reflect cha... | In C# 2.0, you don't have access to LINQ or extension methods like `ToList`, so you'll need to create a custom `ReadOnlyCollection` that wraps the key collection of your dictionary. However, the `ReadOnlyCollection<T>` requires an `IList<T>`, and unfortunately, the `Dictionary<TKey, TValue>.KeyCollection` does not impl... | 35,204 | [
{
"from": "human",
"value": "My class contains a Dictionary<T, S> dict, and I want to expose a ReadOnlyCollection<T> of the keys. How can I do this without copying the Dictionary<T, S>.KeyCollection dict.Keys to an array and then exposing the array as a ReadOnlyCollection? \nI want the ReadOnlyCollection ... |
When I do a ReadLinesFromFile on a file in MSBUILD and go to output that file again, I get all the text on one line. All the Carriage returns and LineFeeds are stripped out.
<Project DefaultTargets = "Deploy"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<Import Project="$(MSBuildExtensionsPath)\MSBuil... | The issue you're facing is that when you output the lines read from the file as an item list in MSBuild, it concatenates them into a single line separated by semicolons (`;`). Unfortunately, MSBuild does not directly provide a mechanism to include line breaks in item lists when outputting them.
However, you can work a... | 30,604 | [
{
"from": "human",
"value": "When I do a ReadLinesFromFile on a file in MSBUILD and go to output that file again, I get all the text on one line. All the Carriage returns and LineFeeds are stripped out.\n<Project DefaultTargets = \"Deploy\"\nxmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" >\n<... |
What is the way to avoid phpunit having to call the constructor for a mock object? Otherwise I would need a mock object as constructor argument, another one for that etc. The api seems to be like this:
getMock($className, $methods = array(), array $arguments = array(),
$mockClassName = '', $callOriginalConstruc... | In PHPUnit, when creating a mock object for a class that has a constructor, you can indeed skip calling the original constructor by setting the `$callOriginalConstructor` parameter to `false`. However, you also need to ensure that if your class requires constructor arguments, you should provide them in the third parame... | 34,410 | [
{
"from": "human",
"value": "What is the way to avoid phpunit having to call the constructor for a mock object? Otherwise I would need a mock object as constructor argument, another one for that etc. The api seems to be like this:\ngetMock($className, $methods = array(), array $arguments = array(),\n ... |
How do you get the caret position in a <textarea> using JavaScript?
For example: This is| a text
This should return 7.
How would you get it to return the strings surrounding the cursor / selection?
E.g.: 'This is', '', ' a text'.
If the word “is” is highlighted, then it would return 'This ', 'is', ' a text'.
| To get the caret position in a `<textarea>` using JavaScript, you can use the `selectionStart` property of the `<textarea>`. This property gives you the position of the cursor (caret) within the text area. Additionally, if you want to get the surrounding text strings based on the cursor or selection, you can manipulate... | 33,727 | [
{
"from": "human",
"value": "How do you get the caret position in a <textarea> using JavaScript?\nFor example: This is| a text\nThis should return 7.\nHow would you get it to return the strings surrounding the cursor / selection?\nE.g.: 'This is', '', ' a text'.\nIf the word “is” is highlighted, then it wou... |
I'm looking for tutorials or walkthroughs for converting DTS packages into the new SSIS 2005. Any one knows.
| Converting DTS (Data Transformation Services) packages to SSIS (SQL Server Integration Services) in SQL Server 2005 can be a detailed process. Here are some steps and resources you can consider:
### Steps for Converting DTS Packages to SSIS:
1. **Use the DTS Package Migration Wizard**:
- SQL Server 2005 includes ... | 32,563 | [
{
"from": "human",
"value": "I'm looking for tutorials or walkthroughs for converting DTS packages into the new SSIS 2005. Any one knows.\n"
},
{
"from": "gpt",
"value": "Converting DTS (Data Transformation Services) packages to SSIS (SQL Server Integration Services) in SQL Server 2005 can be a ... |
I have been asked to provide information on available techniques for assessing our current, and any future websites for security problems. the request is in the form of
Do you know of any good free one that examines for security holes?
I think our data security is probably worth a small amount of upfront spend so any... | When it comes to assessing the security of your websites and applications, there are several techniques and tools you can utilize, ranging from free options to more comprehensive paid solutions. Here’s a breakdown of both, along with some best practices:
### Free Security Assessment Tools
1. **OWASP ZAP (Zed Attack P... | 27,523 | [
{
"from": "human",
"value": "I have been asked to provide information on available techniques for assessing our current, and any future websites for security problems. the request is in the form of\n\nDo you know of any good free one that examines for security holes?\n\nI think our data security is probably... |
When returning objects from a class, when is the right time to release the memory?
Example,
class AnimalLister
{
public:
Animal* getNewAnimal()
{
Animal* animal1 = new Animal();
return animal1;
}
}
If i create an instance of Animal Lister and get Animal reference from it, then where am i supposed to ... | The issue you're facing is related to memory management in C++, specifically with dynamically allocated objects. In your code, you're creating instances of `Animal` using `new`, which means you have to manually manage the memory by calling `delete` when you're done with those objects.
To effectively manage the lifetim... | 31,663 | [
{
"from": "human",
"value": "When returning objects from a class, when is the right time to release the memory?\nExample,\nclass AnimalLister \n{\n public:\n Animal* getNewAnimal() \n {\n Animal* animal1 = new Animal();\n return animal1;\n }\n}\n\nIf i create an instance of Animal Lister and get A... |
As I think most people know already, or if you don't, FPDF released a new version, 1.6 this past August after almost 4 years without a release. I'm wondering if anyone has had any problems upgrading from 1.53 to 1.6?
| Upgrading from FPDF 1.53 to 1.6 may introduce some changes, and users should be aware of potential issues. While many users may find the upgrade smooth, it's important to consider a few factors:
1. **Backward Compatibility**: Review the release notes or changelog provided with the new version to understand what change... | 35,705 | [
{
"from": "human",
"value": "As I think most people know already, or if you don't, FPDF released a new version, 1.6 this past August after almost 4 years without a release. I'm wondering if anyone has had any problems upgrading from 1.53 to 1.6?\n"
},
{
"from": "gpt",
"value": "Upgrading from FP... |
Working with Mircosoft Office Sharepoint Server 2007 (standard edition) what is the best way to place a site collection being developed under version control? We're using Subversion for all our other (non-sharepoint) projects but I'm just not sure how to approach MOSS.
What needs to be placed under version control to ... | Using Microsoft Office SharePoint Server 2007 (MOSS) with Subversion for version control requires a strategic approach, as SharePoint sites have a different structure compared to traditional software projects. Below are the best practices and steps to effectively place a SharePoint site collection under version control... | 30,821 | [
{
"from": "human",
"value": "Working with Mircosoft Office Sharepoint Server 2007 (standard edition) what is the best way to place a site collection being developed under version control? We're using Subversion for all our other (non-sharepoint) projects but I'm just not sure how to approach MOSS.\nWhat ne... |
I was wondering about the best practices for indicating invalid argument combinations in Python. I've come across a few situations where you have a function like so:
def import_to_orm(name, save=False, recurse=False):
"""
:param name: Name of some external entity to import.
:param save: Save the ORM object ... | In Python, it's a common practice to use built-in exception types to signal invalid argument combinations, rather than creating a custom exception like `BadValueError`. The idea is to keep your code aligned with existing conventions and to leverage the Python ecosystem, where users are already familiar with standard ex... | 34,124 | [
{
"from": "human",
"value": "I was wondering about the best practices for indicating invalid argument combinations in Python. I've come across a few situations where you have a function like so:\ndef import_to_orm(name, save=False, recurse=False):\n \"\"\"\n :param name: Name of some external entity t... |
I want to reverse engineer (import into diagram form) the database definition dump of a database I have, then since no foreign keys are defined in this particular database, I want to be able to manually create the table to table key mappings (using crow feet notation if possible).
I've taken a look at MySQL Workbench, ... | There are several tools you can use to reverse engineer a database and create an Entity-Relationship (ER) diagram, especially when dealing with a legacy database without defined foreign keys. Here are some popular options along with their features and advantages:
1. **DbSchema**:
- **Features**: Supports a wide ran... | 32,934 | [
{
"from": "human",
"value": "I want to reverse engineer (import into diagram form) the database definition dump of a database I have, then since no foreign keys are defined in this particular database, I want to be able to manually create the table to table key mappings (using crow feet notation if possible... |
I like StyleCop's static code analysis and rules enforcement. However, it is severely lacking in several key departments.
Adding new rules isn't officially supported and from what I hear pretty difficult.
Automatic "fixing" of trivial rules violations would be nice! Perhaps not with variable naming but with method... | Yes, there are several commercial and open-source alternatives to StyleCop that provide more flexibility in terms of rule customization, automatic fixing of violations, and additional features. Here are a few options you might consider:
1. **ReSharper**: This popular JetBrains product offers extensive code analysis, r... | 33,930 | [
{
"from": "human",
"value": "I like StyleCop's static code analysis and rules enforcement. However, it is severely lacking in several key departments. \n\nAdding new rules isn't officially supported and from what I hear pretty difficult.\nAutomatic \"fixing\" of trivial rules violations would be nice! Pe... |
I want to create a license key, which cryptography algorithm would you recommend?
Basically the inputs would be:
company name
major version number
date created
expirey date
has feature1:
has feature2:
has feature3:
e.g. Acme Inc 5.0 20081102 20081102 0 1 0
Related: Which built-in .NET cryptography algori... | When creating a license key based on the inputs you've provided, you would want to ensure that the algorithm you choose not only generates a unique and secure key but also allows for the verification of the key later on. Here are a couple of steps and recommendations:
### Recommended Cryptographic Algorithms
1. **Has... | 32,601 | [
{
"from": "human",
"value": "I want to create a license key, which cryptography algorithm would you recommend?\nBasically the inputs would be:\n\ncompany name\n major version number\n date created\n expirey date\n has feature1:\n has feature2:\n has feature3:\n\ne.g. Acme Inc 5.0 20081102 20081102 0 ... |
There are a couple of questions similar to this on stack overflow but not quite the same.
I want to open, or create, a local group on a win xp computer and add members to it, domain, local and well known accounts. I also want to check whether a user is already a member so that I don't add the same account twice, and p... | To manage local groups on a Windows XP computer using the `DirectoryEntry` object and the `WinNT://` provider, you can indeed list the members of a local group, check if a user is already a member, and add members to the group as needed. Here's how you can do this step-by-step in C#.
### List Members of a Local Group
... | 26,746 | [
{
"from": "human",
"value": "There are a couple of questions similar to this on stack overflow but not quite the same.\nI want to open, or create, a local group on a win xp computer and add members to it, domain, local and well known accounts. I also want to check whether a user is already a member so that... |
I'm developing a solution which uses an ActiveX control (a commercial one which we bought and that I did not develop). I need to develop the proper installation pages to simulate what happens when a user who has never visited the site and does not have the add-on installed comes to the page.
I've found the "Manage Add-... | Removing an ActiveX control from Internet Explorer can be tricky, especially if it's not listed in the Add/Remove Programs menu or if the standard options to delete it are not available. Here are a few strategies to help you completely remove or reset ActiveX controls so that you can simulate a fresh installation of th... | 28,324 | [
{
"from": "human",
"value": "I'm developing a solution which uses an ActiveX control (a commercial one which we bought and that I did not develop). I need to develop the proper installation pages to simulate what happens when a user who has never visited the site and does not have the add-on installed comes... |
My application enables defining several LDAP servers to work with.
One might want to define Kerberos access to more than one LDAP server.
Can it be done? Can a single host juggle between Active Directory servers with Kerberos as the connection method?
| Yes, a single host can connect to multiple LDAP servers using Kerberos as the authentication method. However, this involves a few considerations and configurations to manage the connections to different Active Directory (AD) servers. Here are some key points to keep in mind:
1. **Kerberos Configuration**: You will nee... | 33,786 | [
{
"from": "human",
"value": "My application enables defining several LDAP servers to work with.\nOne might want to define Kerberos access to more than one LDAP server.\nCan it be done? Can a single host juggle between Active Directory servers with Kerberos as the connection method?\n"
},
{
"from": "... |
I want to know how events are used in embedded system code.
Main intention is to know how exactly event flags are set/reset in code. and how to identify which task is using which event flag and which bits of the flag are getting set/reset by each task.
Please put your suggestion or comments about it.
Thanks in advance.... | Understanding how event flags are utilized in embedded systems, especially in real-time operating systems (RTOS) like VxWorks, ITRON, or OSEK, is crucial for designing efficient and reliable applications. Let’s break down your queries step-by-step.
### What are Event Flags?
Event flags are synchronization mechanisms ... | 30,671 | [
{
"from": "human",
"value": "I want to know how events are used in embedded system code.\nMain intention is to know how exactly event flags are set/reset in code. and how to identify which task is using which event flag and which bits of the flag are getting set/reset by each task.\nPlease put your suggesti... |
Here's something I know is probably possible but I've never managed to do
In VS2005(C++), While debugging, to be able to invoke a function from the code which I'm debugging.
This feature is sometimes essential when debugging complex data structures which can't be explored easily using just the normal capabilities of th... | Invoking functions directly in the Watch window in Visual Studio 2005 while debugging can be tricky, especially if you're dealing with issues related to scope or function signatures. Here are some steps and tips that can help you successfully call a function from the Watch window:
### 1. Ensure Scope Accessibility
Mak... | 32,345 | [
{
"from": "human",
"value": "Here's something I know is probably possible but I've never managed to do\nIn VS2005(C++), While debugging, to be able to invoke a function from the code which I'm debugging.\nThis feature is sometimes essential when debugging complex data structures which can't be explored easi... |
If I annotate a method of a class with an attribute, I can then retrieve custom attributes for that class and see if it has that attribute or not. For example, I'm building a message-oriented program so I have classes like
public class ErrorHandler
{
[HandleMessage(ErrorHandling.ERROR)]
private static void OnError(... | In C#, attributes are designed to be metadata that describe classes, methods, properties, etc. When you create an attribute and apply it to a member, you can't directly access the member from the attribute's constructor. This is because attributes in .NET are instantiated when the program runs, and they don't have a re... | 31,538 | [
{
"from": "human",
"value": "If I annotate a method of a class with an attribute, I can then retrieve custom attributes for that class and see if it has that attribute or not. For example, I'm building a message-oriented program so I have classes like\npublic class ErrorHandler\n{\n [HandleMessage(ErrorHan... |
I launch the following command line (process) from a Windows VC++ 6 program using CreateProcess (or _spawnv()):
java -cp c:\dir\updates.jar;c:\dir\main.jar Main
and class updates in updates.jar (overiding some in main.jar) are not read or found. It is as if the updates.jar library cannot be found or read.
If I launc... | The issue you're experiencing with launching a Java application from your VC++ 6 program using `CreateProcess` or `_spawnv()` seems to relate to how the working directory, environment variables, or permissions are being set when the process is initiated. Here are some things you can check and try to resolve the issue:
... | 33,141 | [
{
"from": "human",
"value": "I launch the following command line (process) from a Windows VC++ 6 program using CreateProcess (or _spawnv()):\n\njava -cp c:\\dir\\updates.jar;c:\\dir\\main.jar Main\n\nand class updates in updates.jar (overiding some in main.jar) are not read or found. It is as if the update... |
I have a base class with a property which (the get method) I want to overwrite in the subclass. My first thought was something like:
class Foo(object):
def _get_age(self):
return 11
age = property(_get_age)
class Bar(Foo):
def _get_age(self):
return 44
This does not work (subclass bar.ag... | Your initial approach for defining a property in the base class and trying to override it in the subclass does not work as you expected because properties in Python do not automatically forward method resolution to the subclass methods. When you define a property in a base class, it binds the method to that class, and ... | 35,596 | [
{
"from": "human",
"value": "I have a base class with a property which (the get method) I want to overwrite in the subclass. My first thought was something like:\nclass Foo(object):\n def _get_age(self):\n return 11\n\n age = property(_get_age)\n\n\nclass Bar(Foo):\n def _get_age(self):\n ... |
I would like to search the bodies of all outlook items. I know how to do this for the four PIM items (Notes/Tasks/Appointments/Contacts). But the code is identical for all of them with the exception of casting the COM object to the specific item type (i.e., ContactItem, AppointmentItem, etc). Is there a parent class ... | In the Microsoft Office Interop for Outlook, the PIM (Personal Information Management) items like `ContactItem`, `AppointmentItem`, `TaskItem`, and `NoteItem` do not share a common base class that exposes the `Body` property. However, they all derive from the `object` class, and you can use their `Type` to check which ... | 34,649 | [
{
"from": "human",
"value": "I would like to search the bodies of all outlook items. I know how to do this for the four PIM items (Notes/Tasks/Appointments/Contacts). But the code is identical for all of them with the exception of casting the COM object to the specific item type (i.e., ContactItem, Appoint... |
I have a field in a database that is nearly unique: 98% of the time the values will be unique, but it may have a few duplicates. I won't be doing many searches on this field; say twice a month. The table currently has ~5000 records and will gain about 150 per month.
Should this field have an index?
I am using MySQL.
| In MySQL, the decision to index a field largely depends on how you plan to use it in your queries, even if you aren't planning on performing many searches on it. Here are some considerations to help you decide whether to index this nearly unique field:
### Pros of Indexing:
1. **Faster Searches**: If you do plan to se... | 35,375 | [
{
"from": "human",
"value": "I have a field in a database that is nearly unique: 98% of the time the values will be unique, but it may have a few duplicates. I won't be doing many searches on this field; say twice a month. The table currently has ~5000 records and will gain about 150 per month.\nShould this... |
How can I get rid of:
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..."/>
Completely !
| The `__VIEWSTATE` input is a mechanism used in ASP.NET Web Forms to maintain the state of the page between postbacks. If you're looking to get rid of the `__VIEWSTATE` entirely, there are a couple of strategies you could consider depending on your situation:
### 1. **Switch to ASP.NET MVC or ASP.NET Core**
If you're w... | 35,054 | [
{
"from": "human",
"value": "How can I get rid of: \n<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\" value=\"...\"/>\n\nCompletely !\n"
},
{
"from": "gpt",
"value": "The `__VIEWSTATE` input is a mechanism used in ASP.NET Web Forms to maintain the state of the page between postback... |
I'm building an "import from Excel" function. It has to be in a DLL, called from a non-MFC app. Has to provide an image of the spreadsheet that users can drag a select box around (to select cells), then click an IMPORT button, and have the right thing happen. Having trouble getting the spreadsheet up, having a button... | Creating an "Import from Excel" feature in a non-MFC application via a DLL can be challenging, especially when dealing with OLE and ActiveX controls. Based on your requirements, let’s go through a possible approach to implement this and address your existing issues.
### Recommended Approach: Using an ActiveX Control f... | 24,695 | [
{
"from": "human",
"value": "I'm building an \"import from Excel\" function. It has to be in a DLL, called from a non-MFC app. Has to provide an image of the spreadsheet that users can drag a select box around (to select cells), then click an IMPORT button, and have the right thing happen. Having trouble ... |
Using jQuery, what's the best way to find the next form element on the page, starting from an arbitrary element? When I say form element I mean <input>, <select>, <button> or <textarea>.
In the following examples, the element with the id "this" is the arbitrary starting point, and the element with the id "next" is the... | To find the next form element (`<input>`, `<select>`, `<button>`, or `<textarea>`) on the page starting from an arbitrary element (in this case, the element with the id `this`), you can use jQuery's `nextAll()` method in combination with `filter()`. The `nextAll()` method gets all the following siblings of the selected... | 34,850 | [
{
"from": "human",
"value": "Using jQuery, what's the best way to find the next form element on the page, starting from an arbitrary element? When I say form element I mean <input>, <select>, <button> or <textarea>.\nIn the following examples, the element with the id \"this\" is the arbitrary starting poin... |
What options are there to detect web-crawlers that do not want to be detected?
(I know that listing detection techniques will allow the smart stealth-crawler programmer to make a better spider, but I do not think that we will ever be able to block smart stealth-crawlers anyway, only the ones that make mistakes.)
I'm no... | Detecting stealthy web crawlers, especially those that try to masquerade as legitimate users, requires a multi-faceted approach. Here are various methods and strategies that can be employed to maximize the chances of detecting such crawlers:
### 1. **Behavioral Analysis**
- **Request Patterns**: Monitor the frequen... | 29,103 | [
{
"from": "human",
"value": "What options are there to detect web-crawlers that do not want to be detected?\n(I know that listing detection techniques will allow the smart stealth-crawler programmer to make a better spider, but I do not think that we will ever be able to block smart stealth-crawlers anyway,... |
My team uses an internal team maven repo that is shared from a development server using Apache. We also run the Continuum CI server on the same machine. Maven builds in Continuum are run with the "install" goal, which copies the final artifact directly into the shared directory.
The question is, what is the difference ... | Great question! Understanding the differences between using the `mvn install` command and the `mvn deploy` command can help you manage your Maven repository more effectively.
### 1. **Functional Differences**
You mentioned you've already understood the functional differences, but for clarity:
- **`mvn install`:** This... | 31,840 | [
{
"from": "human",
"value": "My team uses an internal team maven repo that is shared from a development server using Apache. We also run the Continuum CI server on the same machine. Maven builds in Continuum are run with the \"install\" goal, which copies the final artifact directly into the shared director... |
Consider that I have a transaction:
BEGIN TRANSACTION
DECLARE MONEY @amount
SELECT Amount AS @amount
FROM Deposits
WHERE UserId = 123
UPDATE Deposits
SET Amount = @amount + 100.0
WHERE UserId = 123
COMMIT
And it gets executed on 2 threads, in the order:
thread 1 - select
thread 2 - select
thread 1 - update
th... | Let's analyze the provided SQL transaction under different isolation levels in SQL Server, keeping in mind that both threads are operating on the same user (UserId = 123) and starting with an initial `Amount` of 0. The transaction is as follows:
```sql
BEGIN TRANSACTION
DECLARE MONEY @amount
SELECT Amount AS @amount
... | 32,828 | [
{
"from": "human",
"value": "Consider that I have a transaction:\nBEGIN TRANSACTION\nDECLARE MONEY @amount\nSELECT Amount AS @amount\n FROM Deposits\n WHERE UserId = 123\nUPDATE Deposits\n SET Amount = @amount + 100.0\n WHERE UserId = 123\nCOMMIT\n\nAnd it gets executed on 2 threads, in the order:\n\nth... |
During undergrad i opted to take a network programming course using the POSIX sockets for linux. As a reference we used the book Internetworking using TCP/IP (comer and stevens). 2008 its a pretty dated and still applicatable texts which takes one through several server designs.
One design that is not really featured... | When designing network applications using TCP sockets, handling multiple requests and responses effectively is critical for performance and responsiveness. Here are some considerations and architectures that can help improve server performance in scenarios where a client sends multiple requests to a server over a singl... | 33,907 | [
{
"from": "human",
"value": "During undergrad i opted to take a network programming course using the POSIX sockets for linux. As a reference we used the book Internetworking using TCP/IP (comer and stevens). 2008 its a pretty dated and still applicatable texts which takes one through several server designs... |
I just lost 50% of my answer on a test because I wrote the code out instead of an algorithm on my midterm, bumping me from an A to a C. Is writing code out still considered an algorithmic representation?
Wikipedia: Algorithm Representation (since programming style is pretty much consensus-based)
EDIT: Ok, so let me mak... | I'm sorry to hear about your experience on the midterm. It can be frustrating when the expectations are not clearly communicated, especially when so much is at stake. Let's break down your concerns:
### 1. Code vs. Algorithmic Representation
The distinction between writing code and providing an algorithm (even in pseu... | 34,719 | [
{
"from": "human",
"value": "I just lost 50% of my answer on a test because I wrote the code out instead of an algorithm on my midterm, bumping me from an A to a C. Is writing code out still considered an algorithmic representation?\nWikipedia: Algorithm Representation (since programming style is pretty muc... |
I am trying to access the Cache in the Application_Start method of Global.asax. I am trying to accdess Context.Cache. When I run the code from visual studio it works just fine but when I run it on the server from IIS I get: Session state is not available in this context. I want to seed some values in the cache when the... | The issue you're encountering is due to the fact that `Context.Cache` is not available in the `Application_Start` method of `Global.asax`. When running the application in IIS, `Context` might not have been fully initialized, and as a result, accessing `Session` or related objects will lead to the "Session state is not ... | 28,946 | [
{
"from": "human",
"value": "I am trying to access the Cache in the Application_Start method of Global.asax. I am trying to accdess Context.Cache. When I run the code from visual studio it works just fine but when I run it on the server from IIS I get: Session state is not available in this context. I want ... |
Is there a standard way to associate custom properties with a user? I need to store the number of items per page a user selected in a grid of a document library separately for each user and document library.
Edit:
Sorry about this vagueness, I wanted to do it programmatically. It seems like I've found the solution, it ... | In SharePoint, associating custom properties with a user can be effectively accomplished using the **User Profile Service**, specifically through the `UserProfileManager` class, as you've discovered. This allows you to store custom properties tied to user profiles.
### Storing Custom User Properties
Using the `UserPr... | 32,205 | [
{
"from": "human",
"value": "Is there a standard way to associate custom properties with a user? I need to store the number of items per page a user selected in a grid of a document library separately for each user and document library.\nEdit:\nSorry about this vagueness, I wanted to do it programmatically.... |
Im in the situation that I often send small codesnippets and xml-snippets to coworkers and partners via my outlook.
Has anyone got a good idea or tool that I can use to have my pastes syntaxhighlighted before I paste them into an email.
I was thinking of an intermediate paste to "$fancytool" and then I would have some... | To achieve syntax highlighting for code snippets before pasting them into your Outlook emails, you can use a few different tools and methods that simplify the process. Here are some recommendations:
1. **Online Syntax Highlighters**:
- Websites like [Carbon](https://carbon.now.sh/) and [highlightjs](https://highlig... | 31,241 | [
{
"from": "human",
"value": "Im in the situation that I often send small codesnippets and xml-snippets to coworkers and partners via my outlook. \nHas anyone got a good idea or tool that I can use to have my pastes syntaxhighlighted before I paste them into an email.\nI was thinking of an intermediate paste... |
I was strugling today trying to migrate from Freemarker to Tiles2 + Freemarker.
My freemarker templates use macros that come from spring.ftl.
If I provide a fremarker servlet in web.xml, my model is visible to freemarker, but specific spring variables (naturally) are not populated into the model as springs FreemarkerV... | It sounds like you are grappling with integrating Spring's Freemarker views and managing models effectively in a Tiles2 environment. Your concern about having to adapt the way your model is accessed in the Freemarker templates is valid, and there are a few strategies you can consider to achieve a cleaner and more maint... | 32,421 | [
{
"from": "human",
"value": "I was strugling today trying to migrate from Freemarker to Tiles2 + Freemarker.\nMy freemarker templates use macros that come from spring.ftl. \nIf I provide a fremarker servlet in web.xml, my model is visible to freemarker, but specific spring variables (naturally) are not popu... |
This is a problem with Windows Firewall that is very annoying from its introduction. And persist trough several versions of windows.
I have two questions:
Is it possible to be disabled or at least require confirmation in XP/2003 Server ?
Does UAC handles this in Vista/2008 server? If it does not - is there any way to ... | The issues you're experiencing with Windows Firewall, especially concerning its behavior and user prompts, have been longstanding concerns among users of various Windows versions. Here’s how these aspects work in Windows XP, Windows Server 2003, Windows Vista, and Windows Server 2008:
### Windows XP / Windows Server 2... | 34,666 | [
{
"from": "human",
"value": "This is a problem with Windows Firewall that is very annoying from its introduction. And persist trough several versions of windows. \nI have two questions:\nIs it possible to be disabled or at least require confirmation in XP/2003 Server ?\nDoes UAC handles this in Vista/2008 s... |
What tools do you know, other than those in Visual Studio, to analyze performance bottlenecks in a Windows CE/Mobile application? I'm looking for something like AQTime for CE/Mobile, to profile C/C++ applications compiled to native code.
| Analyzing performance bottlenecks in Windows CE or Windows Mobile applications, especially those developed in C/C++, can be quite challenging due to the limitations of the platform and the tools available. While AQTime is indeed a popular profiling tool, there are other options you can consider for profiling and perfor... | 34,178 | [
{
"from": "human",
"value": "What tools do you know, other than those in Visual Studio, to analyze performance bottlenecks in a Windows CE/Mobile application? I'm looking for something like AQTime for CE/Mobile, to profile C/C++ applications compiled to native code.\n"
},
{
"from": "gpt",
"value... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.