instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
func()
{
Object* pNext;
func1(pNext);
}
func1(Object* pNext)
{
pNext = Segement->GetFirstPara(0);
}
I was expecting it to be pointer to firstpara returned from func1() but I'm seeing NULL can some explain and how to fix it to actually return the firstpara() pointer?
| The behavior you're experiencing stems from how pointers are passed and modified in C/C++. In your current implementation, you are passing `pNext` to `func1`, but the modification you make to `pNext` inside `func1` does not affect the original pointer in `func()` because you are passing it by value.
When you call `fu... | 28,354 | [
{
"from": "human",
"value": "func()\n{\n Object* pNext;\n func1(pNext);\n}\n\nfunc1(Object* pNext)\n{\n pNext = Segement->GetFirstPara(0);\n}\n\nI was expecting it to be pointer to firstpara returned from func1() but I'm seeing NULL can some explain and how to fix it to actually return the firstpar... |
Yesterday I tried to get started with Java RMI. I found this sun tutorial (http://java.sun.com/docs/books/tutorial/rmi/index.html) and started with the server implemantation. But everytime I start the pogram (the rmiregistry is running) I get an AccessControlException with the following StackTrace:
LoginImpl exception:... | It looks like you are encountering a `java.security.AccessControlException` in your Java RMI application, which is likely related to the way permissions are set up for your application. Let's walk through a few steps to resolve this issue:
### 1. Check the Policy File Path
Ensure that the `-Djava.security.policy=serv... | 22,093 | [
{
"from": "human",
"value": "Yesterday I tried to get started with Java RMI. I found this sun tutorial (http://java.sun.com/docs/books/tutorial/rmi/index.html) and started with the server implemantation. But everytime I start the pogram (the rmiregistry is running) I get an AccessControlException with the f... |
I have a WPF control, that has a list of "Investors", and in the right column of the list, a "Delete" button.
I could either waste some time making an image of an "x" in photoshop. Or, I could just use Wingdings font and set the content to "Õ" (which makes a cool looking delete button).
Is this appropriate? My thinking... | Using Wingdings or any other non-standard font as a way to represent icons, such as a delete button in a WPF application, can be tempting due to the ease of implementation. However, there are several considerations and potential drawbacks to this approach:
### 1. Font Availability
While Wingdings is included with many... | 27,077 | [
{
"from": "human",
"value": "I have a WPF control, that has a list of \"Investors\", and in the right column of the list, a \"Delete\" button.\nI could either waste some time making an image of an \"x\" in photoshop. Or, I could just use Wingdings font and set the content to \"Õ\" (which makes a cool lookin... |
I noticed some code of a colleague today that initialized class variables in the initialization. However it was causing a warning, he says because of the order they are in. My question is why is it better to do variable initialization where it currently is and not within the curly brackets?
DiagramScene::DiagramScene... | The initialization list in C++ constructors is a very important aspect of the language, particularly in how it affects the order of initialization for member variables and base classes.
In your colleague's code, you see that several member variables are initialized using an initialization list (the part after the colo... | 26,923 | [
{
"from": "human",
"value": "I noticed some code of a colleague today that initialized class variables in the initialization. However it was causing a warning, he says because of the order they are in. My question is why is it better to do variable initialization where it currently is and not within the c... |
Quick info: I'm using latest release of .NET 2.0, and the following is a stripped down test page I wrote to reproduce the error.
Excluding header bits, (there is no included/inline css or javascript) My content page looks like this:
<asp:Content ID="Content1" ContentPlaceHolderID="cphMain" runat="server">
<div>
<as... | Yes, the issue you're experiencing relates to the fact that the ID "end" is a reserved word in JavaScript. The JavaScript engine recognizes "end" as a property of the built-in `window` object. When you have a div with the ID "end", it creates a potential conflict because JavaScript may interpret calls to `end` in ways ... | 28,866 | [
{
"from": "human",
"value": "Quick info: I'm using latest release of .NET 2.0, and the following is a stripped down test page I wrote to reproduce the error.\nExcluding header bits, (there is no included/inline css or javascript) My content page looks like this:\n<asp:Content ID=\"Content1\" ContentPlaceHol... |
I'm using LINQ to SQL in a data access object library. The library is used in both web (web application/web service) and non-web (windows service) contexts. Initially, I stored the DataContext on the current HttpContext since it permitted me to manage a fairly small unit of work (one web request) and avoided global obj... | Managing the lifetime of a `DataContext` in a mixed environment like a web application and a Windows service can indeed be tricky. Here are several common approaches, along with their pros and cons, as well as an additional suggestion:
### 1. **Per-Request DataContext (Web Context)**
- **Description:** Create a new... | 23,492 | [
{
"from": "human",
"value": "I'm using LINQ to SQL in a data access object library. The library is used in both web (web application/web service) and non-web (windows service) contexts. Initially, I stored the DataContext on the current HttpContext since it permitted me to manage a fairly small unit of work... |
I need to build a prototype for an intranet website, and I want to focus on usability (layout, navigability, etc) and leave the theme for later (I have very bad taste, so this will probably be done by someone else)
I know about ASP.NET's capability of switching themes instantly, but how do I have to design the WebForms... | When designing your ASP.NET WebForms application for an intranet website with a focus on usability, and with the understanding that the theme will be implemented later, you should adopt a strategy that allows for easy theme integration without compromising on your current usability focus. Here are some guidelines to he... | 26,123 | [
{
"from": "human",
"value": "I need to build a prototype for an intranet website, and I want to focus on usability (layout, navigability, etc) and leave the theme for later (I have very bad taste, so this will probably be done by someone else)\nI know about ASP.NET's capability of switching themes instantly... |
I am having trouble getting Team Build to execute my MbUnit unit tests. I have tried to edit TFSBuild.proj and added the following parts:
<Project ...>
<UsingTask TaskName="MbUnit.MSBuild.Tasks.MbUnit" AssemblyFile="path_to_MbUnit.MSBuild.Tasks.dll" />
...
...
<ItemGroup>
<TestAssemblies Include="$(OutDir)\... | It looks like you're trying to integrate MbUnit tests into your Team Build process, but there are a few areas that could be causing issues. Here’s a checklist of steps and troubleshooting tips to help you successfully execute your MbUnit unit tests in TFS Build.
### Step-by-Step Troubleshooting
1. **Verify MbUnit Ins... | 21,406 | [
{
"from": "human",
"value": "I am having trouble getting Team Build to execute my MbUnit unit tests. I have tried to edit TFSBuild.proj and added the following parts:\n<Project ...>\n <UsingTask TaskName=\"MbUnit.MSBuild.Tasks.MbUnit\" AssemblyFile=\"path_to_MbUnit.MSBuild.Tasks.dll\" />\n ...\n ...\n <... |
The Windows Indexing Service pauses itself when it detects the "user is active." Is there a registry entry or something to make it continue indexing regardless of user activity?
Clarification: in Windows XP
| In Windows XP, the Indexing Service is designed to pause indexing when user activity is detected to improve system responsiveness. However, there isn't a straightforward registry entry to completely disable this behavior. That said, you can modify some settings related to the Indexing Service to potentially minimize th... | 29,355 | [
{
"from": "human",
"value": "The Windows Indexing Service pauses itself when it detects the \"user is active.\" Is there a registry entry or something to make it continue indexing regardless of user activity?\nClarification: in Windows XP\n"
},
{
"from": "gpt",
"value": "In Windows XP, the Inde... |
So if I have a method of parsing a text file and returning a list of a list of key value pairs, and want to create objects from the kvps returned (each list of kvps represents a different object), what would be the best method?
The first method that pops into mind is pretty simple, just keep a list of keywords:
private... | Given your requirements for parsing configuration files and creating objects based on key-value pairs (KVPs), it seems that you're looking for a flexible and maintainable way to map those KVPs to your game objects. Here are a few approaches that could work well for your scenario:
### 1. **Using a Factory Method**
You ... | 15,374 | [
{
"from": "human",
"value": "So if I have a method of parsing a text file and returning a list of a list of key value pairs, and want to create objects from the kvps returned (each list of kvps represents a different object), what would be the best method?\nThe first method that pops into mind is pretty sim... |
I'm trying to create a fast 2D point inside polygon algorithm, for use in hit-testing (e.g. Polygon.contains(p:Point)). Suggestions for effective techniques would be appreciated.
| Creating an efficient point-in-polygon algorithm is crucial for fast hit-testing in applications such as graphics rendering, game development, and spatial querying. Below are some effective techniques and algorithms that can help you achieve a fast 2D point-in-polygon test.
### 1. Ray Casting Algorithm
The Ray Casting... | 22,164 | [
{
"from": "human",
"value": "I'm trying to create a fast 2D point inside polygon algorithm, for use in hit-testing (e.g. Polygon.contains(p:Point)). Suggestions for effective techniques would be appreciated.\n"
},
{
"from": "gpt",
"value": "Creating an efficient point-in-polygon algorithm is cru... |
I'm looking for a way to get the name of the main HTML form so I can submit it from JavaScript.
The reason I can just set the name of the form is because the JavaScript is on a User Control that could get added to many different sites with different form names.
Thanks.
| To get the name of the main HTML form in which your JavaScript User Control resides, you can use the `document` object to reference the form elements available in the DOM. Here's a method that you can use to achieve this in JavaScript:
### Method to Get the Main Form Name
1. **Use the `document.forms` collection**: Y... | 26,943 | [
{
"from": "human",
"value": "I'm looking for a way to get the name of the main HTML form so I can submit it from JavaScript.\nThe reason I can just set the name of the form is because the JavaScript is on a User Control that could get added to many different sites with different form names.\nThanks.\n"
},... |
Problem
I have timestamped data, which I need to search based on the timestamp in order to get the one existing timestamp which matches my input timestamp the closest.
Preferably this should be solved with the STL. boost::* or stl::tr1::* (from VS9 with Featurepack) are also possible.
Example of timestamped data:
struc... | Your approach using `std::vector`, `std::sort()`, and `std::equal_range()` is a valid and efficient method for finding the closest timestamp in your dataset. You are correct in thinking that a linear search would be inefficient for larger datasets, which is why leveraging binary search through a sorted vector makes sen... | 24,894 | [
{
"from": "human",
"value": "Problem\nI have timestamped data, which I need to search based on the timestamp in order to get the one existing timestamp which matches my input timestamp the closest.\nPreferably this should be solved with the STL. boost::* or stl::tr1::* (from VS9 with Featurepack) are also p... |
My basic question is, in .NET, how do I clone WebControls?
I would like to build a custom tag, which can produce multiple copies of its children.
Ultimately I intend to build a tag similar to in JSP/Struts.
But the first hurdle I have is the ability to duplicate/clone the contents of a control.
Consider this rather co... | In ASP.NET WebForms, there isn't built-in support for cloning controls, as the `WebControl` class does not implement the `ICloneable` interface. However, you can achieve similar functionality by programmatically recreating the controls you wish to duplicate.
Here's a way to implement your custom control that duplicate... | 25,523 | [
{
"from": "human",
"value": "My basic question is, in .NET, how do I clone WebControls?\nI would like to build a custom tag, which can produce multiple copies of its children.\nUltimately I intend to build a tag similar to in JSP/Struts.\nBut the first hurdle I have is the ability to duplicate/clone the co... |
The goal:
To create a .NET dll i can reference from inside SQL Server where i can pass in an address & get back a geocode string that i can stick into a geography data type as a POINT using STPointFromText() in t-SQL.
I'm using Virtual Earth, I signed up for a developer account which gave me access to virtual earth st... | The issue you are encountering is due to the limitations of the project type you are working with in Visual Studio 2008. When you create a SQL Server project (like a SQL CLR User Defined Function project), it does not support adding a "Service Reference" in the same way that other project types, like ASP.NET or Console... | 24,209 | [
{
"from": "human",
"value": "The goal: \nTo create a .NET dll i can reference from inside SQL Server where i can pass in an address & get back a geocode string that i can stick into a geography data type as a POINT using STPointFromText() in t-SQL.\nI'm using Virtual Earth, I signed up for a developer accou... |
I have an application that behaves oddly, and just to verify, I'd like to see which security zone it is currently running under.
I've found the System.Security.SecurityZone enum, but can't seem to find anything that will return which of these I'm running under.
Does anyone have any tips?
Basically I want to find out if... | Your approach to check the security zone of your application is on the right track, but there are a few nuances to consider when dealing with security zones in .NET, especially with the changes made in recent versions of .NET.
To find out the security zone, you are accessing the `Evidence` of the assembly, which is a ... | 26,174 | [
{
"from": "human",
"value": "I have an application that behaves oddly, and just to verify, I'd like to see which security zone it is currently running under.\nI've found the System.Security.SecurityZone enum, but can't seem to find anything that will return which of these I'm running under.\nDoes anyone hav... |
I once did a cursory search and found no good CVS bindings for Python. I wanted to be able to write helper scripts to do some fine-grained manipulation of the repository and projects in it. I had to resort to using popen and checking stdout and stderr and then parsing those. It was messy and error-prone.
Are there a... | As of my last knowledge update in October 2023, there are indeed some modules available for integrating CVS and Subversion with Python, though their popularity and maintenance can vary.
### CVS Integration
For CVS, you might not find widely-used libraries due to the declining popularity of CVS in favor of more modern... | 26,860 | [
{
"from": "human",
"value": "I once did a cursory search and found no good CVS bindings for Python. I wanted to be able to write helper scripts to do some fine-grained manipulation of the repository and projects in it. I had to resort to using popen and checking stdout and stderr and then parsing those. ... |
I've just finished a flash project where I did the entire project in "pure" AS3, without the use of the Flex framework. I found very little written about this on the web, so I'm not sure if this is a common way to develop RIA's, or if I've jumped off the shoulders of giants and done something stupid that will bite me ... | Hi Marcus,
Congratulations on finishing your project! Developing in pure ActionScript 3 (AS3) without using the Flex framework is certainly a valid approach, and many developers have chosen to do so, especially in the early days of Flash and AS3.
Here are some considerations regarding your choice:
1. **Control and F... | 26,699 | [
{
"from": "human",
"value": "I've just finished a flash project where I did the entire project in \"pure\" AS3, without the use of the Flex framework. I found very little written about this on the web, so I'm not sure if this is a common way to develop RIA's, or if I've jumped off the shoulders of giants a... |
I asked this question before, Here however I think I presented the problem poorly, and got quite a few replies that may have been useful to someone but did not address the actual question and so I pose the question again.
Is there a single-line native method in php that would allow me to do the following.
Please, pleas... | In PHP, there isn't a built-in one-liner that allows you to access an array value directly from a function call without creating a temporary variable. However, you can achieve similar functionality using a combination of built-in functions within a single expression.
While PHP does not allow you to directly index into... | 30,832 | [
{
"from": "human",
"value": "I asked this question before, Here however I think I presented the problem poorly, and got quite a few replies that may have been useful to someone but did not address the actual question and so I pose the question again.\nIs there a single-line native method in php that would a... |
WCFTestClient tool doesn't seem to work if the size of maxNameTableCharCount is greater than default value (16384).
Is there any way to modify the settings of the config file generated by this tool, BEFORE the tool generates it?
I can modify the config file contents after the service connection is established. But I a... | The WCFTestClient tool generates a configuration file automatically when you connect to a WCF service. However, as you've noticed, there are limitations on certain parameters, like `maxNameTableCharCount`, that can affect its ability to retrieve service metadata.
Unfortunately, the WCFTestClient tool does not provide ... | 26,325 | [
{
"from": "human",
"value": "WCFTestClient tool doesn't seem to work if the size of maxNameTableCharCount is greater than default value (16384).\nIs there any way to modify the settings of the config file generated by this tool, BEFORE the tool generates it?\nI can modify the config file contents after the ... |
I love writing my own web-based applications, but don't want to succumb to the not invented here syndrome. So before I go write this myself, I'm looking for solutions that either do this, or perhaps frameworks (like Django or Joomla, etc.) that give me a starting point fairly close to what I need.
My company produces... | You're right to consider existing solutions and frameworks before embarking on a new project to avoid the "not invented here" syndrome. Given your requirements for an icon database that allows searching, version tracking, and extensibility, here are some options and frameworks you might consider:
### 1. **Content Mana... | 14,299 | [
{
"from": "human",
"value": "I love writing my own web-based applications, but don't want to succumb to the not invented here syndrome. So before I go write this myself, I'm looking for solutions that either do this, or perhaps frameworks (like Django or Joomla, etc.) that give me a starting point fairly c... |
I can't for the life of me find a form that doesn't email the results that you submit.
I'm looking to find a form that I can have users enter simple data that i can then spit back out at them in different arrangements. If they submit First and Last, I'll spit out, amongst other things, FirstLast@domain.com. I'm willing... | If you're looking to create a simple web form that allows users to submit their data and then return that data in a different format without sending email notifications, you can achieve this using PHP. Below, I'll provide you with a straightforward example of how you can create such a form and process the data.
### St... | 24,641 | [
{
"from": "human",
"value": "I can't for the life of me find a form that doesn't email the results that you submit.\nI'm looking to find a form that I can have users enter simple data that i can then spit back out at them in different arrangements. If they submit First and Last, I'll spit out, amongst other... |
When I am using a form containing <input id="myFile" type="file" runat="server" /> to upload a file, my server-side code only sees the filename without the full path when using Firefox, while it works just fine in IE.
Is it possible to retrieve the full file path server-side in this case?
| When dealing with file uploads in web applications, it's important to understand that modern browsers, for security and privacy reasons, do not send the full file path of the uploaded file to the server. This behavior is consistent across all browsers, including Firefox, Chrome, and others.
### Explanation:
1. **Secu... | 28,541 | [
{
"from": "human",
"value": "When I am using a form containing <input id=\"myFile\" type=\"file\" runat=\"server\" /> to upload a file, my server-side code only sees the filename without the full path when using Firefox, while it works just fine in IE.\nIs it possible to retrieve the full file path server-s... |
Evaluate:
((((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4) 5)
This is what I did:
evaluate ((((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4) 5)
evaluate 5 -> 5
evaluate (((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4)
evaluate 4 -> 4
evaluate ((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3)
... | Let's evaluate the expression step by step. The expression is:
```
((((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4) 5)
```
### Step 1: Evaluate the outermost expression
We start by applying the first lambda expression to 3:
```
(lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3
```
Substituting `x` with `3` gi... | 29,547 | [
{
"from": "human",
"value": "Evaluate:\n((((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4) 5)\n\nThis is what I did:\n\nevaluate ((((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4) 5)\n\nevaluate 5 -> 5\n\nevaluate (((lambda (x) (lambda (y) (lambda (x) (+ x y)))) 3) 4)\n\nevaluate 4 -> 4\n\nevaluat... |
The only thing I can get python omnicomplete to work with are system modules. I get nothing for help with modules in my site-packages or modules that I'm currently working on.
| If Python's autocomplete functionality (like the one provided by IDEs or text editors) is not working for your site-packages or your own modules, there are several things you can check or do to potentially resolve this issue:
1. **Check Your PYTHONPATH**: Ensure that your custom modules or packages are in the `PYTHONP... | 27,055 | [
{
"from": "human",
"value": "The only thing I can get python omnicomplete to work with are system modules. I get nothing for help with modules in my site-packages or modules that I'm currently working on.\n"
},
{
"from": "gpt",
"value": "If Python's autocomplete functionality (like the one provi... |
I'm struggling to separate the dependencies in the following code:
public static SiteConnector ConnectToSite(String Logon, String Password)
{
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(_URI);
ConfigureRequest(Logon, Password, webRequest);
HttpWebResponse webResponse =... | To unit test the `ConnectToSite` method without relying on the external website, you can separate the dependencies, particularly the HTTP request and response handling, using dependency injection and interfaces. This allows you to mock those dependencies during testing.
Here's a step-by-step approach to refactor your ... | 25,648 | [
{
"from": "human",
"value": "I'm struggling to separate the dependencies in the following code:\n public static SiteConnector ConnectToSite(String Logon, String Password)\n {\n\n HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(_URI);\n ConfigureRequest(Logon, Password, webR... |
I have a set of applications that all rely on a cross-platform library (in-house development), and everything is stored in subversion. Now, this library is part of every app and as such a copy of it has to be in each app's working directory.
In order to be able to go back to any version of an app and have the correct ... | Your situation presents a common challenge in software development, especially when managing dependencies across multiple projects. Here are some strategies that may help you achieve a more fool-proof solution for managing your cross-platform library with Subversion externals:
### 1. Use Semantic Versioning
Implement ... | 28,028 | [
{
"from": "human",
"value": "I have a set of applications that all rely on a cross-platform library (in-house development), and everything is stored in subversion. Now, this library is part of every app and as such a copy of it has to be in each app's working directory. \nIn order to be able to go back to a... |
For the computer game I'm making, I obviously want to play sound. So far, I've been using AudioClip to play WAV files. While this approach works fine, the WAV files tend to be gigantic. A few seconds of sound end up being hundreds of kB. I'm faced with having a game download that's 95% audio!
The obvious option here wo... | When it comes to handling audio in Java for a game, you're right to look beyond WAV files due to their large size. Here are several strategies you can use to reduce the audio footprint of your game and play sound efficiently:
### 1. **Using Compressed Audio Formats**
- **Ogg Vorbis**: This is a good choice for game au... | 25,285 | [
{
"from": "human",
"value": "For the computer game I'm making, I obviously want to play sound. So far, I've been using AudioClip to play WAV files. While this approach works fine, the WAV files tend to be gigantic. A few seconds of sound end up being hundreds of kB. I'm faced with having a game download tha... |
I have apache web server installed as frontend and I have j2ee SAP Netweaver Application Server installed in Intranet server. How can I configure apache to forward requests and response to/from j2ee app server.
for example, external apache server's ip is 9.20.1.1:80.
internal sap server's address is 192.168.0.1/sap/bc... | To configure Apache to forward requests to your J2EE SAP NetWeaver Application Server, you can use the Apache `mod_proxy` module. This allows Apache to act as a reverse proxy, forwarding requests it receives to your internal server.
Here's how you can configure it:
### Step 1: Enable Required Apache Modules
First, e... | 22,294 | [
{
"from": "human",
"value": "I have apache web server installed as frontend and I have j2ee SAP Netweaver Application Server installed in Intranet server. How can I configure apache to forward requests and response to/from j2ee app server.\nfor example, external apache server's ip is 9.20.1.1:80. \ninternal... |
I need a way to determine the type of an HTML element in JavaScript. It has the ID, but the element itself could be a <div>, a <form> field, a <fieldset>, etc. How can I achieve this?
| In JavaScript, you can easily determine the type of an HTML element by using the `getElementById` method to retrieve the element and then accessing its `tagName` property. The `tagName` property returns the tag name of the element in uppercase. Here’s how you can do it:
```javascript
// Function to determine the type ... | 29,931 | [
{
"from": "human",
"value": "I need a way to determine the type of an HTML element in JavaScript. It has the ID, but the element itself could be a <div>, a <form> field, a <fieldset>, etc. How can I achieve this?\n"
},
{
"from": "gpt",
"value": "In JavaScript, you can easily determine the type o... |
I'm trying to determine which records to delete from a database when a user submits a form.
The page has two CheckBoxList one representing the records before modification and one after.
I can easily get the selected values that need to be deleted like this...
//get the items not selected that were selected before
var o... | In your case, you're trying to delete a collection of items from a database using LINQ, and you want to leverage the capabilities of LINQ to avoid using a `foreach` loop. However, the `DeleteAllOnSubmit` method isn't directly available for a query result derived from a join in LINQ.
You can achieve your goal by conver... | 26,648 | [
{
"from": "human",
"value": "I'm trying to determine which records to delete from a database when a user submits a form.\nThe page has two CheckBoxList one representing the records before modification and one after.\nI can easily get the selected values that need to be deleted like this...\n//get the items ... |
I'm working on a new solution configuration for our large VC++ project using VS 2008. I'd like this configuration to use the multicore build flag /MP.
However, the "#import" feature of generating COM wrapper classes is sprinkled through-out the code base and this feature is not supported when using /MP.
I understand w... | It sounds like you're tackling a common issue when transitioning to multicore builds with the `/MP` flag in Visual Studio 2008 due to the limitations imposed by the `#import` directive. Your proposed solutions are solid, and it appears you've thought them through quite well. Here are a few additional suggestions, along... | 23,975 | [
{
"from": "human",
"value": "I'm working on a new solution configuration for our large VC++ project using VS 2008. I'd like this configuration to use the multicore build flag /MP. \nHowever, the \"#import\" feature of generating COM wrapper classes is sprinkled through-out the code base and this feature is ... |
In my c# app, I've got a list that I navigate with an Enumerator. It works great for moving forward through the list, but the Enumerator class doesn't have a MoveBack method.
Is there different class that has a MoveBack method, or do I need to write my own?
| In C#, the `IEnumerator` interface, which is typically used with the `foreach` statement and provides an enumerator for a collection, indeed does not support backward traversal directly. Unfortunately, there isn't a built-in class that allows you to move backwards like you would with a `MoveBack` method.
If you need t... | 23,266 | [
{
"from": "human",
"value": "In my c# app, I've got a list that I navigate with an Enumerator. It works great for moving forward through the list, but the Enumerator class doesn't have a MoveBack method. \nIs there different class that has a MoveBack method, or do I need to write my own?\n"
},
{
"fr... |
As usual, some background information first:
Database A (Access database) - Holds a table that has information I need from only two columns. The information from these two columns is needed for an application that will be used by people that cannot access database A.
Database B (Access database) - Holds a table that co... | Your approach to transferring data between two Access databases is quite comprehensive, but it seems you are running into issues with detecting changes during the merge operation. The `DataSet.Merge` method is indeed designed to merge data, but it doesn’t automatically mark the rows as changed if you are not modifying ... | 23,478 | [
{
"from": "human",
"value": "As usual, some background information first:\nDatabase A (Access database) - Holds a table that has information I need from only two columns. The information from these two columns is needed for an application that will be used by people that cannot access database A.\nDatabase ... |
I'm currently on chapter 4 of Real World Haskell, and I'm trying to wrap my head around implementing foldl in terms of foldr.
(Here's their code:)
myFoldl :: (a -> b -> a) -> a -> [b] -> a
myFoldl f z xs = foldr step id xs z
where step x g a = g (f a x)
I thought I'd try to implement zip using the same technique,... | Yes, it is indeed possible to implement `zip` using `foldr`. The key is to understand how to use `foldr` to accumulate pairs from the two lists you're zipping together.
The `zip` function takes two lists and combines them into a list of pairs. The standard definition of `zip` looks like this:
```haskell
zip :: [a] ->... | 24,449 | [
{
"from": "human",
"value": "I'm currently on chapter 4 of Real World Haskell, and I'm trying to wrap my head around implementing foldl in terms of foldr.\n(Here's their code:)\nmyFoldl :: (a -> b -> a) -> a -> [b] -> a\n\nmyFoldl f z xs = foldr step id xs z\n where step x g a = g (f a x)\n\nI thought I'... |
What's the difference between toolkits and frameworks? Do you know a good comparison?
| Yes, toolkits and frameworks are both terms commonly used in software development, but they refer to different concepts and serve different purposes. Here's a comparison to help clarify the differences:
### Definition:
- **Toolkit:**
A toolkit is a collection of tools or libraries that provides developers with the c... | 26,098 | [
{
"from": "human",
"value": "What's the difference between toolkits and frameworks? Do you know a good comparison?\n"
},
{
"from": "gpt",
"value": "Yes, toolkits and frameworks are both terms commonly used in software development, but they refer to different concepts and serve different purposes... |
Hoping some of you TinyXML++ people can help me out. Really, since you recomended to me before I think you owe me ;)
I have the following code:
//ticpp::Iterator< ticpp::Element > child( "SetPiece" );
ticpp::Iterator< ticpp::Node > child("SetPiece");
GLuint lc_SPieces = 0;
for(child = child.begin( this )... | It looks like you're facing an issue when trying to use `ticpp::Iterator< ticpp::Element >` in TinyXML++. Based on the error message and the fact that it works with `ticpp::Iterator< ticpp::Node >`, it's likely that the specific issue is related to how `ticpp::Element` is being used or instantiated.
Here are some pote... | 26,718 | [
{
"from": "human",
"value": "Hoping some of you TinyXML++ people can help me out. Really, since you recomended to me before I think you owe me ;)\nI have the following code:\n //ticpp::Iterator< ticpp::Element > child( \"SetPiece\" );\n ticpp::Iterator< ticpp::Node > child(\"SetPiece\");\n GLuint lc... |
Is it possible to programmatically force a full garbage collection run in ActionScript 3.0?
Let's say I've created a bunch of Display objects with eventListeners and some of the DO's have been removed, some of the eventListeners have been triggered and removed etc... Is there a way to force garbage collection to run an... | In ActionScript 3.0, you don't have direct control over the garbage collection process. The garbage collector in Flash Player and Adobe AIR is designed to run automatically and manage memory efficiently based on the application's needs. However, there are some practices you can follow to help ensure that objects become... | 23,801 | [
{
"from": "human",
"value": "Is it possible to programmatically force a full garbage collection run in ActionScript 3.0?\nLet's say I've created a bunch of Display objects with eventListeners and some of the DO's have been removed, some of the eventListeners have been triggered and removed etc... Is there a... |
Does Geronimo provides a standalone transaction manager?
And if it does, is it possible to use it in Tomcat?
| Apache Geronimo does include a transaction manager as part of its Java EE server functionality. Specifically, it provides a fully compliant implementation of the Java Transaction API (JTA) and can manage transactions across various resources like databases and messaging systems.
### Using Geronimo's Transaction Manage... | 27,132 | [
{
"from": "human",
"value": "Does Geronimo provides a standalone transaction manager?\nAnd if it does, is it possible to use it in Tomcat?\n"
},
{
"from": "gpt",
"value": "Apache Geronimo does include a transaction manager as part of its Java EE server functionality. Specifically, it provides a ... |
I have a dictionary that I normally access with a key, so I need fast random access reads. However for one function I need to process every item in the dictionary where the order is important. It seems to be working OK in tests. Is it OK to depend on the order of items in a dictionary?
| Yes, as of Python 3.7, dictionaries maintain the insertion order of items. This means that when you iterate over a dictionary, you will get the items in the order they were added. This behavior became an official part of the language specification in Python 3.8.
However, if you are using an earlier version of Python (... | 30,868 | [
{
"from": "human",
"value": "I have a dictionary that I normally access with a key, so I need fast random access reads. However for one function I need to process every item in the dictionary where the order is important. It seems to be working OK in tests. Is it OK to depend on the order of items in a dict... |
We are all talking about the efficiency of the algorithms and it depends on input size -basically.
How about the system specifications of current computer that runs the algorithm? does it make any difference to run a different sorting algorithm in a Core 2 Duo 2.6 GHZ, 4 GB RAM-computer or in a P-2, 256 MB RAM-computer... | The performance of algorithms indeed depends not only on the algorithm itself and its efficiency (time and space complexity) but also significantly on the underlying hardware and system specifications of the computer running the algorithm. Here's how system specifications impact the performance of algorithms, particula... | 21,725 | [
{
"from": "human",
"value": "We are all talking about the efficiency of the algorithms and it depends on input size -basically.\nHow about the system specifications of current computer that runs the algorithm? does it make any difference to run a different sorting algorithm in a Core 2 Duo 2.6 GHZ, 4 GB RAM... |
$doba = explode("/", $dob);
$date = date("Y-m-d", mktime(0,0,0, $doba[0], $doba[1], $doba[2]));
The above code turns any date i pass through into 1999-11-30 and i know it was working yesterday. Date is correct when I echo $doba. Anyone have any ideas?
Cheers
| The issue you are experiencing in your code is likely due to the order of the date components you are passing into the `mktime` function. The `mktime` function's parameters are as follows: `mktime(hour, minute, second, month, day, year)`.
Given that you are using `explode("/", $dob);`, it looks like your `$dob` string... | 27,704 | [
{
"from": "human",
"value": "$doba = explode(\"/\", $dob);\n\n$date = date(\"Y-m-d\", mktime(0,0,0, $doba[0], $doba[1], $doba[2]));\n\nThe above code turns any date i pass through into 1999-11-30 and i know it was working yesterday. Date is correct when I echo $doba. Anyone have any ideas?\nCheers\n"
},
... |
Which is the best way to go forward while building a localized aspx web application, .resx files of satellite assemblies? Is there any performance comparisons available any where on web?
| When building a localized ASP.NET web application, you have two main options for managing localization: using `.resx` files or satellite assemblies. Each approach has its own advantages and considerations. Here’s an overview of both methods:
### 1. Using `.resx` Files
- **Description**: Resource files (`.resx`) contai... | 26,304 | [
{
"from": "human",
"value": "Which is the best way to go forward while building a localized aspx web application, .resx files of satellite assemblies? Is there any performance comparisons available any where on web?\n"
},
{
"from": "gpt",
"value": "When building a localized ASP.NET web applicati... |
Recently I was working with generating a PDF from Crystal Reports through a webform. It was failing, which I determined to be caused by the permissions settings on the c:\windows\temp dir. I gave the Network Service account full access to this folder, which promptly fixed the issue. But is there a reason the Netwo... | The issue you're encountering with the permissions on the `C:\Windows\Temp` directory and the Network Service account is related to security principles in Windows Server operating systems, including Windows Server 2003.
By default, the `C:\Windows\Temp` folder may have limited permissions to enhance security. Here are... | 29,801 | [
{
"from": "human",
"value": "Recently I was working with generating a PDF from Crystal Reports through a webform. It was failing, which I determined to be caused by the permissions settings on the c:\\windows\\temp dir. I gave the Network Service account full access to this folder, which promptly fixed t... |
I have written a few MSBuild custom tasks that work well and are use in our CruiseControl.NET build process.
I am modifying one, and wish to unit test it by calling the Task's Execute() method.
However, if it encounters a line containing
Log.LogMessage("some message here");
it throws an InvalidOperationException:
Ta... | To unit test your MSBuild custom task and avoid the `InvalidOperationException` related to logging, you need to properly initialize your task's logging mechanism before calling the `Execute()` method. Here's how you can set up your unit test to ensure that the task is properly initialized:
1. **Create a Mock Build Eng... | 27,817 | [
{
"from": "human",
"value": "I have written a few MSBuild custom tasks that work well and are use in our CruiseControl.NET build process.\nI am modifying one, and wish to unit test it by calling the Task's Execute() method. \nHowever, if it encounters a line containing \nLog.LogMessage(\"some message here\"... |
I tried to override the settings in the default stlyesheet that comes with the simplemodal jquery plugin with containerCSS which is working fine in IE7 but not Firefox or Chrome. Not sure if this is a bug or I am doing something wrong.
jQuery code:
$(document).ready(function() {
$("#ButtonPopup").click(function() {... | It looks like you are trying to customize the modal dialog's CSS settings using the SimpleModal jQuery plugin. The issue you are encountering in Firefox and Chrome might be related to how you are specifying the CSS properties for the modal's container.
### Potential Issues:
1. **CSS Values**: The values you are passin... | 24,298 | [
{
"from": "human",
"value": "I tried to override the settings in the default stlyesheet that comes with the simplemodal jquery plugin with containerCSS which is working fine in IE7 but not Firefox or Chrome. Not sure if this is a bug or I am doing something wrong.\njQuery code:\n$(document).ready(function()... |
While building a small experimental HTTP server, I need to implement the persistent connection feature of HTTP 1.1 (and the pipelining feature).
How do I test it?
Using a browser like Firefox gives me little or no control, and it's hard to check.
Any ideas?
Thanks
| Testing an experimental HTTP server with features like persistent connections (HTTP/1.1) and pipelining can indeed be challenging with a typical web browser. However, there are several tools and approaches you can use to thoroughly test these features:
### 1. **Use cURL**
cURL is a command-line tool that allows you t... | 23,213 | [
{
"from": "human",
"value": "While building a small experimental HTTP server, I need to implement the persistent connection feature of HTTP 1.1 (and the pipelining feature).\nHow do I test it?\nUsing a browser like Firefox gives me little or no control, and it's hard to check.\nAny ideas?\nThanks\n"
},
... |
Is there a way in C# to:
Get all the properties of a class that have attributes on them (versus having to loop through all properties and then check if attribute exists.
If i want all Public, Internal, and Protected properties but NOT private properties, i can't find a way of doing that. I can only do this:
Property... | Yes, you can filter the properties of a class to retrieve only those that have attributes and meet your specified access modifiers. To do this, you can first get all the properties using `GetProperties` with the appropriate `BindingFlags`, and then filter them based on whether they are public, internal, or protected, w... | 28,809 | [
{
"from": "human",
"value": "Is there a way in C# to:\n\nGet all the properties of a class that have attributes on them (versus having to loop through all properties and then check if attribute exists.\nIf i want all Public, Internal, and Protected properties but NOT private properties, i can't find a way o... |
We've had problems with a virus scanner murdering the performance of our app by slowing down writes to an H2 db. So we'd like to be able to detect the presence of any virus scanner and alert the user of the potential problem. It would be part of a problem detection retue that would alert users to known performance fact... | Detecting the presence of antivirus (AV) software directly can be challenging due to varying implementations and the security implications of such checks. However, there are some approaches that you could consider for detecting antivirus software more directly, while keeping in mind that some methods may not be foolpro... | 24,980 | [
{
"from": "human",
"value": "We've had problems with a virus scanner murdering the performance of our app by slowing down writes to an H2 db. So we'd like to be able to detect the presence of any virus scanner and alert the user of the potential problem. It would be part of a problem detection retue that wo... |
I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward.
<asp:ListView runat="server" ID="ArticleList">
<LayoutTemplate>
<div class="ContentContainer">
<div runat="server" ... | When you're working with `ListView` and implementing your own `ITemplate` classes for `LayoutTemplate` and `ItemTemplate`, it's important to understand how to bind data properly to each item in the template. When you implement the `ItemTemplate` using `ITemplate`, you'll need to manually retrieve and bind the data item... | 9,155 | [
{
"from": "human",
"value": "I am writing a Composite control, which contains a listview to display a table of items. Normally when using a ListView in Asp.NET I would define the templates in the code-forward.\n<asp:ListView runat=\"server\" ID=\"ArticleList\">\n <LayoutTemplate>\n <div class=\"Co... |
What are the usual methods to compare two polygons for similarity? Vertices are in 2D.
| Comparing two polygons for similarity in 2D involves several geometric and mathematical techniques. Here are the usual methods:
1. **Vertex Count and Structure**:
- Check if the polygons have the same number of vertices. If they don't, they cannot be similar.
2. **Side Length Ratios**:
- Compute the lengths of ... | 29,072 | [
{
"from": "human",
"value": "What are the usual methods to compare two polygons for similarity? Vertices are in 2D.\n"
},
{
"from": "gpt",
"value": "Comparing two polygons for similarity in 2D involves several geometric and mathematical techniques. Here are the usual methods:\n\n1. **Vertex Coun... |
Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it comes to Ajax. Unfortunately, there are a few problems that I often see with the JavaScript that it generates.
Rails typically uses inline event handling.
<a onclick="somejavascript(); return false;" />
This is generally frowned upon, as it... | When working with Ruby on Rails, achieving a balance between server-side generated JavaScript and custom, manually-written JavaScript can significantly improve the maintainability, readability, and flexibility of your application. Here are some insights on this topic, addressing your primary question and the subquestio... | 23,859 | [
{
"from": "human",
"value": "Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it comes to Ajax. Unfortunately, there are a few problems that I often see with the JavaScript that it generates. \n\nRails typically uses inline event handling.\n<a onclick=\"somejavascript(); return fals... |
I used a class which derives from CListBox, and create it with following:
style:WS_CHILD|WS_VISIBLE |LBS_OWNERDRAWFIXED | WS_VSCROLL | WS_HSCROLL
I expect the ListBox's item to be have a fixed size, not affected by the size of the list box. So I override the MeasureItem() method, in which I specify the item's size lik... | Your approach to overriding the `MeasureItem` method to specify a fixed size for your custom owner-drawn `CListBox` is generally correct. However, there are a few considerations to ensure that the item size remains fixed and does not change when the size of the list box is altered:
1. **Ensure LBS_NOSCROLL**: If you'r... | 27,010 | [
{
"from": "human",
"value": "I used a class which derives from CListBox, and create it with following:\nstyle:WS_CHILD|WS_VISIBLE |LBS_OWNERDRAWFIXED | WS_VSCROLL | WS_HSCROLL\n\nI expect the ListBox's item to be have a fixed size, not affected by the size of the list box. So I override the MeasureItem() me... |
I did this tests and the results seems the count function scale linearly. I have another function relying strongly in the efficiency to know if there are any data, so I would like to know how to replace this select count(*) with another more efficient (maybe constant?) query or data structure.
psql -d testdb -U postgr... | When you use `SELECT COUNT(*)` on a large table, the query scans the entire table to count the number of rows, leading to a linear increase in execution time as the table grows in size. If you frequently need to check if there are any rows in the table (i.e., you want to know whether the table is empty or not), there a... | 23,463 | [
{
"from": "human",
"value": "I did this tests and the results seems the count function scale linearly. I have another function relying strongly in the efficiency to know if there are any data, so I would like to know how to replace this select count(*) with another more efficient (maybe constant?) query or ... |
This seems to be a common problem but I cannot find a solution.
I type in my username and password which are in a login control I have created.
I then press enter once I've typed in my password and the page just refreshes. It triggers the page load event but not the button on click event.
If I press the submit button t... | It sounds like you're experiencing an issue with form submission in your login control. When pressing Enter in a text input field, the form should typically be submitted as if the submit button was clicked. If this is not happening and the page just refreshes without triggering the expected event, here are a few things... | 26,000 | [
{
"from": "human",
"value": "This seems to be a common problem but I cannot find a solution.\nI type in my username and password which are in a login control I have created.\nI then press enter once I've typed in my password and the page just refreshes. It triggers the page load event but not the button on ... |
I'm struggling with Test::Unit. When I think of unit tests, I think of one simple test per file. But in Ruby's framework, I must instead write:
class MyTest < Test::Unit::TestCase
def setup
end
def test_1
end
def test_1
end
end
But setup and teardown run for every invocation of a test_* met... | In Ruby's Test::Unit framework, the setup and teardown methods are designed to run before and after each test method in your test case class. This can indeed be limiting if you want to have a single setup for the entire class instead of for each individual test. However, there is a way to achieve what you want by using... | 27,327 | [
{
"from": "human",
"value": "I'm struggling with Test::Unit. When I think of unit tests, I think of one simple test per file. But in Ruby's framework, I must instead write: \nclass MyTest < Test::Unit::TestCase \n def setup \n end\n\n def test_1 \n end\n\n def test_1 \n end\nend\n\nBut setup ... |
Is it possible to unlisten on a socket after you have called listen(fd, backlog)?
Edit: My mistake for not making myself clear. I'd like to be able to temporarily unlisten on the socket. Calling close() will leave the socket in the M2LS state and prevent me from reopening it (or worse, some nefarious program could bin... | In the context of socket programming, once you have called `listen(fd, backlog)` on a socket, there is no direct mechanism to "temporarily unlisten" on that socket. The listen state indicates that the socket is ready to accept incoming connection requests, and there is no built-in API to pause or disable this state wit... | 28,337 | [
{
"from": "human",
"value": "Is it possible to unlisten on a socket after you have called listen(fd, backlog)? \nEdit: My mistake for not making myself clear. I'd like to be able to temporarily unlisten on the socket. Calling close() will leave the socket in the M2LS state and prevent me from reopening it (... |
I'm trying to unit test a piece of code that needs a currently logged in user in the test. Using the .Net 2.0 Membership Provider, how can I programmatically log in as a user for this test?
| To programmatically log in as a user in your unit tests when using the .NET 2.0 Membership Provider, you can simulate the login process by using the `Membership` class and the `FormsAuthentication` class to set the user as authenticated. Here's how you can do it:
1. **Create a test user (if it doesn't already exist):*... | 24,790 | [
{
"from": "human",
"value": "I'm trying to unit test a piece of code that needs a currently logged in user in the test. Using the .Net 2.0 Membership Provider, how can I programmatically log in as a user for this test?\n"
},
{
"from": "gpt",
"value": "To programmatically log in as a user in your... |
I have a simple website I'm testing. It's running on localhost and I can access it in my web browser. The index page is simply the word "running". urllib.urlopen will successfully read the page but urllib2.urlopen will not. Here's a script which demonstrates the problem (this is the actual script and not a simplifi... | The issue you're encountering with `urllib2.urlopen` while `urllib.urlopen` works fine might be due to the way `urllib2` handles redirects and the specific server or environment setup.
Based on the error message you're seeing (HTTP Error 504: Gateway Timeout), it indicates that `urllib2` is having trouble reaching the... | 25,954 | [
{
"from": "human",
"value": "I have a simple website I'm testing. It's running on localhost and I can access it in my web browser. The index page is simply the word \"running\". urllib.urlopen will successfully read the page but urllib2.urlopen will not. Here's a script which demonstrates the problem (t... |
I'm playing about with lighttpd on a small virtual private server. I two domains pointing to the server. I am using the latest version of lighttpd and mod_evhost on Ubuntu 8.10.
I'm trying to set up a rule such that if anyone requests domain.com or www.domain.com they get served from /webroot/domain.com/www/
Similarl... | It looks like you are on the right track with using `mod_evhost` in Lighttpd to manage virtual hosts based on the requested domains. However, the issue you're facing stems from the regex patterns you're using to match the hostnames, as well as the ordering of your rules.
Here's a revised version of your Lighttpd confi... | 27,889 | [
{
"from": "human",
"value": "I'm playing about with lighttpd on a small virtual private server. I two domains pointing to the server. I am using the latest version of lighttpd and mod_evhost on Ubuntu 8.10.\n\nI'm trying to set up a rule such that if anyone requests domain.com or www.domain.com they get se... |
I intermittently get this in error in my .NET 1.1 C# Windows Forms application. Someone indicated that this is due to a bug in the 1.1 framework and suggests putting the following code into any custom controls.
protected override void OnParentChanged(EventArgs e)
{
if (this.Parent != null)
{
this.CreateParams.... | The issue you're experiencing is related to a known bug in the .NET Framework 1.1, where controls don't properly handle their parent changes, leading to inconsistencies in their rendering and behavior. The code snippet you provided is indeed a common workaround to this problem by ensuring that the control's window hand... | 26,226 | [
{
"from": "human",
"value": "I intermittently get this in error in my .NET 1.1 C# Windows Forms application. Someone indicated that this is due to a bug in the 1.1 framework and suggests putting the following code into any custom controls.\nprotected override void OnParentChanged(EventArgs e)\n{\n if (thi... |
I need to recover form an error case where a file gets left in a locked state. How can I in c# tell this file to reset it's locks? I need to add to this the file is opened by a 3rd party dll and I don't actually have access to the file handle.
| If a file is left in a locked state by a third-party DLL and you don't have access to the file handle, recovering from this state can be quite challenging. The file lock is usually held by the process that opened it, and without the handle, you can't directly manipulate the file lock. However, there are a few approache... | 26,030 | [
{
"from": "human",
"value": "I need to recover form an error case where a file gets left in a locked state. How can I in c# tell this file to reset it's locks? I need to add to this the file is opened by a 3rd party dll and I don't actually have access to the file handle.\n"
},
{
"from": "gpt",
... |
I cant seem to get IE6 and IE7 running alongside each other on my Windows Server 2003 VPC.
I have tried both: http://browsers.evolt.org/?ie/32bit/standalone
and: http://tredosoft.com/Multiple_IE , and yes, I tried putting the Wininet.dll in my standalone path.
The browser works, but cookies does not! Any help would be ... | Running Internet Explorer 6 and 7 side by side on Windows Server 2003 can be tricky, especially with cookie management. Since you've already tried the common standalone solutions without success, here are a few additional approaches you can take:
1. **Use Virtual Machines for Isolation**: While you want to avoid using... | 27,274 | [
{
"from": "human",
"value": "I cant seem to get IE6 and IE7 running alongside each other on my Windows Server 2003 VPC.\nI have tried both: http://browsers.evolt.org/?ie/32bit/standalone\nand: http://tredosoft.com/Multiple_IE , and yes, I tried putting the Wininet.dll in my standalone path.\nThe browser wor... |
I just want to know how to validate (or clean) user input in ASP.NET MVC so that an HttpRequestValidationException will not be thrown regardless of the values submitted. For example, with a text input, if the user inputs <BR/>, it will cause an exception and the Yellow Screen of Death will be shown. I don't want that... | To validate and clean user input in ASP.NET MVC, preventing `HttpRequestValidationException` from being thrown and allowing for a user-friendly experience, you can follow these steps:
### 1. **Use Custom Model Binding**
You can create a custom model binder that will sanitize user input before it is bound to your mode... | 26,249 | [
{
"from": "human",
"value": "I just want to know how to validate (or clean) user input in ASP.NET MVC so that an HttpRequestValidationException will not be thrown regardless of the values submitted. For example, with a text input, if the user inputs <BR/>, it will cause an exception and the Yellow Screen ... |
We’re developing a web-based application that allows administrators to upload plug-ins. All plug-ins are stored in a special folder outside the app root (say, C:\Plugins) and are dynamically loaded via Assembly.LoadFrom(). This works just fine for the most part: WebControls in the plug-ins are instantiated and loaded, ... | It looks like you're dealing with a common challenge when dynamically loading assemblies in a web application, especially regarding the compilation of ASPX files that reference classes defined in those dynamically loaded assemblies. Here are some strategies to address the issue:
### 1. Use the `Assembly` Directive
Yo... | 22,390 | [
{
"from": "human",
"value": "We’re developing a web-based application that allows administrators to upload plug-ins. All plug-ins are stored in a special folder outside the app root (say, C:\\Plugins) and are dynamically loaded via Assembly.LoadFrom(). This works just fine for the most part: WebControls in ... |
I'm looking for Forum software similar to phpBB, but intended to run within a RoR application. I'm looking for a list of sites, along with one recommendation for which one is currently the ideal choice (ease of setup, simplicity, aesthetics).
| If you're looking for forum software that can integrate with Ruby on Rails (RoR), here are some options you can consider:
### 1. Discourse
- **Description**: Discourse is a modern forum software that uses Ruby on Rails. It offers a clean and responsive design, powerful moderation tools, and a rich feature set includin... | 29,426 | [
{
"from": "human",
"value": "I'm looking for Forum software similar to phpBB, but intended to run within a RoR application. I'm looking for a list of sites, along with one recommendation for which one is currently the ideal choice (ease of setup, simplicity, aesthetics).\n"
},
{
"from": "gpt",
... |
Is there a way to resize a std::vector to lower capacity when I no longer need previously reserved space?
| In C++, `std::vector` manages its own dynamic array, which allows it to automatically resize as needed. When you reserve space in a vector using `vector::reserve`, it allocates a larger capacity than currently needed, but this capacity can remain even when you have fewer elements. If you want to reduce the capacity of ... | 27,108 | [
{
"from": "human",
"value": "Is there a way to resize a std::vector to lower capacity when I no longer need previously reserved space?\n"
},
{
"from": "gpt",
"value": "In C++, `std::vector` manages its own dynamic array, which allows it to automatically resize as needed. When you reserve space i... |
What is the standard way for allowing and implementing a plugin system for your application?
In my last application I made a simple interface for all plugins that they must implement. I then load all assemblies in the apps directory and toss out any that don't implement that interface.
One of the methods in the interf... | Implementing a plugin system can greatly enhance the extensibility and maintainability of an application. There are several important considerations and best practices when designing a plugin architecture. Here’s a general overview of key components and considerations for a robust plugin system:
### 1. Define a Clear ... | 24,136 | [
{
"from": "human",
"value": "What is the standard way for allowing and implementing a plugin system for your application?\nIn my last application I made a simple interface for all plugins that they must implement. I then load all assemblies in the apps directory and toss out any that don't implement that i... |
Some time ago, I came across an online article that described how to configure Windows XP to automatically accept the default option on a dialog box. As I (vaguely) recall, it was some sort of oddball registry configuration that did this, and it amazingly worked. Yeah - it's dangerous, but it would be very helpful righ... | To configure Windows XP to automatically accept default options in dialog boxes, you can use a registry edit to suppress interactive dialog boxes. However, please be cautious when editing the registry, as incorrect changes can lead to system instability. Always back up your registry before making any changes.
Here's h... | 28,067 | [
{
"from": "human",
"value": "Some time ago, I came across an online article that described how to configure Windows XP to automatically accept the default option on a dialog box. As I (vaguely) recall, it was some sort of oddball registry configuration that did this, and it amazingly worked. Yeah - it's dan... |
We have inherited an ant build file but now need to deploy to both 32bit and 64bit systems.
The non-Java bits are done with GNUMakefiles where we just call "uname" to get the info. Is there a similar or even easier way to mimic this with ant?
| Yes, you can achieve a similar outcome in Apache Ant by using the built-in `exec` task to run the `uname` command and capture the output. Depending on the output of `uname`, you can set properties to distinguish between 32-bit and 64-bit systems. Here’s a step-by-step guide on how you can set this up in your `build.xml... | 24,979 | [
{
"from": "human",
"value": "We have inherited an ant build file but now need to deploy to both 32bit and 64bit systems.\nThe non-Java bits are done with GNUMakefiles where we just call \"uname\" to get the info. Is there a similar or even easier way to mimic this with ant?\n"
},
{
"from": "gpt",
... |
Now there's something I always wondered: how is sleep() implemented ?
If it is all about using an API from the OS, then how is the API made ?
Does it all boil down to using special machine-code on the CPU ? Does that CPU need a special co-processor or other gizmo without which you can't have sleep() ?
The best known in... | The `sleep()` function, as implemented in operating systems (OS), is indeed an abstraction built upon lower-level system calls and hardware features. Let's break down how `sleep()` works, how the OS implements it, and how timers function in this context.
### How `sleep()` Works
1. **User-Space Call**: When a program ... | 25,139 | [
{
"from": "human",
"value": "Now there's something I always wondered: how is sleep() implemented ?\nIf it is all about using an API from the OS, then how is the API made ?\nDoes it all boil down to using special machine-code on the CPU ? Does that CPU need a special co-processor or other gizmo without which... |
I'm writing an iOS app with a table view inside a tab view. In my UITableViewController, I implemented -tableView:didSelectRowAtIndexPath:, but when I select a row at runtime, the method isn't being called. The table view is being populated though, so I know that other tableView methods in my controller are being call... | If the `tableView:didSelectRowAtIndexPath:` method in your `UITableViewController` is not being called when you select a row, there are several things you should check:
1. **User Interaction**: Make sure that the table view and its cells are interactive. If `userInteractionEnabled` is set to `NO` on the table view or ... | 27,271 | [
{
"from": "human",
"value": "I'm writing an iOS app with a table view inside a tab view. In my UITableViewController, I implemented -tableView:didSelectRowAtIndexPath:, but when I select a row at runtime, the method isn't being called. The table view is being populated though, so I know that other tableVie... |
A project I'm working on will pull XML from a web-server and build a data store from it. The data will have certain core fields but needs to be extendable... for example I have a and later might want to have which adds extra fields.
In the Flex app, I don't want the central data store to be working on XML objects or ... | Flex does not provide built-in functionality to automatically map XML elements to strong typed objects like a `Person` class directly. However, you can implement a flexible and extensible solution using a combination of custom conversion methods and class constructors. Here’s how you can achieve this:
### Step 1: Defi... | 20,363 | [
{
"from": "human",
"value": "A project I'm working on will pull XML from a web-server and build a data store from it. The data will have certain core fields but needs to be extendable... for example I have a and later might want to have which adds extra fields.\nIn the Flex app, I don't want the central d... |
I'm working on an application for work that is going to query our employee database. The end users want the ability to search based on the standard name/department criteria, but they also want the flexibility to query for all people with the first name of "James" that works in the Health Department. The one thing I wan... | Yes, it is definitely possible to allow flexible querying of your employee database without directly constructing SQL statements from user inputs, thus mitigating the risk of SQL injection. One common approach is to use dynamic SQL within stored procedures, but instead of concatenating user inputs directly into SQL str... | 25,559 | [
{
"from": "human",
"value": "I'm working on an application for work that is going to query our employee database. The end users want the ability to search based on the standard name/department criteria, but they also want the flexibility to query for all people with the first name of \"James\" that works in... |
I have a char* p, which points to a \0-terminated string. How do I create a C++ string from it in an exception-safe way?
Here is an unsafe version:
string foo()
{
char *p = get_string();
string str( p );
free( p );
return str;
}
An obvious solution would be to try-catch - any easier ways?
| In C++, you can create a `std::string` from a `char*` safely using RAII principles without the need for explicit try-catch blocks. One way to achieve this is by utilizing `std::unique_ptr` with a custom deleter to ensure that the memory is automatically released, regardless of whether an exception occurs.
Here's how ... | 29,046 | [
{
"from": "human",
"value": "I have a char* p, which points to a \\0-terminated string. How do I create a C++ string from it in an exception-safe way?\nHere is an unsafe version:\nstring foo()\n{\n char *p = get_string();\n\n string str( p );\n free( p );\n return str;\n}\n\nAn obvious solution would be... |
There are some tasks, especially the ones that involve deleting folders as SU, that I do thoughtfully and slowly before I press the Enter key. I think if others saw me do these at the careful pace that I do they would cringe. Are there critical programming tasks that you perform that you believe deserve this thoughtful... | Absolutely! Many critical programming tasks deserve thoughtful and careful consideration, particularly those that can have significant consequences. Here are a few examples:
1. **Data Deletion**: Similar to your experience with deleting folders as superuser (SU), deleting databases, files, or large datasets should alw... | 27,637 | [
{
"from": "human",
"value": "There are some tasks, especially the ones that involve deleting folders as SU, that I do thoughtfully and slowly before I press the Enter key. I think if others saw me do these at the careful pace that I do they would cringe. Are there critical programming tasks that you perform... |
I have to develop a tool for monitoring helpdesk agents. I can figure out how to capture keyboard events and mouse events; however I need to capture the control that emitted/consumed the event too. Is it possible to find that out?
| Yes, it is possible to capture not only keyboard and mouse events but also to identify the control that emitted or consumed those events. The approach to do this will depend on the technology stack you're using (e.g., Windows Forms, WPF, Web applications, etc.). Here are some general strategies for different environmen... | 26,008 | [
{
"from": "human",
"value": "I have to develop a tool for monitoring helpdesk agents. I can figure out how to capture keyboard events and mouse events; however I need to capture the control that emitted/consumed the event too. Is it possible to find that out?\n"
},
{
"from": "gpt",
"value": "Yes... |
So I just love it when my application is working great in Firefox, but then I open it in IE and... Nope, please try again.
The issue I'm having is that I'm setting a CSS display property to either none or table-cell with JavaScript.
I was initially using display: block, but Firefox was rendering it weird without the ta... | It's common to encounter differences in how browsers interpret CSS properties, especially between modern browsers like Firefox and older versions of Internet Explorer (IE). Here are a few suggestions that might help you achieve consistent behavior without resorting to JavaScript hacks:
### 1. Use CSS Flexbox
If possi... | 26,275 | [
{
"from": "human",
"value": "So I just love it when my application is working great in Firefox, but then I open it in IE and... Nope, please try again.\nThe issue I'm having is that I'm setting a CSS display property to either none or table-cell with JavaScript.\nI was initially using display: block, but Fi... |
When I dump a Sybase database, it doesn't seem to matter whether there's data in the tables or not, the file size is the same. I've been told that this is down to the fact that my dump file is binary and not logical, so the file of the dump file is based on the allocated size of the database. I know that Oracle can use... | In Sybase, the default behavior for database dumps (using tools like `dump database`) is to create a binary dump, which indeed captures the entire allocated space in the database, regardless of whether the tables contain data or not. This is why you see a consistent file size.
Here are a few strategies you might consi... | 28,428 | [
{
"from": "human",
"value": "When I dump a Sybase database, it doesn't seem to matter whether there's data in the tables or not, the file size is the same. I've been told that this is down to the fact that my dump file is binary and not logical, so the file of the dump file is based on the allocated size of... |
Every so often, I'll have to switch between languages for the majority of the code I write (whether for work or for play). I find that C++ is one of those languages that requires a lot of mental cache space, so if I take a long break from it, then I forget a lot of the details. Even things like adding items to an STL ... | Certainly! Here’s a cheat sheet with essential C++ concepts, syntax, and STL container usage that you can bookmark for quick reference.
### C++ Basics
#### 1. **Basic Syntax**
- **Comments**:
```cpp
// Single line comment
/* Multi-line comment */
```
- **Variables**:
```cpp
int ... | 22,513 | [
{
"from": "human",
"value": "Every so often, I'll have to switch between languages for the majority of the code I write (whether for work or for play). I find that C++ is one of those languages that requires a lot of mental cache space, so if I take a long break from it, then I forget a lot of the details.... |
Is there a ColdFusion analog for the deployment descriptor/web.xml file found in a J2EE web container? I know CF is running on top of JRun and that I could just tweak the JRun dd, but what about an application-specific configuration file? Is there something like this that I'm not aware of or do you just have to roll yo... | In ColdFusion, there isn't a direct equivalent to the `web.xml` file used in J2EE applications. The `web.xml` file serves various purposes in Java web applications, including configuration of servlets, filters, listeners, and various deployment descriptors. ColdFusion, being a rapid application development platform, ab... | 23,707 | [
{
"from": "human",
"value": "Is there a ColdFusion analog for the deployment descriptor/web.xml file found in a J2EE web container? I know CF is running on top of JRun and that I could just tweak the JRun dd, but what about an application-specific configuration file? Is there something like this that I'm no... |
How do you setup a multi-developer XDebug PHP environment?
I have the following setup:
I have a linux machine with Apache and Xdebug loaded and a php.ini file that I think is correct.
I found a python proxy script that I'm using to proxy the calls from the PDT Eclipse IDE's my developers are using to the Apache/Xdebu... | Setting up a multi-developer XDebug environment can be a bit tricky, especially with multiple IDEs and configurations involved. Here's a step-by-step guide to help you set it up correctly:
### 1. Basic XDebug Configuration on the Linux Server
Make sure you have the following configuration in your `php.ini` (or the XDe... | 23,914 | [
{
"from": "human",
"value": "How do you setup a multi-developer XDebug PHP environment?\nI have the following setup:\n\nI have a linux machine with Apache and Xdebug loaded and a php.ini file that I think is correct. \nI found a python proxy script that I'm using to proxy the calls from the PDT Eclipse IDE'... |
How to copy file(s) from one solaris 9 machine to another solaris 9 machine using only java?
We have ssh access to both machines. The java program will run on one of those two machines.
Update: rsync is not really an option. can't install it easily (UNIX team is, hum, hard to deal with)
| To copy files from one Solaris 9 machine to another using Java over SSH, you can utilize the JSch library, which is a pure Java implementation of SSH2. This library allows you to establish an SSH connection, execute commands, and transfer files.
Here's a step-by-step guide on how to do this:
### Step 1: Add JSch Libr... | 23,141 | [
{
"from": "human",
"value": "How to copy file(s) from one solaris 9 machine to another solaris 9 machine using only java?\nWe have ssh access to both machines. The java program will run on one of those two machines.\nUpdate: rsync is not really an option. can't install it easily (UNIX team is, hum, hard to ... |
In one of my projects I need to build an ASP.NET page and some of the controls need to be created dynamically. These controls are added to the page by the code-behind class and they have some event-handlers added to them. Upon the PostBacks these event-handlers have a lot to do with what controls are then shown on the ... | The issue you're experiencing with having to click each button twice after the first click is related to the ASP.NET page lifecycle and how dynamic controls are handled. When you create controls dynamically, you must recreate them on every postback **before** the event handlers are executed. This is because during a po... | 26,553 | [
{
"from": "human",
"value": "In one of my projects I need to build an ASP.NET page and some of the controls need to be created dynamically. These controls are added to the page by the code-behind class and they have some event-handlers added to them. Upon the PostBacks these event-handlers have a lot to do ... |
Consider the delegate for a generic A to B function:
public delegate B Fun<A, B>(A x);
I can then write a function that accepts and invokes the Fun delegate:
public static B invokeFun<A, B>(A x, Fun<A, B> f)
{ return f(x); }
(Never mind whether it is wise to write invokeFun.)
Can I write invokeFun without naming the ... | In C#, when you want to declare a method that accepts a delegate type without naming the delegate, you cannot use the syntax you proposed (`B (A) f`). Instead, you need to refer to the delegate type directly or use a built-in delegate type like `Func<A, B>`, which is a more common and versatile alternative.
Here's how... | 30,719 | [
{
"from": "human",
"value": "Consider the delegate for a generic A to B function:\npublic delegate B Fun<A, B>(A x);\n\nI can then write a function that accepts and invokes the Fun delegate:\npublic static B invokeFun<A, B>(A x, Fun<A, B> f)\n{ return f(x); }\n\n(Never mind whether it is wise to write invok... |
I have a Windows forms project and a Web Service project in my solution, and I'm trying to call the web service and return a customer object as the result. The problem is that when I try to receive the return object, I get an error that it can't convert it. For example, here is the signature for my webservice:
Public F... | The issue you are encountering stems from the way web services work in .NET, particularly with the use of proxy classes. When you add a web reference in your project, Visual Studio generates a proxy class in the namespace of that web reference (in your case, `wsDrivers.Driver`). This class is a separate type from the `... | 25,835 | [
{
"from": "human",
"value": "I have a Windows forms project and a Web Service project in my solution, and I'm trying to call the web service and return a customer object as the result. The problem is that when I try to receive the return object, I get an error that it can't convert it. For example, here is ... |
On large tables in MSSQL; selecting specific columns results in greater speed of the query. Does the same apply to Linq to SQL?
Would this:
var person = from p in [DataContextObject].Persons
where p.PersonsID == 1
select new { p.PersonsID, p.PersonsAdress, p.PersonsZipcode };
be faster than t... | Yes, in general, selecting specific columns in a query can lead to improved performance, both in SQL and when using LINQ to SQL, but the extent of the performance difference can depend on various factors.
### How It Works
1. **Reduced Data Transfer**: By selecting only the columns you need, the amount of data that ha... | 27,221 | [
{
"from": "human",
"value": "On large tables in MSSQL; selecting specific columns results in greater speed of the query. Does the same apply to Linq to SQL?\nWould this:\nvar person = from p in [DataContextObject].Persons\n where p.PersonsID == 1\n select new { p.PersonsID, p.Persons... |
After reading a couple of answers and comments on some SQL questions here, and also hearing that a friend of mine works at a place which has a policy which bans them, I'm wondering if there's anything wrong with using backticks around field names in MySQL.
That is:
SELECT `id`, `name`, `anotherfield` ...
-- vs --
SELEC... | Using backticks around field names in MySQL serves a specific purpose and can have both benefits and drawbacks depending on the context in which they're used.
### Benefits of Using Backticks
1. **Reserved Keywords**: If your field name happens to match a reserved keyword in SQL (like `select`, `order`, `group`, etc.)... | 28,179 | [
{
"from": "human",
"value": "After reading a couple of answers and comments on some SQL questions here, and also hearing that a friend of mine works at a place which has a policy which bans them, I'm wondering if there's anything wrong with using backticks around field names in MySQL.\nThat is:\nSELECT `id`... |
I've been reading Skype4Java (java api for skype) and noticed they use jni to access the skype client.
intuitively I'd assume that there already is a standard library in java that has an OS-sensitive jni implementation to access other processes. I set up to look for one, but couldn't find it.
Is there such a library? ... | As of my last knowledge update in October 2023, there isn't a single, standardized Java library that provides an OS-sensitive JNI (Java Native Interface) implementation for accessing other processes. JNI is typically used when you want to call native code (usually written in C or C++) from Java, but it is generally use... | 25,999 | [
{
"from": "human",
"value": "I've been reading Skype4Java (java api for skype) and noticed they use jni to access the skype client.\nintuitively I'd assume that there already is a standard library in java that has an OS-sensitive jni implementation to access other processes. I set up to look for one, but c... |
I was wondering which one should I consider if I need the software to be used on both platforms, WIN and Linux and why?
| When considering software that needs to be used on both Windows and Linux platforms, there are several factors to evaluate, including compatibility, development environment, user interface, and support. Here are some options you can consider and the reasons for each:
### 1. **Cross-Platform Software Frameworks**
- ... | 29,819 | [
{
"from": "human",
"value": "I was wondering which one should I consider if I need the software to be used on both platforms, WIN and Linux and why?\n"
},
{
"from": "gpt",
"value": "When considering software that needs to be used on both Windows and Linux platforms, there are several factors to ... |
I have a project that dynamically loads in unknown assemblies implementing a specified interface. I don't know the contents or purposes of the assembly, other than it implementing my interface.
I need to somehow restrict the amount of processing power available to these assemblies. Processor priority is not what I'm lo... | To measure and restrict the CPU usage of dynamically loaded assemblies that implement a specified interface, running them in isolated processes and using performance counters is indeed a reasonable approach. Here’s a breakdown of how you can achieve this and the considerations involved:
### Running in Isolated Process... | 23,609 | [
{
"from": "human",
"value": "I have a project that dynamically loads in unknown assemblies implementing a specified interface. I don't know the contents or purposes of the assembly, other than it implementing my interface.\nI need to somehow restrict the amount of processing power available to these assembl... |
I'd like to do some work with the nitty-gritties of computer imaging. I'm looking for a way to read single pixels of data, analyze them programatically, and change them. What is the best language to use for this (Python, c++, Java...)? What is the best fileformat?
I don't want any super fancy software/APIs... I'm lo... | For working with the nitty-gritties of computer imaging, including reading, analyzing, and modifying single pixels, Python is often a great choice due to its simplicity and the availability of libraries that can facilitate low-level image manipulation. However, if you're looking for performance and more control over me... | 23,793 | [
{
"from": "human",
"value": "I'd like to do some work with the nitty-gritties of computer imaging. I'm looking for a way to read single pixels of data, analyze them programatically, and change them. What is the best language to use for this (Python, c++, Java...)? What is the best fileformat?\nI don't wa... |
I'm using tortoise svn in Windows.
How can I branch in SVN and have it branch my svn:external folders as well?
| Branching in Subversion (SVN) using TortoiseSVN can be straightforward, but it doesn't automatically handle `svn:externals` when you branch. `svn:externals` are properties that specify external repositories or folders to be included in your project. When you create a branch, the externals are not automatically branched... | 26,775 | [
{
"from": "human",
"value": "I'm using tortoise svn in Windows.\nHow can I branch in SVN and have it branch my svn:external folders as well?\n"
},
{
"from": "gpt",
"value": "Branching in Subversion (SVN) using TortoiseSVN can be straightforward, but it doesn't automatically handle `svn:externals... |
When I go to create my status bar overlay, I note that I can include a position attribute. I want to be able to dynamically change this attribute. Near as I can tell, just using JavaScript to find the element and change the position attribute doesn't move the status bar panel around on the status bar.
Any suggestions a... | To dynamically change the position of a status bar overlay in a web application, you may need to consider how the overlay is structured and rendered within the DOM. The `position` attribute alone may not be enough if the status bar or overlay uses CSS for its layout. Here are some strategies you can consider:
### 1. U... | 26,921 | [
{
"from": "human",
"value": "When I go to create my status bar overlay, I note that I can include a position attribute. I want to be able to dynamically change this attribute. Near as I can tell, just using JavaScript to find the element and change the position attribute doesn't move the status bar panel ar... |
I need to send an email to someone and want them to be able to simply reply to the email without having to specify the email address.
Using sp_send_dbmail sets the reply-to address as the name of the profile that it was sent from.
Can this be changed to specify the reply-to so it looks like it came from me.
Thanks.
| In SQL Server, when you use the `sp_send_dbmail` stored procedure, you can indeed customize the reply-to address by using the `@reply_to` parameter. This allows you to specify an email address that recipients can reply to without having to manually input the address.
Here’s an example of how you might structure your `... | 24,858 | [
{
"from": "human",
"value": "I need to send an email to someone and want them to be able to simply reply to the email without having to specify the email address.\nUsing sp_send_dbmail sets the reply-to address as the name of the profile that it was sent from.\nCan this be changed to specify the reply-to so... |
I've recently been trying to create units tests for some legacy code.
I've been taking the approach of using the linker to show me which functions cause link errors, greping the source to find the definition and creating a stub from that.
Is there an easier way?
Is there some kind of C++ parser that can give me class... | Creating unit tests for legacy code can indeed be a challenging task, especially when dealing with missing dependencies and link errors. Using a linker to identify undefined functions and then creating stubs can work, but there are indeed more systematic approaches you can take.
### C++ Parsers and Tools
1. **Clang ... | 26,396 | [
{
"from": "human",
"value": "I've recently been trying to create units tests for some legacy code.\nI've been taking the approach of using the linker to show me which functions cause link errors, greping the source to find the definition and creating a stub from that. \nIs there an easier way? \nIs there so... |
In our application we enable users to print pages. We do this by supplying a button which when click calls the window.print() function.
Some of the pages would look better if they were printed in landscape mode rather than portrait. Is there a way to control the page layout from JavaScript?
Update: Following the advi... | To control the page layout for printing (i.e., switching between portrait and landscape) using CSS, you can utilize a combination of CSS media queries specifically for print. Unfortunately, you cannot directly control the orientation with JavaScript; however, you can set up your CSS styles to achieve the desired effect... | 27,672 | [
{
"from": "human",
"value": "In our application we enable users to print pages. We do this by supplying a button which when click calls the window.print() function.\nSome of the pages would look better if they were printed in landscape mode rather than portrait. Is there a way to control the page layout fro... |
We are thinking of renaming our web directory schema to be more user friendly. However, we need any URL requests for the old directory structure to forward to the new one. so....
How do I forward requests for all of these:
http://mydomain.com/OLDdirname/
http://mydomain.com/OLDdirname/samesubdir/
http://mydomain.com/O... | To accomplish the URL redirection from the old directory structure to the new one, you can use URL rewriting or redirect rules, depending on your server environment. Below are examples for both Apache (using `.htaccess`) and Nginx.
### For Apache (.htaccess)
If you're using an Apache server, you can create or modify ... | 16,772 | [
{
"from": "human",
"value": "We are thinking of renaming our web directory schema to be more user friendly. However, we need any URL requests for the old directory structure to forward to the new one. so....\nHow do I forward requests for all of these: \nhttp://mydomain.com/OLDdirname/\nhttp://mydomain.com/... |
I want to get other process' argv like ps.
I'm using Mac OS X 10.4.11 running on Intel or PowerPC.
First, I read code of ps and man kvm, then I wrote some C code.
#include <kvm.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <paths.h>
int
main(void) {
char errbuf[1024]... | It looks like you are trying to retrieve the command-line arguments of processes on macOS using both the `kvm` interface and the `sysctl` interface. While you've made some progress, there are nuances in how these systems work, especially on older versions of macOS like 10.4.11.
Let's take a look at your issues with bo... | 22,857 | [
{
"from": "human",
"value": "I want to get other process' argv like ps.\nI'm using Mac OS X 10.4.11 running on Intel or PowerPC.\nFirst, I read code of ps and man kvm, then I wrote some C code.\n#include <kvm.h>\n#include <fcntl.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <sys/sysctl.h>\n#include ... |
I want to checkout, and then update as necessary, the Django Subversion trunk on a Mac OS X Leopard 10.5.5 machine.
I am only interested in having updated Django code on my Mac. I am not interested in contributing patches to the Django project. I do not need the Subversion history for the Django trunk.
I plan to use G... | To keep your Mac updated with the latest Django trunk, you have a few options to choose from. Given your requirements, let’s evaluate each of the suggested methods and determine the best approach.
### Option 1: Use Subversion (svn)
Using Subversion directly with the command:
```bash
svn co http://code.djangoproject.co... | 25,672 | [
{
"from": "human",
"value": "I want to checkout, and then update as necessary, the Django Subversion trunk on a Mac OS X Leopard 10.5.5 machine. \nI am only interested in having updated Django code on my Mac. I am not interested in contributing patches to the Django project. I do not need the Subversion his... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.