instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
To do DataBinding of the Document in a WPF RichtextBox, I saw 2 solutions so far, which are to derive from the RichtextBox and add a DependencyProperty, and also the solution with a "proxy".
Neither the first or the second are satisfactory. Does somebody know another solution, or instead, a commercial RTF control which... | If you are looking for a way to perform data binding with a WPF `RichTextBox`, there are indeed limited options since the `RichTextBox.Document` property does not support direct data binding out of the box. You are correct in noting the two common solutions: creating a derived class with a `DependencyProperty` or using... | 49,385 | [
{
"from": "human",
"value": "To do DataBinding of the Document in a WPF RichtextBox, I saw 2 solutions so far, which are to derive from the RichtextBox and add a DependencyProperty, and also the solution with a \"proxy\".\nNeither the first or the second are satisfactory. Does somebody know another solution... |
Some naive questions the numbers in sysprocesses.
What I conclude by looking at the numbers cpu, physical_io, memusage
Do any of these numbers sum to a finite amount?
Also, I notice that when I run a query, that the status beomes 'runnable'.
When the query stops it becomes 'sleeping'.
However the resources-used figures... | It's great that you're looking into the details of `sysprocesses` and trying to understand how SQL Server manages its processes. Let's clarify your questions regarding the numbers and statuses in `sysprocesses`.
### 1. Understanding the Metrics
- **cpu**: This column indicates the CPU time (in milliseconds) that a pro... | 49,947 | [
{
"from": "human",
"value": "Some naive questions the numbers in sysprocesses.\nWhat I conclude by looking at the numbers cpu, physical_io, memusage\nDo any of these numbers sum to a finite amount?\nAlso, I notice that when I run a query, that the status beomes 'runnable'.\nWhen the query stops it becomes '... |
I have a client server based windows forms application that needs an administrator only screen. The administrator functionality needs to be implemented in such a way that at any given time only one administrator can access that screen. The windows forms client application talks to the server using .NET Remoting. And t... | To implement an administrator-only screen in a client-server Windows Forms application using .NET Remoting, while ensuring that only one administrator can access the screen at any time, you can follow these steps:
### Step 1: Define Access Control on the Server
1. **Create a Mutex**: On the server side, you can use a... | 42,937 | [
{
"from": "human",
"value": "I have a client server based windows forms application that needs an administrator only screen. The administrator functionality needs to be implemented in such a way that at any given time only one administrator can access that screen. The windows forms client application talks ... |
Running ipconfig /all shows a Teredo Tunneling Pseudo-Interface. What is that? Does this have something to do with IPv4 vs IPv6? Should I get rid of it? If so how?
| The Teredo Tunneling Pseudo-Interface is a networking component that allows IPv6 connectivity over an IPv4 network. It is part of a mechanism called Teredo, which is a tunneling protocol designed to enable IPv6 traffic to be transmitted through IPv4 NAT (Network Address Translation) devices. This is particularly useful... | 49,282 | [
{
"from": "human",
"value": "Running ipconfig /all shows a Teredo Tunneling Pseudo-Interface. What is that? Does this have something to do with IPv4 vs IPv6? Should I get rid of it? If so how?\n"
},
{
"from": "gpt",
"value": "The Teredo Tunneling Pseudo-Interface is a networking component that a... |
The image.size attribute of UIImageView gives the size of the original UIImage. I would like to find out the size of the autoscaled image when it is put in the UIImageView (typically smaller than the original).
For example, I have the image set to Aspect Fit. Now I want to know its new height and width on the screen s... | Yes, you can determine the size of the scaled image within a `UIImageView` that is set to `Aspect Fit` without having to reverse engineer the scaling manually. To achieve this, you can use the `contentMode` property of the `UIImageView` along with the size of the `UIImageView` and the original size of the `UIImage`. He... | 49,722 | [
{
"from": "human",
"value": "The image.size attribute of UIImageView gives the size of the original UIImage. I would like to find out the size of the autoscaled image when it is put in the UIImageView (typically smaller than the original). \nFor example, I have the image set to Aspect Fit. Now I want to kno... |
I'm so sick of the pass-callback-data-as-void*-struct anti-pattern. Boost bind solves it nicely, but is an unacceptable dependency. What's a lightweight alternative? How would I write it myself as simply as possible?
| If you're looking to avoid the "pass-callback-data-as-void*-struct" anti-pattern without depending on a library like Boost, you can create a lightweight solution using C++11 (or later) features such as `std::function` and `std::bind`.
Here's a simple way to create a callback mechanism without using void pointers:
###... | 47,739 | [
{
"from": "human",
"value": "I'm so sick of the pass-callback-data-as-void*-struct anti-pattern. Boost bind solves it nicely, but is an unacceptable dependency. What's a lightweight alternative? How would I write it myself as simply as possible?\n"
},
{
"from": "gpt",
"value": "If you're look... |
How do I calculate the distance between two points specified by latitude and longitude?
For clarification, I'd like the distance in kilometers; the points use the WGS84 system and I'd like to understand the relative accuracies of the approaches available.
| To calculate the distance between two points specified by latitude and longitude using the WGS84 coordinate system, you have several methods to choose from. The most common methods are:
1. **Haversine Formula**:
The Haversine formula calculates the shortest distance over the earth's surface, giving an approximation... | 1,373 | [
{
"from": "human",
"value": "How do I calculate the distance between two points specified by latitude and longitude?\nFor clarification, I'd like the distance in kilometers; the points use the WGS84 system and I'd like to understand the relative accuracies of the approaches available.\n"
},
{
"from"... |
I want to play a movie file or any animation file till the time application not loaded completely.
Is there any simple way to do it?
| Yes, you can play a movie file or an animation while your application is loading by using a splash screen or loading screen approach. Here's a simple way to implement this in a few different programming environments.
### For Web Applications (HTML/JavaScript):
You can create a simple HTML page that plays a video or ... | 47,229 | [
{
"from": "human",
"value": "I want to play a movie file or any animation file till the time application not loaded completely.\nIs there any simple way to do it?\n"
},
{
"from": "gpt",
"value": "Yes, you can play a movie file or an animation while your application is loading by using a splash s... |
I've searched the web a bit, but all I found were abandoned projects and only CGI support.
EDIT 1: C isn't just used for writing drivers or embedded systems. We have mailreaders, newsreaders, editors, etc. all written in C. I've written two BBS in the last century before the web became popular. The libraries are gettin... | It's great to hear that you're interested in returning to your roots and exploring web development in C! While it's true that C isn't as common for web development as languages like JavaScript, Python, or Ruby, it can still be a powerful choice for certain use cases, particularly if you're looking for performance and l... | 49,331 | [
{
"from": "human",
"value": "I've searched the web a bit, but all I found were abandoned projects and only CGI support.\nEDIT 1: C isn't just used for writing drivers or embedded systems. We have mailreaders, newsreaders, editors, etc. all written in C. I've written two BBS in the last century before the we... |
I recently completed development of a mid-traficked(?) website (peak 60k hits/hour), however, the site only needs to be updated once a minute - and achieving the required performance can be summed up by a single word: "caching".
For a site like SO where the data feeding the site changes all the time, I would imagine a ... | Designing and maintaining a highly interactive website like Stack Overflow, which handles significant traffic and frequent data updates, requires a multi-layered approach to architecture, caching, and data consistency. Here are some key architectural and design principles that help ensure performance and responsiveness... | 44,093 | [
{
"from": "human",
"value": "I recently completed development of a mid-traficked(?) website (peak 60k hits/hour), however, the site only needs to be updated once a minute - and achieving the required performance can be summed up by a single word: \"caching\".\nFor a site like SO where the data feeding the s... |
I'm trying to run Python scripts using Xcode's User Scripts menu.
The issue I'm having is that my usual os.sys.path (taken from ~/.profile) does not seem to be imported when running scripts from XCode the way it is when running them at the Terminal (or with IPython). All I get is the default path, which means I can't d... | When running Python scripts from Xcode, the environment variables, including the `PATH` and `PYTHONPATH`, are likely set differently than when running scripts from the Terminal. This discrepancy can lead to issues with module imports, as you have discovered.
### Solutions to the Problem
1. **Set PYTHONPATH in Xcode**... | 45,060 | [
{
"from": "human",
"value": "I'm trying to run Python scripts using Xcode's User Scripts menu.\nThe issue I'm having is that my usual os.sys.path (taken from ~/.profile) does not seem to be imported when running scripts from XCode the way it is when running them at the Terminal (or with IPython). All I get ... |
What would you suggest for the following scenario:
A dozen of developers need to build and design a complex system. This design needs to be documented for future developers and the design decisions must be noted. These reports need to be made about every two months. My question is how this project should be documented... | In a scenario like this, it's important to find a balance between development work and documentation. Here are some strategies to ensure effective documentation of the complex system while minimizing the impact on development:
### 1. **Designate Documentation Champions:**
- **Select 2-3 developers** who have a good... | 45,742 | [
{
"from": "human",
"value": "What would you suggest for the following scenario: \nA dozen of developers need to build and design a complex system. This design needs to be documented for future developers and the design decisions must be noted. These reports need to be made about every two months. My questio... |
I know you can look at the row.count or tables.count, but are there other ways to tell if a dataset is empty?
| Yes, there are several ways to check if a dataset is empty, depending on the context and the programming environment you are using. Here are some common methods across different frameworks and languages:
### 1. **Pandas (Python)**
In a Pandas DataFrame, you can check if it is empty using:
- `df.empty` - Returns `True`... | 3,712 | [
{
"from": "human",
"value": "I know you can look at the row.count or tables.count, but are there other ways to tell if a dataset is empty?\n"
},
{
"from": "gpt",
"value": "Yes, there are several ways to check if a dataset is empty, depending on the context and the programming environment you are... |
On occasion, I get the following error in design mode of some user controls in Visual Studio 2008:
The file 'UserControl.vb' does not
support code parsing or generation
because it is not contained within a
project that supports code.
It doesn't happen on a consistent basis, but it happens enough to be annoying.... | The error you're encountering in Visual Studio 2008 can occur for a few reasons, even if your project is indeed a WinForms project that supports code. Here are some common causes and potential solutions to consider:
1. **Corrupted User Control File**: The `.vb` or designer files for your user control might be corrupte... | 46,837 | [
{
"from": "human",
"value": "On occasion, I get the following error in design mode of some user controls in Visual Studio 2008:\n\nThe file 'UserControl.vb' does not\n support code parsing or generation\n because it is not contained within a\n project that supports code.\n\nIt doesn't happen on a consist... |
I'm working on a Java web application that integrates with a few other external applications that are deployed along with it. Authentication information must be synchronized across everything and the other applications want to authenticate against LDAP. The application will be deployed in environments where there will ... | Integrating LDAP functionality into your Java web application can indeed streamline deployment, especially when you need to manage authentication across multiple applications without relying on an external LDAP server. Here are some options for embeddable LDAP servers, along with considerations regarding their licenses... | 47,590 | [
{
"from": "human",
"value": "I'm working on a Java web application that integrates with a few other external applications that are deployed along with it. Authentication information must be synchronized across everything and the other applications want to authenticate against LDAP. The application will be d... |
is it possible to create something like this i ASP.NET MVC beta 1
i have tried but the
override bool OnPreAction(string actionName,
System.Reflection.MethodInfo methodInfo)
does not exsist anymore and
override void OnActionExecuting(ActionExecutingContext filterContext)
don't give me access... | In ASP.NET MVC (even in the early versions like beta 1), there are ways to implement functionality similar to what you're trying to achieve, although the specific methods you're referencing may vary in their availability depending on the version you are using.
In ASP.NET MVC, you can create a custom action filter that... | 46,666 | [
{
"from": "human",
"value": "is it possible to create something like this i ASP.NET MVC beta 1\ni have tried but the\noverride bool OnPreAction(string actionName, \n System.Reflection.MethodInfo methodInfo)\n\ndoes not exsist anymore and\noverride void OnActionExecuting(ActionExecut... |
Is there a reason why zero is used as a "default" function return value? I noticed that several functions from the stdlib and almost everywhere else, when not returning a proper number (e.g pow(), strcpy()) or an error (negative numbers), simply return zero.
I just became curious after seeing several tests performed wi... | The use of zero as a "default" return value in many programming languages, especially in C and C++, stems from several historical and practical considerations:
1. **Conventions and Historical Reasons**: In the early days of programming, especially with languages like C, there were conventions that established zero as ... | 46,694 | [
{
"from": "human",
"value": "Is there a reason why zero is used as a \"default\" function return value? I noticed that several functions from the stdlib and almost everywhere else, when not returning a proper number (e.g pow(), strcpy()) or an error (negative numbers), simply return zero.\nI just became cur... |
I just got a weird idea about how to configure environment-dependent parameters. Sort of like parameters you can find in Rails' config/database.yml
In my current project I use PHP and Litespeed Web Server (though the same technique applies to PHP + Apache), and I thought... 'why not use mod_rewrite for this?'. I have s... | Using mod_rewrite to set environment variables for different configurations in your PHP application can be an innovative approach, but it has its pros and cons. Let's break it down:
### Pros:
1. **Simplicity**: You can centralize environment-specific configurations in the web server configuration without needing to mo... | 47,577 | [
{
"from": "human",
"value": "I just got a weird idea about how to configure environment-dependent parameters. Sort of like parameters you can find in Rails' config/database.yml\nIn my current project I use PHP and Litespeed Web Server (though the same technique applies to PHP + Apache), and I thought... 'wh... |
For a poor man's implementation of near-collation-correct sorting on the client side I need a JavaScript function that does efficient single character replacement in a string.
Here is what I mean (note that this applies to German text, other languages sort differently):
native sorting gets it wrong: a b c o u z ä ö ü
... | You're on the right track with your `makeSortString` function, but you're right about the inefficiency of creating the regex each time it's called. By using a closure, you can create the regex just once, improving the performance. Additionally, I'll provide an alternative approach using an array mapping, which can also... | 45,332 | [
{
"from": "human",
"value": "For a poor man's implementation of near-collation-correct sorting on the client side I need a JavaScript function that does efficient single character replacement in a string.\nHere is what I mean (note that this applies to German text, other languages sort differently):\n\nnati... |
I have a problem that I would like have solved via a SQL query. This is going to
be used as a PoC (proof of concept).
The problem:
Product offerings are made up of one or many product instances, a product
instance can belong to many product offerings.
This can be realised like this in a table:
PO | PI
-----
A | 10
A... | To solve this problem, you can use a SQL query that first groups the product offerings based on their associated product instances and then filters the results based on the input product instances. Here’s a SQL query that you can use:
### SQL Query
```sql
WITH OfferingInstanceCounts AS (
SELECT
PO,
... | 49,546 | [
{
"from": "human",
"value": "I have a problem that I would like have solved via a SQL query. This is going to\nbe used as a PoC (proof of concept).\nThe problem:\nProduct offerings are made up of one or many product instances, a product\ninstance can belong to many product offerings.\nThis can be realised l... |
I have resource bundle with my country characters - how to change them into html entities.
I prefer plugin integrated with Eclipse to have all tools in one place.
| To convert special characters in your resource bundle to HTML entities using Eclipse, you can use a plugin that helps with text manipulation. Here are a couple of options you might consider:
### Option 1: Use an Eclipse Plugin for HTML Encoding
1. **HTML Tidy**:
- If you're using the Eclipse Web Tools Platform (W... | 46,114 | [
{
"from": "human",
"value": "I have resource bundle with my country characters - how to change them into html entities.\nI prefer plugin integrated with Eclipse to have all tools in one place.\n"
},
{
"from": "gpt",
"value": "To convert special characters in your resource bundle to HTML entities... |
How would you get a reference to an executing class several stack frames above the current one? For example, if you have:
Class a {
foo() {
new b().bar();
}
}
Class b {
bar() {
...
}
}
Is there a way to get the value that would be retrieved by using 'this' in foo() while the thread ... | In Java, you cannot directly obtain a reference to an instance of a class from several stack frames up in the call stack (like `foo()` in your example) while executing a method in a different class (like `bar()`). Java doesn't provide built-in mechanisms for traversing the call stack in this manner, as it goes against ... | 49,419 | [
{
"from": "human",
"value": "How would you get a reference to an executing class several stack frames above the current one? For example, if you have:\nClass a { \n foo() {\n new b().bar();\n }\n}\n\nClass b {\n bar() {\n ...\n }\n}\n\n\nIs there a way to get the value that would ... |
I'm wanting to keep the font size of a navigation menu the same size for all browsers. I set the font-size of the navigation menu text to a specific pixel size. In IE this works, but not in FF.
The problem is, if a person changes their browser's font size, then it completely ruins the menu layout in FF.
Is there a ... | To maintain a consistent font size across different browsers and ensure that your navigation menu looks good regardless of the user's browser settings, you can take a few approaches. Here are some suggestions:
### 1. Use `rem` or `em` Units
Instead of using fixed `px` sizes, consider using `rem` or `em` units for you... | 47,899 | [
{
"from": "human",
"value": "I'm wanting to keep the font size of a navigation menu the same size for all browsers. I set the font-size of the navigation menu text to a specific pixel size. In IE this works, but not in FF. \nThe problem is, if a person changes their browser's font size, then it completel... |
I have an a aspx page, but all content is generated by hands(yes I know that I need to make a handler, I have another question)
I want to cache output in client browser. Problem is that it's cached only for one query.
public static void ProceedCaching(string etag, string lastModify, string response, HttpRespons... | The issue you're facing stems from how HTTP caching works, particularly with the `ETag` and `Last-Modified` headers. When the client receives a `304 Not Modified` response, it essentially indicates that the cached version is still valid. However, the client should still maintain the `ETag` and `Last-Modified` informati... | 45,189 | [
{
"from": "human",
"value": "I have an a aspx page, but all content is generated by hands(yes I know that I need to make a handler, I have another question)\nI want to cache output in client browser. Problem is that it's cached only for one query.\n public static void ProceedCaching(string etag, stri... |
I know that I can use $('#myId').load('aPage.html'); to load a page into an element, how do I do use that to alter an image?
| To alter an image using jQuery's `.load()` method, you can load HTML content that includes an image or manipulate the image after loading the content.
Here are two common approaches you might consider:
### 1. Load HTML Content with an Image
If you have a separate HTML file (e.g., `aPage.html`) that contains an imag... | 48,894 | [
{
"from": "human",
"value": "I know that I can use $('#myId').load('aPage.html'); to load a page into an element, how do I do use that to alter an image?\n"
},
{
"from": "gpt",
"value": "To alter an image using jQuery's `.load()` method, you can load HTML content that includes an image or manipu... |
I am trying to send some data from a LINQ query in C# to an Excel speed sheet using OLE
I have a query like this:
Var data = from d in db.{MyTable}
where d.Name = "Test"
select d;
I have the Excel OLE object working fine, I just can't figure out how to populate the cells in Excel with the data fr... | Certainly! If you have the LINQ query returning the data that you want to populate into an Excel spreadsheet using OLE Automation, you can follow these steps to get the data into the cells of your Excel worksheet.
Assuming that you have set up your OLE object to create and manipulate an Excel application, here’s a sam... | 47,629 | [
{
"from": "human",
"value": "I am trying to send some data from a LINQ query in C# to an Excel speed sheet using OLE\nI have a query like this:\nVar data = from d in db.{MyTable}\n where d.Name = \"Test\"\n select d;\n\nI have the Excel OLE object working fine, I just can't figure out ho... |
I'm working on a P2P application, and I need to get it to communicate through NAT Routers / Firewalls using UPnP. However, it doesn't seem that the .NET Framework includes support for UPnP.
Is there a UPnP Library for .NET? C# or VB.NET?
UPDATE: I have since found the NATUPnP 1.0 Type Library (NATUPNP.DLL) COM Componen... | It's great to hear that you've made progress with your P2P application using UPnP! Yes, UPnP (Universal Plug and Play) can be quite useful for applications that need to work with NAT routers and firewalls. While the .NET Framework does not provide built-in support for UPnP, you can certainly leverage existing libraries... | 47,982 | [
{
"from": "human",
"value": "I'm working on a P2P application, and I need to get it to communicate through NAT Routers / Firewalls using UPnP. However, it doesn't seem that the .NET Framework includes support for UPnP.\nIs there a UPnP Library for .NET? C# or VB.NET?\nUPDATE: I have since found the NATUPnP ... |
I've always been confused about how the linker works, and it's a difficult subject to search for.
To demonstrate my question and to provide a framework for an answer, I'll put down what I know (or think I know) so far. I may be very wrong. :)
First, each .cpp file is built into an intermediate file (.o for Posix/ELF an... | You're on the right track regarding how the linker works and the overall process of building C++ applications. Let's break it down step-by-step and clarify some of your points.
### Compilation Process Overview
1. **Preprocessing**:
- The preprocessor handles directives (like `#include`, `#define`, etc.) and gener... | 46,579 | [
{
"from": "human",
"value": "I've always been confused about how the linker works, and it's a difficult subject to search for.\nTo demonstrate my question and to provide a framework for an answer, I'll put down what I know (or think I know) so far. I may be very wrong. :)\nFirst, each .cpp file is built int... |
Hey there, I've got a block of HTML that I'm going to be using repeatedly (at various times during a users visit, not at once). I think that the best way to accomplish this is to create an HTML div, hide it, and when needed take its innerHTML and do a replace() on several keywords. As an example HTML block...
<div id... | Your approach is on the right track, but there's room for improvement in terms of performance and readability. Instead of manipulating the inner HTML directly and repeatedly, you can create a function that handles the template replacement more efficiently. Here’s a cleaner and potentially faster way to achieve what you... | 49,379 | [
{
"from": "human",
"value": "Hey there, I've got a block of HTML that I'm going to be using repeatedly (at various times during a users visit, not at once). I think that the best way to accomplish this is to create an HTML div, hide it, and when needed take its innerHTML and do a replace() on several keywo... |
I’m currently using the OpenNETCF.Desktop.Communication.dll to copy files from my desktop to a CE device, but I keep getting an error:
‘Could not create remote file’
My development environment is VS2005 (VB.NET)
My code:
ObjRapi.Connect()
ObjRapi.CopyFileToDevice("C:\results.txt", "\results.txt")
ObjRapi.Dispose()
Obj... | The error message "Could not create remote file" suggests that there might be an issue with either the path on the CE device or the file permissions. Here are some troubleshooting steps you can follow to resolve this issue:
1. **Check Device Connection**: Make sure that your device is properly connected and that you c... | 47,460 | [
{
"from": "human",
"value": "I’m currently using the OpenNETCF.Desktop.Communication.dll to copy files from my desktop to a CE device, but I keep getting an error:\n‘Could not create remote file’ \nMy development environment is VS2005 (VB.NET)\nMy code:\nObjRapi.Connect()\nObjRapi.CopyFileToDevice(\"C:\\res... |
I want to send an Email message after a page is returned to the browser. Where do I place this send Email code so that it does not delay the page that is returned to the browser?
| To ensure that sending an email does not delay the page returned to the browser, you can implement a few different strategies depending on the technology stack you are using. Here are some common approaches:
### 1. Asynchronous Processing with JavaScript
You can use JavaScript to make an asynchronous call to your ser... | 48,034 | [
{
"from": "human",
"value": "I want to send an Email message after a page is returned to the browser. Where do I place this send Email code so that it does not delay the page that is returned to the browser? \n"
},
{
"from": "gpt",
"value": "To ensure that sending an email does not delay the pa... |
I am currently reading "Beginning CakePHP:From Novice to Professional" by David Golding. At one point I have to use the CLI-command "cake bake", I get the welcome-screen but when I try to bake e.g. a Controller I get the following error messages:
Warning: mysql_connect(): Can't connect to local MySQL server through soc... | It looks like you're running into an issue where CakePHP is unable to connect to your MySQL server, which is likely due to a misconfiguration in your database settings, particularly with how the connection is established. Here’s a step-by-step guide to help you troubleshoot and resolve the issue:
### Step 1: Verify MA... | 48,336 | [
{
"from": "human",
"value": "I am currently reading \"Beginning CakePHP:From Novice to Professional\" by David Golding. At one point I have to use the CLI-command \"cake bake\", I get the welcome-screen but when I try to bake e.g. a Controller I get the following error messages:\nWarning: mysql_connect(): C... |
why this is happen ?
When u create abstract class in c++ Ex: Class A (which has a pure virtual function)
after that class B is inherited from class A
And if class A has constructor called A()
suppose i created an Object of class B then the compiler initializes the base class first i.e.class A and then initialize ... | In C++, an abstract class is defined as a class that contains at least one pure virtual function. While it is true that you cannot instantiate an abstract class directly (you cannot create an object of the abstract class), its constructor can still be called as part of the instantiation process of a derived class.
###... | 45,256 | [
{
"from": "human",
"value": "why this is happen ?\nWhen u create abstract class in c++ Ex: Class A (which has a pure virtual function)\nafter that class B is inherited from class A \nAnd if class A has constructor called A() \nsuppose i created an Object of class B then the compiler initializes the base... |
I'm currently writing some methods that do some basic operations on form controls eg Textbox, Groupbox, these operations are generic and can be used in any application.
I started to write some unit tests and was just wondering should I use the real form controls found in System.Windows.Forms or should I just mock up t... | When it comes to unit testing, there are several considerations to weigh, especially in the context of a UI framework like `System.Windows.Forms`. Let's break it down based on your example and your question.
### Use Real Controls vs. Mocking
1. **Using Real Controls:**
- In your case, you're using real `TextBox` i... | 45,267 | [
{
"from": "human",
"value": "I'm currently writing some methods that do some basic operations on form controls eg Textbox, Groupbox, these operations are generic and can be used in any application. \nI started to write some unit tests and was just wondering should I use the real form controls found in Syste... |
My company are about to implement a new architecture in which we have proposed BizTalk (we are a Microsoft shop) as the Enterprise Service Bus (ESB) in a SOA (please don't quote Service Oriented Ambiguity) environment.
Our business is to take Orders through our new Order Capture GUI which must connect to our Customers ... | Introducing an Enterprise Service Bus (ESB) can be a strategic move for organizations seeking to improve system integration, especially in a Service-Oriented Architecture (SOA) environment. Here are some considerations to help clarify when an ESB makes sense, particularly in your scenario:
### When to Consider Using a... | 46,724 | [
{
"from": "human",
"value": "My company are about to implement a new architecture in which we have proposed BizTalk (we are a Microsoft shop) as the Enterprise Service Bus (ESB) in a SOA (please don't quote Service Oriented Ambiguity) environment.\nOur business is to take Orders through our new Order Captur... |
We are building a query to count the number of events per hour, per day. Most days there are hours that do not have any activity and therefore where the query is run the count of activities per hour show up but there are gaps and the query excludes these. We still want to show the hours that do not have activity and di... | To ensure that you capture all hours of the day, even when there are no events in certain hours, you can use a combination of a Common Table Expression (CTE) or a subquery to generate a complete list of hours in the specified range, and then LEFT JOIN it with your existing event count query. Below is an example of how ... | 46,798 | [
{
"from": "human",
"value": "We are building a query to count the number of events per hour, per day. Most days there are hours that do not have any activity and therefore where the query is run the count of activities per hour show up but there are gaps and the query excludes these. We still want to show t... |
Has anyone spent several hours to get the UI of their application render correctly in all the browsers?
How do you tackle the frustration when simple styles tend to work in one browser but not others..and end of the day you invent the hack to handle it (in some cases that too does not happen), only after wasting your t... | Absolutely, many developers have spent hours (or even days) trying to get their application's UI to render correctly across different browsers. Cross-browser compatibility can be frustrating, and it's a common pain point in web development. Here are some strategies to help tackle this challenge:
### 1. **Use Modern CS... | 44,797 | [
{
"from": "human",
"value": "Has anyone spent several hours to get the UI of their application render correctly in all the browsers?\nHow do you tackle the frustration when simple styles tend to work in one browser but not others..and end of the day you invent the hack to handle it (in some cases that too d... |
Environment:
Team Foundation Server 2005
Visual Studio 2008
I have a reasonably large project with several code branches and several subfolders, solutions, etc. below each code branch.
In one particular branch, I have a folder with 3 subfolders. One of the folders is marked correctly as "Latest: Yes". However, the othe... | It sounds like you're experiencing issues with Team Foundation Server (TFS) regarding the synchronization of files and folders in your Visual Studio 2008 environment. Here are some potential steps and considerations to troubleshoot and resolve the issue with folders marked as "Latest: Not downloaded":
1. **Force a Get... | 49,697 | [
{
"from": "human",
"value": "Environment:\nTeam Foundation Server 2005\nVisual Studio 2008\nI have a reasonably large project with several code branches and several subfolders, solutions, etc. below each code branch.\nIn one particular branch, I have a folder with 3 subfolders. One of the folders is marked ... |
I need to iterate through the items (strings) in a CComboBox to check which string is the longest. How can I get each item in the list?
| To iterate through the items in a `CComboBox` and find the longest string, you can use the `GetCount()` method to retrieve the number of items in the combo box and the `GetLBText()` method to retrieve each item. Below is a simple example of how to do this in a Win32 application using MFC (Microsoft Foundation Classes):... | 47,285 | [
{
"from": "human",
"value": "I need to iterate through the items (strings) in a CComboBox to check which string is the longest. How can I get each item in the list?\n"
},
{
"from": "gpt",
"value": "To iterate through the items in a `CComboBox` and find the longest string, you can use the `GetCou... |
I've got this small question - given a bitmask of weekdays (e.g., Sunday = 0x01, Monday = 0x02, Tuesday = 0x04, etc...) and today's day (in a form of Sunday = 1, Monday = 2, Tuesday = 3, etc...) - what's the most elegant way to find out the next day from today, that's set in the bitmask? By elegant I mean, is there a w... | To find the next day from today that's set in a bitmask without using `if`, `switch`, or similar statements, you can leverage bitwise operations along with some arithmetic.
Here’s a way to achieve that in a systematic and elegant manner using a loop and bitwise operations:
```python
def next_day(bitmask, today):
... | 44,899 | [
{
"from": "human",
"value": "I've got this small question - given a bitmask of weekdays (e.g., Sunday = 0x01, Monday = 0x02, Tuesday = 0x04, etc...) and today's day (in a form of Sunday = 1, Monday = 2, Tuesday = 3, etc...) - what's the most elegant way to find out the next day from today, that's set in the... |
I would like to use Apple's Xcode IDE to develop applications on the OS X, but I find the UI immensely confusing because I am so used to developing in Visual Studio on Windows.
Does anyone know of any Xcode quickstart guides for the Visual Studio developer that map common tasks and functionality from one to the other?
... | Transitioning from Visual Studio to Xcode can be a bit challenging, especially if you're accustomed to the specific workflows and UI of Visual Studio. Here are some resources and tips to help you get started with Xcode, particularly for C/C++ development, as well as answers to your specific questions.
### Xcode Quicks... | 49,065 | [
{
"from": "human",
"value": "I would like to use Apple's Xcode IDE to develop applications on the OS X, but I find the UI immensely confusing because I am so used to developing in Visual Studio on Windows.\nDoes anyone know of any Xcode quickstart guides for the Visual Studio developer that map common tasks... |
I'm looking for some information and a little history. I am writing a program and I want to save some data without using a database. I'm assuming I could use XML but what else can I use? How do you save data to files and then retrieve them without XML and without plain text? What is Binary formatting, can that be used?... | Certainly! When you want to store data without using a database and you're looking beyond XML and plain text, you have several options, including binary formatting and other serialization techniques. Here's an overview of your options along with some explanations:
### 1. **Binary Formatting**
Binary formatting involve... | 44,638 | [
{
"from": "human",
"value": "I'm looking for some information and a little history. I am writing a program and I want to save some data without using a database. I'm assuming I could use XML but what else can I use? How do you save data to files and then retrieve them without XML and without plain text? Wha... |
Anticipating the day when multi-touch interfaces become more pervasive, are there libraries in Java that can be used for developing touch applications? I'm looking for interfaces similar to MouseListener / MouseMotionListener / MouseWheelListener.
| Yes, as multi-touch interfaces become more prevalent, several libraries and frameworks in Java have been developed to support touch input. While the standard AWT and Swing libraries provide mouse event listeners, they are not designed specifically for touch. However, you can utilize third-party libraries or specific fr... | 46,577 | [
{
"from": "human",
"value": "Anticipating the day when multi-touch interfaces become more pervasive, are there libraries in Java that can be used for developing touch applications? I'm looking for interfaces similar to MouseListener / MouseMotionListener / MouseWheelListener.\n"
},
{
"from": "gpt",... |
We use Perl for GUI test automation. It has been very successful. We have written a very lightweight DSL kind of language for GUI testing. The DSL is very similar to a object model.
For example, we have an Application object at the root. Each property sheet in the application is a View object. Each page under the page ... | Creating a DSL (Domain-Specific Language) in Perl that allows for more readable and fluent syntax for your GUI testing can certainly enhance the usability of your test automation framework. While Perl does not provide a dedicated syntax for creating DSLs, you can achieve the desired functionality using a combination of... | 45,467 | [
{
"from": "human",
"value": "We use Perl for GUI test automation. It has been very successful. We have written a very lightweight DSL kind of language for GUI testing. The DSL is very similar to a object model.\nFor example, we have an Application object at the root. Each property sheet in the application i... |
I need to export a report to Excel file using PHP i.e. on the fly. I am actually getting data from MySQL and presenting it in HTML tables.
I am able to export all this data into Excel file format, except images. I can't point the image source to an absolute URL, because this file also needs to work off-line.
Is there a... | Exporting an Excel file with embedded images using PHP can be a bit tricky, especially when you're trying to avoid using any libraries that require PEAR/PECL extensions. However, you can still achieve this using a combination of PHP and a library like PHPExcel (now known as PhpSpreadsheet), which does not require those... | 46,608 | [
{
"from": "human",
"value": "I need to export a report to Excel file using PHP i.e. on the fly. I am actually getting data from MySQL and presenting it in HTML tables.\nI am able to export all this data into Excel file format, except images. I can't point the image source to an absolute URL, because this fi... |
I am inside the IDE and I can run all the unit tests in a file but is there any way to run all test in a project or solution at once?
| Yes, most Integrated Development Environments (IDEs) provide a way to run all tests in a project or solution at once. Here’s how to do it in some popular IDEs:
### Visual Studio
1. **Open Test Explorer**: Go to `Test` in the menu and click on `Test Explorer`.
2. **Run All Tests**: In the Test Explorer window, there is... | 47,660 | [
{
"from": "human",
"value": "I am inside the IDE and I can run all the unit tests in a file but is there any way to run all test in a project or solution at once?\n"
},
{
"from": "gpt",
"value": "Yes, most Integrated Development Environments (IDEs) provide a way to run all tests in a project or ... |
I want to take a look on Fluent NHibernate but unfortunately I cannot find any information on how to build it from the sources. Maybe someone can help me? What tools I need for building it?
| Building Fluent NHibernate from source is a straightforward process if you have the right tools set up. Here's a step-by-step guide to help you get started:
### Prerequisites
1. **.NET SDK**: Ensure you have the .NET SDK installed. Fluent NHibernate supports .NET Core, so having the latest version of the SDK is ideal... | 47,038 | [
{
"from": "human",
"value": "I want to take a look on Fluent NHibernate but unfortunately I cannot find any information on how to build it from the sources. Maybe someone can help me? What tools I need for building it?\n"
},
{
"from": "gpt",
"value": "Building Fluent NHibernate from source is a ... |
I'm building an XML DOM document in C++. My problem is this: I execute an XPATH query from an Element in my Document, which I know will return another Element. The elementPtr->selectSingleNode call returns an IXMLDOMNode. How can I gain access to the attributes of this node?
Part of me wants to downcast the Node to an... | It seems like you've identified that your issue stems from the `selectSingleNode` call returning a `NULL` pointer, indicating that the XPath query did not find a matching node. This is indeed a critical point, as any further operations on a `NULL` pointer will lead to runtime errors.
When working with MSXML and XPath ... | 47,231 | [
{
"from": "human",
"value": "I'm building an XML DOM document in C++. My problem is this: I execute an XPATH query from an Element in my Document, which I know will return another Element. The elementPtr->selectSingleNode call returns an IXMLDOMNode. How can I gain access to the attributes of this node?\nP... |
I'm looking to find records in a table that match a specific number that the user enters. So, the user may enter 12345, but this could be 123zz4-5 in the database.
I imagine something like this would work, if PHP functions worked in MySQL.
SELECT * FROM foo WHERE preg_replace("/[^0-9]/","",bar) = '12345'
What's the e... | To achieve the desired functionality of stripping non-numeric characters from a column in MySQL to match against a user-supplied number, you can use a combination of string functions available in MySQL, such as `REPLACE` and `REGEXP_REPLACE` (if you're using MySQL 8.0 or later).
Here's how you can implement it:
### ... | 47,349 | [
{
"from": "human",
"value": "I'm looking to find records in a table that match a specific number that the user enters. So, the user may enter 12345, but this could be 123zz4-5 in the database.\nI imagine something like this would work, if PHP functions worked in MySQL.\nSELECT * FROM foo WHERE preg_replace... |
I am given a problem where I have been given N nodes in a graph that are interconnected to each other then given a matrix which lists down a node being connected to another (1 if it is, 0 if not). I am wondering how to best approach this problem. I think these are adjacency matrix? But how would I implement that ...
... | You're correct that an adjacency matrix is a useful representation of a graph where the elements indicate whether pairs of vertices are adjacent (i.e., connected). In an adjacency matrix for a graph with \(N\) nodes, you will have an \(N \times N\) matrix where the entry at row \(i\) and column \(j\) is 1 if there is a... | 46,773 | [
{
"from": "human",
"value": "I am given a problem where I have been given N nodes in a graph that are interconnected to each other then given a matrix which lists down a node being connected to another (1 if it is, 0 if not). I am wondering how to best approach this problem. I think these are adjacency ma... |
This one has been stumping me for a while. But I'm no expert. This is a bit long...
I have a WinForms app with an Outlook style UI. That it to say there is a bar on the left hand pane that allows you to select a 'screen' which is a WinForms control, say the customer screen, and on the right hand pane there will appe... | You've posed a complex problem with several layers, so let's break it down step-by-step.
### 1. Implementing Unit of Work in WinForms
To apply the Unit of Work pattern in your WinForms application, you might consider the following approach:
- **Scoped DataContext**: Create a new `DataContext` for each unit of work (f... | 47,548 | [
{
"from": "human",
"value": "This one has been stumping me for a while. But I'm no expert. This is a bit long...\nI have a WinForms app with an Outlook style UI. That it to say there is a bar on the left hand pane that allows you to select a 'screen' which is a WinForms control, say the customer screen, ... |
I have a webservice and client in c#/dotnet and I am using EnableDecompression to gzip compress the responses that I get from the web server. Is it possible to compress the requests as well?
| Yes, you can compress requests in C#/.NET when communicating with a web service, although it requires a bit of extra setup compared to handling compressed responses. Here's how you can do it:
1. **Compress Request Body**: You will need to manually compress the request data before sending it. This can be done using GZi... | 48,857 | [
{
"from": "human",
"value": "I have a webservice and client in c#/dotnet and I am using EnableDecompression to gzip compress the responses that I get from the web server. Is it possible to compress the requests as well?\n"
},
{
"from": "gpt",
"value": "Yes, you can compress requests in C#/.NET ... |
My details: custom mobile device running Windows CE 4.2, Compact Framework 2.0 SP1. C# app making decent use of P/Invokes with no problems until now.
I've written a low-level keyboard hook (similar to, but not identical to, this CodeProject post) which works marvelously with one exception. One thing that our software d... | It seems you are facing a challenging issue when integrating a low-level keyboard hook with the Windows CE screen calibration functionality. Let’s analyze your situation based on the potential causes you outlined:
### a) Keyboard hooks and keyboard-requiring P/Invokes are incompatible
Keyboard hooks themselves are not... | 47,421 | [
{
"from": "human",
"value": "My details: custom mobile device running Windows CE 4.2, Compact Framework 2.0 SP1. C# app making decent use of P/Invokes with no problems until now.\nI've written a low-level keyboard hook (similar to, but not identical to, this CodeProject post) which works marvelously with on... |
In my application I have a UITextField inside a UITableViewCell. If I click inside the text field and add some text I find that if try to move the insertion point it works the first time but fails on subsequent attempts. I am completely unable to move the selection; no "magnifying glass" appears.
Even more curious, thi... | It seems like you're experiencing a common issue with UITextField editing within a UITableViewCell, which can often be due to how the text field and cell interact with touch events and the responder system in iOS. Here are some potential workarounds and solutions you can try to fix the issue of the insertion point not ... | 47,343 | [
{
"from": "human",
"value": "In my application I have a UITextField inside a UITableViewCell. If I click inside the text field and add some text I find that if try to move the insertion point it works the first time but fails on subsequent attempts. I am completely unable to move the selection; no \"magnify... |
Hey. I have a problem with the highlighter in ComboBox. Recently I had to gray out certain items in a ComboBox and I did that by manually (programitically) drawing strings in the ComboBox. In a .NET combobox under the DrawMode.NORMAL, the lighlighter will automatically come when you click the arrow and the backcolor of... | When you're using `DrawMode.OwnerDrawVariable` in a ComboBox, you will need to handle the mouse hover effect yourself, since the default behavior (such as changing the foreground color on hover) doesn't apply when you manually draw the items.
To achieve the hover effect that you described, you can use the `MouseEnter`... | 45,156 | [
{
"from": "human",
"value": "Hey. I have a problem with the highlighter in ComboBox. Recently I had to gray out certain items in a ComboBox and I did that by manually (programitically) drawing strings in the ComboBox. In a .NET combobox under the DrawMode.NORMAL, the lighlighter will automatically come when... |
I'm trying to make an application that keeps an object model in sync with a database by observing all changes and then immediately persisting the objects in questions. Many of the object in the model have children in large lists or trees.
When I load an object from the database, I rely on a one-way cascading relations... | To achieve your goal of persisting changes to a `Parent` object without automatically persisting its `children` due to the cascade setting, you have a few options. Each has its pros and cons, and the best choice depends on your application's design and requirements.
### Option 1: Modify Cascade Types
If you set the c... | 49,002 | [
{
"from": "human",
"value": "I'm trying to make an application that keeps an object model in sync with a database by observing all changes and then immediately persisting the objects in questions. Many of the object in the model have children in large lists or trees.\nWhen I load an object from the databas... |
I've been struggling with this for quite awhile and haven't been able to
find a solution. I need a user to be able to view multiple top level
domains with a single login.
My understanding is that this needs to be set in environment.rb and
called with before_dispatch. This is what I've come up with:
require 'activesuppo... | The approach you've taken in your Ruby on Rails application to allow a user to access multiple top-level domains with a single login is on the right track. However, there are a few adjustments you may want to consider.
First, the way you're trying to set the `session_domain` may not be working as expected. The `sessio... | 48,429 | [
{
"from": "human",
"value": "I've been struggling with this for quite awhile and haven't been able to\nfind a solution. I need a user to be able to view multiple top level\ndomains with a single login.\nMy understanding is that this needs to be set in environment.rb and\ncalled with before_dispatch. This is... |
Does anyone know where a log of who connected to my subversion server and what they did with it is?
I'm looking to find out what time and which files were checked out.
I'm assuming that it has something like a webserver log somewhere and I just can't find it.
EDIT: From the response below, I wasn't aware that there ... | When using `svnserve` for your Subversion server, logging is handled differently compared to other server setups like Apache with mod_dav_svn. If you're running `svnserve` as a service on Windows, it does not log connections or file operations by default, which is why you're unable to find logs about who connected to y... | 44,272 | [
{
"from": "human",
"value": "Does anyone know where a log of who connected to my subversion server and what they did with it is? \nI'm looking to find out what time and which files were checked out.\nI'm assuming that it has something like a webserver log somewhere and I just can't find it.\nEDIT: From th... |
My development machine is a quad core system, but I just ran into ( and I am still debugging ), and problem when my application is deployed to single processor systems. I get a dead lock.
I would like to be able to debug using only a single processor, rather than having to build a development VM to debug with.
Is it p... | Debugging deadlocks can be tricky, especially when dealing with multi-threaded applications. Unfortunately, Visual Studio itself does not provide a direct option to limit the number of processors for a debug session. However, there are several techniques and tools you can use to simulate single-processor environments a... | 47,457 | [
{
"from": "human",
"value": "My development machine is a quad core system, but I just ran into ( and I am still debugging ), and problem when my application is deployed to single processor systems. I get a dead lock.\nI would like to be able to debug using only a single processor, rather than having to buil... |
I have a DropDownList on a repeater control, as well as a button.
The button is disabled until a valid item is selected on the DropDownList, when I want to enable the button. Unfortunately I can't seem to get to it.
Found the repeater by: (.As() method is an extension method for (object as T), just makes casting easier... | It looks like you have already figured out how to retrieve the sibling control (the `ImageButton`) from the `DropDownList` inside a `Repeater` when its `SelectedIndexChanged` event is fired. That's great!
To recap and clarify the solution for anyone who might encounter a similar situation, here’s a step-by-step breakd... | 49,741 | [
{
"from": "human",
"value": "I have a DropDownList on a repeater control, as well as a button.\nThe button is disabled until a valid item is selected on the DropDownList, when I want to enable the button. Unfortunately I can't seem to get to it.\nFound the repeater by: (.As() method is an extension method f... |
I have some jQuery code. I have called an Ajax function file, file.php, that has some fields, like:
<input type="radio" value="plz">Milk</input>.
Will I assign into again jQuery function? If so, how do I do it? I attached a sample file:
<html>
<head>
<LINK REL=StyleSheet HREF="examples.css" TITLE="Contempo... | It looks like you are using jQuery to perform an AJAX request to `file.php`, but you are not properly handling the returned data or updating the DOM with the radio button input generated from that file. Here's how you can modify your code to properly use the data returned from the AJAX request and append the radio butt... | 49,233 | [
{
"from": "human",
"value": "I have some jQuery code. I have called an Ajax function file, file.php, that has some fields, like:\n<input type=\"radio\" value=\"plz\">Milk</input>.\n\nWill I assign into again jQuery function? If so, how do I do it? I attached a sample file:\n<html>\n <head>\n <LINK... |
What is the best (date format independent way) in PHP to calculate difference in days between two dates in specified format.
I tried the following function:
function get_date_offset($start_date, $end_date)
{
$start_time = strtotime($start_date);
$end_time = strtotime($end_date);
return round(($end_time-$start_tim... | To calculate the difference in days between two dates in PHP, while allowing for various input formats through a specified format, it's better to use the `DateTime` class and `DateTime::createFromFormat()` function. This approach avoids the problems associated with `strtotime()`, especially when dealing with different ... | 49,359 | [
{
"from": "human",
"value": "What is the best (date format independent way) in PHP to calculate difference in days between two dates in specified format.\nI tried the following function:\nfunction get_date_offset($start_date, $end_date)\n{\n $start_time = strtotime($start_date);\n $end_time = strtotime($e... |
I have a class that looks like this:
public class TextField : TextBox
{
public bool Required { get; set; }
RequiredFieldValidator _validator;
protected override void CreateChildControls()
{
base.CreateChildControls();
_validator = new RequiredFieldValidator();
_validator.ControlToValida... | You're correct in your observation that the server-side validation isn't working due to how and when you're adding the validator to the page. The key issue here is that you need to ensure that the validator is added to the page's collection of validators at the appropriate time while also respecting the state of the `R... | 49,030 | [
{
"from": "human",
"value": "I have a class that looks like this:\npublic class TextField : TextBox\n{\n public bool Required { get; set; }\n RequiredFieldValidator _validator;\n\n protected override void CreateChildControls()\n {\n base.CreateChildControls();\n\n\n _validator = new Requir... |
I am trying to so something like Database Design for Tagging, except each of my tags are grouped into categories.
For example, let's say I have a database about vehicles. Let's say we actually don't know very much about vehicles, so we can't specify the columns all vehicles will have. Therefore we shall "tag" vehicle... | To design your database schema to effectively handle tagging of vehicles with categories while ensuring that certain tags (like manufacturer) can only occur once per vehicle, you can follow a structure that allows for both flexibility in tagging and enforcement of unique constraints.
Here’s a recommended schema:
### ... | 46,474 | [
{
"from": "human",
"value": "I am trying to so something like Database Design for Tagging, except each of my tags are grouped into categories.\nFor example, let's say I have a database about vehicles. Let's say we actually don't know very much about vehicles, so we can't specify the columns all vehicles wi... |
I am trying to select a record out of the table1 by joining table2 and using table2 columns in the WHERE statement. Col1 and Col2 in table1 can be stored in col1 of table2. I need to join col1 of table2 with either the value of col1 or col2 in table1
here is the sql statement I created so (pseudo):
SELECT
t1.Col1,... | The SQL query you've written seems to be in the right direction, but it’s important to ensure that the join condition accurately reflects your intent. Your goal is to select records from `table1` where either `Col1` or `Col2` matches `Col1` from `table2`.
Your current approach will work, but it may result in a Cartes... | 46,192 | [
{
"from": "human",
"value": "I am trying to select a record out of the table1 by joining table2 and using table2 columns in the WHERE statement. Col1 and Col2 in table1 can be stored in col1 of table2. I need to join col1 of table2 with either the value of col1 or col2 in table1\nhere is the sql statement... |
What is the most code free way to decode a string:
\xD0\xAD\xD0\xBB\xD0\xB5\xD0\xBA\xD1\x82\xD1\x80\xD0\xBE\xD0\xBD\xD0\xBD\xD0\xB0\xD1\x8F
to human string in C#?
This hex string contains some unicode symbols.
I know about
System.Convert.ToByte(string, fromBase);
But I was wondering if there are some built-in helper... | In C#, you can easily decode a hex-encoded string that contains Unicode characters using the `Encoding` class. However, there isn't a built-in method that directly converts a hex-encoded string like the one you provided into a human-readable string. Instead, you can use a combination of methods to achieve this.
The st... | 47,740 | [
{
"from": "human",
"value": "What is the most code free way to decode a string:\n\\xD0\\xAD\\xD0\\xBB\\xD0\\xB5\\xD0\\xBA\\xD1\\x82\\xD1\\x80\\xD0\\xBE\\xD0\\xBD\\xD0\\xBD\\xD0\\xB0\\xD1\\x8F\n\nto human string in C#?\nThis hex string contains some unicode symbols.\nI know about \nSystem.Convert.ToByte(stri... |
So far I've read some blog articles about cloud computing and services for hosting applications in the grid.
If I'd wanted to have a web application running in the cloud for as little cost as possible, what would be the best solution?
Let's assume the following configuration:
J2EE web application
Any free database (... | To host, deploy, and run a J2EE web application in the cloud with minimal costs and low server management, I recommend the following stack:
### 1. Hosting Platform
**Platform as a Service (PaaS) Providers**: PaaS platforms abstract much of the infrastructure management, allowing you to focus on your application code r... | 45,771 | [
{
"from": "human",
"value": "So far I've read some blog articles about cloud computing and services for hosting applications in the grid. \nIf I'd wanted to have a web application running in the cloud for as little cost as possible, what would be the best solution?\nLet's assume the following configuration:... |
I need to set a system environment variable from a Bash script that would be available outside of the current scope. So you would normally export environment variables like this:
export MY_VAR=/opt/my_var
But I need the environment variable to be available at a system level though. Is this possible?
| To set a system-wide environment variable that persists beyond the current session, you typically need to modify system configuration files instead of doing it through a Bash script that runs and exits. The method you choose depends on the operating system you are using.
### On Linux
1. **Using `/etc/environment`**
... | 44,602 | [
{
"from": "human",
"value": "I need to set a system environment variable from a Bash script that would be available outside of the current scope. So you would normally export environment variables like this:\nexport MY_VAR=/opt/my_var\n\nBut I need the environment variable to be available at a system level... |
I need to write a script to set ip address/mask/broadcast as an alias on eth0:0 plus set the default gateway.
This solution works:
ifconfig eth0:0 <ip> netmask <mask> up
ip route replace default via <ip>
but sometimes the second call gets an error "network unavailable".
Adding a sleep between them fixes it, but is unr... | When setting up an IP address and a default gateway on a Linux system, using `ifconfig` and `ip` commands, it's crucial to ensure that the network interface is fully initialized and ready to accept the routing changes. While adding a sleep can sometimes help, a more robust approach involves checking the state of the in... | 45,475 | [
{
"from": "human",
"value": "I need to write a script to set ip address/mask/broadcast as an alias on eth0:0 plus set the default gateway.\nThis solution works:\nifconfig eth0:0 <ip> netmask <mask> up\nip route replace default via <ip>\n\nbut sometimes the second call gets an error \"network unavailable\".\... |
I have the VS2005 standard edition and MS says this:
Note: The Windows Service Application
project templates and associated
functionality are not available in the
Standard Edition of Visual Basic and
Visual C# .NET...
Is it possible to write a Windows Service application without upgrading my VS2005 Standard... | Yes, it is possible to create a Windows Service application without upgrading from Visual Studio 2005 Standard Edition, even though the built-in project templates and functionality for Windows Service applications are not included in that edition. You can create a Windows Service manually by following these steps:
1. ... | 44,470 | [
{
"from": "human",
"value": "I have the VS2005 standard edition and MS says this:\n\nNote: The Windows Service Application\n project templates and associated\n functionality are not available in the\n Standard Edition of Visual Basic and\n Visual C# .NET...\n\nIs it possible to write a Windows Service... |
File fil = new File("Tall.txt");
FileReader inputFil = new FileReader(fil);
BufferedReader in = new BufferedReader(inputFil);
int [] tall = new int [100];
String s =in.readLine();
while(s!=null)
{
int i = 0;
tall[i] = Integer.parseInt(s); //this is line 19
System.out.println(tall[i]);
s = in.readLine... | The exception you are encountering, `java.lang.NumberFormatException: For input string: ""`, indicates that your program is attempting to parse an empty string as an integer. This is occurring because when you read lines from the file "Tall.txt", the end of the file (EOF) is being reached, and your `BufferedReader` ret... | 48,915 | [
{
"from": "human",
"value": "File fil = new File(\"Tall.txt\");\nFileReader inputFil = new FileReader(fil);\nBufferedReader in = new BufferedReader(inputFil);\n\nint [] tall = new int [100];\n\nString s =in.readLine();\n\nwhile(s!=null)\n{\n int i = 0;\n tall[i] = Integer.parseInt(s); //this is line 1... |
I'm trying to use Jeditable as an inline editing solution.
The default behavior (click on the element to edit it) works quite well, but I would like to activate an element by clicking on another element.
For example clicking on a.activateEdit will activate the next div.edit (obviously should be done using jQuery selec... | It's great that you've found a better solution! However, if you're still interested in how to activate an inline editing element using Jeditable when clicking on another element, here's how you could approach it:
You can achieve this by binding a click event to the `.activateEdit` element and then using the `.editable... | 49,012 | [
{
"from": "human",
"value": "I'm trying to use Jeditable as an inline editing solution.\nThe default behavior (click on the element to edit it) works quite well, but I would like to activate an element by clicking on another element.\nFor example clicking on a.activateEdit will activate the next div.edit (... |
I have some products that belongs to the some category.
Each category can have different properties.
For example,
category cars has properties color,
power, ...
category pets have properties weight, age, ...
Number of categories is about 10-15.
Number of properties in each category is 3-15.
Number of products is v... | Designing a database to handle products with dynamic categories and properties requires a flexible structure that can accommodate varying numbers of categories and properties while enabling efficient searches. Below is a proposed design using an Entity-Attribute-Value (EAV) model, suitable for SQL Server 2005.
### Dat... | 43,975 | [
{
"from": "human",
"value": "I have some products that belongs to the some category.\nEach category can have different properties.\nFor example, \n\ncategory cars has properties color,\npower, ... \ncategory pets have properties weight, age, ...\n\nNumber of categories is about 10-15.\nNumber of properties... |
I have an IQueryable and an object of type T.
I want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName))
so ...
public IQueryable<T> DoWork<T>(string fieldName)
where T : EntityObject
{
...
T objectOfTypeT = ...;
....
return SomeIQueryable<T>().Where(o => ... | You are right in identifying that using `GetProperty` directly isn't valid. Instead, you can leverage expression trees in order to dynamically build a query that allows you to filter on a property by name. This approach is indeed a bit more involved, but it's manageable with a few steps.
Here's how you can achieve it ... | 41,742 | [
{
"from": "human",
"value": "I have an IQueryable and an object of type T.\nI want to do IQueryable().Where(o => o.GetProperty(fieldName) == objectOfTypeT.GetProperty(fieldName))\nso ...\npublic IQueryable<T> DoWork<T>(string fieldName)\n where T : EntityObject\n{\n ...\n T objectOfTypeT = ...;\n... |
If you have a lot of Stored Procedures and you change the name of a column of a table, is there a way to check which Stored Procedures won't work any longer?
Update: I've read some of the answers and it's clear to me that there's is no easy way to do this. Would it be easier to move away from Stored Procedures?
| Yes, if you change the name of a column in a table, it can indeed impact any stored procedures (or other database objects like views, functions, etc.) that reference that column. Unfortunately, SQL Server (and other databases) do not provide a straightforward built-in mechanism to find all stored procedures that refere... | 45,449 | [
{
"from": "human",
"value": "If you have a lot of Stored Procedures and you change the name of a column of a table, is there a way to check which Stored Procedures won't work any longer?\n\nUpdate: I've read some of the answers and it's clear to me that there's is no easy way to do this. Would it be easier ... |
On Windows I can do CreateProcess(..., CREATE_NEW_CONSOLE, ...) and my child process (which is console app, not GUI) will be launched in a new window. What is the easiest way to emulate this on Mac OS?
| On macOS, you can use the `NSTask` class in combination with `Terminal` to run a console application in a new window. Here’s a simple way to emulate the behavior of `CreateProcess` with `CREATE_NEW_CONSOLE` in a macOS environment.
1. **Using a Shell Script**: You can create a shell script that opens a new Terminal win... | 47,127 | [
{
"from": "human",
"value": "On Windows I can do CreateProcess(..., CREATE_NEW_CONSOLE, ...) and my child process (which is console app, not GUI) will be launched in a new window. What is the easiest way to emulate this on Mac OS?\n"
},
{
"from": "gpt",
"value": "On macOS, you can use the `NSTas... |
I have a table like the following:
transaction_id
user_id
other_user_id
trans_type
amount
This table is used to maintain the account transactions for a finance type app.
Its double entry accounting so a transfer from User A to B would insert two rows into the table looking like.
1, A, B, Sent, -100
1, B, A, Received, ... | To ensure that your fund transfer process is both atomic and safe from race conditions, you need to implement a proper locking mechanism in your database. The issue you're experiencing is often referred to as a "race condition," where two transactions are executed simultaneously, leading to inconsistencies in the resul... | 47,030 | [
{
"from": "human",
"value": "I have a table like the following:\ntransaction_id\nuser_id\nother_user_id\ntrans_type\namount\n\nThis table is used to maintain the account transactions for a finance type app.\nIts double entry accounting so a transfer from User A to B would insert two rows into the table look... |
I'm looking for some useful books for a beginner who wants to better understand the Sun JVM
| If you're a beginner looking to understand the Sun (now Oracle) Java Virtual Machine (JVM), there are several books that can help you get started. Here’s a list of some useful titles that cover the JVM, Java programming, and related concepts:
1. **"Java Performance: The Definitive Guide" by Scott Oaks**
This book... | 45,913 | [
{
"from": "human",
"value": "I'm looking for some useful books for a beginner who wants to better understand the Sun JVM\n"
},
{
"from": "gpt",
"value": "If you're a beginner looking to understand the Sun (now Oracle) Java Virtual Machine (JVM), there are several books that can help you get star... |
How do I detect when my Compact Framework application is being smart-minimized (smart minimize is what happens when the user clicks the "X" button in the top-right corner on a Pocket PC)?
The Deactivate event isn't the right way because it occurs in circumstances other than minimization, such as when a message box or a... | Detecting when your Compact Framework application is being smart-minimized (specifically on a Pocket PC) can be a bit tricky since the standard events and properties do not provide a direct way to determine a smart minimize action. However, there are a few approaches you can take to handle this scenario.
### Approach ... | 45,786 | [
{
"from": "human",
"value": "How do I detect when my Compact Framework application is being smart-minimized (smart minimize is what happens when the user clicks the \"X\" button in the top-right corner on a Pocket PC)?\nThe Deactivate event isn't the right way because it occurs in circumstances other than m... |
There example on the net and code given in Learn OpenCv,Orielly.
After many attempts the out.avi file is written with 0 bytes.
I wonder where i went wrong.
The following are the code i used...
int main(int argc, char* argv[]) {
CvCapture* input = cvCaptureFromFile(argv[1]);
IplImage* image = cvRetrieveFrame(inp... | The code you provided has a few potential issues that could lead to the output video file `out.avi` being 0 bytes. Let's go through the main issues and provide a solution.
### Common Issues:
1. **Infinite Loop**: The loop in your code does not have a break condition. If `cvQueryFrame` fails to retrieve a frame (for ex... | 45,895 | [
{
"from": "human",
"value": "There example on the net and code given in Learn OpenCv,Orielly.\nAfter many attempts the out.avi file is written with 0 bytes.\nI wonder where i went wrong.\nThe following are the code i used...\nint main(int argc, char* argv[]) {\n CvCapture* input = cvCaptureFromFile(argv[... |
I have 2 tables, an active table and an inactive table. I want to move rows from the active to the inactive table. My first thought was
insert into inactive select * from active where ...
delete from active active where ...
However about .42 seconds later I noticed this will drop/duplicate rows if updates alter what t... | You are correct that using `INSERT INTO ... SELECT` followed by `DELETE` can lead to issues with rows being moved inconsistently if the data is updated between the two operations. This is a common challenge in transactional systems where multiple processes or users may be modifying data concurrently.
To address this i... | 47,990 | [
{
"from": "human",
"value": "I have 2 tables, an active table and an inactive table. I want to move rows from the active to the inactive table. My first thought was\ninsert into inactive select * from active where ...\ndelete from active active where ...\n\nHowever about .42 seconds later I noticed this wil... |
I am fairly beginner level at shell scripts and following are the details..
Am looking for the best way to fire sql queries and and carry out some logic based on that data. I've used the following snippet..
shellvariable=sqlplus $user/$passwd <<END
select count(1) from table1;
end
EOF
if[$shellvariable -ne 0] then
<>
f... | Certainly! There are a few improvements we can make to your shell script snippet to execute SQL queries in a more efficient and syntactically correct manner. Below is a refined example:
### Improved Shell Script Example
```bash
#!/bin/bash
# Define your database credentials and query
user="your_username"
passwd="you... | 47,728 | [
{
"from": "human",
"value": "I am fairly beginner level at shell scripts and following are the details..\nAm looking for the best way to fire sql queries and and carry out some logic based on that data. I've used the following snippet..\nshellvariable=sqlplus $user/$passwd <<END\nselect count(1) from table1... |
Which is more efficient?
SELECT theField
FROM theTable
GROUP BY theField
or
SELECT DISTINCT theField
FROM theTable
| The efficiency of using `GROUP BY` versus `DISTINCT` in SQL can depend on various factors including the specific database system being used, the size of the dataset, the presence of indexes, and the optimization of the query execution plan. Here’s a general comparison:
### `SELECT DISTINCT theField FROM theTable`
- **... | 48,001 | [
{
"from": "human",
"value": "Which is more efficient?\nSELECT theField\nFROM theTable\nGROUP BY theField\n\nor\nSELECT DISTINCT theField\nFROM theTable\n\n"
},
{
"from": "gpt",
"value": "The efficiency of using `GROUP BY` versus `DISTINCT` in SQL can depend on various factors including t... |
Is there a PHP version of JavaScript's confirm() function?
If not, what are my other options or how do I make something similar to the confirm()?
| PHP is a server-side language, whereas JavaScript is a client-side language. The `confirm()` function in JavaScript is used to display a dialog box that prompts the user for confirmation, and it operates in the browser environment. When you use `confirm()`, it pauses the execution of the script until the user responds,... | 48,364 | [
{
"from": "human",
"value": "Is there a PHP version of JavaScript's confirm() function?\nIf not, what are my other options or how do I make something similar to the confirm()?\n"
},
{
"from": "gpt",
"value": "PHP is a server-side language, whereas JavaScript is a client-side language. The `confi... |
I wonder what the best approach is for a situation where I want to have the user type in
http://myserver/something/20
and get redirected (301 or 302) to
http://someotherserver/applications/something/modules/default.aspx?id=20
For .net 3.5 and IIS 7 I found some solutions, but unfortunately I am stuck with .net 3.0 and... | In an environment with .NET 3.0 and IIS 6.0, handling URL redirections like the one you mentioned can be somewhat limited, especially since you don’t want to install additional components and you're aware that URL rewriting and redirection are not straightforward with the default configurations.
However, you can achie... | 47,897 | [
{
"from": "human",
"value": "I wonder what the best approach is for a situation where I want to have the user type in\nhttp://myserver/something/20\nand get redirected (301 or 302) to \nhttp://someotherserver/applications/something/modules/default.aspx?id=20\nFor .net 3.5 and IIS 7 I found some solutions, b... |
I'm working on a puzzle game, the game engine holds a complex hierarchy of objects, from game actors to vectors to transition animations. Depending on the game state, they might add up from 10 to 1000 (in extreme cases). I've been delaying the moment until I'd have to work on the saving and loading of all that mess, as... | Using `NSKeyedArchiver` (or its modern alternative, `Codable` in Swift) can be an effective way to handle saving and loading complex object hierarchies in your puzzle game. Here are some points to consider regarding your specific concerns:
### 1. Object Hierarchy and Relationships
- **Serialization of Pointers/Referen... | 49,884 | [
{
"from": "human",
"value": "I'm working on a puzzle game, the game engine holds a complex hierarchy of objects, from game actors to vectors to transition animations. Depending on the game state, they might add up from 10 to 1000 (in extreme cases). I've been delaying the moment until I'd have to work on th... |
How can I figure out what is actually causing the following error? The page is the same as other pages but for some reason, only this page is having this error. It also only happens on the ISP (GoDaddy) who has a trust level of Medium and I can't set a breakpoint and try to catch it.
Server Error in '/' Application.
Se... | The error you're experiencing is a `SecurityException`, specifically indicating that your application is trying to perform an operation that is not allowed by the medium trust level enforced by your hosting provider (GoDaddy). In this case, the specific operation that is failing involves requesting permission to access... | 45,025 | [
{
"from": "human",
"value": "How can I figure out what is actually causing the following error? The page is the same as other pages but for some reason, only this page is having this error. It also only happens on the ISP (GoDaddy) who has a trust level of Medium and I can't set a breakpoint and try to catc... |
When I have entities in my domain with lists of things, should they be exposed as ILists or IEnumerables? E.g. Order has a bunch of OrderLines.
| When deciding whether to expose your collections as `IList<T>` or `IEnumerable<T>`, there are several considerations to take into account, particularly related to encapsulation, flexibility, and the specific use case of your domain.
### 1. Encapsulation
- **Use `IEnumerable<T>`**: If you want to encapsulate the collec... | 47,936 | [
{
"from": "human",
"value": "When I have entities in my domain with lists of things, should they be exposed as ILists or IEnumerables? E.g. Order has a bunch of OrderLines. \n"
},
{
"from": "gpt",
"value": "When deciding whether to expose your collections as `IList<T>` or `IEnumerable<T>`, there... |
I have a result from an SQL query that I would like to sort alphabetical, but there are a couple of commonly used results that I would like to float to the top.
Is there a simple way I can achieve this either by doing clever SQL or by sorting the (asp.net) datatable once I have it filled?
I know the database ID of the... | Yes, you can achieve this by modifying your SQL query to sort the results in a specific order based on your criteria. You can use a combination of a `CASE` statement in your `ORDER BY` clause to prioritize certain values (by their IDs) while still sorting the rest alphabetically.
Here’s a simple example of how you cou... | 47,943 | [
{
"from": "human",
"value": "I have a result from an SQL query that I would like to sort alphabetical, but there are a couple of commonly used results that I would like to float to the top. \nIs there a simple way I can achieve this either by doing clever SQL or by sorting the (asp.net) datatable once I hav... |
When my colleague debugs a web application in his visual studio instance his output window streams all of the assemblies that are being compiled, (at least I believe that is what it's doing) but mine does not. I do see the text "Ready" flashing down in the status bar intermittently which I believe is something similar ... | It sounds like you’re experiencing differences in the output settings in Visual Studio when debugging. To enable detailed output information during the compilation of the web application, you can follow these steps to check your Visual Studio settings:
1. **Check Output Window Settings**:
- Go to the **Output** wi... | 49,707 | [
{
"from": "human",
"value": "When my colleague debugs a web application in his visual studio instance his output window streams all of the assemblies that are being compiled, (at least I believe that is what it's doing) but mine does not. I do see the text \"Ready\" flashing down in the status bar intermitt... |
We take text/csv like data over long periods (~days) from costly experiments and so file corruption is to be avoided at all costs.
Recently, a file was copied from the Explorer in XP whilst the experiment was in progress and the data was partially lost, presumably due to multiple access conflict.
What are some good te... | File corruption and data loss during long-running experiments are significant concerns, especially when dealing with valuable or costly data. To help mitigate these issues in a Delphi application running on Windows XP, you can implement various strategies. Here are some ideas, along with comments on the ones you listed... | 47,145 | [
{
"from": "human",
"value": "We take text/csv like data over long periods (~days) from costly experiments and so file corruption is to be avoided at all costs.\nRecently, a file was copied from the Explorer in XP whilst the experiment was in progress and the data was partially lost, presumably due to multip... |
Doing some more tinkering with development on VS2008/Vista/IIS7, I'm wondering at a few things regarding the Network Service account. It had no issues running my website until I attempted to set up the Sql Role Membership Provider, which creates a local database in the App_Data folder. Somewhere in there, Network Servi... | When using the `Network Service` account in IIS7, there are certain limitations and permissions that you need to be aware of, especially when it comes to accessing resources like databases and files.
### Permissions Required for `Network Service`
1. **File System Permissions**:
The `Network Service` account need... | 48,645 | [
{
"from": "human",
"value": "Doing some more tinkering with development on VS2008/Vista/IIS7, I'm wondering at a few things regarding the Network Service account. It had no issues running my website until I attempted to set up the Sql Role Membership Provider, which creates a local database in the App_Data ... |
I'm trying to debug a rather complicated formula evaluator written in T-SQL UDFs (don't ask) that recursively (but indirectly through an intermediate function) calls itself, blah, blah.
And, of course, we have a bug.
Now, using PRINT statements (that can then be read from ADO.NET by implementing a handler for the InfoM... | Debugging complex recursive T-SQL UDFs can be quite challenging, especially since UDFs have limitations, including the inability to use `PRINT` statements. However, there are a few methods you can use to trace calls and examine parameters to help in debugging.
### Option 1: Use a Temporary Table for Logging
One effect... | 45,374 | [
{
"from": "human",
"value": "I'm trying to debug a rather complicated formula evaluator written in T-SQL UDFs (don't ask) that recursively (but indirectly through an intermediate function) calls itself, blah, blah.\nAnd, of course, we have a bug.\nNow, using PRINT statements (that can then be read from ADO.... |
A simple application is written in CF 2.0. It's single-threaded as far as I'm concerned.
Two parts of the application are of interest: an event handler that handles "Barcode scanned" event raised by a class that represents PDA's barcode scanner (provided by manufacturer), and an event handler for Windows.Forms.Timer th... | In a single-threaded environment like that of Windows Forms applications, it is generally true that event handlers are executed in the order that events are received, meaning that one event should complete before another can start executing. The Windows Forms message loop processes messages for controls, including both... | 46,392 | [
{
"from": "human",
"value": "A simple application is written in CF 2.0. It's single-threaded as far as I'm concerned.\nTwo parts of the application are of interest: an event handler that handles \"Barcode scanned\" event raised by a class that represents PDA's barcode scanner (provided by manufacturer), and... |
Using Visual Studio 2005 with default install of Crystal Reports.
When I create a report, Crystal asks for the database, and I give it my development db. In the app, I create a DataTable and pass it to the report, which is then handed to the CR Viewer. At runtime, neither the report object, nor the viewer need to see t... | This situation arises primarily because of how Crystal Reports handles database connections and the data source information stored within the report file itself. Here’s an overview of your questions and potential solutions:
### 1. Different Behavior in Visual Studio vs. Installed Application
When you design reports i... | 45,969 | [
{
"from": "human",
"value": "Using Visual Studio 2005 with default install of Crystal Reports.\nWhen I create a report, Crystal asks for the database, and I give it my development db. In the app, I create a DataTable and pass it to the report, which is then handed to the CR Viewer. At runtime, neither the r... |
When is a good idea to save information in a XML file and when in a own-format file?
For XML (or other standard) I see:
(+) Standard format.
(-) It's tedious to hand modify.
For own-format files I see:
(-) We need to build a own-parser (non-standard).
(+) It can be easy to hand modify the files.
| When deciding whether to use an XML file or a custom format file for saving information, it's essential to weigh the pros and cons based on the specific requirements of your application, use cases, and long-term maintenance considerations. Here’s a more detailed breakdown of when each option might be the best choice:
... | 45,885 | [
{
"from": "human",
"value": "When is a good idea to save information in a XML file and when in a own-format file?\nFor XML (or other standard) I see:\n\n(+) Standard format.\n(-) It's tedious to hand modify.\n\nFor own-format files I see:\n\n(-) We need to build a own-parser (non-standard).\n(+) It can be e... |
I was working with a new C++ developer a while back when he asked the question: "Why can't variable names start with numbers?"
I couldn't come up with an answer except that some numbers can have text in them (123456L, 123456U) and that wouldn't be possible if the compilers were thinking everything with some amount of a... | Your explanation touches on one of the key reasons why variable names in C++ (and many other programming languages) cannot start with a number: it helps to distinguish between variable names and numerical literals. However, there are a few more points worth mentioning regarding why this restriction exists.
1. **Ambigu... | 45,767 | [
{
"from": "human",
"value": "I was working with a new C++ developer a while back when he asked the question: \"Why can't variable names start with numbers?\"\nI couldn't come up with an answer except that some numbers can have text in them (123456L, 123456U) and that wouldn't be possible if the compilers we... |
How do I set environment variables from Java? I see that I can do this for subprocesses using ProcessBuilder. I have several subprocesses to start, though, so I'd rather modify the current process's environment and let the subprocesses inherit it.
There's a System.getenv(String) for getting a single environment variab... | In Java, the environment variables for the currently running process are indeed read-only. The methods you referenced—`System.getenv()` and its associated functionality—allow you to read environment variables, but they do not allow modifications. This design is intentional and is part of Java’s philosophy to provide a ... | 46,811 | [
{
"from": "human",
"value": "How do I set environment variables from Java? I see that I can do this for subprocesses using ProcessBuilder. I have several subprocesses to start, though, so I'd rather modify the current process's environment and let the subprocesses inherit it.\nThere's a System.getenv(Strin... |
Can someone explain to or link to an article that explains how the parameters passed into the action of a controller are populated? I understand the basic mapping when you have the Controller/Action/ID and the ID is passed in as a variable, if it doesn't convert to the type that you are asking for then it won't be pass... | In ASP.NET MVC, the parameters of controller actions are populated through a process called model binding. When a request is received, the framework examines the incoming data (from the query string, route data, form fields, etc.) and tries to map that data to the action method parameters.
### How Model Binding Works
... | 47,591 | [
{
"from": "human",
"value": "Can someone explain to or link to an article that explains how the parameters passed into the action of a controller are populated? I understand the basic mapping when you have the Controller/Action/ID and the ID is passed in as a variable, if it doesn't convert to the type that... |
I want to create a unique id but uniqid() is giving something like '492607b0ee414'. What i would like is something similar to what tinyurl gives: '64k8ra'. The shorter, the better. The only requirements are that it should not have an obvious order and that it should look prettier than a seemingly random sequence of num... | To create a unique, short, and aesthetically pleasing ID similar to those generated by services like TinyURL, you can implement a simple encoding mechanism. Here's a method using base encoding to achieve your desired result:
1. **Base Encoding**: Use a custom base (e.g., base 26 or base 36) to encode your IDs. This wi... | 48,084 | [
{
"from": "human",
"value": "I want to create a unique id but uniqid() is giving something like '492607b0ee414'. What i would like is something similar to what tinyurl gives: '64k8ra'. The shorter, the better. The only requirements are that it should not have an obvious order and that it should look prettie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.