instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
What is the difference between Object-Oriented Modeling and Object-Oriented Programming? I overheard a conversation on my subway train this morning and it seems that these things are different. Aren't they?
Yes, Object-Oriented Modeling (OOM) and Object-Oriented Programming (OOP) are related but distinct concepts in the realm of software development and design. ### Object-Oriented Modeling (OOM) - **Conceptual Framework**: OOM is primarily concerned with the design and structure of software systems at a high level. It in...
9,815
[ { "from": "human", "value": "What is the difference between Object-Oriented Modeling and Object-Oriented Programming? I overheard a conversation on my subway train this morning and it seems that these things are different. Aren't they?\n" }, { "from": "gpt", "value": "Yes, Object-Oriented Modeli...
I once wrote this line in a Java class. This compiled fine in Eclipse but not on the command line. This is on Eclipse 3.3 JDK 1.5 Windows XP Professional Any clues? Error given on the command line is: Icons.java:16: code too large public static final byte[] compileIcon = { 71, 73, 70, 56, 57, 97, 50, ...
The error message you're encountering, `code too large`, indicates that the method you're trying to compile contains too much bytecode. In Java, there is a limit of 64 KB for any single method's bytecode size, and it seems that your array `compileIcon` is large enough that it's being considered as a large method. Here...
9,167
[ { "from": "human", "value": "I once wrote this line in a Java class. This compiled fine in Eclipse but not on the command line. \nThis is on\n\nEclipse 3.3\nJDK 1.5\nWindows XP Professional\n\nAny clues?\nError given on the command line is:\nIcons.java:16: code too large\n public static final byt...
I think it's associating my Web Service's CS files with the related ASMX files. But whatever's happening, I can't double-click to open the CS files - I have to "view Code" or it opens in the designer. Anyone know how to turn off this automatic behavior? I just want to edit the code!
It sounds like you're experiencing a common issue in Visual Studio where the code-behind files (the `.cs` files) for your ASMX web services are being linked to the designer or the wrong view. Here are some steps you can take to ensure that double-clicking the `.cs` files opens them in the code editor: ### Method 1: Ch...
8,031
[ { "from": "human", "value": "I think it's associating my Web Service's CS files with the related ASMX files. But whatever's happening, I can't double-click to open the CS files - I have to \"view Code\" or it opens in the designer. \nAnyone know how to turn off this automatic behavior? I just want to edi...
What kind of performance implications are there to consider when using try-catch statements in php 5? I've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 and lacks many of the niceties of php 5. So, I don'...
Using `try-catch` statements in PHP 5 introduces several performance implications and considerations that you should be aware of, especially if you're transitioning from PHP 4 where exception handling was not as robust. Here are some points to consider: 1. **Overhead of Exceptions**: Throwing and catching exceptions i...
9,193
[ { "from": "human", "value": "What kind of performance implications are there to consider when using try-catch statements in php 5? \nI've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 and lacks...
We're reviewing some of our practices at work - and the specific thing we're looking at right now is the best method for doing Comms with Flex based clients, and .NET web services. Our typical approach is to first model the interactions based on requirements, mock up some XML messages and sanity check them, turn those...
It sounds like you're grappling with a common challenge when working with relational databases and complex object models, especially when dealing with join tables and the need to keep your serialized output user-friendly for Flex clients. Here are some strategies you could consider to improve your approach: ### 1. **C...
6,306
[ { "from": "human", "value": "We're reviewing some of our practices at work - and the specific thing we're looking at right now is the best method for doing Comms with Flex based clients, and .NET web services. \nOur typical approach is to first model the interactions based on requirements, mock up some XML ...
I've got a custom handler applied to a class (using the Policy Injection Application Block in entlib 4) and I would like to know whether the input method is a property when Invoke is called. Following is what my handler looks like. [ConfigurationElementType(typeof(MyCustomHandlerData))] public class MyCustomHandler : ...
Yes, there is a better way to determine whether a method is a property getter or setter in your custom handler. Instead of parsing the method name to check for `get_` or `set_`, you can utilize the `MethodInfo` class and its properties to check if the method is an accessor of a property. Here's how you can do it: 1. ...
9,273
[ { "from": "human", "value": "I've got a custom handler applied to a class (using the Policy Injection Application Block in entlib 4) and I would like to know whether the input method is a property when Invoke is called. Following is what my handler looks like.\n[ConfigurationElementType(typeof(MyCustomHand...
So you have a String that is retrieved from an admin web UI (so it is definitely a String). How can you find out whether this string is an IP address or a hostname in Java? Update: I think I didn't make myself clear, I was more asking if there is anything in the Java SDK that I can use to distinguish between IPs and ho...
In Java, you can use regular expressions and the `InetAddress` class from the `java.net` package to help determine if a given string is an IP address or a hostname. Here's a basic approach to distinguish between the two: 1. **Check if the string matches the pattern of an IP address** (both IPv4 and IPv6). 2. **If it d...
3,591
[ { "from": "human", "value": "So you have a String that is retrieved from an admin web UI (so it is definitely a String). How can you find out whether this string is an IP address or a hostname in Java?\nUpdate: I think I didn't make myself clear, I was more asking if there is anything in the Java SDK that I...
As many of you probably know, online banks nowadays have a security system whereby you are asked some personal questions before you even enter your password. Once you have answered them, you can choose for the bank to "remember this computer" so that in the future you can login by only entering your password. How does...
The "remember this computer" feature you're referring to typically involves the use of a combination of techniques to securely identify the device you're logging in from, without relying solely on cookies or IP addresses. ### How "Remember This Computer" Works 1. **Tokens**: When you choose to "remember this computer...
5,914
[ { "from": "human", "value": "As many of you probably know, online banks nowadays have a security system whereby you are asked some personal questions before you even enter your password. Once you have answered them, you can choose for the bank to \"remember this computer\" so that in the future you can log...
How do I create a silverlight data template in code? I've seen plenty of examples for WPF, but nothing for Silverlight. Edit: Here's the code I'm now using this for, based on the answer from Santiago below. public DataTemplate Create(Type type) { return (DataTemplate)XamlReader.Load( @"<DataTemplate ...
Creating a `DataTemplate` in Silverlight using code involves using `XamlReader` to load XAML strings. Your current approach is a solid method for dynamically creating data templates. However, if you want to expand on that or make it clearer, here’s a breakdown of how to create a `DataTemplate` for a specific type progr...
8,202
[ { "from": "human", "value": "How do I create a silverlight data template in code? I've seen plenty of examples for WPF, but nothing for Silverlight.\nEdit: Here's the code I'm now using this for, based on the answer from Santiago below.\npublic DataTemplate Create(Type type)\n{\n return (DataTemplate)XamlR...
I quite like the drag and drop pluggable programming blocks in scratch ( http://scratch.mit.edu/ ) I'd like to be able to get users to create their own mini scripts using the same kind of technique... just wondering if anyone knows of anything similar I could utilise in .NET? ideally in WPF.
If you're looking for a way to implement a drag-and-drop programming interface similar to Scratch in a .NET WPF application, there are several options and libraries you might consider: ### 1. **Blockly** - **Overview**: Blockly is a web-based visual programming editor that allows users to build applications by pluggin...
5,809
[ { "from": "human", "value": "I quite like the drag and drop pluggable programming blocks in scratch ( http://scratch.mit.edu/ )\nI'd like to be able to get users to create their own mini scripts using the same kind of technique...\njust wondering if anyone knows of anything similar I could utilise in .NET...
Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all cars made during the 1960s, with a license plate that starts with AZ, ordered by the n...
Using JoSQL is a great option for querying in-memory Java objects, as it provides a SQL-like syntax for performing queries on Java collections. It allows you to write more expressive and readable queries compared to looping through the collection and applying filters manually. However, there are other alternatives and ...
10,517
[ { "from": "human", "value": "Suppose you have a collection of a few hundred in-memory objects and you need to query this List to return objects matching some SQL or Criteria like query. For example, you might have a List of Car objects and you want to return all cars made during the 1960s, with a license pl...
I've encrypted the connectionstring in my web.config file using the steps in the link below: http://www.codeproject.com/KB/database/WebFarmConnStringsNet20.aspx However, whenever I call my application, it will give the following error: Failed to decrypt using provider 'CustomProvider'. Error message from the pro...
The error you're encountering, "Failed to decrypt using provider 'CustomProvider'. Error message from the provider: The RSA key container could not be opened," suggests that there is a permissions issue with the RSA key container you are trying to access. Here are several steps you can take to troubleshoot and resolve ...
8,186
[ { "from": "human", "value": "I've encrypted the connectionstring in my web.config file using the steps in the link below:\nhttp://www.codeproject.com/KB/database/WebFarmConnStringsNet20.aspx\nHowever, whenever I call my application, it will give the following error: \n\nFailed to decrypt using provider\n ...
I'm setting up my team's source control + build/integration process from scratch. We were using VSS and a tool we created in-house to perform the build process. We decided to move on to a more modern environment. I have the SVN running, and I would like to set a continuous integration process with CruiseControl.NET. Is...
Setting up a continuous integration (CI) process with CruiseControl.NET and SVN can streamline your build and deployment processes. Below is a step-by-step guide to help you get started, including best practices. ### Step 1: Install CruiseControl.NET 1. **Download and Install**: - Go to the [CruiseControl.NET web...
3,800
[ { "from": "human", "value": "I'm setting up my team's source control + build/integration process from scratch. We were using VSS and a tool we created in-house to perform the build process. We decided to move on to a more modern environment. I have the SVN running, and I would like to set a continuous integ...
I have a WCF service from which I want to return a DataTable. I know that this is often a highly-debated topic, as far as whether or not returning DataTables is a good practice. Let's put that aside for a moment. When I create a DataTable from scratch, as below, there are no problems whatsoever. The table is created, p...
The issue you're encountering with your WCF service when trying to return a `DataTable` populated from a database query, as opposed to a manually created one, could stem from several potential causes. Here are some considerations and troubleshooting steps you can take: ### 1. DataTable Serialization: `DataTable` uses ...
3,207
[ { "from": "human", "value": "I have a WCF service from which I want to return a DataTable. I know that this is often a highly-debated topic, as far as whether or not returning DataTables is a good practice. Let's put that aside for a moment.\nWhen I create a DataTable from scratch, as below, there are no pr...
Any suggestions for good open source asp.net (C#) apps out there which meet as many of the following:? Designed well and multi tiered Clean & commented code Good use of several design patterns Web pages display properly in all common browsers Produces valid html and has good use of css Use of css themes. Prefer usage ...
Here are several open-source ASP.NET (C#) applications that meet many of your requirements: ### 1. **nopCommerce** - **Description:** An open-source eCommerce solution built on ASP.NET MVC. It's highly customizable and has a vast community. - **Highlights:** - Multi-tier architecture. - Well-structured and comment...
6,558
[ { "from": "human", "value": "Any suggestions for good open source asp.net (C#) apps out there which meet as many of the following:?\n\nDesigned well and multi tiered\nClean & commented code\nGood use of several design patterns\nWeb pages display properly in all common browsers\nProduces valid html and has g...
I found some informations about controlling IIS 5.1 from command line via adsutil.vbs (http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d3df4bc9-0954-459a-b5e6-7a8bc462960c.mspx?mfr=true). The utility is available at c:\InetPub\AdminScripts. The utility throw only errors like the following: Er...
Certainly! To check if a virtual directory exists in IIS 5.1 and create it if it does not, you can use the `adsutil.vbs` script. Here's how you can do this step by step. ### Step 1: Open Command Prompt 1. Click on **Start**. 2. Select **Run**. 3. Type `cmd` and press **Enter** to open the Command Prompt. ### Step 2:...
7,162
[ { "from": "human", "value": "I found some informations about controlling IIS 5.1 from command line via adsutil.vbs (http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/d3df4bc9-0954-459a-b5e6-7a8bc462960c.mspx?mfr=true). The utility is available at c:\\InetPub\\AdminScripts.\nThe util...
This isn't a holy war, this isn't a question of "which is better". What are the pros of using the following format for single statement if blocks. if (x) print "x is true"; if(x) print "x is true"; As opposed to if (x) { print "x is true"; } if(x) { print "x is true"; } If you format your single stateme...
The choice of using bracket-less single statement `if` blocks can have several pros, particularly in the context of code style and personal/team preferences. Here are some potential benefits that may have led programmers to adopt this format: 1. **Compactness**: Removing the brackets can make the code appear more conc...
9,871
[ { "from": "human", "value": "This isn't a holy war, this isn't a question of \"which is better\".\nWhat are the pros of using the following format for single statement if blocks.\nif (x) print \"x is true\";\n\nif(x) \n print \"x is true\";\n\nAs opposed to\nif (x) { print \"x is true\"; }\nif(x) {\n ...
Why was the arguments.callee.caller property deprecated in JavaScript? It was added and then deprecated in JavaScript, but it was omitted altogether by ECMAScript. Some browser (Mozilla, IE) have always supported it and don't have any plans on the map to remove support. Others (Safari, Opera) have adopted support for...
The `arguments.callee.caller` property in JavaScript was deprecated for several reasons, primarily related to performance, maintainability, and the design philosophy of JavaScript. ### Reasons for Deprecation: 1. **Performance Issues**: - Using `arguments.callee` and `arguments.callee.caller` can hinder optimizati...
8,365
[ { "from": "human", "value": "Why was the arguments.callee.caller property deprecated in JavaScript?\nIt was added and then deprecated in JavaScript, but it was omitted altogether by ECMAScript. Some browser (Mozilla, IE) have always supported it and don't have any plans on the map to remove support. Other...
I am writing an editor using Scintilla. I am already using a lexer to do automatic syntax highlighting but now I would like to mark search results. If I want to mark only one hit I can set the selection there, however, I would like to mark (e.g. with yellow background) all the hits. I writing this in Perl but if you ha...
To mark search results in a Scintilla-based editor, you can utilize the `Marker` functionality provided by the Scintilla library. This allows you to set markers at specific positions in the text, enabling you to highlight multiple instances of a search result with a distinct background color. Here is a basic approach ...
8,882
[ { "from": "human", "value": "I am writing an editor using Scintilla.\nI am already using a lexer to do automatic syntax highlighting but now I would like to mark search results. If I want to mark only one hit I can set the selection there, however, I would like to mark (e.g. with yellow background) all the ...
I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.) I'm aware of the "DataFormWebPart" but was unable to get one working properly. It requires a valid DataSource and I was unable...
Hi Steve, Creating a custom web part in SharePoint that integrates well with the UI and functionality is definitely a common requirement. Here are some suggestions to help you achieve your goal, including alternatives to the DataFormWebPart and SPGridView. ### 1. Use of ListView Web Part One option is to leverage the...
7,330
[ { "from": "human", "value": "I've built a web part for Sharepoint that retrieves data from an external service. I'd like to display the items in a way that's UI-compatible with Sharepoint (fits in with its surroundings.)\nI'm aware of the \"DataFormWebPart\" but was unable to get one working properly. It ...
I just started learning JSP technology, and came across a wall. How do you output HTML from a method in <%! ... %> JSP declaration block? This doesn't work: <%! void someOutput() { out.println("Some Output"); } %> ... <% someOutput(); %> Server says there's no “out”. U: I do know how to rewrite code with this met...
In JSP, the `<%! ... %>` declaration block is used to define methods and variables that can be used throughout the JSP page. However, the `out` object, which is a `JspWriter` and is used for sending output to the client, is not available inside the declaration block. The `out` object is accessible only in scriptlet blo...
10,479
[ { "from": "human", "value": "I just started learning JSP technology, and came across a wall.\nHow do you output HTML from a method in <%! ... %> JSP declaration block?\nThis doesn't work:\n<%! \nvoid someOutput() {\n out.println(\"Some Output\");\n}\n%>\n...\n<% someOutput(); %>\n\nServer says there's no...
I have email addresses encoded with HTML character entities. Is there anything in .NET that can convert them to plain strings?
Yes, in .NET you can easily convert HTML character entities back to plain strings using the `System.Net.WebUtility` class, which provides methods for encoding and decoding HTML. Specifically, you can use the `HtmlDecode` method to convert the HTML-encoded strings to plain text. Here's an example of how you can use it:...
11,778
[ { "from": "human", "value": "I have email addresses encoded with HTML character entities. Is there anything in .NET that can convert them to plain strings?\n" }, { "from": "gpt", "value": "Yes, in .NET you can easily convert HTML character entities back to plain strings using the `System.Net.Web...
I'm porting old VB6 code that uses the Winsock control to C#. I haven't done any socket programming and I wonder if anyone has a good reference/tutorial/howto that I can use to start getting up to speed. I'm appealing to the hive mind while I proceed with my generally unproductive googling. I'm using UDP, not TCP at t...
Porting from VB6 using the Winsock control to C# can be quite a task, especially when it comes to understanding socket programming concepts. Since you're working with UDP, it’s important to understand the differences between TCP and UDP as well. Here’s a brief overview and some resources to help you get started with UD...
6,931
[ { "from": "human", "value": "I'm porting old VB6 code that uses the Winsock control to C#. I haven't done any socket programming and I wonder if anyone has a good reference/tutorial/howto that I can use to start getting up to speed.\nI'm appealing to the hive mind while I proceed with my generally unproduc...
List Comprehension for me seems to be like the opaque block of granite that regular expressions are for me. I need pointers. Say, I have a 2D list: li = [[0,1,2],[3,4,5],[6,7,8]] I would like to merge this either into one long list li2 = [0,1,2,3,4,5,6,7,8] or into a string with separators: s = "0,1,2,3,4,5,6,7,8" R...
List comprehensions can indeed seem daunting at first, but they're a powerful and concise way to create lists in Python. Let's break down how to achieve both of your goals using list comprehensions. ### 1. Merging a 2D List into a 1D List To convert your 2D list `li` into a 1D list `li2`, you can use a nested list co...
8,657
[ { "from": "human", "value": "List Comprehension for me seems to be like the opaque block of granite that regular expressions are for me. I need pointers.\nSay, I have a 2D list:\nli = [[0,1,2],[3,4,5],[6,7,8]]\n\nI would like to merge this either into one long list\nli2 = [0,1,2,3,4,5,6,7,8]\n\nor into a st...
What is the difference between the following class methods? Is it that one is static and the other is not? class Test(object): def method_one(self): print "Called method_one" def method_two(): print "Called method_two" a_test = Test() a_test.method_one() a_test.method_two()
Yes, you're correct that there is a difference between the two methods based on how they are defined, but there's more to it than just being static or not. Let's break it down: 1. **Instance Method (`method_one`)**: - Defined as `def method_one(self):`. - It requires an instance of the class (an object) to be ca...
9,517
[ { "from": "human", "value": "What is the difference between the following class methods?\nIs it that one is static and the other is not?\nclass Test(object):\n def method_one(self):\n print \"Called method_one\"\n\n def method_two():\n print \"Called method_two\"\n\na_test = Test()\na_test.method_on...
Although somewhat related to this question, I have what I think is a different take on it. Is a desktop app that has no connections to the "cloud" dead? I believe that some things are going to continue to be on the machine (operating systems obviously, browsers, some light-weight applications), but more and more things...
The question of whether desktop applications that have no connections to the cloud are "dead" is quite complex, as it involves various factors such as user preferences, technological advancements, and the nature of specific tasks. Here are some considerations regarding the future of desktop applications: ### Use Cases...
3,614
[ { "from": "human", "value": "Although somewhat related to this question, I have what I think is a different take on it.\nIs a desktop app that has no connections to the \"cloud\" dead? I believe that some things are going to continue to be on the machine (operating systems obviously, browsers, some light-we...
We are setting up a new SharePoint for which we don't have a valid SSL certificate yet. I would like to call the Lists web service on it to retrieve some meta data about the setup. However, when I try to do this, I get the exception: The underlying connection was closed: Could not establish trust relationship for the ...
When dealing with a temporary or self-signed SSL certificate in a .NET application, you can bypass the SSL certificate validation by handling the `ServicePointManager.ServerCertificateValidationCallback` property. However, be cautious when ignoring SSL errors, especially in production environments, as this can expose y...
10,635
[ { "from": "human", "value": "We are setting up a new SharePoint for which we don't have a valid SSL certificate yet. I would like to call the Lists web service on it to retrieve some meta data about the setup. However, when I try to do this, I get the exception:\n\nThe underlying connection was closed: Coul...
According to Microsoft the FileUpload control is not compatible with an AJAX UpdatePanel. I am aware that a PostBackTrigger can be added to the submit button of the form like this: <Triggers> <asp:PostBackTrigger ControlID="Button1" /> </Triggers> The problem is that this forces the form to perform a full post-back...
Yes, you are correct that the `FileUpload` control cannot be used within an `UpdatePanel` due to the nature of how file uploads work in ASP.NET. The `UpdatePanel` is designed to perform partial postbacks, but the file upload requires a full postback to function correctly. While using a `PostBackTrigger` is one way to ...
7,092
[ { "from": "human", "value": "According to Microsoft the FileUpload control is not compatible with an AJAX UpdatePanel. \nI am aware that a PostBackTrigger can be added to the submit button of the form like this:\n<Triggers>\n <asp:PostBackTrigger ControlID=\"Button1\" />\n</Triggers>\n\nThe problem is that...
So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want it to display properly. The problem that...
It's great to hear that threading resolved your issue with displaying the form over the PowerShell session! However, it's understandable that you'd like to explore a more efficient way to communicate between threads without relying on polling. Here's a breakdown of how to make your implementation cleaner and more res...
5,097
[ { "from": "human", "value": "So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want...
Can anyone point to any websites or web applications that are using the Presentation-Abstraction-Control design pattern rather than MVC? Desktop applications are easy to find like this (e.g.; GIMP) but I'm looking for something on the web.
The Presentation-Abstraction-Control (PAC) design pattern is less commonly discussed in the context of web applications compared to the Model-View-Controller (MVC) pattern. However, there are some web applications and frameworks that exhibit characteristics of the PAC pattern, especially when focusing on modularity and...
9,498
[ { "from": "human", "value": "Can anyone point to any websites or web applications that are using the Presentation-Abstraction-Control design pattern rather than MVC? Desktop applications are easy to find like this (e.g.; GIMP) but I'm looking for something on the web.\n" }, { "from": "gpt", "val...
Does someone know if it is possible to modify the JVM settings at runtime (e.g. -dname=value)? I need this little trick to run my Java stored procedure (oracle 10g).
Modifying JVM settings (like those specified via command-line options such as `-Dname=value`) at runtime in a Java application is not directly supported. JVM options are typically specified at startup, and they configure the JVM environment before any Java code is executed. Once the JVM is running, these options cannot...
9,951
[ { "from": "human", "value": "Does someone know if it is possible to modify the JVM settings at runtime (e.g. -dname=value)?\nI need this little trick to run my Java stored procedure (oracle 10g).\n" }, { "from": "gpt", "value": "Modifying JVM settings (like those specified via command-line optio...
EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters Our business uses the WebMethods integration server to handle most of our outbound communications, and its FTP functionality leaves something to be desired. We are having a problem that may be specific to WebMethods, but if anyone can point me...
Hi Eric, It sounds like you're encountering a frustrating issue with the WebMethods integration server's FTP functionality, particularly with the NLST command when dealing with empty directories. Here are a few potential causes and solutions to explore: 1. **Timeout Settings**: Verify the timeout settings in your Web...
6,757
[ { "from": "human", "value": "EDIT: Learned that Webmethods actually uses NLST, not LIST, if that matters\nOur business uses the WebMethods integration server to handle most of our outbound communications, and its FTP functionality leaves something to be desired. We are having a problem that may be specific...
How do I create an optional parameter in a mysql stored procedure?
In MySQL, you can create a stored procedure with optional parameters by defining the parameters with default values. If the caller does not provide a value for an optional parameter, the default value will be used. Here's the syntax and an example to illustrate how to create a stored procedure with optional parameters....
10,355
[ { "from": "human", "value": "How do I create an optional parameter in a mysql stored procedure?\n" }, { "from": "gpt", "value": "In MySQL, you can create a stored procedure with optional parameters by defining the parameters with default values. If the caller does not provide a value for an opti...
I have a web server and I am currently paying for SVN hosting at a company that specializes in hosting svn. I am thinking of just installing SVN on my dedicated server, are there any security implications of this?
Setting up your own SVN (Subversion) server on a dedicated server can be a viable option, but there are several security implications and best practices to consider. Here are some key points to keep in mind: ### Security Implications 1. **Access Control**: - You must implement proper access controls to ensure that...
6,416
[ { "from": "human", "value": "I have a web server and I am currently paying for SVN hosting at a company that specializes in hosting svn.\nI am thinking of just installing SVN on my dedicated server, are there any security implications of this? \n" }, { "from": "gpt", "value": "Setting up your ow...
A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth. Is this true? How's this technique named?
Yes, what your friend is referring to is a technique often associated with **peer-to-peer (P2P) networking**. In a typical P2P setup, two devices on private networks can communicate with each other indirectly through a public server, often referred to as a signaling server or a rendezvous server. This allows the device...
11,651
[ { "from": "human", "value": "A friend of mine told me there was a way to connect two private IPs without using a proxy server. The idea was that both computers connected to a public server and some how the server joined the private connections and won't use any more bandwidth.\nIs this true? How's this tech...
After successfully building dblink on solaris 10 using Sun C 5.9 SunOS_sparc 2007/05/03 and gmake. I ran gmake installcheck and got the following output: ========== running regression test queries ========== test dblink ... FAILED ====================== 1 of 1 tests failed. The differences tha...
The error you're seeing indicates that the `dblink` extension you built is unable to find a specific symbol (`PG_GETARG_TEXT_PP`) that it expects from the PostgreSQL server library. This usually happens when there's a mismatch between the version of PostgreSQL you are running and the version of `dblink` you have compil...
5,720
[ { "from": "human", "value": "After successfully building dblink on solaris 10 using Sun C 5.9\nSunOS_sparc 2007/05/03 and gmake.\nI ran gmake installcheck and got the following output:\n========== running regression test queries ==========\n\ntest dblink ... FAILED\n\n==================...
I am adding a ADO.Net Data Service lookup feature to an existing web page. Everything works great when running from visual studio, but when I roll it out to IIS, I get the following error: Request ErrorThe server encountered an error processing the request. See server logs for more details. I get this even when tryi...
It sounds like you're facing a common issue when deploying an ADO.NET Data Service to IIS. Here are several steps you can take to diagnose and hopefully resolve the problem: ### 1. Check for Missing Assemblies Make sure that all the necessary assemblies for ADO.NET Data Services are deployed to your IIS environment. S...
10,190
[ { "from": "human", "value": "I am adding a ADO.Net Data Service lookup feature to an existing web page. Everything works great when running from visual studio, but when I roll it out to IIS, I get the following error:\n\nRequest ErrorThe server encountered an error processing the request. See server logs f...
What are the benefits of doing static code analysis on your source code? I was playing around with FxCop and I was wondering if there any benefits beyond making sure you are following the coding standards.
Static code analysis offers a variety of benefits beyond simply ensuring compliance with coding standards. Here are several key advantages: 1. **Early Bug Detection**: Static code analysis helps identify potential issues, bugs, and vulnerabilities in the code before execution. Catching these problems early in the deve...
8,945
[ { "from": "human", "value": "What are the benefits of doing static code analysis on your source code? I was playing around with FxCop and I was wondering if there any benefits beyond making sure you are following the coding standards. \n" }, { "from": "gpt", "value": "Static code analysis offers...
I have been hearing the podcast blog for a while, I hope I dont break this. The question is this: I have to insert an xml to a database. This will be for already defined tables and fields. So what is the best way to accomplish this? So far I am leaning toward programatic. I have been seeing varios options, one is Data...
To insert XML data into a SQL Server database using C# and SQL Server 2005, you can follow a structured approach. Given that you're considering a programmatic solution, here’s a step-by-step guide on how to achieve this: ### Step 1: Prepare Your XML Make sure your XML is well-formed and follows the structure that mat...
5,486
[ { "from": "human", "value": "I have been hearing the podcast blog for a while, I hope I dont break this. \nThe question is this: I have to insert an xml to a database. This will be for already defined tables and fields. So what is the best way to accomplish this? So far I am leaning toward programatic. I ha...
Would the following SQL remove also the index - or does it have to be removed separately? CREATE TABLE #Tbl (field int) CREATE NONCLUSTERED INDEX idx ON #Tbl (field) DROP TABLE #Tbl
When you execute the `DROP TABLE #Tbl` statement in SQL Server, it removes both the table and any associated indexes automatically. Therefore, there is no need to remove the index separately. Here is the summary of the process: 1. When the table `#Tbl` is created, an index `idx` is created on the `field`. 2. When you...
13,309
[ { "from": "human", "value": "Would the following SQL remove also the index - or does it have to be removed separately?\nCREATE TABLE #Tbl (field int)\n\nCREATE NONCLUSTERED INDEX idx ON #Tbl (field)\n\nDROP TABLE #Tbl\n\n" }, { "from": "gpt", "value": "When you execute the `DROP TABLE #Tbl` stat...
I'm trying to rebuild an old metronome application that was originally written using MFC in C++ to be written in .NET using C#. One of the issues I'm running into is playing the midi files that are used to represent the metronome "clicks". I've found a few articles online about playing MIDI in .NET, but most of them se...
Playing MIDI files in a .NET application can indeed be a bit more challenging than working with audio formats like WAV or MP3, mainly because of the way MIDI works and the available libraries in .NET. Here's an overview of how you can handle MIDI playback in C#, along with some practical methods: ### Understanding MID...
4,377
[ { "from": "human", "value": "I'm trying to rebuild an old metronome application that was originally written using MFC in C++ to be written in .NET using C#. One of the issues I'm running into is playing the midi files that are used to represent the metronome \"clicks\".\nI've found a few articles online abo...
Does anyone have examples of how to use DBMS_APPLICATION_INFO package with JBOSS? We have a various applications which run within JBOSS and share db pools. I would like, at the start of each session these applications to identify themselves to the database using DBMS_APPLICATION_INFO so I can more easily track which s...
Using the `DBMS_APPLICATION_INFO` package to set the client identifier for your sessions in a JBoss environment is a great way to track the source of database issues. This can be particularly useful when multiple applications share the same database connection pool. ### Steps to Use DBMS_APPLICATION_INFO in JBoss 1. ...
6,592
[ { "from": "human", "value": "Does anyone have examples of how to use DBMS_APPLICATION_INFO package with JBOSS? \nWe have a various applications which run within JBOSS and share db pools. I would like, at the start of each session these applications to identify themselves to the database using DBMS_APPLICATI...
A coworker of mine has this problem, apparently after installing Re#, which seems totally irrelevant. But perhaps it isn't. Could not load file or assembly "SqlManagerUi, Version=9.0.242.0..." or one of its dependencies. The module was expected to contain an assembly manifest. (mscorlib). Why is this? Thanks
The error message you're seeing indicates that the .NET runtime is having trouble loading a specific assembly, `SqlManagerUi`, which is part of SQL Server Management Studio (SSMS) and is related to SQL Server tools. The error message suggests that the assembly may be either missing, corrupted, or that there is a versio...
10,461
[ { "from": "human", "value": "A coworker of mine has this problem, apparently after installing Re#, which seems totally irrelevant. But perhaps it isn't.\nCould not load file or assembly \"SqlManagerUi, Version=9.0.242.0...\" or one of its dependencies. The module was expected to contain an assembly manifest...
Following this question: Good crash reporting library in c# Is there any library like CrashRpt.dll that does the same on Linux? That is, generate a failure report including a core dump and any necessary environment and notify the developer about it? Edit: This seems to be a duplicate of this question
For crash reporting in C# applications running on Linux, there are several options that can help you generate crash reports, including core dumps and additional context about the application's state. While there isn't a direct equivalent to CrashRpt.dll for Linux, you can consider the following libraries and tools: 1....
9,796
[ { "from": "human", "value": "Following this question:\nGood crash reporting library in c#\nIs there any library like CrashRpt.dll that does the same on Linux? That is, generate a failure report including a core dump and any necessary environment and notify the developer about it?\nEdit: This seems to be a ...
Considering such code: class ToBeTested { public: void doForEach() { for (vector<Contained>::iterator it = m_contained.begin(); it != m_contained.end(); it++) { doOnce(*it); doTwice(*it); doTwice(*it); } } void doOnce(Contained & c) { // do something } void doTwice(Contained &...
To test the execution order and count of function calls in C++, you can use a mocking framework. Both GoogleTest (gtest) and GoogleMock (gmock) can be used together for this purpose. You can create mock versions of the `doOnce` and `doTwice` methods and verify the order and number of calls made to these methods when ...
4,695
[ { "from": "human", "value": "Considering such code:\nclass ToBeTested {\npublic:\n void doForEach() {\n for (vector<Contained>::iterator it = m_contained.begin(); it != m_contained.end(); it++) {\n doOnce(*it);\n doTwice(*it);\n doTwice(*it);\n }\n }\n void doOnce(Contained & c) {...
One of the things I miss the most in ActionScript is the lack of operator overloading, in particular ==. I kind of work around this issue by adding a "Compare" method to my classes, but that doesn't help in many cases, like when you want to use things like the built in Dictionary. Is there a good way to work around thi...
ActionScript does indeed lack operator overloading, which can make it challenging to implement equality checks in a way that's as seamless as in some other languages. Here are a few workarounds that you can use to achieve a similar effect, especially when working with collections like the `Dictionary`. ### 1. Using a ...
6,801
[ { "from": "human", "value": "One of the things I miss the most in ActionScript is the lack of operator overloading, in particular ==. I kind of work around this issue by adding a \"Compare\" method to my classes, but that doesn't help in many cases, like when you want to use things like the built in Diction...
We're having problem with a huge number of legacy stored procedures at work. Do you guys recommend any tool the can help better understand those procedures? Some kind of reverse engineering that indentifies inter-procedure dependencies and/or procedure vs. tables dependencies. Can be a free or commercial tool. Thanks!
Managing legacy stored procedures can indeed be challenging, especially when it comes to understanding dependencies and interrelations among them. Here are some tools, both free and commercial, that can help you analyze and reverse engineer stored procedures: ### Free Tools 1. **SQL Server Management Studio (SSMS)**:...
8,617
[ { "from": "human", "value": "We're having problem with a huge number of legacy stored procedures at work. Do you guys recommend any tool the can help better understand those procedures? Some kind of reverse engineering that indentifies inter-procedure dependencies and/or procedure vs. tables dependencies. C...
It's a bit difficult to implement a deep object copy function. What steps you take to ensure the original object and the cloned one share no reference?
Implementing a deep copy function requires careful consideration of how objects are structured and what types of data they may contain. The goal is to create a new instance of an object that is a complete copy of the original, with no shared references to mutable objects. Here are the general steps you can follow to im...
5,783
[ { "from": "human", "value": "It's a bit difficult to implement a deep object copy function. What steps you take to ensure the original object and the cloned one share no reference? \n" }, { "from": "gpt", "value": "Implementing a deep copy function requires careful consideration of how objects a...
I have the following setup: Code on my local machine (OS X) shared as a Samba share A Ubuntu VM running within Parallels, mounts the share Running Rails 2.1 (either via Mongrel, WEBrick or passenger) in development mode, if I make changes to my views they don't update without me having to kick the server. I've tried ...
It sounds like you're facing issues with file change detection in your Rails development environment running on a VM with mounted Samba or NFS shares. Here are some potential solutions and workarounds to address this issue: ### 1. **File System Notifications** Rails relies on file system notifications to detect change...
6,456
[ { "from": "human", "value": "I have the following setup:\n\nCode on my local machine (OS X) shared as a Samba share\nA Ubuntu VM running within Parallels, mounts the share\n\nRunning Rails 2.1 (either via Mongrel, WEBrick or passenger) in development mode, if I make changes to my views they don't update wit...
I've recently inherited a internationalized and text-heavy Struts 1.1 web application. Many of the JSP files look like: <p> <bean:message key="alert" /> </p> and the properties files look like: messages.properties alert=Please update your <a href="/address.do">address</a> and <a href="/contact.do">contact informat...
You are facing common issues when dealing with internationalization (i18n) in web applications, particularly when using Struts 1.1 with JSP. Here are several strategies to tackle the problems you've outlined: ### 1. Use Placeholders with a Custom Tag or Utility Function To solve the issue with the action URLs and kee...
6,458
[ { "from": "human", "value": "I've recently inherited a internationalized and text-heavy Struts 1.1 web application. Many of the JSP files look like:\n<p>\n <bean:message key=\"alert\" />\n</p>\n\nand the properties files look like:\nmessages.properties\nalert=Please update your <a href=\"/address.do\">ad...
What is the best compilable scripting language for Win32? I prefer .EXE's because I don't want to install the runtime on the servers first (my company administrates many via remote), but I need to be able to do things like NTFS permissions and (if possible) APIs over the network. There was a small Perl which appeared ...
Given your requirements for a compilable scripting language on Windows that can produce standalone `.EXE` files, manipulate NTFS permissions, and handle APIs over the network, here are several options you might consider: ### 1. **Go (Golang)** - **Pros**: Go is a statically typed language that compiles to a single bi...
8,584
[ { "from": "human", "value": "What is the best compilable scripting language for Win32? I prefer .EXE's because I don't want to install the runtime on the servers first (my company administrates many via remote), but I need to be able to do things like NTFS permissions and (if possible) APIs over the networ...
How do I compile, link and call different YACC grammars using yyparse() in one program?
To compile, link, and call different YACC (Yet Another Compiler Compiler) grammars using `yyparse()` in one program, you will need to follow a few steps. Here’s a structured approach: ### Step 1: Create YACC Grammars Assume you have two YACC files: `grammar1.y` and `grammar2.y`. **grammar1.y:** ```yacc %{ #include <...
1,536
[ { "from": "human", "value": "How do I compile, link and call different YACC grammars using yyparse() in one program?\n" }, { "from": "gpt", "value": "To compile, link, and call different YACC (Yet Another Compiler Compiler) grammars using `yyparse()` in one program, you will need to follow a few...
I heard Joel and Jeff talking about sIFR in one of the early podcasts. I've been using it on www.american-data.com and www.chartright.us with some fairly mixed results. Yesterday I was informed that the first line of text on my website appeared upside down in Internet Explorer 6 without flash player. I'm pretty sure ...
sIFR (Scalable Inman Flash Replacement) is a technique that allows web designers to use custom fonts on their websites by replacing HTML text with Flash-based text. While it can provide a way to achieve better typography on the web, it also comes with some caveats, especially when it comes to browser compatibility and ...
8,014
[ { "from": "human", "value": "I heard Joel and Jeff talking about sIFR in one of the early podcasts. I've been using it on www.american-data.com and www.chartright.us with some fairly mixed results. \nYesterday I was informed that the first line of text on my website appeared upside down in Internet Explore...
I have settled a web synchronization between SQLSERVER 2005 as publisher and SQLEXPRESS as suscriber. Web synchro has to be launched manually through IE interface (menu tools/synchronize) and to be selected among available synchronizations. Everything is working fine except that I did not find a way to automate the syn...
Automating the web synchronization between SQL Server 2005 as a publisher and SQL Server Express as a subscriber can be accomplished through several methods. While SQL Server Replication does not provide a direct way to automate web synchronization through the Internet Explorer interface, you can consider the following...
6,943
[ { "from": "human", "value": "I have settled a web synchronization between SQLSERVER 2005 as publisher and SQLEXPRESS as suscriber. Web synchro has to be launched manually through IE interface (menu tools/synchronize) and to be selected among available synchronizations.\nEverything is working fine except tha...
Let's say that on the C++ side my function takes a variable of type jstring named myString. I can convert it to an ANSI string as follows: const char* ansiString = env->GetStringUTFChars(myString, 0); is there a way of getting const wchar_t* unicodeString = ...
Yes, you can convert a `jstring` to a wide character string (`const wchar_t*`) in C++ using the Java Native Interface (JNI). To achieve this, you need to first convert the `jstring` to a UTF-16 encoded string, which is the internal representation of strings in Java (since Java strings are UTF-16). Here's how you can do...
7,288
[ { "from": "human", "value": "Let's say that on the C++ side my function takes a variable of type jstring named myString. I can convert it to an ANSI string as follows:\nconst char* ansiString = env->GetStringUTFChars(myString, 0);\n\nis there a way of getting\nconst wchar_t* unicodeString = ...\n" }, { ...
We have two versions of a managed C++ assembly, one for x86 and one for x64. This assembly is called by a .net application complied for AnyCPU. We are deploying our code via a file copy install, and would like to continue to do so. Is it possible to use a Side-by-Side assembly manifest to loading a x86 or x64 assembl...
In a file copy deployment scenario, particularly when you're dealing with a .NET application compiled for AnyCPU that needs to reference different versions of a native (managed C++) assembly based on the processor architecture (x86 or x64), you cannot rely solely on Side-by-Side assemblies or application manifests. S...
10,325
[ { "from": "human", "value": "We have two versions of a managed C++ assembly, one for x86 and one for x64. This assembly is called by a .net application complied for AnyCPU. We are deploying our code via a file copy install, and would like to continue to do so.\nIs it possible to use a Side-by-Side assembl...
Some files in our repository are individual to each developer. For example some developers use a local database, which is configured in a properties file in the project. So each developer has different settings. When one developer commits, he always has to take care to not commit his individually configured files. How ...
Handling individual developer configurations in a shared repository can be a common challenge. Here are some best practices to manage these scenarios effectively: ### 1. **Use a `.gitignore` file** Add the files that contain developer-specific configurations to your `.gitignore` file. This ensures that these files are...
9,957
[ { "from": "human", "value": "Some files in our repository are individual to each developer. For example some developers use a local database, which is configured in a properties file in the project. So each developer has different settings. When one developer commits, he always has to take care to not commi...
Right now, we're using PGP command line 9.0. Does anybody know if GnuPG will work? It'd be a lot cheaper. EDIT: Theoretically, GnuPG/PGP/McAfee eBusiness Server should be able to interoperate. In practice, you pretty much just have to test to see. We did not make GnuPG work with McAfee eBusiness Server.
GnuPG (GNU Privacy Guard) is a free implementation of the OpenPGP standard, and it is designed to be compatible with PGP. In theory, GnuPG should be able to interoperate with your existing PGP command line tools, as both adhere to the same standards. However, interoperability in practice can sometimes be tricky due to...
8,652
[ { "from": "human", "value": "Right now, we're using PGP command line 9.0. Does anybody know if GnuPG will work? It'd be a lot cheaper.\nEDIT:\nTheoretically, GnuPG/PGP/McAfee eBusiness Server should be able to interoperate. In practice, you pretty much just have to test to see. We did not make GnuPG work ...
I'm inserting multiple records into a table A from another table B. Is there a way to get the identity value of table A record and update table b record with out doing a cursor? Create Table A (id int identity, Fname nvarchar(50), Lname nvarchar(50)) Create Table B (Fname nvarchar(50), Lname nvarchar(50), NewId int) ...
In SQL Server 2005, if you want to insert multiple records from Table B into Table A and simultaneously update Table B with the generated identity values from Table A, you can use the `OUTPUT` clause in your `INSERT` statement. The `OUTPUT` clause allows you to capture the identity values generated during the insert op...
9,249
[ { "from": "human", "value": "I'm inserting multiple records into a table A from another table B. Is there a way to get the identity value of table A record and update table b record with out doing a cursor?\nCreate Table A\n(id int identity,\nFname nvarchar(50),\nLname nvarchar(50))\n\nCreate Table B\n(Fnam...
Is there any way to create C# 3.0 anonymous object via Reflection at runtime in .NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically. edited later to clarify the use case An extra constraint is that I will be running all of it inside a Silverlight app, so ex...
Creating C# anonymous types at runtime via reflection in .NET 3.5 (including Silverlight) is quite challenging because anonymous types are essentially generated classes with compiler-generated names. However, you can create similar functionality by using the `ExpandoObject` class, which is available in .NET 4.0 and lat...
8,756
[ { "from": "human", "value": "Is there any way to create C# 3.0 anonymous object via Reflection at runtime in .NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically.\nedited later to clarify the use case\nAn extra constraint is that I will be runnin...
I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that?
When dealing with ASP.NET applications that are using different versions of the framework (in this case, ASP.NET 1.1 and ASP.NET 2.0), there are several considerations regarding authentication and logout mechanisms. 1. **Forms Authentication Basics**: The `FormsAuthentication.SignOut()` method in ASP.NET effectively c...
9,501
[ { "from": "human", "value": "I have a main asp.net app, which is written in asp.net 1.1. Runnning underneath the application are several 2.0 apps. To completely logout a user can I just logout of the 1.1 app with FormsAuthentication.SignOut or is it more complicated than that?\n" }, { "from": "gpt",...
At home we have a proxy server. At work we don't. Firefox irritates in this regard: whenever I launch it, it defaults to the proxy server. If I do Tools>Options>Settings and select "No proxy", no problem. However, if I shutdown Firefox and restart it, I have to do the Tools>Options>Settings thing all over again because...
It sounds like you're encountering a common issue with Firefox and its handling of proxy settings. Here are a few methods to make the "No proxy" setting stick or to toggle between proxy settings: ### Method 1: Modify Firefox Preferences Directly 1. **Open Firefox**. 2. In the address bar, type `about:config` and pres...
7,522
[ { "from": "human", "value": "At home we have a proxy server. At work we don't. Firefox irritates in this regard: whenever I launch it, it defaults to the proxy server. If I do Tools>Options>Settings and select \"No proxy\", no problem. However, if I shutdown Firefox and restart it, I have to do the Tools>Op...
I'm trying to run the Tomcat with JBoss Embedded jpa booking example. I run the build and deploy the war. I then get the following error: ERROR [catalina.core.ContainerBase.[Catalina].[localhost].[/jboss-seam-jpa]] Error configuring application listener of class com.sun.faces.config.ConfigureListener java.lang.NoCla...
The error messages you're encountering suggest that your application is missing some necessary JAR files for running JSF (JavaServer Faces) with EL (Expression Language) support on Tomcat 5.5.x. The specific missing classes are part of the EL API and its implementation. Here's a step-by-step guide to help you resolve ...
6,907
[ { "from": "human", "value": "I'm trying to run the Tomcat with JBoss Embedded jpa booking example. I run the build and deploy the war. I then get the following error:\n\nERROR [catalina.core.ContainerBase.[Catalina].[localhost].[/jboss-seam-jpa]] Error configuring application listener of class com.sun.fac...
I'd like to write some quick scripts to play with bluetooth devices (scan etc…), for the Mac. Under linux I'd probably use hcitool, or the python bluez library. What tools are there for the Mac?
On macOS, you can work with Bluetooth devices using several command-line tools and libraries. Here are some options you might find helpful: ### Command-Line Tools 1. **`blueutil`**: - A command-line utility that provides Bluetooth functionalities such as turning Bluetooth on/off, scanning for devices, and more. ...
7,878
[ { "from": "human", "value": "I'd like to write some quick scripts to play with bluetooth devices (scan etc…), for the Mac. Under linux I'd probably use hcitool, or the python bluez library. \nWhat tools are there for the Mac?\n" }, { "from": "gpt", "value": "On macOS, you can work with Bluetooth...
Killing the processs while obtaining this information would be fine.
It seems like you may be looking for instructions on how to kill a specific process while obtaining information about it in a system. This process can vary depending on the operating system you are using. Here are the instructions for both Windows and Unix-like systems (Linux, macOS): ### On Windows: 1. **Open Comman...
9,524
[ { "from": "human", "value": "Killing the processs while obtaining this information would be fine.\n" }, { "from": "gpt", "value": "It seems like you may be looking for instructions on how to kill a specific process while obtaining information about it in a system. This process can vary depending...
int i = 4; string text = "Player "; cout << (text + i); I'd like it to print Player 4. The above is obviously wrong but it shows what I'm trying to do here. Is there an easy way to do this or do I have to start adding new includes?
In C++, you cannot directly concatenate a string and an integer using the `+` operator because the `+` operator is not overloaded for this combination. You have a few options to achieve your goal of printing "Player 4". You can convert the integer to a string first or use string formatting. Here are a few common method...
10,658
[ { "from": "human", "value": "int i = 4;\nstring text = \"Player \";\ncout << (text + i);\n\nI'd like it to print Player 4.\nThe above is obviously wrong but it shows what I'm trying to do here. Is there an easy way to do this or do I have to start adding new includes?\n" }, { "from": "gpt", "val...
I have an many embedded objects (shapes) in a worksheet and the icons is displayed inside a cell. How do I know the Cell range in which the shape object is displayed. Example: When I select a B2 and then select the object(shape) in the B17, and I query on the Cell.Address it shows B2 - how do I get the cell address a...
In Excel, when you have shapes (or other embedded objects) in a worksheet, they can overlap with cells, and sometimes selecting a shape can cause the active cell reference to change. However, you can use VBA (Visual Basic for Applications) to find out which cell a shape is currently covering. Here's a simple VBA code ...
8,685
[ { "from": "human", "value": "I have an many embedded objects (shapes) in a worksheet and the icons is displayed inside a cell. How do I know the Cell range in which the shape object is displayed. \nExample: When I select a B2 and then select the object(shape) in the B17, and I query on the Cell.Address it ...
I am looking for some JavaScript plugin (preferably jQuery) to be able to scroll through an image, in the same way that Google Maps works. I can make the image draggable but then I see the whole image while dragging even if the parent div is overflow:hidden. Any help would be greatly appreciated!
To create a scrollable image interface similar to Google Maps using jQuery, you can use a combination of mouse events and CSS to achieve the desired functionality. Below is a simple example of how you can implement this: ### HTML Structure ```html <div id="image-container"> <img id="draggable-image" src="your-ima...
6,997
[ { "from": "human", "value": "I am looking for some JavaScript plugin (preferably jQuery) to be able to scroll through an image, in the same way that Google Maps works.\nI can make the image draggable but then I see the whole image while dragging even if the parent div is overflow:hidden.\nAny help would be ...
When I originally was introduced to Mocks I felt the primary purpose was to mock up objects that come from external sources of data. This way I did not have to maintain an automated unit testing test database, I could just fake it. But now I am starting to think of it differently. I am wondering if Mocks are more eff...
Your reflections on using mocks for unit testing highlight a common debate among software developers and testers regarding the balance between isolation and integration in testing. Here are several key points to consider regarding your approach: ### Purpose of Mocks - **Isolation**: Mocks are indeed useful for isolati...
7,300
[ { "from": "human", "value": "When I originally was introduced to Mocks I felt the primary purpose was to mock up objects that come from external sources of data. This way I did not have to maintain an automated unit testing test database, I could just fake it.\nBut now I am starting to think of it differen...
this wiki page gave a general idea of how to convert a single char to ascii http://en.wikibooks.org/wiki/Ruby_Programming/ASCII But say if I have a string and I wanted to get each character's ascii from it, what do i need to do? "string".each_byte do |c| $char = c.chr $ascii = ?char puts $ascii end I...
To convert each character of a string to its ASCII value in Ruby, you can use the `each_byte` method, which iterates over each byte of the string. The `each_byte` method gives you the ASCII value directly, so you don't need to convert the character back using `chr`. Here's a corrected version of your code that prints ...
11,870
[ { "from": "human", "value": "this wiki page gave a general idea of how to convert a single char to ascii http://en.wikibooks.org/wiki/Ruby_Programming/ASCII\nBut say if I have a string and I wanted to get each character's ascii from it, what do i need to do?\n\"string\".each_byte do |c|\n $char = c.chr...
I'm trying to understand how namespaces work in XML. When I have an element like foo:bar, the attributes will often not have namespaces on them. But sometimes they will. Are the attribute in the namespace of the element, even when the default namespace has been declared? Looking over the xsd for xhtml it seems the attr...
In XML, namespaces are a mechanism to avoid naming conflicts by qualifying names of elements and attributes in XML documents. Here's a basic breakdown of how namespaces work, especially in relation to your question about attributes. ### Namespaces in XML 1. **Defining a Namespace**: - A namespace is defined in XML...
7,075
[ { "from": "human", "value": "I'm trying to understand how namespaces work in XML. When I have an element like foo:bar, the attributes will often not have namespaces on them. But sometimes they will. Are the attribute in the namespace of the element, even when the default namespace has been declared? Looking...
I want to store the current URL in a session variable to reference the previous visited page. If I store every URL (via a before_filter on ApplicationController), also actions which end in a redirect (create, update, etc) are considered as last visited page. Is there a way to tell Rails only to execute a function if a ...
You're on the right track with using the `after_filter` (now `after_action` in newer Rails versions) to store the previous page URL in the session or flash. However, your current solution of checking for the existence of a template file is not ideal and may not work in all cases (e.g., partials, layouts, etc.). A more...
8,727
[ { "from": "human", "value": "I want to store the current URL in a session variable to reference the previous visited page.\nIf I store every URL (via a before_filter on ApplicationController), also actions which end in a redirect (create, update, etc) are considered as last visited page.\nIs there a way to ...
I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them?
Testing private methods is a topic that often generates debate among developers. Here are some considerations to help you determine whether to test private methods: ### Reasons Not to Test Private Methods: 1. **Encapsulation**: Private methods are implementation details. The idea is that you should be testing the pub...
8,812
[ { "from": "human", "value": "I have read this post about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them?\n" }, { "from": "gpt...
On a small embedded system project we have some code which we would like to run in a thread so we are electing to build in top of an embedded RTOS (eCos). Previously, we have used a cyclic executive in main() that drove tasks each implemented as a state machine. For some tasks we encountered problems where the task wo...
Mixing an RTOS and a cyclic executive can make sense in certain scenarios, especially in an embedded system with limited resources like yours. Here are some considerations to help you evaluate this approach: ### Advantages: 1. **Simplicity in Design**: By using a cyclic executive to handle multiple tasks, you can avoi...
8,772
[ { "from": "human", "value": "On a small embedded system project we have some code which we would like to run in a thread so we are electing to build in top of an embedded RTOS (eCos). \nPreviously, we have used a cyclic executive in main() that drove tasks each implemented as a state machine. For some tasks...
What would be the best strategy to generate anagrams. An anagram is a type of word play, the result of rearranging the letters of a word or phrase to produce a new word or phrase, using all the original letters exactly once; ex. Eleven plus two is anagram of Twelve plus one A decimal point is anagram of I'm a dot...
Generating anagrams efficiently while filtering for valid words from a dictionary can be approached systematically. Here’s a step-by-step strategy you can follow: ### 1. **Create a Dictionary:** Start with a comprehensive dictionary or word list. This can be a simple list of valid words stored in a data structure t...
7,166
[ { "from": "human", "value": "What would be the best strategy to generate anagrams.\n\nAn anagram is a type of word play, the result of rearranging the letters\nof a word or phrase to produce a new word or phrase, using all the original\nletters exactly once; \nex.\n\n\nEleven plus two is anagram of Twelve ...
How can I change the width of a textarea form element if I used ModelForm to create it? Here is my product class: class ProductForm(ModelForm): long_desc = forms.CharField(widget=forms.Textarea) short_desc = forms.CharField(widget=forms.Textarea) class Meta: model = Product And the template code......
To change the width of a `Textarea` form element in a Django `ModelForm`, you can customize the widget in the form definition. Specifically, you can set the `attrs` attribute of the `Textarea` widget to specify the `cols` and `rows` attributes or set a CSS class for styling. Here’s how you can modify your `ProductForm...
8,519
[ { "from": "human", "value": "How can I change the width of a textarea form element if I used ModelForm to create it?\nHere is my product class:\nclass ProductForm(ModelForm):\n long_desc = forms.CharField(widget=forms.Textarea)\n short_desc = forms.CharField(widget=forms.Textarea)\n class Meta:\n ...
General Follow the same standards for all tests. Be clear about what each test state is. Be specific about the expected behavior. Examples 1) MethodName_StateUnderTest_ExpectedBehavior Public void Sum_NegativeNumberAs1stParam_ExceptionThrown() Public void Sum_NegativeNumberAs2ndParam_ExceptionThrown () Public voi...
To follow the naming standards for unit tests effectively, you can use a structured approach to ensure clarity and consistency. Below are examples of how to structure your test method names according to the guidelines provided: ### Test Naming Standards 1. **Method Naming Convention**: - Format: `ClassName_Method...
9,336
[ { "from": "human", "value": "General\n\nFollow the same standards for all tests.\nBe clear about what each test state is.\nBe specific about the expected behavior.\n\nExamples\n1) MethodName_StateUnderTest_ExpectedBehavior\nPublic void Sum_NegativeNumberAs1stParam_ExceptionThrown() \n\nPublic void Sum_Negat...
So far I had "designed" my app-icon in the Visual-Studio-Editor. 16-Colors, 4kB. Now someone created a more sophisticated and up-to-date app-icon for me, which results in a filesize of about 250kB. Problem: A user reported, that win2000 is complaining, because it is not able to digest this amount of data for an icon. ...
When creating application icons, especially for compatibility with older operating systems like Windows 2000, it’s important to consider the following best practices regarding resolutions and color depths. ### 1. **Icon Resolutions:** Icons should generally include multiple sizes to accommodate different display requi...
7,774
[ { "from": "human", "value": "So far I had \"designed\" my app-icon in the Visual-Studio-Editor. 16-Colors, 4kB.\nNow someone created a more sophisticated and up-to-date app-icon for me, which results in a filesize of about 250kB. \nProblem: A user reported, that win2000 is complaining, because it is not abl...
How do I make diff ignore temporary files like foo.c~? Is there a configuration file that will make ignoring temporaries the default? More generally: what's the best way to generate a "clean" patch off a tarball? I do this rarely enough (submitting a bug fix to an OSS project by email) that I always struggle with it......
To configure `diff` to ignore temporary files like `foo.c~`, you can use the `-x` option as you've noted. However, if you want to make this behavior more convenient and reusable, there are a few approaches you can consider. ### Using a Configuration File for Diff Unfortunately, `diff` doesn't support a global configu...
6,172
[ { "from": "human", "value": "How do I make diff ignore temporary files like foo.c~? Is there a configuration file that will make ignoring temporaries the default?\nMore generally: what's the best way to generate a \"clean\" patch off a tarball? I do this rarely enough (submitting a bug fix to an OSS project...
How do I best convert a System.Data.DbType enumeration value to the corresponding (or at least one of the possible corresponding) System.Type values? For example: DbType.StringFixedLength -> System.String DbType.String -> System.String DbType.Int32 -> System.Int32 I've only seen very "dirty" solutions but nothing rea...
To convert a `System.Data.DbType` enumeration value to the corresponding `System.Type`, you can create a mapping between `DbType` and `Type`. A clean and structured way to do this is by using a dictionary to map each `DbType` to its corresponding `Type`. Here’s how you can implement that in a straightforward manner: `...
10,358
[ { "from": "human", "value": "How do I best convert a System.Data.DbType enumeration value to the corresponding (or at least one of the possible corresponding) System.Type values?\nFor example:\nDbType.StringFixedLength -> System.String \nDbType.String -> System.String\nDbType.Int32 -> System.Int32\n\nI've o...
I have a quick question. How do I get the image generated by a JComponent.paint or paintComponent? I have a JComponent which I use as a 'workspace' and where I have overwritten the paintComponent method to my own. The thing is that my workspace JComponent also has children which has their own paintComponent methods. So...
To capture the rendered image of your `JComponent`, including both your component's graphics and its children's graphics, you need to make sure to correctly call the painting methods while providing the appropriate Graphics context. Here’s how you can do it: ### Step-by-Step Approach 1. **Use a BufferedImage**: Creat...
8,407
[ { "from": "human", "value": "I have a quick question. How do I get the image generated by a JComponent.paint or paintComponent?\nI have a JComponent which I use as a 'workspace' and where I have overwritten the paintComponent method to my own. The thing is that my workspace JComponent also has children whic...
How does it work, what is it used for and when should one use it?
It seems like your question is somewhat general. To provide a precise answer, could you specify what "it" refers to? Are you asking about a particular technology, tool, method, or concept? Examples could include software applications, scientific methods, mental health therapies, or even something like artificial intell...
13,444
[ { "from": "human", "value": "How does it work, what is it used for and when should one use it?\n" }, { "from": "gpt", "value": "It seems like your question is somewhat general. To provide a precise answer, could you specify what \"it\" refers to? Are you asking about a particular technology, too...
How do I programatically (Using C#) find out what the path is of my My Pictures folder? Does this work on XP and Vista?
In C#, you can programmatically find the path to the "My Pictures" folder using the `Environment.GetFolderPath` method along with `Environment.SpecialFolder`. This method will work on various versions of Windows, including XP and Vista. Here’s a simple example of how you can achieve this: ```csharp using System; cla...
9,840
[ { "from": "human", "value": "How do I programatically (Using C#) find out what the path is of my My Pictures folder? \nDoes this work on XP and Vista?\n" }, { "from": "gpt", "value": "In C#, you can programmatically find the path to the \"My Pictures\" folder using the `Environment.GetFolderPath...
I cant post the code (proprietary issues) but does anyone know what types of things would cause the following error in C#. It is being thrown by a VOIP client that I wrote (using counterpath api) when the call is ended by the other client. The error is: System.AccessViolationException was unhandled Message="Attempted...
The `System.AccessViolationException` you encountered typically occurs when your code tries to read or write to a memory location that it does not have permission to access. In the context of a VoIP client, this can arise from a variety of issues, particularly when dealing with interop calls or unmanaged code. Here are...
8,040
[ { "from": "human", "value": "I cant post the code (proprietary issues) but does anyone know what types of things would cause the following error in C#. It is being thrown by a VOIP client that I wrote (using counterpath api) when the call is ended by the other client. The error is:\nSystem.AccessViolationEx...
Net::HTTP can be rather cumbersome for the standard use case!
Yes, you're right! `Net::HTTP` in Ruby can be a bit verbose and cumbersome for common HTTP tasks, especially when compared to higher-level libraries. The standard library provides a lot of functionality but often requires more boilerplate code to accomplish simple tasks like making GET or POST requests. For many appli...
11,692
[ { "from": "human", "value": "Net::HTTP can be rather cumbersome for the standard use case!\n" }, { "from": "gpt", "value": "Yes, you're right! `Net::HTTP` in Ruby can be a bit verbose and cumbersome for common HTTP tasks, especially when compared to higher-level libraries. The standard library p...
(Eclipse 3.4, Ganymede) I have an existing Dynamic Web Application project in Eclipse. When I created the project, I specified 'Default configuration for Apache Tomcat v6' under the 'Configuration' drop down. It's a month or 2 down the line, and I would now like to change the configuration to Tomcat 'v5.5'. (This will ...
Downgrading the configuration of an existing Dynamic Web Application project in Eclipse can indeed be a bit tricky, especially when dealing with different versions of the Apache Tomcat runtime and the associated project facets. Here are the steps you can take to successfully change your project's configuration from Tom...
7,351
[ { "from": "human", "value": "(Eclipse 3.4, Ganymede)\nI have an existing Dynamic Web Application project in Eclipse. When I created the project, I specified 'Default configuration for Apache Tomcat v6' under the 'Configuration' drop down.\nIt's a month or 2 down the line, and I would now like to change the ...
I have a file that I want to include in Python but the included file is fairly long and it'd be much neater to be able to split them into several files but then I have to use several include statements. Is there some way to group together several files and include them all at once?
Yes, you can organize and include multiple files in Python by using modules and packages. Here are a couple of approaches to group several files and include them all at once: ### 1. Using a Python Package If you have multiple Python files that you want to include together, you can create a package. A package is essen...
5,542
[ { "from": "human", "value": "I have a file that I want to include in Python but the included file is fairly long and it'd be much neater to be able to split them into several files but then I have to use several include statements.\nIs there some way to group together several files and include them all at o...
I have 6 sound files (1.wav 2.wav etc..) of which 3 different ones have to be heard each time the web page opens. The numbers are selected randomly. I have tried multiple "embeds" but only the last sound selected gets produced. I have also tried javascript routines that fiddle the bgsound attribute, however, I was not ...
You can achieve your goal using HTML and JavaScript by utilizing the `Audio` object to load and play multiple sound files. Here’s a step-by-step guide on how to randomly select and play three sound files when the page loads or when a button is clicked. ### Example Implementation 1. **Create HTML Structure**: Creat...
8,958
[ { "from": "human", "value": "I have 6 sound files (1.wav 2.wav etc..) of which 3 different ones have to be heard each time the web page opens. The numbers are selected randomly.\nI have tried multiple \"embeds\" but only the last sound selected gets produced.\nI have also tried javascript routines that fidd...
Is there an easy way (in .Net) to test if a Font is installed on the current machine?
Yes, in .NET you can easily check if a font is installed on the current machine by using the `System.Drawing.Text` namespace. You can access the installed fonts and check if a specific font is present. Here’s a simple method to determine if a font is installed: ```csharp using System; using System.Drawing.Text; publi...
8,686
[ { "from": "human", "value": "Is there an easy way (in .Net) to test if a Font is installed on the current machine?\n" }, { "from": "gpt", "value": "Yes, in .NET you can easily check if a font is installed on the current machine by using the `System.Drawing.Text` namespace. You can access the ins...
class MyContainedClass { }; class MyClass { public: MyContainedClass * getElement() { // ... std::list<MyContainedClass>::iterator it = ... // retrieve somehow return &(*it); } // other methods private: std::list<MyContainedClass> m_contained; }; Though msdn says std::list should not perform reloc...
Returning a pointer to an element stored in a `std::list` can be safe as long as you understand the implications of how the `std::list` manages its elements. Here are some considerations: 1. **Stability of Addresses**: As you mentioned, `std::list` is a doubly-linked list, and its elements are not subject to relocatio...
8,934
[ { "from": "human", "value": "class MyContainedClass {\n};\n\nclass MyClass {\npublic:\n MyContainedClass * getElement() {\n // ...\n std::list<MyContainedClass>::iterator it = ... // retrieve somehow\n return &(*it);\n }\n // other methods\nprivate:\n std::list<MyContainedClass> m_contained;\n}...
I'm a web developer, and I want to make the web sites I develop more accessible to those using screen readers. What limitations do screen readers have that I should be most aware of, and what can I do to avoid hitting these limitations. This question was sparked by reading another question about non-image based captch...
Screen readers have made significant advancements over the years, but there are still inherent limitations and considerations when it comes to web accessibility. Here are some key limitations and best practices to make your websites more accessible for users relying on screen readers: ### Limitations of Screen Readers...
6,925
[ { "from": "human", "value": "I'm a web developer, and I want to make the web sites I develop more accessible to those using screen readers. What limitations do screen readers have that I should be most aware of, and what can I do to avoid hitting these limitations.\nThis question was sparked by reading ano...
Refactoring is the process of improving the existing system design without changing its behavior. Besides Martin Fowler's seminal book "Refactoring - Improving the design of existing code" and Joshua Kerievsky's book "Refactoring to Patterns", are there any good resources on refactoring?
Yes, there are several valuable resources on refactoring beyond the works of Martin Fowler and Joshua Kerievsky. Here are some noteworthy recommendations: 1. **Refactoring Guru (refactoring.guru)**: This website offers an extensive collection of refactoring techniques and principles, illustrated with clear examples an...
7,411
[ { "from": "human", "value": "Refactoring is the process of improving the existing system design without changing its behavior.\nBesides Martin Fowler's seminal book \"Refactoring - Improving the design of existing code\" and Joshua Kerievsky's book \"Refactoring to Patterns\", are there any good resources o...
Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined parameter? Example 1 - separate parameters: function convertTem...
When designing your function for temperature conversion, both approaches (separate parameters vs. combined parameter) have their pros and cons. Here’s a breakdown to help you decide which one might be better for your use case: ### Separate Parameters **Example:** ```javascript function convertTemperature(fromScale, t...
7,071
[ { "from": "human", "value": "Let's say that I'm writing a function to convert between temperature scales. I want to support at least Celsius, Fahrenheit, and Kelvin. Is it better to pass the source scale and target scale as separate parameters of the function, or some sort of combined parameter?\nExample 1 ...
I have a list I've built in Sharepoint, where one of the fields is a date that the user enters. I want to add another field, which is a calculated value field that needs to be the date provided by the user + 30 days. What formula do I need to pass to the calculated value field to achieve that?
In SharePoint, to create a calculated field that adds 30 days to a date entered by the user, you can use the `DATE` function along with the `YEAR`, `MONTH`, and `DAY` functions. Assuming your user-input date field is named "UserDate", the formula you would use in the calculated field would look like this: ```plainte...
9,573
[ { "from": "human", "value": "I have a list I've built in Sharepoint, where one of the fields is a date that the user enters.\nI want to add another field, which is a calculated value field that needs to be the date provided by the user + 30 days.\nWhat formula do I need to pass to the calculated value field...
I am uploading multiple files using the BeginGetRequestStream of HttpWebRequest but I want to update the progress control I have written whilst I post up the data stream. How should this be done, I have tried calling Dispatch.BeginInvoke (as below) from within the loop that pushes the data into the stream but it lock...
It looks like you're encountering a UI thread blockage due to the way you are invoking the progress update from within your `PushData` method. The `Dispatcher.BeginInvoke` method is indeed a good way to update the UI from a background thread, but calling it in a tight loop (like the one in your `PushData` method) can c...
6,449
[ { "from": "human", "value": "I am uploading multiple files using the BeginGetRequestStream of HttpWebRequest but I want to update the progress control I have written whilst I post up the data stream. \nHow should this be done, I have tried calling Dispatch.BeginInvoke (as below) from within the loop that p...
I have a site map of a few thoasand pages where the only different content on them is the title attribute and the content plotted out in a google map? Will google punish me for this as spam?
Having a site with thousands of pages where the primary difference is in the title attribute and the content displayed on a Google Map could potentially raise concerns for Google regarding duplicate content. While having some variation in content (like titles and map locations) may not automatically lead to a penalty, ...
9,113
[ { "from": "human", "value": "I have a site map of a few thoasand pages where the only different content on them is the title attribute and the content plotted out in a google map?\nWill google punish me for this as spam?\n" }, { "from": "gpt", "value": "Having a site with thousands of pages wher...
I am working with some CSS that is poorly written to say the least. I am not a design/CSS expert, but I at least understand the C in CSS. While the builtin CSS support inside of VS-2008 is far improved over previous versions, it still doesn't quite do what I am looking for. I was wondering if anyone know of a good prog...
If you're looking to refactor and clean up your CSS code, there are several tools and utilities that can help you achieve that. While you may not find an exact equivalent to ReSharper specifically for CSS in Visual Studio 2008, there are some options you can consider: ### CSS Preprocessors 1. **Sass or LESS**: These p...
10,006
[ { "from": "human", "value": "I am working with some CSS that is poorly written to say the least. I am not a design/CSS expert, but I at least understand the C in CSS. While the builtin CSS support inside of VS-2008 is far improved over previous versions, it still doesn't quite do what I am looking for.\nI w...
I'm working on a simple multiplayer game in which 2-4 players are placed at separate entrypoints in a maze and need to reach a goal point. Generating a maze in general is very easy, but in this case the goal of the game is to reach the goal before everyone else and I don't want the generation algorithm to drastically ...
Creating a maze generation algorithm that ensures fair paths for multiple players while minimizing the advantage one player may have over the others can be quite challenging. However, here’s a strategy you might consider that aims to balance the path lengths for multiple players. ### Maze Generation Algorithm 1. **Ch...
8,433
[ { "from": "human", "value": "I'm working on a simple multiplayer game in which 2-4 players are placed at separate entrypoints in a maze and need to reach a goal point. Generating a maze in general is very easy, but in this case the goal of the game is to reach the goal before everyone else and I don't want...
A friend of mine was explaining how they do ping-pong pairing with TDD at his workplace and he said that they take an "adversarial" approach. That is, when the test writing person hands the keyboard over to the implementer, the implementer tries to do the bare simplest (and sometimes wrong thing) to make the test pass....
The "adversarial" approach to ping-pong pairing in Test-Driven Development (TDD) can indeed be a beneficial practice, but it also has its trade-offs. Here are some thoughts on its effectiveness and potential benefits, as well as reasons why it might feel slower in the short term. ### Benefits of the Adversarial Approa...
9,254
[ { "from": "human", "value": "A friend of mine was explaining how they do ping-pong pairing with TDD at his workplace and he said that they take an \"adversarial\" approach. That is, when the test writing person hands the keyboard over to the implementer, the implementer tries to do the bare simplest (and so...
When uploading a file (jpeg) via a form in IE7 I am seeing a mime-type of "image/pjpeg" instead of "image/jpeg" (as I see in Firefox or similar). It's easy enough to work around this problem, but I'm just wondering why IE7 is behaving differently in this case?
The behavior you're observing with Internet Explorer 7 (IE7) returning a MIME type of "image/pjpeg" instead of "image/jpeg" is due to the way IE7 handles file uploads for JPEG images. This is rooted in the historical context of how browsers identified and processed image files. Here are a few reasons why IE7 behaves t...
9,225
[ { "from": "human", "value": "When uploading a file (jpeg) via a form in IE7 I am seeing a mime-type of \"image/pjpeg\" instead of \"image/jpeg\" (as I see in Firefox or similar). It's easy enough to work around this problem, but I'm just wondering why IE7 is behaving differently in this case?\n" }, { ...