instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Is there any open source Object Database available? I would like to have a look at the source code and see how stuffs are implemented.
Yes, there are several open-source object databases that you can explore. Here are a few notable ones: 1. **db4o**: db4o (database for objects) is an open-source object database that allows you to store and retrieve objects directly without the need for mapping them to relational tables. It has been popular among Java...
40,396
[ { "from": "human", "value": "Is there any open source Object Database available? I would like to have a look at the source code and see how stuffs are implemented.\n" }, { "from": "gpt", "value": "Yes, there are several open-source object databases that you can explore. Here are a few notable on...
I want to write a script that will stop a scheduled task on a remote computer, do some stuff, and then start the schedule task back up. How can I do it?
To create a script that stops a scheduled task on a remote computer, performs some operations, and then restarts the scheduled task, you can use PowerShell. Below are the steps and an example script to accomplish this. ### Prerequisites: 1. **Remote Management Enabled**: Ensure that PowerShell Remoting is enabled on t...
34,859
[ { "from": "human", "value": "I want to write a script that will stop a scheduled task on a remote computer, do some stuff, and then start the schedule task back up.\nHow can I do it?\n" }, { "from": "gpt", "value": "To create a script that stops a scheduled task on a remote computer, performs so...
So, I'd like to be able to set the max log file size to 64M, but after doing so with innodb_log_file_size=64M MySQL starts OK, but nothing seems to work properly. EDIT: and by properly I mean not at all. Setting other InnoDB variables aren't causing any problems. How should I go about troubleshooting this one?
Setting the `innodb_log_file_size` to a specific value, like 64M, can sometimes lead to issues, especially if the InnoDB log files are not properly configured or if there are other dependent settings. Here are some steps to help you troubleshoot the problem: 1. **Check MySQL Error Log**: The first step in troubleshoot...
37,338
[ { "from": "human", "value": "So, I'd like to be able to set the max log file size to 64M, but after doing so with innodb_log_file_size=64M MySQL starts OK, but nothing seems to work properly. \nEDIT: and by properly I mean not at all. Setting other InnoDB variables aren't causing any problems.\nHow should I...
How best can I convert instances of double backslashes to a single backslash in a string, but remove any occurrences of single backslash? So this: \|Testing|ABC:1234\\1000-1\| Should convert to this: |Testing|ABC:1234\1000-1| Ideally I want to avoid a temporary replace of '\' to another character. A solution using...
To achieve the desired transformation using .NET and regular expressions, you can use a `Regex.Replace` method to handle the replacements in one step. The strategy is to replace double backslashes with a single backslash while simultaneously removing single backslashes. You can achieve this by using a regular express...
40,653
[ { "from": "human", "value": "How best can I convert instances of double backslashes to a single backslash in a string, but remove any occurrences of single backslash?\nSo this:\n\n\\|Testing|ABC:1234\\\\1000-1\\|\n\nShould convert to this:\n\n|Testing|ABC:1234\\1000-1|\n\nIdeally I want to avoid a temporary...
I've been using this function but I'd like to know what's the most efficient and accurate way to get it. function daysInMonth(iMonth, iYear) { return 32 - new Date(iYear, iMonth, 32).getDate(); }
The function you've provided is a clever way to calculate the number of days in a month by leveraging JavaScript's Date object. However, it has a small inefficiency because it creates a Date object for the 32nd day of the month, which requires the Date object to normalize and compute the correct date, though this metho...
40,917
[ { "from": "human", "value": "I've been using this function but I'd like to know what's the most efficient and accurate way to get it.\nfunction daysInMonth(iMonth, iYear) {\n return 32 - new Date(iYear, iMonth, 32).getDate();\n}\n\n" }, { "from": "gpt", "value": "The function you've provided i...
I have a problem with the following code: for(i = 0;(i - 1)< n;i++) { char* b; sprintf(b, "%d", i); } It compiles fine but when I run it it give me the infamous "0XC0000005 Access Violation" error. I have tried setting b to NULL, "", "0", 0 and a bunch of other stuff but then I get the "0XC0000005 Access Violation" er...
The issue you're encountering is due to the usage of the pointer `b` without allocating memory for it. In your code snippet: ```c char* b; sprintf(b, "%d", i); ``` `b` is declared as a pointer to a character (`char*`), but it does not point to any allocated memory. Attempting to write to an unallocated memory locatio...
41,350
[ { "from": "human", "value": "I have a problem with the following code:\nfor(i = 0;(i - 1)< n;i++)\n{\nchar* b;\nsprintf(b, \"%d\", i);\n}\n\nIt compiles fine but when I run it it give me the infamous \"0XC0000005 Access Violation\" error. I have tried setting b to NULL, \"\", \"0\", 0 and a bunch of other s...
I'm trying to learn jQuery, to make up for my anemic javascript skills. As a test project, I have a page full of links, and I want to have a button on the page open all the links in new tabs. The links all have target="_blank" attributes. I'm using this $('button').click(function() { $('a').click(); );} I've ...
Your current approach using `$('a').click();` is not going to work as expected because it simulates a click event programmatically. While this can be useful in some contexts, there are certain circumstances where it won't trigger the default action of opening a new tab. Here's a better way to achieve your goal using j...
42,238
[ { "from": "human", "value": "I'm trying to learn jQuery, to make up for my anemic javascript skills.\nAs a test project, I have a page full of links, and I want to have a button on the page open all the links in new tabs. The links all have target=\"_blank\" attributes.\nI'm using this\n $('button').click...
The resource editor keeps wiping out code of this form in my .rc: #ifndef V2 IDB_SPLASHSCREEN BITMAP "res\\xyz v1.bmp" #else IDB_SPLASHSCREEN BITMAP "res\\xyz v2.bmp" #endif Anyone know of a workaround? Better way to accomplish the same?
The issue you’re experiencing with your resource editor might be due to its inability to properly handle preprocessor directives like `#ifndef`, `#else`, and `#endif`. Some resource editors do not support conditional compilation in `.rc` files, leading to unintended removal or modification of the code that uses these d...
40,873
[ { "from": "human", "value": "The resource editor keeps wiping out code of this form in my .rc:\n#ifndef V2\nIDB_SPLASHSCREEN BITMAP \"res\\\\xyz v1.bmp\"\n#else\nIDB_SPLASHSCREEN BITMAP \"res\\\\xyz v2.bmp\"\n#endif\n\nAnyone know of a workaround? Better way ...
First, I know there are methods off of the generic List<> class already in the framework do iterate over the List<>. But as an example, what is the correct syntax to write a ForEach method to iterate over each object of a List<>, and do a Console.WriteLine(object.ToString()) on each object. Something that takes the Lis...
Certainly! You can create a simple `ForEach` method that takes a `List<T>` and an `Action<T>` as parameters. This method will iterate over each item in the list and execute the provided action, which in your case is to print each object's string representation using `Console.WriteLine`. Here's how you can implement it...
40,475
[ { "from": "human", "value": "First, I know there are methods off of the generic List<> class already in the framework do iterate over the List<>.\nBut as an example, what is the correct syntax to write a ForEach method to iterate over each object of a List<>, and do a Console.WriteLine(object.ToString()) on...
Is there any way I can specify a standard or custom numeric format string to always output the sign, be it +ve or -ve (although what it should do for zero, I'm not sure!)
In .NET, if you want to specify a numeric format string that always shows the sign of a number (both positive and negative), you can achieve this using custom numeric format strings. Here’s how you can do it: ### For Positive and Negative Numbers You can use the custom numeric format string `"+0;-0"` which will force...
41,920
[ { "from": "human", "value": "Is there any way I can specify a standard or custom numeric format string to always output the sign, be it +ve or -ve (although what it should do for zero, I'm not sure!)\n" }, { "from": "gpt", "value": "In .NET, if you want to specify a numeric format string that al...
I have an Informix SQL query which returns a set of rows. It was slightly modified for the new version of the site we've been working on and our QA noticed that the new version returns different results. After investigation we've found that the only difference between two queries were in the number of fields returned. ...
The issue you're encountering, where the number of fields returned in a SELECT statement appears to affect the results even though the FROM, WHERE, and ORDER BY clauses remain unchanged, could stem from a few possible reasons: 1. **Implicit vs. Explicit Cursor Behavior**: Depending on how you're retrieving and process...
36,942
[ { "from": "human", "value": "I have an Informix SQL query which returns a set of rows. It was slightly modified for the new version of the site we've been working on and our QA noticed that the new version returns different results. After investigation we've found that the only difference between two querie...
I have a huge dictionary of blank values in a variable called current like so: struct movieuser {blah blah blah} Dictionary<movieuser, float> questions = new Dictionary<movieuser, float>(); So I am looping through this dictionary and need to fill in the "answers", like so: for(var k = questions.Keys.GetEnumerator();k....
You're right that modifying a dictionary while iterating through it can lead to an `InvalidOperationException`. However, you can use a different approach to achieve your goal without creating a copy of the dictionary. Instead of using the enumerator to loop through the keys, you can iterate through the dictionary using...
42,878
[ { "from": "human", "value": "I have a huge dictionary of blank values in a variable called current like so:\nstruct movieuser {blah blah blah}\nDictionary<movieuser, float> questions = new Dictionary<movieuser, float>();\n\nSo I am looping through this dictionary and need to fill in the \"answers\", like so...
SELECT avg(con_hits) as avg_hits FROM content WHERE con_type = 1 AND con_posttime < $twelve_hrs_ago AND con_refresh = 0 ORDER BY con_posttime DESC LIMIT 100 I would like it to go to the first record that was posted at least 12 hours ago (denoted by the $twelve_hrs_ago variable which has the suita...
To achieve the desired behavior of averaging the `con_hits` for records posted at least 12 hours ago while ignoring the `LIMIT` clause in the sense of including all records after the first one that meets the condition, you can use a Common Table Expression (CTE) or a subquery to first find the starting point (the first...
38,946
[ { "from": "human", "value": "SELECT \n avg(con_hits) as avg_hits \nFROM \n content \nWHERE \n con_type = 1 \n AND con_posttime < $twelve_hrs_ago \n AND con_refresh = 0 \nORDER BY \n con_posttime DESC \nLIMIT 100\n\nI would like it to go to the first record that was posted at least 12 hours ago (denote...
What does "Overloaded"/"Overload" mean in regards to programming?
In programming, "overloaded" or "overload" typically refers to a feature that allows multiple functions or methods to have the same name but different parameters or signatures. This concept is common in languages that support polymorphism, such as C++, Java, and Python (though Python uses a different approach since it ...
40,496
[ { "from": "human", "value": "What does \"Overloaded\"/\"Overload\" mean in regards to programming?\n" }, { "from": "gpt", "value": "In programming, \"overloaded\" or \"overload\" typically refers to a feature that allows multiple functions or methods to have the same name but different parameter...
I have a few Munin plugins which report stats from an Autonomy database. They all use a small library which scrapes the XML status output for the relevant numbers. I'm trying to bundle the library and plugins into a Puppet-installable RPM. The actual RPM-building should be straightforward; once I have a distutils-produ...
To package your Python code using `distutils` and have it install into a specific directory structure, you will want to organize your code as a proper Python package. In Python, a package is a directory that contains an `__init__.py` file, which can be empty but indicates to Python that the directory should be treated ...
40,094
[ { "from": "human", "value": "I have a few Munin plugins which report stats from an Autonomy database. They all use a small library which scrapes the XML status output for the relevant numbers.\nI'm trying to bundle the library and plugins into a Puppet-installable RPM. The actual RPM-building should be stra...
I need a solution to catalog a number of applications in our company (more than 100 less than 1000). Right now we are using a spreadsheet and for each app we fill in name, short description, contact person and maintainer (internal or vendor). The puspose is to use this list for IT planning and incident management (imp...
It's great that you’re already considering various solutions for cataloging applications in your organization. Given your requirements, I'll provide some insights into the options you're considering, along with some additional recommendations and common pitfalls to be aware of. ### Evaluating Your Current Options 1. ...
32,209
[ { "from": "human", "value": "I need a solution to catalog a number of applications in our company (more than 100 less than 1000). \nRight now we are using a spreadsheet and for each app we fill in name, short description, contact person and maintainer (internal or vendor). The puspose is to use this list fo...
I am wondering what is best practice when it comes to dependencies and how releases should be done. In my case I have a library that relies on log4net and I am wondering if I should distribute log4net.dll (set the log4net reference to copy local) along with the release? Could I simply state that log4net should be inst...
When distributing a library that has dependencies, such as log4net, best practices generally revolve around ensuring that your library is easy to use and reduces the potential for conflicts. Here are some key points to consider regarding dependency management and release practices: ### 1. **Copy Local vs. GAC:** - **...
36,241
[ { "from": "human", "value": "I am wondering what is best practice when it comes to dependencies and how releases should be done. In my case I have a library that relies on log4net and I am wondering if I should distribute log4net.dll (set the log4net reference to copy local) along with the release? \nCould ...
I embedded a default media player into my webpage with the following html <object height="20" width="200"> <embed src="url to music" autostart="false" loop="false" height="20" width="200"> </object> Everytime I go to the website, this object automatically downloads the music. How can I disable the autodownload? I wa...
To prevent your embedded media player from automatically downloading the audio file when the page loads, you can consider a few approaches. The `<object>` and `<embed>` tags may not provide the necessary control over automatic downloading behavior, especially in some browsers. Here are a couple of alternatives you can...
40,513
[ { "from": "human", "value": "I embedded a default media player into my webpage with the following html\n<object height=\"20\" width=\"200\">\n <embed src=\"url to music\" autostart=\"false\" loop=\"false\" height=\"20\" width=\"200\">\n</object>\nEverytime I go to the website, this object automatically down...
Some time ago I got this error when building ANY Visual Studio Deployment project. "Unrecoverable build error" I thought my VS installation was corrupted or I deleted some important files, but ...
The "Unrecoverable build error" in Visual Studio, especially when it occurs during deployment projects, can be frustrating. Here are several steps you can take to troubleshoot and resolve this issue: 1. **Check Project Configuration**: - Ensure that the configuration settings for your deployment project are correct...
40,317
[ { "from": "human", "value": "Some time ago I got this error when building ANY Visual Studio Deployment project.\n\"Unrecoverable build error\" \nI thought my VS installation was corrupted or I deleted some important files, but ...\n" }, { "from": "gpt", "value": "The \"Unrecoverable build error\...
First some background. I am trying to run Community Engine on a fresh install of Ubuntu. CE is a open src social networking plugin running on Rails. I was able to get CE up and running on my windows box w/o issue. I have decided to use Ubuntu 8.10 as my development environment now, and am stuck on this issue. I have re...
It looks like you're encountering a compatibility issue with the Engines plugin while trying to use the Community Engine on your Ubuntu setup. The error message indicates that the version of the Engines plugin you're using requires Rails 2.1.1 or later, but there's something in your setup that's causing it not to recog...
36,833
[ { "from": "human", "value": "First some background. I am trying to run Community Engine on a fresh install of Ubuntu. CE is a open src social networking plugin running on Rails. I was able to get CE up and running on my windows box w/o issue. I have decided to use Ubuntu 8.10 as my development environment n...
I have a C# application for on a pocket pc. It looks as a browser but some underlaying extra things. Currently im using the webbrowser of .net but I want to use the Opera browser due functionality. Is it possible to add a opera item on my form? And how do I do that?
Using the Opera browser directly as an embedded component in a C# application for a Pocket PC (or Windows Mobile) is not straightforward since Opera does not provide an ActiveX or .NET control that can be embedded directly within your application. However, you can achieve similar functionality by opening external links...
41,399
[ { "from": "human", "value": "I have a C# application for on a pocket pc. It looks as a browser but some underlaying extra things. Currently im using the webbrowser of .net but I want to use the Opera browser due functionality. Is it possible to add a opera item on my form? And how do I do that?\n" }, { ...
I swear I've seen someone do this, but I can't find it in the various lists of shortcuts. Given: String s = "A very long ............................ String"; Is there an Eclipse shortcut to turn it into: String s = "A very long ............................ " + "String";
Yes, there is a way to format long strings in Eclipse without needing to manually add the concatenation operator (`+`). While Eclipse does not have a direct shortcut for splitting a long string into multiple lines with a concatenation, you can achieve this formatting using a combination of manual actions and Eclipse's ...
41,090
[ { "from": "human", "value": "I swear I've seen someone do this, but I can't find it in the various lists of shortcuts.\nGiven:\nString s = \"A very long ............................ String\";\n\nIs there an Eclipse shortcut to turn it into:\nString s = \"A very long ............................ \" \n + \...
I was told that decimal is implemented as user defined type and other c# types like int have specific opcodes devoted to them. What's the reasoning behind this?
In C#, the `decimal` type is implemented as a user-defined type while basic numeric types like `int`, `float`, and `double` have specific opcodes that are natively supported by the Common Language Runtime (CLR). Here are some key reasons behind this design decision: 1. **Precision and Scale**: The `decimal` type is de...
40,853
[ { "from": "human", "value": "I was told that decimal is implemented as user defined type and other c# types like int have specific opcodes devoted to them. What's the reasoning behind this?\n" }, { "from": "gpt", "value": "In C#, the `decimal` type is implemented as a user-defined type while bas...
I have a J2ee application where I basically want two objects, created by two separate servlets to communicate directly and I need these intances to be stable, i.e. to "know" each other during the session. The sequence is roughly: Client sends a request to Servlet #1, which creates object A Client sends a second reque...
Creating a stable communication mechanism between two objects instantiated by different servlets in a J2EE application can indeed be challenging, especially if you want to maintain a coherent state across multiple requests in a session. Here are several approaches you can consider to achieve this: ### 1. **Using Sessi...
37,913
[ { "from": "human", "value": "I have a J2ee application where I basically want two objects, created by two separate servlets to communicate directly and I need these intances to be stable, i.e. to \"know\" each other during the session.\nThe sequence is roughly: \n\nClient sends a request to Servlet #1, whic...
I am using following code to embed files, video with .wmv extension, that is not working in Firefox. It's working fine in IE. document.getElementById("QuestionMedia").innerHTML += '<OBJECT ID="MediaPlayer" WIDTH="350" HEIGHT="280" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"STANDBY="Loading Windows Media Pla...
The issue you're experiencing with embedding .wmv video files in Firefox is due to the fact that Firefox does not natively support the Windows Media Player ActiveX controls or the .wmv file format in the same way that Internet Explorer does. ActiveX is specific to Internet Explorer and is not supported by other modern ...
39,600
[ { "from": "human", "value": "I am using following code to embed files, video with .wmv extension, that is not working in Firefox. It's working fine in IE.\ndocument.getElementById(\"QuestionMedia\").innerHTML += \n '<OBJECT ID=\"MediaPlayer\" WIDTH=\"350\" HEIGHT=\"280\" CLASSID=\"CLSID:22D6F312-B0F6-11D0-...
I figure this problem is easier than just a regular spell checker since the list of U.S cities is small compared to all known English words. Anyhow, here's the problem: I have text files with full of city names; some of which are spelled correctly and some which aren't. What kind of algorithm can I use to correct all ...
To correct misspellings of city names in your text files, you can utilize a variety of algorithms and techniques. Here’s a structured approach to tackle this problem: ### Steps to Correct Misspellings of City Names: 1. **Data Preparation**: - **City Name List**: Compile a comprehensive list of U.S. city names. Thi...
38,315
[ { "from": "human", "value": "I figure this problem is easier than just a regular spell checker since the list of U.S cities is small compared to all known English words.\nAnyhow, here's the problem:\nI have text files with full of city names; some of which are spelled correctly and some which aren't. \nWhat...
When A Python exception is thrown by code that spans multiple lines, e.g.: myfoos = [foo("bar", "baz", "quux", i) for i in range(10)] Python will report the line number of the last line, and will show the code fragment from that line: Traceback (most recent call last...
In Python, when an exception is raised, it typically reports the line number of the last executed line of code within the block where the error occurred. Unfortunately, Python does not provide a built-in way to automatically collect the start and end lines of multi-line statements for the traceback. However, you can m...
40,238
[ { "from": "human", "value": "When A Python exception is thrown by code that spans multiple lines, e.g.:\n myfoos = [foo(\"bar\",\n \"baz\",\n \"quux\",\n i) for i in range(10)]\n\nPython will report the line number of the last line, and will show the code frag...
I have a string with a length that is a multiple of 8 that contains only 0's and 1's. I want to convert the string into a byte array suitable for writing to a file. For instance, if I have the string "0010011010011101", I want to get the byte array [0x26, 0x9d], which, when written to file, will give 0x269d as the bi...
You can convert a binary string (which consists of '0's and '1's) into a byte array in Python using the built-in functions. You can achieve this by splitting the string into chunks of 8 bits, converting each chunk to an integer, and then converting those integers into bytes. Here's a step-by-step solution: 1. Split t...
41,266
[ { "from": "human", "value": "I have a string with a length that is a multiple of 8 that contains only 0's and 1's. I want to convert the string into a byte array suitable for writing to a file. For instance, if I have the string \"0010011010011101\", I want to get the byte array [0x26, 0x9d], which, when ...
Say I have a controller with an Index Method and a Update Method. After the Update is done I want to redirect to Index(). Should I use return RedirectToAction("Index") or can I just call return Index()? Is there a difference? public ActionResult Index() { return View("Index", viewdata); } public ActionResult Update(...
In an ASP.NET MVC controller, there is a significant difference between using `return RedirectToAction("Index")` and `return Index()` after performing an update. ### 1. RedirectToAction("Index") Using `RedirectToAction("Index")` will redirect the user's browser to the `Index` action. This means: - **New HTTP Request...
42,523
[ { "from": "human", "value": "Say I have a controller with an Index Method and a Update Method. After the Update is done I want to redirect to Index(). Should I use return RedirectToAction(\"Index\") or can I just call return Index()? Is there a difference?\npublic ActionResult Index()\n{\n return View(\"In...
I've been working with code synthesis xsd to generate an xml tree to ensure constinency of the xml output to the original xsd. After initial testing, everything looked ok but when I tried entering invalid values (correct type, but outside the defined range), the values were allowed. Although the xml is well formed and ...
It sounds like you're using an XML schema (XSD) to validate XML documents, and you've encountered an issue where the generated XML doesn't enforce value constraints defined in the schema. This can happen for several reasons when using code synthesis tools or XML libraries. Here are some steps you might take to troubles...
39,741
[ { "from": "human", "value": "I've been working with code synthesis xsd to generate an xml tree to ensure constinency of the xml output to the original xsd.\nAfter initial testing, everything looked ok but when I tried entering invalid values (correct type, but outside the defined range), the values were all...
I want to run a few tomcat web apps behind IIS 6. I was wondering what the most common way that this is accomplished. I have done this with Apache using the AJP connector and using HTTP proxypass. Is this done the same way with IIS 6? Thank you.
Running Tomcat web applications behind IIS 6 is a common scenario, and while it's somewhat different from Apache, you can achieve similar functionality using IIS as a reverse proxy or by utilizing the ISAPI Redirector. Here are a couple of common methods to accomplish this: ### 1. Using ISAPI Redirector (Jakarta Conne...
40,078
[ { "from": "human", "value": "I want to run a few tomcat web apps behind IIS 6. I was wondering what the most common way that this is accomplished. I have done this with Apache using the AJP connector and using HTTP proxypass. Is this done the same way with IIS 6? Thank you.\n" }, { "from": "gpt",...
We have a fairly complicated GUI in windows forms using C# and .Net 2.0. My problem is that whenever I drag any window over the GUI, it leaves artifacts over the form. I can't for the life of me figure out how to eliminate it. I've tried enabling double buffering, but it only helps, doesn't eliminate the problem. Other...
It sounds like you're experiencing a common issue in Windows Forms applications, particularly when using complex controls or third-party libraries. Artifacts can occur when the drawing of controls is not properly managed or when the graphics context isn't correctly handled. Since you've mentioned that enabling double b...
37,904
[ { "from": "human", "value": "We have a fairly complicated GUI in windows forms using C# and .Net 2.0. My problem is that whenever I drag any window over the GUI, it leaves artifacts over the form. I can't for the life of me figure out how to eliminate it. I've tried enabling double buffering, but it only he...
What is the best way to dynamically add TableRows and TableCells to an ASP.NET table from Javascript? Thanks, Jeff
Dynamically adding `TableRow` and `TableCell` elements to an ASP.NET table using JavaScript can be achieved with a combination of server-side controls and client-side scripting. Here’s a basic approach on how you can do this: ### Step 1: Define Your ASP.NET Table First, you should define your ASP.NET Table in your ma...
39,509
[ { "from": "human", "value": "What is the best way to dynamically add TableRows and TableCells to an ASP.NET table from Javascript?\nThanks,\nJeff\n" }, { "from": "gpt", "value": "Dynamically adding `TableRow` and `TableCell` elements to an ASP.NET table using JavaScript can be achieved with a co...
I am trying to animate an object, let's say its a car. I want it go from point x1,y1,z1 to point x2,y2,z2 . It moves to those points, but it appears to be drifting rather than pointing in the direction of motion. So my question is: how can I solve this issue in my updateframe() event? Could you point me in the directio...
To ensure your car object points in the direction of its motion while animating between two points in 3D space, you can follow these general steps: ### Steps to Point the Car in the Direction of Motion 1. **Calculate the Direction Vector**: First, determine the direction vector that represents the motion from the ...
39,000
[ { "from": "human", "value": "I am trying to animate an object, let's say its a car. I want it go from point\nx1,y1,z1\nto point x2,y2,z2 . It moves to those points, but it appears to be drifting rather than pointing in the direction of motion. So my question is: how can I solve this issue in my updateframe(...
In have a many-to-many linking table and I'm trying to set up two foreign keys on it. I run these two statements: ALTER TABLE address_list_memberships ADD CONSTRAINT fk_address_list_memberships_address_id FOREIGN KEY index_address_id (address_id) REFERENCES addresses (id); ALTER TABLE address_list_memberships ADD CONS...
The behavior you're observing is related to how MySQL handles foreign keys and indexing. When you create a foreign key constraint on a column, MySQL does indeed automatically create an index for that column if one does not already exist. However, if you explicitly define an index on that column before adding the foreig...
41,800
[ { "from": "human", "value": "In have a many-to-many linking table and I'm trying to set up two foreign keys on it. I run these two statements:\nALTER TABLE address_list_memberships\nADD CONSTRAINT fk_address_list_memberships_address_id\nFOREIGN KEY index_address_id (address_id)\nREFERENCES addresses (id);\n...
I am trying to write a C++ program that takes the following inputs from the user to construct rectangles (between 2 and 5): height, width, x-pos, y-pos. All of these rectangles will exist parallel to the x and the y axis, that is all of their edges will have slopes of 0 or infinity. I've tried to implement what is ment...
It seems like you are trying to implement a way to test the intersection of rectangles in C++. The code snippet you provided appears to be part of a larger program aimed at calculating whether two rectangles intersect based on their vertices, using some vector mathematics. Let’s break down the task and help you write ...
38,571
[ { "from": "human", "value": "I am trying to write a C++ program that takes the following inputs from the user to construct rectangles (between 2 and 5): height, width, x-pos, y-pos. All of these rectangles will exist parallel to the x and the y axis, that is all of their edges will have slopes of 0 or infin...
Using Firebird, I want to combine the results of two queries using UNION ALL, then sort the resulting output on a given column. (select C1, C2, C3 from T1) union all (select C1, C2, C3 from T2) order by C3 The parentheses came from valid syntax for other databases, and are needed to make sure the arguments to UNION A...
In Firebird, you cannot directly place an `ORDER BY` clause after a `UNION ALL` that combines two result sets, because the `ORDER BY` clause needs to be applied to the entire combined result set, not to each individual query within the `UNION ALL`. To achieve the desired behavior and sort the combined results based o...
43,118
[ { "from": "human", "value": "Using Firebird, I want to combine the results of two queries using UNION ALL, then sort the resulting output on a given column.\n(select C1, C2, C3 from T1)\nunion all \n(select C1, C2, C3 from T2)\norder by C3\n\nThe parentheses came from valid syntax for other databases, and a...
In LINQ2SQL it was possible to set the return type of a stored procedure to auto generated. I am unable to do so with the Entity Framework. I want to set the return type of a stored procdure to auto-generated with the Entity Framework. Is this possible? Kind regards.
In Entity Framework, you don't have the same auto-generation feature for stored procedure return types as you do in LINQ to SQL. However, you can still work with stored procedures and handle their return types. When you import a stored procedure in Entity Framework, it generates a method based on the return type you d...
38,960
[ { "from": "human", "value": "In LINQ2SQL it was possible to set the return type of a stored procedure to auto generated.\nI am unable to do so with the Entity Framework.\nI want to set the return type of a stored procdure to auto-generated with the Entity Framework.\nIs this possible?\nKind regards.\n" },...
Is there a way to disable the drag&drop functionality for Solution Explorer? Why would you ask? I'm using an wacom pen tablet for quite some years and I love it. But when you use it in solution explorer in combination with a source control like TFS or AnkhSvn it's a disaster when you accidentally move a file into an ...
Yes, you can disable or mitigate the drag-and-drop functionality in the Solution Explorer of Visual Studio to prevent accidental file moves when using a pen tablet. While there's no direct option in Visual Studio to completely disable drag-and-drop, you can try the following workarounds: ### Workarounds: 1. **Adjust ...
41,297
[ { "from": "human", "value": "Is there a way to disable the drag&drop functionality for Solution Explorer?\nWhy would you ask? I'm using an wacom pen tablet for quite some years and I love\nit. But when you use it in solution explorer in combination with a source control \nlike TFS or AnkhSvn it's a disaster...
How do I setup TeamCity 4.0 so that I can access it over port 443 on the internet? e.g. https://teamcity.mydomain.com I am running IIS 7 on the same server that TeamCity is installed. I see two options: Setup TeamCity to use port 8443 and create a reverse proxy in IIS that routes requests to the TeamCity public IP a...
To set up TeamCity 4.0 to be accessed over port 443 using IIS 7 as a reverse proxy, you can follow these steps. This will involve configuring IIS to forward requests to the internal port that TeamCity is using, typically 8111 or another port if you've configured it differently. Here’s a detailed guide on how to do this...
38,938
[ { "from": "human", "value": "How do I setup TeamCity 4.0 so that I can access it over port 443 on the internet? e.g. https://teamcity.mydomain.com\nI am running IIS 7 on the same server that TeamCity is installed. I see two options:\n\nSetup TeamCity to use port 8443 and\ncreate a reverse proxy in IIS tha...
Is it better to initialize class member variables on declaration private List<Thing> _things = new List<Thing>(); private int _arb = 99; or in the default constructor? private List<Thing> _things; private int _arb; public TheClass() { _things = new List<Thing>(); _arb = 99; } Is it simply a matter of style or ar...
The choice of whether to initialize class member variables at the point of declaration or in the constructor is largely a matter of style and code clarity, though there are some subtle differences to consider: ### 1. **Readability and Clarity** - **Initialization at Declaration:** Initializing member variables at the ...
39,534
[ { "from": "human", "value": "Is it better to initialize class member variables on declaration\nprivate List<Thing> _things = new List<Thing>();\nprivate int _arb = 99;\n\nor in the default constructor?\nprivate List<Thing> _things;\nprivate int _arb;\n\npublic TheClass()\n{\n _things = new List<Thing>();\n...
I tried to follow the widget example by mindtrove's blog. Here is the example demo page. There are some problems with this widget: left & right arrow keys, and home & end keys are not working in Firefox(I am using a Mac), and none of any keys are working if I load the example page in Safari. I am not sure if this is on...
It sounds like you're encountering issues with keyboard event handling in your widget, particularly with the arrow keys and home/end keys on different browsers on macOS. Here are some points to consider that might help you troubleshoot and resolve the problem: 1. **Dojo Key Handling**: Ensure you are using the latest ...
37,562
[ { "from": "human", "value": "I tried to follow the widget example by mindtrove's blog. Here is the example demo page.\nThere are some problems with this widget: left & right arrow keys, and home & end keys are not working in Firefox(I am using a Mac), and none of any keys are working if I load the example p...
I want to convert a std::string to lowercase. I am aware of the function tolower(). However, in the past I have had issues with this function and it is hardly ideal anyway as using it with a std::string would require iterating over each character. Is there an alternative which works 100% of the time?
Yes, there are indeed alternatives to using `std::tolower()` directly to convert a `std::string` to lowercase in C++. One of the most straightforward and effective methods is to use the `std::transform` algorithm from the `<algorithm>` header in combination with `std::tolower`. This approach allows you to convert the e...
36,595
[ { "from": "human", "value": "I want to convert a std::string to lowercase. I am aware of the function tolower(). However, in the past I have had issues with this function and it is hardly ideal anyway as using it with a std::string would require iterating over each character.\nIs there an alternative which ...
I remember hearing Joel say he has 2 different locations where the servers are located, each location has 2 front end servers and 1 back end server. If a one of the hosting facilities goes down, how can he switch over to the other one? (Or is it just going to be a DNS change that will take 24-72 hours to propagate?)....
To address the first question regarding how Joel can switch over to a different hosting facility if one goes down: If Joel has two locations with a setup involving multiple front-end and back-end servers, he can implement a failover mechanism that allows for quick switching without relying solely on DNS changes, whic...
40,866
[ { "from": "human", "value": "I remember hearing Joel say he has 2 different locations where the servers are located, each location has 2 front end servers and 1 back end server.\n\nIf a one of the hosting facilities goes down, how can he switch over to the other one? (Or is it just going to be a DNS change...
Is the source code for the common login controls available? Those are the controls which are available under Login section in Toolbox: Login, LoginView, PasswordRecovery, LoginStatus, LoginName, CreateUserWizard, ChangePassword Eventually could you point me to a good source of custom implementation of functiona...
The common login controls you mentioned, such as `Login`, `LoginView`, `PasswordRecovery`, `LoginStatus`, `LoginName`, `CreateUserWizard`, and `ChangePassword`, are part of the ASP.NET Web Forms framework. While the exact source code for these controls isn't publicly available as they're part of the ASP.NET framework i...
36,817
[ { "from": "human", "value": "Is the source code for the common login controls available?\nThose are the controls which are available under Login section in Toolbox: \n\nLogin, \nLoginView, \nPasswordRecovery,\nLoginStatus, \nLoginName,\nCreateUserWizard, \nChangePassword\n\nEventually could you point me to...
Given the iPhone's 25k limit for caching of files, I'm wondering if there's interest in an iPhone optimized javascript library that makes caching a top level goal. Since it'd be iPhone only it could get rid of most cross-browser cruft and rely on safari specific capabilities, hopefully cutting down some of the girth an...
The idea of creating an iPhone-optimized JavaScript library with a focus on caching and performance is intriguing, especially considering the constraints of mobile devices and the specific limitations of the iOS environment. Here are some thoughts on the feasibility and potential benefits of such a library: ### Advant...
41,064
[ { "from": "human", "value": "Given the iPhone's 25k limit for caching of files, I'm wondering if there's interest in an iPhone optimized javascript library that makes caching a top level goal. Since it'd be iPhone only it could get rid of most cross-browser cruft and rely on safari specific capabilities, ho...
What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is in the range of valid values?
To convert an `Int` value to the corresponding `Char` in UTF-16, you can cast the integer to a `char` in programming languages that support this. The specific implementation can vary slightly depending on the programming language you are using. Here are examples in a few common programming languages: ### Java In Java...
40,431
[ { "from": "human", "value": "What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is in the range of valid values?\n" }, { "from": "gpt", "value": "To convert an `Int` value to the corresponding `Char` in UTF-16, you can cast the integer to a `char`...
Can someone provide me a sample for a ncover task for a nunit dll?
Certainly! To create a sample NUnit test project that can be used with NCover for code coverage analysis, follow these steps: ### 1. Set Up Your Project First, create a simple .NET project and add a reference to NUnit. You can do this using the .NET CLI: ```bash dotnet new classlib -n SampleLibrary dotnet new nunit ...
40,131
[ { "from": "human", "value": "Can someone provide me a sample for a ncover task for a nunit dll?\n" }, { "from": "gpt", "value": "Certainly! To create a sample NUnit test project that can be used with NCover for code coverage analysis, follow these steps:\n\n### 1. Set Up Your Project\n\nFirst, c...
In the application there is a dialog where only numeric string entries are valid. Therefore I would like to set the numeric keyboard layout. Does anyone know how to simulate key press on the keyboard or any other method to change the keyboard layout? Thanks!
To set up a numeric keyboard layout or to simulate key presses on the keyboard, it depends on the platform or technology stack you are working with (e.g., web, Android, iOS, desktop applications). Here are a few approaches depending on the context: ### 1. Web Applications In a web application, you can set the input ty...
40,252
[ { "from": "human", "value": "In the application there is a dialog where only numeric string entries are valid. Therefore I would like to set the numeric keyboard layout.\nDoes anyone know how to simulate key press on the keyboard or any other method to change the keyboard layout?\nThanks!\n" }, { "f...
I'm trying to create some HtmlHelper extensions and ran into a bit of a roadblock trying to get my extension methods to use attempted values defined by the ViewData.ModelState. The HtmlHelper.GetModelAttemptedValue() method is marked internal and isn't available to my extension methods. Is there a simple alternative in...
In ASP.NET MVC, if you want to retrieve the attempted values from the `ModelState` in your custom `HtmlHelper` extensions, there is indeed a way to do this without directly using `HtmlHelper.GetModelAttemptedValue()`. You can access the `ModelState` directly from the `HtmlHelper.ViewContext` or `HtmlHelper.ViewData` p...
41,200
[ { "from": "human", "value": "I'm trying to create some HtmlHelper extensions and ran into a bit of a roadblock trying to get my extension methods to use attempted values defined by the ViewData.ModelState. The HtmlHelper.GetModelAttemptedValue() method is marked internal and isn't available to my extension ...
When compiling this: char *str = [[NSString stringWithFormat:@"%i days and %i hours", days, hours] UTF8String]; I get this warning: initialization discards qualifiers from pointer target type How do I get rid of it?
The warning you're encountering—"initialization discards qualifiers from pointer target type"—stems from the fact that `UTF8String` returns a `const char *`, while you're trying to assign it to a `char *`. This discrepancy causes the warning since you're discarding the `const` qualifier, which is not safe. To fix this...
43,743
[ { "from": "human", "value": "When compiling this:\nchar *str = [[NSString stringWithFormat:@\"%i days and %i hours\", days, hours] UTF8String];\n\nI get this warning:\ninitialization discards qualifiers from pointer target type\n\nHow do I get rid of it?\n" }, { "from": "gpt", "value": "The warn...
This is probably a n00blike (or worse) question. But I've always viewed a schema as a table definition in a database. This is wrong or not entirely correct. I don't remember much from my database courses.
Your understanding of a schema is partially correct, but it can be expanded to provide a clearer picture. In the context of databases, a schema is more broadly defined as the structure that defines how data is organized and how relationships among data are managed. Here are some key points to clarify the concept of a ...
41,791
[ { "from": "human", "value": "This is probably a n00blike (or worse) question. But I've always viewed a schema as a table definition in a database. This is wrong or not entirely correct. I don't remember much from my database courses. \n" }, { "from": "gpt", "value": "Your understanding of a sche...
DocumentsController#common_query can handle multiple different request styles. i.e. all docs in batch 4 or all docs tagged "happy" I want a single route to make em pretty, so: /documents/common_query?batch=4 /documents/common_query?tag=happy become: /documents/batch/4 /documents/tag/happy So the end result is that #com...
To achieve the desired URL structure while still using the existing `DocumentsController#common_query` method, you'll need to set up your routes and implement a way to extract the parameters from the URL. Here’s how you can do this using Ruby on Rails: ### Step 1: Define the Routes You need to define the new routes i...
40,974
[ { "from": "human", "value": "DocumentsController#common_query can handle multiple different request styles.\ni.e. all docs in batch 4 or all docs tagged \"happy\"\nI want a single route to make em pretty, so:\n/documents/common_query?batch=4\n/documents/common_query?tag=happy\nbecome:\n/documents/batch/4\n/...
I'm looking to write a small proxy server for kicks and giggles. Apart from the options in libWWW, can anyone recommend any opensource options for the HTTP server and client code? Thinking of a library of some kind similar to libWWW. Chosen language is C/C++ but open to Java, C#, Python... etc. :-)
There are several open-source libraries available in various languages that you can use to implement an HTTP proxy server. Here’s a list of some popular options in C/C++, Java, C#, and Python: ### C/C++ 1. **libcurl** - **Description**: A client-side URL transfer library supporting various protocols, including HTT...
35,070
[ { "from": "human", "value": "I'm looking to write a small proxy server for kicks and giggles.\nApart from the options in libWWW, can anyone recommend any opensource options for the HTTP server and client code? Thinking of a library of some kind similar to libWWW.\nChosen language is C/C++ but open to Java, ...
It seems like due to the threading issue logger.warn (thats what I tested) doesn't generate any output? my code is similar to this: def deliver(args) logger.info "delivery start" thread_pool.defer(:deliver_deferred, args) logger.info "delivery end" end def deliver_deferred(args) logger.warn "whatsoever" end A...
The issue you are encountering may stem from how the threading and logging are being handled in your application. Here's a breakdown of what might be happening and how you can troubleshoot or fix the problem: ### Possible Issues 1. **Thread Synchronization**: If the main thread exits before the worker thread has a ch...
38,164
[ { "from": "human", "value": "It seems like due to the threading issue logger.warn (thats what I tested) doesn't generate any output? my code is similar to this:\ndef deliver(args)\n logger.info \"delivery start\"\n thread_pool.defer(:deliver_deferred, args)\n logger.info \"delivery end\"\nend\n\ndef deli...
I have an app that writes messages to the event log. The source I'm passing in to EventLog.WriteEntry does not exist, so the Framework tries to create the source by adding it to the registry. It works fine if the user is an Admin by I get the following whe the user is not an admin: "System.Security.SecurityException : ...
The issue you're facing stems from the fact that modifying the Windows Event Log requires administrative privileges. Even if you've manually created the registry entry with an admin account, the current user still needs to have the necessary permissions to write entries to that log. ### Here's how you can address the ...
40,380
[ { "from": "human", "value": "I have an app that writes messages to the event log. The source I'm passing in to EventLog.WriteEntry does not exist, so the Framework tries to create the source by adding it to the registry. It works fine if the user is an Admin by I get the following whe the user is not an adm...
I think the question says it all. I'm new to Eclipse plugin development, so I'm sure there's an easy answer.
Welcome to Eclipse plugin development! If you have a specific question or topic you're curious about regarding plugin development, feel free to ask. Here are a few common areas where newcomers often seek guidance: 1. **Setting Up the Development Environment**: Ensure you have the Eclipse IDE for RCP and RAP developers...
42,852
[ { "from": "human", "value": "I think the question says it all. I'm new to Eclipse plugin development, so I'm sure there's an easy answer.\n" }, { "from": "gpt", "value": "Welcome to Eclipse plugin development! If you have a specific question or topic you're curious about regarding plugin develo...
In my Mac OS X Activity monitor it lists each "process" id for each application. It links several processes to a single thread, for instance iTunes and Finder are currently both listed under thread 7. The way I learned about threads and processes would lead me to think that this should be the other way around. I learne...
You're correct in your understanding that in operating system terminology, a **process** is typically considered a program in execution, and it can contain one or more **threads** of execution. Each thread can run independently and can perform tasks concurrently within the same process. However, there seems to be a mi...
43,224
[ { "from": "human", "value": "In my Mac OS X Activity monitor it lists each \"process\" id for each application. It links several processes to a single thread, for instance iTunes and Finder are currently both listed under thread 7. The way I learned about threads and processes would lead me to think that th...
I have a class that inherits a generic dictionary and an inteface public class MyDictionary: Dictionary<string, IFoo>, IMyDictionary { } the issue is that consumers of this class are looking for the '.Keys' and ".Values" properties of the interface so i added: /// <summary> /// /// </summary> ICollect...
The error you're encountering occurs because the `Keys` and `Values` properties are already defined in the `Dictionary<string, IFoo>` class, and your `MyDictionary` class is attempting to implement them in the `IMyDictionary` interface. Since both properties have the same name and signature, the compiler needs to know ...
40,953
[ { "from": "human", "value": "I have a class that inherits a generic dictionary and an inteface\npublic class MyDictionary: Dictionary<string, IFoo>, IMyDictionary\n{\n}\n\nthe issue is that consumers of this class are looking for the '.Keys' and \".Values\" properties of the interface so i added:\n /// <...
I have a problem where I want to read an object from the database using Hibernate, change a value, and save the object. If changing the value takes some time, what's the best way to ensure the underlying object in the database has not changed? I am doing this in one transaction (and one session). The code looks someth...
When you're using Hibernate and need to ensure that the underlying data in the database hasn't changed while you are processing it, you can utilize an optimistic locking strategy. This approach involves checking for changes to the entity before you save it back to the database. Here are the steps to implement optimis...
40,688
[ { "from": "human", "value": "I have a problem where I want to read an object from the database using Hibernate, change a value, and save the object. If changing the value takes some time, what's the best way to ensure the underlying object in the database has not changed? I am doing this in one transaction ...
In an impersonation scenario related to Sharepoint I need to execute some code in a separate process (the process will run in the context of a certain user). I do not want to launch a separate application, basically I want to do a "run as" on just a method.
Running code in the context of a different user in .NET, specifically in a SharePoint context, can be a challenging task due to security and permission considerations. However, you can achieve "run as" functionality for a method in several ways, depending on your specific needs and environment. Here’s a high-level over...
37,434
[ { "from": "human", "value": "In an impersonation scenario related to Sharepoint I need to execute some code in a separate process (the process will run in the context of a certain user). I do not want to launch a separate application, basically I want to do a \"run as\" on just a method.\n" }, { "fr...
I had svnserve configured to look at directory "Foo" for the repository it served. Now I changed the configuration from one repository to multiple repositories, all contained in one directory "Bar". I reconfigured svnserve to look at "Bar", but now my client can't find any repositories. What am I doing wrong? Do I need...
When using `svnserve` to serve multiple repositories from a single parent directory (like "Bar"), there are a couple of things to ensure for proper configuration and accessibility. 1. **Directory Structure**: Ensure that your directory structure is correct. If you changed from a single repository ("Foo") to multiple r...
43,002
[ { "from": "human", "value": "I had svnserve configured to look at directory \"Foo\" for the repository it served. Now I changed the configuration from one repository to multiple repositories, all contained in one directory \"Bar\". I reconfigured svnserve to look at \"Bar\", but now my client can't find any...
We use a simple object model for our low level networking code at work where struct pointers are passed around to functions which are pretending to be methods. I've inherited most of this code which was written by consultants with passable C/C++ experience at best and I've spent many late nights trying to refactor code...
In C, without object-oriented features like inheritance or polymorphism, you need to adopt different strategies for mocking dependencies during unit testing. Here are a few approaches you can consider to mock `TcpSocket` and test `foo_transmit_command` effectively without fundamentally redesigning your current code wit...
27,006
[ { "from": "human", "value": "We use a simple object model for our low level networking code at work where struct pointers are passed around to functions which are pretending to be methods. I've inherited most of this code which was written by consultants with passable C/C++ experience at best and I've spent...
We are having some performance issues with a page and I wanted to ask about this. If I have a repeater and in the itemtemplate of the repeater I have a dropdownlist bound to an sql datasource, will that selectcommand be called once per each item even though the same result is returned each time? If so, as a quick fix...
Yes, if you have a `Repeater` and within its `ItemTemplate` you are binding a `DropDownList` to an `SqlDataSource`, the `SelectCommand` of that `SqlDataSource` will be executed for each item in the repeater. This means if your repeater has, for example, 10 items, the same SQL query will be executed 10 times, which can ...
40,626
[ { "from": "human", "value": "We are having some performance issues with a page and I wanted to ask about this. If I have a repeater and in the itemtemplate of the repeater I have a dropdownlist bound to an sql datasource, will that selectcommand be called once per each item even though the same result is r...
I need a small, portable framework for logging on embedded linux. Ideally it would output to a file or a socket, and having some sort of log rotation/compression would also be nice. So far, I've found a lot of frameworks, but almost all of them have daunting build procedures or require the use of application framework...
For a simple and lightweight logging solution in embedded Linux, consider the following options that avoid complex build processes and dependencies: ### 1. **Loguru** - **Description**: Loguru is a lightweight C++ logging library that is easy to use and doesn’t have external dependencies. It's not specifically targete...
40,155
[ { "from": "human", "value": "I need a small, portable framework for logging on embedded linux. Ideally it would output to a file or a socket, and having some sort of log rotation/compression would also be nice.\nSo far, I've found a lot of frameworks, but almost all of them have daunting build procedures o...
Note: The examples below are C# but this problem should not be specific to any language in particular. So I am building an object domain using a variant of the S# Architecture. For those unfamiliar with it, and to save you some reading time the idea is simply that you have a Data Access Object Interface for each of yo...
Circular dependencies in object-oriented design, especially when it comes to data access objects (DAOs), can be a tricky issue to manage. Here are some commonly used strategies to resolve circular dependencies in your scenario: ### 1. **Dependency Injection with Lazy Initialization** You can use lazy initialization fo...
39,264
[ { "from": "human", "value": "Note: The examples below are C# but this problem should not be specific to any language in particular.\nSo I am building an object domain using a variant of the S# Architecture. For those unfamiliar with it, and to save you some reading time the idea is simply that you have a D...
What's the best way to throw an exception in objective-c/cocoa?
In Objective-C, throwing exceptions is not as common as in some other languages, and many developers prefer to use NSError for error handling. However, if you do want to throw an exception, you can use the built-in `@throw` directive. Here's a simple way to throw an exception: 1. Define the exception using `NSExcepti...
39,234
[ { "from": "human", "value": "What's the best way to throw an exception in objective-c/cocoa?\n" }, { "from": "gpt", "value": "In Objective-C, throwing exceptions is not as common as in some other languages, and many developers prefer to use NSError for error handling. However, if you do want to ...
I've been knocking my head against this for some time now. I'm not really sure why it isn't working. I'm still pretty new to this whole WPF business. Here's my XAML for the combobox <ComboBox SelectedValuePath="Type.FullName" SelectedItem="{Binding Path=Type}" Name="cmoBox" /> Here's what populates the C...
It seems like you are having some issues with the binding for your `ComboBox` in WPF. Based on the XAML and the explanation you've provided, here are a few things to check and adjust to ensure the binding works as expected: 1. **Check the DataContext**: Make sure that the `DataContext` you are setting in `groupBox.Dat...
37,401
[ { "from": "human", "value": "I've been knocking my head against this for some time now. I'm not really sure why it isn't working. I'm still pretty new to this whole WPF business. \nHere's my XAML for the combobox\n<ComboBox \n SelectedValuePath=\"Type.FullName\"\n SelectedItem=\"{Binding Path=Type}\"\...
I have a chart with a series that denotes a large set (1000's) of discrete measurements. Some of these are bad measurements and I want to colour the line for the series based on another set of data that describes how accurate the measurements are. Bad measurements should be red and good measurements green and the in be...
Certainly! You can achieve this in VBA for Excel by manipulating the `SeriesCollection` of a chart and changing the color of each data point based on their accuracy values. Below are the steps and a sample code to get you started: ### Steps 1. **Prepare Your Data:** - Ensure you have two sets of data: - The d...
38,535
[ { "from": "human", "value": "I have a chart with a series that denotes a large set (1000's) of discrete measurements. Some of these are bad measurements and I want to colour the line for the series based on another set of data that describes how accurate the measurements are. Bad measurements should be red ...
In designing a fluid layout, how do you use borders without ruining the layout. More specifically, I have a HTML widget which consists of five divs. I would like the five divs to take up all the room in the containing element. I would also like to have a 1px border around each. I tried: .box { float: left; height: 10...
When designing a fluid layout with borders around elements, it's important to account for the box model, which includes the content, padding, border, and margin. A common issue is that adding borders increases the total width of the elements, causing them to exceed the width of their container and potentially wrap to t...
39,875
[ { "from": "human", "value": "In designing a fluid layout, how do you use borders without ruining the layout.\nMore specifically, I have a HTML widget which consists of five divs. I would like the five divs to take up all the room in the containing element. I would also like to have a 1px border around eac...
I am wondering if there is any way to list all the calls to a function in source code, so that I could see the dependencies if I modify that function. One method I use is to search the function name in the "Entire Solution" but I am looking for a better way.
There are several ways to list all calls to a function in source code, each with its own advantages and potential drawbacks. Here are a few approaches you can consider: ### 1. **IDE Features** Many integrated development environments (IDEs) come with built-in features that make it easy to find all references to a func...
40,311
[ { "from": "human", "value": "I am wondering if there is any way to list all the calls to a function in source code, so that I could see the dependencies if I modify that function.\nOne method I use is to search the function name in the \"Entire Solution\" but I am looking for a better way.\n" }, { "...
Background I'm trying out Scons by setting up a basic C++ sample project that has two sub-projects: Prj1 is an EXE that depends on Prj2 Prj2 is a DLL that exports some functions The problem I'm running into is that the library builds its .obj, .pdb, .lib, .dll, etc. files in the same directory as it's SConscript fil...
To configure SCons for multiple projects with dependencies and ensure that their output binaries are directed to a common directory, you've adopted a good approach by utilizing the `SConscript` files and helper functions. This allows you to maintain a clean structure and avoid clutter in your source directories. Here...
38,610
[ { "from": "human", "value": "Background\nI'm trying out Scons by setting up a basic C++ sample project that has two sub-projects: \n\nPrj1 is an EXE that depends on Prj2\nPrj2 is a DLL that exports some functions\n\nThe problem I'm running into is that the library builds its .obj, .pdb, .lib, .dll, etc. fil...
I have installed VS 2008 SP1 on W2k3 OS. After I installed ASP.NET MVC beta and tried creating ASP.NET MVC type project I get the following error. "the project type is not supported by this installation" Let me know if you have fixed this issue.
The error message "the project type is not supported by this installation" typically indicates that Visual Studio is not able to recognize the ASP.NET MVC project type, which can occur due to several reasons. Here are some steps you can take to troubleshoot and resolve the issue: 1. **Check ASP.NET MVC Version**: Ensu...
40,678
[ { "from": "human", "value": "I have installed VS 2008 SP1 on W2k3 OS. After I installed ASP.NET MVC beta and tried creating ASP.NET MVC type project I get the following error.\n\"the project type is not supported by this installation\"\nLet me know if you have fixed this issue.\n" }, { "from": "gpt"...
I have a separate partition on my disk formatted with FAT32. When I hibernate windows, I want to be able to load another OS, create/modify files that are on that partition, then bring Windows out of hibernation and be able to see the changes that I've made. I know what you're going to type, "Well, you're not supposed t...
You're venturing into a territory that can lead to data corruption and instability, as modifying the contents of a partition while Windows is in a hibernated state is not a standard use case and goes against how hibernation is designed to work. However, if you understand the risks and are willing to proceed, here are s...
39,861
[ { "from": "human", "value": "I have a separate partition on my disk formatted with FAT32. When I hibernate windows, I want to be able to load another OS, create/modify files that are on that partition, then bring Windows out of hibernation and be able to see the changes that I've made.\nI know what you're g...
I am tracking the Java versions being used by web visitors: http://cowwoc.blogspot.com/2008/12/tracking-java-versions-using-google.html Unfortunately, the integration level is skin deep. I would like Google Analytics to tell me what percentage of visitors ran what version, and drill down further to find out what sub-at...
To improve the integration of Java version tracking with Google Analytics, as well as to explore alternatives, here are some suggestions: ### Improving Google Analytics Integration 1. **Custom Dimensions:** - Use Google Analytics custom dimensions to track Java versions. Set up a custom dimension for the Java vers...
37,299
[ { "from": "human", "value": "I am tracking the Java versions being used by web visitors: http://cowwoc.blogspot.com/2008/12/tracking-java-versions-using-google.html\nUnfortunately, the integration level is skin deep. I would like Google Analytics to tell me what percentage of visitors ran what version, and ...
It seems to me that most people write their tests against in-memory, in-process databases like SQLite when working with NHibernate. I have this up and running but my first test (that uses NHibernate) always takes between 3-4 seconds to execute. The next test runs much faster. I am using FluentNhibernate to do the mappi...
When working with NHibernate and using Test-Driven Development (TDD), you have several options to optimize your test execution time and maintain effective testing practices. Here are some strategies: ### 1. **Use an In-Memory Database for Testing** Using an in-memory database like SQLite is a common practice because ...
39,496
[ { "from": "human", "value": "It seems to me that most people write their tests against in-memory, in-process databases like SQLite when working with NHibernate. I have this up and running but my first test (that uses NHibernate) always takes between 3-4 seconds to execute. The next test runs much faster.\nI...
I have a stored procedure that creates and opens some cursors. It closes them at the end, but if it hits an error those cursors are left open! Then subsequent runs fail when it tries to create cursors since a cursor with the name already exists. Is there a way I can query which cursors exists and if they are open or ...
In SQL Server, cursors are session-specific and cannot be queried directly to see if they are open. However, you can implement error handling in your stored procedure to ensure that cursors are closed properly, even if an error occurs. One common approach is to use a `TRY...CATCH` block to handle errors in your stored...
40,222
[ { "from": "human", "value": "I have a stored procedure that creates and opens some cursors. It closes them at the end, but if it hits an error those cursors are left open! Then subsequent runs fail when it tries to create cursors since a cursor with the name already exists.\nIs there a way I can query whi...
I have the following structure: class Base { } class Child : Base { } When I try to do the following: DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Base)); serializer.WriteObject(stream, data); It fails with the error message: Type 'MyNamespace.Child' with data contract name 'C...
The error you're encountering is due to the fact that the `DataContractJsonSerializer` does not have any knowledge of the derived class `Child` when serializing an object of type `Base`. To resolve this issue, you need to inform the serializer about the derived types by using the `KnownTypeAttribute` attribute. Here's...
42,293
[ { "from": "human", "value": "I have the following structure:\nclass Base\n{\n}\n\nclass Child : Base\n{\n}\n\nWhen I try to do the following:\nDataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(Base));\nserializer.WriteObject(stream, data);\n\nIt fails with the error message:\n\nT...
On a SQL Server 2005 database, one of our remote developers just checked in a change to a stored procedure that changed a "select scope_identity" to "select @@identity". Do you know of any reasons why you'd use @@identity over scope_identity?
Using `@@IDENTITY` versus `SCOPE_IDENTITY()` in SQL Server has implications that are important to understand, especially in the context of your stored procedure change. ### Differences between `@@IDENTITY` and `SCOPE_IDENTITY()` 1. **Scope**: - `SCOPE_IDENTITY()` returns the last identity value generated for any ...
42,332
[ { "from": "human", "value": "On a SQL Server 2005 database, one of our remote developers just checked in a change to a stored procedure that changed a \"select scope_identity\" to \"select @@identity\". Do you know of any reasons why you'd use @@identity over scope_identity?\n" }, { "from": "gpt", ...
I am unable to build my Web Application (not Web Site) in our build environement. We use DMAKE in our build environment (this unfortunately is non negotiable, therefore using MSBUILD is not permitted ) and when invoking the asp.net precompiler through C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -d -n...
It sounds like you're encountering an issue with the `aspnet_compiler` where it cannot load your application's Global.asax file type, specifically `X.Y.Admin.Site.Global`. This could be due to several reasons related to how your project is set up or how the build process is configured. Below are some troubleshooting st...
36,693
[ { "from": "human", "value": "I am unable to build my Web Application (not Web Site) in our build environement. We use DMAKE in our build environment (this unfortunately is non negotiable, therefore using MSBUILD is not permitted ) and when invoking the asp.net precompiler through\nC:\\Windows\\Microsoft.NET...
The C++ standard dictates that member variables inside a single access section must be layed out in memory in the same order they were declared in. At the same time, compilers are free to choose the mutual ordering of the access sections themselves. This freedom makes it impossible in theory to link binaries created ...
The C++ standard indeed specifies that member variables within a single access section (i.e., public, protected, or private) must be laid out in the order they are declared. This is primarily to ensure predictability and consistency in how member variables are accessed within the same class, enabling developers to reas...
40,045
[ { "from": "human", "value": "The C++ standard dictates that member variables inside a single access section must be layed out in memory in the same order they were declared in. At the same time, compilers are free to choose the mutual ordering of the access sections themselves. This freedom makes it impos...
For a school assignment I have to write x86 assembly code, except I can't use gcc to compile it since my computer is an x64 machine, and gcc is only excpecting x86 code. Is there a command that'll make gcc accept it x86 assembly code? Thanks P.S. I know my code is valid since it compiles just fine on x86 machines.
To compile x86 assembly code on an x64 machine, you can use a cross-compiler or set up your environment to handle the different architecture. The `gcc` compiler can target different architectures if it is set up correctly. Here are a few options you could consider: ### Using a Cross-Compiler 1. **Install a Cross Comp...
41,694
[ { "from": "human", "value": "For a school assignment I have to write x86 assembly code, except I can't use gcc to compile it since my computer is an x64 machine, and gcc is only excpecting x86 code. Is there a command that'll make gcc accept it x86 assembly code? Thanks\nP.S. I know my code is valid sinc...
I have created a site, which parses XML files and display its content on the appropriate page. Is my site a dynamic web page or static web page? How do dynamic and static web pages differ? I feel it's dynamic, because I parse the content from xml files; initially i don't have any content in my main page.. What do you t...
Based on your description, your site is indeed a **dynamic web page**. Here’s why, along with an explanation of the differences between dynamic and static web pages: ### Dynamic Web Pages 1. **Content Generation**: Dynamic web pages generate content on-the-fly based on user interactions or other variables. In your ca...
42,398
[ { "from": "human", "value": "I have created a site, which parses XML files and display its content on the appropriate page. Is my site a dynamic web page or static web page?\nHow do dynamic and static web pages differ?\nI feel it's dynamic, because I parse the content from xml files; initially i don't have ...
I have a general exception handler, Application_error in my global.asax where I'm trying to isolate all the uncaught exceptions on all my many pages. I don't want to use Page_error to catch exception because it's inefficient to call that on so many pages. So where in the exception can I find what page actually caused t...
In ASP.NET, when an unhandled exception occurs, you can use the `Application_Error` method in your `Global.asax` file to log or handle the exception. Unfortunately, the `Application_Error` method itself does not provide a direct way to identify which specific page (or request) caused the exception. However, you can ret...
41,330
[ { "from": "human", "value": "I have a general exception handler, Application_error in my global.asax where I'm trying to isolate all the uncaught exceptions on all my many pages. I don't want to use Page_error to catch exception because it's inefficient to call that on so many pages. So where in the excepti...
in my flex application, I created a Tilelist. In this Tilelist, I am using an ItemRenderer to create a box consisting of an image and an VSlider in each tile. The tile need to be dragable when you click on the image, but not dragable when you slide the slider. How can I achieve this ? I have been scratching my head se...
To achieve the desired functionality where a TileList item is draggable when clicking on the image, but not when sliding the VSlider, you can use a combination of event handling in your ItemRenderer. Below is a step-by-step guide to help you set this up. ### Step 1: Create a Custom ItemRenderer You need to create a c...
33,799
[ { "from": "human", "value": "in my flex application, I created a Tilelist. In this Tilelist, I am using an ItemRenderer to create a box consisting of an image and an VSlider in each tile. \nThe tile need to be dragable when you click on the image, but not dragable when you slide the slider. How can I achiev...
Why EAccessViolation is raised when executing the code below? uses Generics.Collections; ... var list: TList<TNotifyEvent>; ... begin list := TList<TNotifyEvent>.Create(); try list.Add(myNotifyEvent); list.Remove(myNotifyEvent); // EAccessViolation at address... finally FreeAndNil(list); ...
The `EAccessViolation` exception you are encountering when executing the provided code is likely due to the misuse of the `TList<TNotifyEvent>` and how you're handling the event delegates in Delphi. ### Here are a few key points to consider: 1. **Anonymous Method and Event Handler**: In Delphi, `TNotifyEvent` is a pr...
40,449
[ { "from": "human", "value": "Why EAccessViolation is raised when executing the code below? \nuses\n Generics.Collections;\n ...\n\nvar\n list: TList<TNotifyEvent>;\n ...\n\nbegin\n list := TList<TNotifyEvent>.Create();\n try\n list.Add(myNotifyEvent);\n list.Remove(myNotifyEvent); // EAccessVio...
I would like to know which one is the best material that I can hand out to my students about "C# comments".
When preparing materials on C# comments for students, it's essential to present the information clearly and engagingly. Here’s a suggested structure for your material: ### Title: Understanding Comments in C# #### Introduction to Comments - Definition: Comments are annotations in the code that are not executed. They h...
35,572
[ { "from": "human", "value": "I would like to know which one is the best material that I can hand out to my students about \"C# comments\".\n" }, { "from": "gpt", "value": "When preparing materials on C# comments for students, it's essential to present the information clearly and engagingly. Here...
At my office we have an SVN server set up and I'd like to know how much traffic it is using. I'm not interested in the bandwidth, just the total number of 1s and 0s the SVN service is sending/receiving. The data will all be going via the svn:// protocol, and the server is running XP pro.
To measure the total number of bits being sent and received by your SVN server over the `svn://` protocol on a Windows XP Pro machine, you can use a network monitoring tool that can track the traffic specific to the SVN process. Here are some steps you can take: ### Option 1: Using Wireshark Wireshark is a powerful n...
40,729
[ { "from": "human", "value": "At my office we have an SVN server set up and I'd like to know how much traffic it is using. I'm not interested in the bandwidth, just the total number of 1s and 0s the SVN service is sending/receiving.\nThe data will all be going via the svn:// protocol, and the server is runni...
I am developing a .NET CF based Graphics Application, my project involves a lot of drawing images, We have decided to go for porting the application on different handset resolution.(240 X 240 , 480 X 640) etc. How would i go onto achieve this within single solution/project? Is there a need to create different projects...
To develop a .NET Compact Framework (CF) graphics application that can adapt to different handset resolutions (like 240x240, 480x640, etc.) without creating separate projects for each resolution, you can follow these steps: ### 1. Use a Single Project with Resolution Independence Instead of creating multiple projects...
37,992
[ { "from": "human", "value": "I am developing a .NET CF based Graphics Application, my project involves a lot of drawing images, We have decided to go for porting the application on different handset resolution.(240 X 240 , 480 X 640) etc. \nHow would i go onto achieve this within single solution/project?\nI...
I have to build small (for now) admin app in Silverlight2, and would like to use some pattern for binding UI with my BL/DAL. I found view-model-viewmodel and mvp/mvc patterns, where first one (V/M/VM) is specially suited for WPF apps, because it uses rich capabilities of WPF data-binding options. What do you suggest? C...
Certainly! In Silverlight 2, the capabilities for data binding are not as robust as in WPF, but you can still implement a pattern that resembles the View-Model-ViewModel (V/M/VM) pattern. This pattern focuses on separating the UI (View) from the business logic (ViewModel), allowing for easier testing and maintenance. ...
38,380
[ { "from": "human", "value": "I have to build small (for now) admin app in Silverlight2, and would like to use some pattern for binding UI with my BL/DAL.\nI found view-model-viewmodel and mvp/mvc patterns, where first one (V/M/VM) is specially suited for WPF apps, because it uses rich capabilities of WPF da...
I am using the .NET 3.5 SP1 framework and I've implemented URL routing in my application. I was getting javascript errors: Error: ASP.NET Ajax client-side framework failed to load. Resource interpreted as script but transferred with MIME type text/html. ReferenceError: Can't find variable: Sys Which I believe is be...
The issue you're encountering is due to the fact that the `IgnoreRoute` method is not available in the .NET Framework 3.5 SP1, which is why you're seeing the compilation error. The `IgnoreRoute` method was introduced in later versions of ASP.NET, specifically in .NET 4.0 and above. In .NET 3.5, you can achieve similar...
40,602
[ { "from": "human", "value": "I am using the .NET 3.5 SP1 framework and I've implemented URL routing in my application. I was getting javascript errors: \n\nError: ASP.NET Ajax client-side framework failed to load.\nResource interpreted as script but transferred with MIME type text/html.\nReferenceError: Ca...
I have an object I am using to store document meta data into a table. The body text of the document can be very large, sometimes > 2GB so I will be storing it into a nvarchar(max) field in SQL 2008. I'll use SQL 2008 later to index that field. I won't be using filestreams because they are very restrictive to the dat...
When dealing with very large data (such as large text or binary data) in SQL Server, particularly in versions like SQL Server 2008, there are important considerations regarding how to manage it effectively, especially in the context of LINQ to SQL. ### LINQ to SQL and Large Data Handling 1. **OutOfMemory Exception:**...
39,354
[ { "from": "human", "value": "I have an object I am using to store document meta data into a table. The body text of the document can be very large, sometimes > 2GB so I will be storing it into a nvarchar(max) field in SQL 2008. I'll use SQL 2008 later to index that field. I won't be using filestreams bec...
I have some global variables in a Python script. Some functions in that script call into C - is it possible to set one of those variables while in C and if so, how? I appreciate that this isn't a very nice design in the first place, but I need to make a small change to existing code, I don't want to embark on major ref...
Yes, it is possible to set global variables defined in a Python script from C code, especially if you're interfacing with Python through the Python/C API. Here’s a basic overview of how you can achieve this. ### Steps to Set Python Global Variables from C 1. **Include Python Headers**: Ensure your C code includes the...
36,964
[ { "from": "human", "value": "I have some global variables in a Python script. Some functions in that script call into C - is it possible to set one of those variables while in C and if so, how?\nI appreciate that this isn't a very nice design in the first place, but I need to make a small change to existing...
For enterprise web apps, every little bit counts. What performance tips can you share to help programmers program more efficiently? To start it off: Use StringBuilders over strings since strings are Mutable (they get re-created every time you modify them). Avoid using Datasets as they are very bloated, use SqlReader i...
Certainly! Here are several performance tips that can help programmers write more efficient code for enterprise web applications: ### 1. Use Asynchronous Programming - **Use `async` and `await`:** For I/O-bound operations like network calls and database access, using asynchronous programming can help improve responsiv...
38,880
[ { "from": "human", "value": "For enterprise web apps, every little bit counts.\nWhat performance tips can you share to help programmers program more efficiently?\nTo start it off:\n\nUse StringBuilders over strings since strings are Mutable (they get re-created every time you modify them).\nAvoid using Data...
I'm writing a mobile content adaptation plugin for a bespoke CMS in PHP. The CMS contains <img/> links to images with absolute URLs which are all 400 pixels wide and vary in height. I'd like to parse the HTML (which is stored in MySQL) and re-scale each image to a new width - this will vary according to the device. I'd...
To achieve your goal of adapting images for mobile content in your bespoke CMS using PHP, you can either use the GD library or ImageMagick for image processing. Below, I'll outline a solution using both libraries, along with a caching mechanism to avoid unnecessary image resizing on the fly. ### Steps to Implement 1....
30,119
[ { "from": "human", "value": "I'm writing a mobile content adaptation plugin for a bespoke CMS in PHP. The CMS contains <img/> links to images with absolute URLs which are all 400 pixels wide and vary in height.\nI'd like to parse the HTML (which is stored in MySQL) and re-scale each image to a new width - t...
Currently I have the function CreateLog() for creating a a log4net Log with name after the constructing instance's class. Typically used as in: class MessageReceiver { protected ILog Log = Util.CreateLog(); ... } If we remove lots of error handling the implementation boils down to: [EDIT: Please read the lo...
The issue you're facing stems from the fact that `System.Diagnostics.StackFrame` retrieves the method information based on the call stack, and in the case of inheritance, it will refer to the method that is directly invoking `CreateLog()`, which is in the base class (`MessageReceiver`), rather than the derived class. ...
40,105
[ { "from": "human", "value": "Currently I have the function CreateLog() for creating a a log4net Log with name after the constructing instance's class. \nTypically used as in:\nclass MessageReceiver\n{\n protected ILog Log = Util.CreateLog();\n ...\n}\n\nIf we remove lots of error handling the implem...
I am in a Windows Desktop application and I have a data stream and a mime type in the database. Is there a better way than writing it to a temp folder and launching the default editor for it? If I have to use the temp folder how can I get the file extension from the MIME type in a C# Windows Desktop application?
If you want to open a file associated with a MIME type without explicitly saving it to a temporary folder, you can consider using a few different approaches. However, the most common method is indeed saving it temporarily and then launching it with the associated application. This is because most applications expect a ...
39,938
[ { "from": "human", "value": "I am in a Windows Desktop application and I have a data stream and a mime type in the database. Is there a better way than writing it to a temp folder and launching the default editor for it?\nIf I have to use the temp folder how can I get the file extension from the MIME type i...
Can Emacs support the concept of projects? That would be where several configuration options varies depending on what project you are working on.
Yes, Emacs has robust support for projects, allowing you to manage configurations and settings that can vary based on the project you are working on. This functionality is primarily facilitated by several built-in features and packages. Here are some ways you can manage project-specific settings in Emacs: 1. **Project...
37,700
[ { "from": "human", "value": "Can Emacs support the concept of projects? That would be where several configuration options varies depending on what project you are working on.\n" }, { "from": "gpt", "value": "Yes, Emacs has robust support for projects, allowing you to manage configurations and se...
I have a really simple ASP.NET web application and a web setup project that deploys the project output and content files to a virtual directory in IIS. What I want is for the MSI to automatically disable Anonymouse Access for that virtual folder in IIS. I suspect it can probably be done by writing some code in a custo...
In a standard ASP.NET Web Setup Project, there isn’t a built-in option to directly modify IIS settings like enabling or disabling anonymous access for a virtual directory. However, you can achieve this functionality using a custom action in a DLL as you mentioned. Below are the steps to create a custom action that disa...
39,792
[ { "from": "human", "value": "I have a really simple ASP.NET web application and a web setup project that deploys the project output and content files to a virtual directory in IIS.\nWhat I want is for the MSI to automatically disable Anonymouse Access for that virtual folder in IIS. \nI suspect it can proba...
In PHP 5.2 there was a nice security function added called "input_filter", so instead of saying: $name = $_GET['name']; you can now say: $name = filter_input (INPUT_GET, 'name', FILTER_SANITIZE_STRING); and it automatically sanitizes your string, there is also: FILTER_SANITIZE_ENCODED FILTER_SANITIZE_NUMBER_INT FILT...
To achieve your goal of sanitizing input while also allowing for manipulation of the `$_GET` and `$_POST` arrays, you can follow a structured approach. The key is to process the input before calling `filter_input`, as `filter_input` only reads from the superglobals as they are. ### Suggested Approach 1. **Create a Fu...
39,910
[ { "from": "human", "value": "In PHP 5.2 there was a nice security function added called \"input_filter\", so instead of saying:\n$name = $_GET['name'];\n\nyou can now say:\n$name = filter_input (INPUT_GET, 'name', FILTER_SANITIZE_STRING);\n\nand it automatically sanitizes your string, there is also:\n\nFILT...