instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Where can I find a free, lightweight YUI-like compressor for PHP? I am sure it will decrease the file size but will compressing PHP code boost its performance? Is this the same thing as an obfuscator?
To answer your questions: ### Where to Find a Free, Lightweight YUI-like Compressor for PHP If you're looking for a PHP compressor similar to YUI Compressor (which is primarily for JavaScript and CSS), consider the following options: 1. **PHP Minifier**: This is a simple tool that can compress PHP code by removing wh...
40,785
[ { "from": "human", "value": "Where can I find a free, lightweight YUI-like compressor for PHP?\nI am sure it will decrease the file size but will compressing PHP code boost its performance?\nIs this the same thing as an obfuscator?\n" }, { "from": "gpt", "value": "To answer your questions:\n\n##...
Is there a C function call that can change the last modified date of a file or directory in Windows?
Yes, in Windows, you can use the Windows API to change the last modified date of a file or directory. The function you can use is `SetFileTime()`. Here's a simple example of how you can use it in a C program: 1. First, include the necessary headers. 2. Use `CreateFile()` to open the file or directory. 3. Use `SetFileT...
39,218
[ { "from": "human", "value": "Is there a C function call that can change the last modified date of a file or directory in Windows?\n" }, { "from": "gpt", "value": "Yes, in Windows, you can use the Windows API to change the last modified date of a file or directory. The function you can use is `Se...
Are there Windows API functions that allows reading what the current password policy is? For instance, minimum length, complexity etc. If not reading, is there a way to verify a password against the policy programmatically?
In Windows, there are several APIs and functions that can be used to access or verify password policies, though there isn't a direct API function that provides all the specific settings like minimum length, complexity, etc., in a single call. However, you can retrieve this information using a combination of the `NetUse...
36,528
[ { "from": "human", "value": "Are there Windows API functions that allows reading what the current password policy is? For instance, minimum length, complexity etc.\nIf not reading, is there a way to verify a password against the policy programmatically?\n" }, { "from": "gpt", "value": "In Windo...
I'm writing a windows service which will be used to monitor some other services and runs an external application if the service goes down. I've got most of it working, the windows service runs, the code monitoring the other services works a treat but I'm having problems running the external app when there's a failure. ...
To capture the output of the external application you are starting in your Windows Service, you need to redirect the standard output and standard error streams of the process. You can then read the output from these streams after the process finishes executing. Here’s how you can modify your code to achieve this: ```c...
37,382
[ { "from": "human", "value": "I'm writing a windows service which will be used to monitor some other services and runs an external application if the service goes down.\nI've got most of it working, the windows service runs, the code monitoring the other services works a treat but I'm having problems running...
My client wants to sign the application code. He gave me an .spc file for signing a .NET desktop application. How should I use it within the app? Thanks
To sign a .NET desktop application using an SPC (Software Publisher Certificate) file, you typically need to convert it to a format that can be used with signing tools, such as a PFX (Personal Exchange Format) file. The SPC file is used in conjunction with a private key, which may be contained in a separate file (often...
38,219
[ { "from": "human", "value": "My client wants to sign the application code. He gave me an .spc file for signing a .NET desktop application. How should I use it within the app?\nThanks\n" }, { "from": "gpt", "value": "To sign a .NET desktop application using an SPC (Software Publisher Certificate)...
I'm looking for a production quality bloom filter implementation in Python to handle fairly large numbers of items (say 100M to 1B items with 0.01% false positive rate). Pybloom is one option but it seems to be showing its age as it throws DeprecationWarning errors on Python 2.5 on a regular basis. Joe Gregorio also ...
For a production-quality Bloom filter implementation in Python that can efficiently handle large numbers of items (such as 100M to 1B) with a low false positive rate, you might consider the following options: ### 1. **pybloom-live** This is an actively maintained fork of the original PyBloom library, which addresses s...
37,710
[ { "from": "human", "value": "I'm looking for a production quality bloom filter implementation in Python to handle fairly large numbers of items (say 100M to 1B items with 0.01% false positive rate). \nPybloom is one option but it seems to be showing its age as it throws DeprecationWarning errors on Python ...
Please let me know how can I disable weak Ciphers for Tomcat 5.5.27
Disabling weak ciphers in Apache Tomcat 5.5.27 involves modifying the SSL connector configuration in the `server.xml` file. Keep in mind that Tomcat 5.5.27 is a very old version, and it is strongly recommended to upgrade to a more recent version to benefit from better security features and support. ### Steps to Disabl...
37,899
[ { "from": "human", "value": "Please let me know how can I disable weak Ciphers for Tomcat 5.5.27\n" }, { "from": "gpt", "value": "Disabling weak ciphers in Apache Tomcat 5.5.27 involves modifying the SSL connector configuration in the `server.xml` file. Keep in mind that Tomcat 5.5.27 is a very ...
I want to learn algorithms using some very basic simple tutorials. Are there any out there? I have heard of recursion and stuff and I would like to get good at it. Any help would be appreciated.
Absolutely! Learning algorithms, especially concepts like recursion, can be both fun and rewarding. Here are some basic resources and tutorials that can help you get started: ### Online Tutorials 1. **Khan Academy - Algorithms**: - Khan Academy offers a very approachable introduction to algorithms. The lessons are...
36,193
[ { "from": "human", "value": "I want to learn algorithms using some very basic simple tutorials. Are there any out there? I have heard of recursion and stuff and I would like to get good at it. Any help would be appreciated.\n" }, { "from": "gpt", "value": "Absolutely! Learning algorithms, especi...
This one is a bit tedious in as far as explaining, so here goes. I'm essentially populating a tableView on the iPhone with multiple sections, and potentially multiple rows per section. To my understanding, it's best to have an array of arrays so that you can simply determine how many sections one has by sending a messa...
To achieve your goal of organizing the data into an array of arrays for your tableView, you can use `NSMutableDictionary` to group the records by their `location` and then extract the values into an `NSMutableArray`. Here's how you can do it in Swift: 1. **Create your initial data**: Start with an array of dictionarie...
37,254
[ { "from": "human", "value": "This one is a bit tedious in as far as explaining, so here goes. I'm essentially populating a tableView on the iPhone with multiple sections, and potentially multiple rows per section. To my understanding, it's best to have an array of arrays so that you can simply determine how...
Every so often I get the impression that my knowledge of mathematics (as it pertains to the field of software development) has some gaps. I'm an educated person. I have a college degree. I've always enjoyed learning, which is why I would like to try to fill in these gaps. My job is in the financial industry, and I feel...
It's great to hear that you are eager to refine your mathematical skills, especially in relation to your work in the financial industry! Given your background in Computer Science and your interest in large-scale number crunching, there are several areas of mathematics that you may want to focus on, as well as resources...
37,595
[ { "from": "human", "value": "Every so often I get the impression that my knowledge of mathematics (as it pertains to the field of software development) has some gaps. I'm an educated person. I have a college degree. I've always enjoyed learning, which is why I would like to try to fill in these gaps.\nMy jo...
What is the default location for the MySQL configuration file on a redhat linux box?
On a Red Hat Linux system, the default location for the MySQL configuration file is typically: - `/etc/my.cnf` In some cases, MySQL may also look for configuration files in the following locations: - `/etc/my.cnf.d/` - `~/.my.cnf` (user-specific configuration) These files can contain various configuration settings ...
42,922
[ { "from": "human", "value": "What is the default location for the MySQL configuration file on a redhat linux box?\n" }, { "from": "gpt", "value": "On a Red Hat Linux system, the default location for the MySQL configuration file is typically:\n\n- `/etc/my.cnf`\n\nIn some cases, MySQL may also lo...
I read the tutorials for web applications and the special rules you can put into style sheets. Are folks finding they can just tweak their style sheets to serve up content to iPhones or do they deliver custom iPhone specific pages? would you bother with this if you were going to create a specific page anyway for mobil...
When it comes to delivering content to iPhones or other mobile devices, there are generally two approaches: responsive design using CSS and creating separate mobile-specific pages. Each method has its own advantages and considerations, so let's explore both options to help you make an informed decision. ### 1. Respons...
39,073
[ { "from": "human", "value": "I read the tutorials for web applications and the special rules you can put into style sheets. Are folks finding they can just tweak their style sheets to serve up content to iPhones or do they deliver custom iPhone specific pages? would you bother with this if you were going t...
So, if i have: public class Sedan : Car { /// ... } public class Car : Vehicle, ITurn { [MyCustomAttribute(1)] public int TurningRadius { get; set; } } public abstract class Vehicle : ITurn { [MyCustomAttribute(2)] public int TurningRadius { get; set; } } public interface ITurn { [MyCustomAt...
To retrieve custom attributes from a property and its ancestry (i.e., the property in the base class and any implemented interfaces), you need to manually inspect each level of the inheritance hierarchy. The built-in methods you mentioned only retrieve attributes directly declared on the target property and do not auto...
39,576
[ { "from": "human", "value": "So, if i have:\npublic class Sedan : Car \n{\n /// ...\n}\n\npublic class Car : Vehicle, ITurn\n{\n [MyCustomAttribute(1)]\n public int TurningRadius { get; set; }\n}\n\npublic abstract class Vehicle : ITurn\n{\n [MyCustomAttribute(2)]\n public int TurningRadius {...
How to insert data into a particular cell in a Excel Work sheet in Asp.net
To insert data into a specific cell of an Excel worksheet using ASP.NET, you can use the `EPPlus` library or `Microsoft.Office.Interop.Excel` library. Here, I'll show you how to do this using the `EPPlus` library, which is more straightforward and does not require Excel to be installed on the server. ### Using EPPlus ...
28,231
[ { "from": "human", "value": "How to insert data into a particular cell in a Excel Work sheet in Asp.net\n" }, { "from": "gpt", "value": "To insert data into a specific cell of an Excel worksheet using ASP.NET, you can use the `EPPlus` library or `Microsoft.Office.Interop.Excel` library. Here, I'...
I recently purchased a Windows Server 2008 server, Our company will be using it as a Web Server. I have set the web site up in IIS 7.0 and I can accsess it by typing http://10.1.1.8 on the computers within the network. When I try to accsess it through the net on other computers it doesnt seem to work, But most importa...
Hi Oliver, It sounds like you're off to a good start setting up your web server on Windows Server 2008 with IIS 7.0. Let's address your two main concerns: accessing your site from the internet and setting up a domain name. ### Accessing Your Website from the Internet 1. **Public IP Address**: First, ensure that your...
36,630
[ { "from": "human", "value": "I recently purchased a Windows Server 2008 server, Our company will be using it as a Web Server. I have set the web site up in IIS 7.0 and I can accsess it by typing http://10.1.1.8 on the computers within the network.\nWhen I try to accsess it through the net on other computer...
As a huge XSL fan, I am very happy to use xsl as the view in our proprietary MVC framework on ASP.NET. Objects in the model are serialized under the hood using .NET's xml serializer, and we use quite atomic xsl templates to declare how each object or property should transform. For example: <xsl:template match="/Artic...
It sounds like you have a solid setup using XSLT with ASP.NET, and you're finding great benefits from its declarative nature while also encountering some of the limitations, particularly regarding intellisense and type safety. ### Options for Enhanced Intellisense and Strong Typing 1. **Razor Syntax in ASP.NET MVC**:...
39,709
[ { "from": "human", "value": "As a huge XSL fan, I am very happy to use xsl as the view in our proprietary MVC framework on ASP.NET. Objects in the model are serialized under the hood using .NET's xml serializer, and we use quite atomic xsl templates to declare how each object or property should transform.\n...
Is there a way to automatically set Trust Center locations in a network environment when upgrading to Access 2007?
Yes, you can automatically set Trust Center locations in a network environment when upgrading to Access 2007 by using a combination of Group Policy and registry edits. Here are the steps to do this: ### Step 1: Identify Trusted Locations Decide on the network paths or folders that you want to designate as trusted loca...
38,602
[ { "from": "human", "value": "Is there a way to automatically set Trust Center locations in a network environment when upgrading to Access 2007?\n" }, { "from": "gpt", "value": "Yes, you can automatically set Trust Center locations in a network environment when upgrading to Access 2007 by using a...
Putting aside the fact that one is open-source, which tool is more feature rich and performant for SVN support within Visual Studio.
When comparing tools for SVN (Subversion) support within Visual Studio, two popular options are **AnkhSVN** and **VisualSVN**. Here’s a breakdown of their features and performance: ### VisualSVN: - **Ease of Use**: VisualSVN is known for its user-friendly interface and seamless integration with Visual Studio. It has a...
40,435
[ { "from": "human", "value": "Putting aside the fact that one is open-source, which tool is more feature rich and performant for SVN support within Visual Studio.\n" }, { "from": "gpt", "value": "When comparing tools for SVN (Subversion) support within Visual Studio, two popular options are **Ank...
So, I've been looking at Hadoop with keen interest, and to be honest I'm fascinated, things don't get much cooler. My only minor issue is I'm a C# developer and it's in Java. It's not that I don't understand the Java as much as I'm looking for the Hadoop.net or NHadoop or the .NET project that embraces the Google MapRe...
It's great to hear that you're interested in Hadoop! While Hadoop itself is primarily written in Java, there are indeed options for .NET developers looking to work with Hadoop and the MapReduce paradigm. 1. **Hadoop.NET**: This was one of the earlier attempts to provide a .NET interface for Hadoop. However, it's not a...
40,652
[ { "from": "human", "value": "So, I've been looking at Hadoop with keen interest, and to be honest I'm fascinated, things don't get much cooler.\nMy only minor issue is I'm a C# developer and it's in Java.\nIt's not that I don't understand the Java as much as I'm looking for the Hadoop.net or NHadoop or the ...
How can I find out the number of dimensions in an array in Classic ASP ( VBScript ) . I am being passed an Array with multiple dimensions but I only want to look at the last. Seems easy in other languages.
In Classic ASP (VBScript), you can determine the number of dimensions in an array using the built-in function `UBound`. Here's how you can find out the number of dimensions and specifically focus on the last dimension of the array. In VBScript, arrays can be either one-dimensional, two-dimensional, or multi-dimensiona...
39,969
[ { "from": "human", "value": "How can I find out the number of dimensions in an array in Classic ASP ( VBScript ) .\nI am being passed an Array with multiple dimensions but I only want to look at the last. Seems easy in other languages.\n" }, { "from": "gpt", "value": "In Classic ASP (VBScript), ...
I have the following code in WCF service to throw a custom fault based on certain situations. I am getting a "The creator of this fault did not specify a Reason" exception. What am I doing wrong? //source code if(!DidItPass) { InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid Routing Code - No ...
The exception you're encountering, "The creator of this fault did not specify a Reason," occurs because when throwing a `FaultException<T>` in WCF, you need to provide additional information regarding the reason for the fault. The `FaultException` is expected to have a `Reason` which helps clients understand what went ...
42,639
[ { "from": "human", "value": "I have the following code in WCF service to throw a custom fault based on certain situations. I am getting a \"The creator of this fault did not specify a Reason\" exception. What am I doing wrong?\n//source code\nif(!DidItPass)\n{\n InvalidRoutingCodeFault fault = new Inva...
I am trying to import an existing PDF as a template with FPDI. The template is in landscape format. If I import the template into a new document the template page is inserted in portrait form with the content rotated 90 degrees. If my new document is in portrait the full content appears, but if the new document is a...
Yes, you can use a landscape template with FPDI, but you need to ensure that the page orientation and dimensions are correctly handled in your new PDF document. FPDI does allow for the importing of pages from an existing PDF and you can specify the orientation. Here are the steps you can follow to successfully import ...
37,489
[ { "from": "human", "value": "I am trying to import an existing PDF as a template with FPDI. The template is in landscape format. If I import the template into a new document the template page is inserted in portrait form with the content rotated 90 degrees. If my new document is in portrait the full cont...
After discussing with a newly arrived developer in my team, I realized that there are still, in C++, habits of using C constructs because they are supposed to be better (i.e. faster, leaner, prettier, pick your reason). What are the examples worth sharing, showing a C constructs, compared to the similar C++ construct? ...
One notable example of a C construct versus a C++ construct is the use of manual memory management with `malloc` and `free` in C compared to automatic memory management with constructors and destructors in C++. ### C Construct: Manual Memory Management In C, dynamic memory allocation is done using `malloc` and deallo...
39,066
[ { "from": "human", "value": "After discussing with a newly arrived developer in my team, I realized that there are still, in C++, habits of using C constructs because they are supposed to be better (i.e. faster, leaner, prettier, pick your reason).\nWhat are the examples worth sharing, showing a C construct...
The execvp() function executes the program that is given as an argument. It checks the $PATH variable to find the program. I'm writing something in which I would like to check to see if several programs exist before calling any exec() functions. What's the best way to do this?
To check if several programs exist in the system before invoking `exec()` functions, you can use the `access()` function from the `<unistd.h>` library. This function allows you to check the accessibility of a file (in this case, the programs you're interested in) according to the specified mode (like checking if the fi...
38,948
[ { "from": "human", "value": "The execvp() function executes the program that is given as an argument. It checks the $PATH variable to find the program. I'm writing something in which I would like to check to see if several programs exist before calling any exec() functions. What's the best way to do this?\n...
/* I start with this: */ <Report> <prop1>4</prop1> <prop2>2255</prop2> <prop3>true</prop3> <prop4>false</prop4> <prop5>true</prop5> </Report> /* I want this result (change the value of node "prop5"): */ <Report> <prop1>4</prop1> <prop2>2255</prop2> <prop3>true</prop3> <pro...
The issue you are encountering stems from the way you are assigning the new value to the XML node. When you use `report.xml[item.xmlNodeName] = item.value.toString();`, it treats it as a new item being added to the XML structure rather than modifying the existing node. To properly change the value of an existing XML n...
40,649
[ { "from": "human", "value": "/* I start with this: */\n\n<Report>\n <prop1>4</prop1> \n <prop2>2255</prop2> \n <prop3>true</prop3> \n <prop4>false</prop4> \n <prop5>true</prop5> \n</Report>\n\n/* I want this result (change the value of node \"prop5\"): */\n\n<Report>\n <prop1>4</prop1> \n ...
Here is the directory structure /domain.com /public_html /functions /image /mobile /www the /domain.com/public_html/www folder has a file index.php the default web directory is /user/public_html/www in the index file is an include that includes the functions with include"../functions/function.inc" this works ...
The issue you're encountering is due to how web servers serve files and directories. When you set up a web server (like Apache or Nginx), it typically has a document root that defines where the publicly accessible files are located. In your case, the document root is set to `/domain.com/public_html/www`, meaning that o...
31,716
[ { "from": "human", "value": "Here is the directory structure\n/domain.com\n /public_html\n /functions\n /image\n /mobile\n /www\n\nthe /domain.com/public_html/www folder has a file index.php\nthe default web directory is /user/public_html/www\nin the index file is an include that includes the functions ...
Is it possible to use WSE 2.0 SP2 under VS 2008? I realise that the add-in (that generates the proxy classes/configuration) is not compatible but there are work-arounds to this (copying over the files from a VS 2003 solution). Our web services are relatively static so would not be making too many changes anwyay. We may...
Yes, it is possible to use ASP.NET Web Services Enhancements (WSE) 2.0 SP2 with Visual Studio 2008, although it requires some additional steps since the integrated tools and add-ins that were available in Visual Studio 2003 are not compatible. Here are some steps you can take to work with WSE 2.0 in a Visual Studio 20...
40,827
[ { "from": "human", "value": "Is it possible to use WSE 2.0 SP2 under VS 2008?\nI realise that the add-in (that generates the proxy classes/configuration) is not compatible but there are work-arounds to this (copying over the files from a VS 2003 solution). Our web services are relatively static so would not...
Ok, I am importing and parsing csv files in a C# app. I started out doing a simple ReadLine() and splitting on commas but it turns out some of the text fields have commas in them. So I started to roll my own splitting function. Fortunately, it was only a few minutes before the "Hey stupid, someone's probably already ...
When working with CSV files in C#, especially when dealing with commas and other special characters in both the file and field names, it can be tricky. Since you're already on the right path with the OleDb approach, here are a few suggestions to help you manage files with special characters in their names: ### 1. Use ...
37,394
[ { "from": "human", "value": "Ok, I am importing and parsing csv files in a C# app. I started out doing a simple ReadLine() and splitting on commas but it turns out some of the text fields have commas in them. So I started to roll my own splitting function. Fortunately, it was only a few minutes before the...
I'd like to automatically login to VSS when I open it, and skip the login prompt altogether. Is this possible?
Visual SourceSafe (VSS) does not have a built-in feature to automatically skip the login prompt when opening the application. However, you can streamline the login process using a few methods. Here are some suggestions: 1. **Use a Saved Password**: If you're using Visual SourceSafe with a specific user account, you ca...
41,854
[ { "from": "human", "value": "I'd like to automatically login to VSS when I open it, and skip the login prompt altogether. Is this possible?\n" }, { "from": "gpt", "value": "Visual SourceSafe (VSS) does not have a built-in feature to automatically skip the login prompt when opening the applicati...
I saw something about needing to have the assembly available for the type of the first argument passed to the function. I think it is, I can't figure out what am I missing. This code is in a service. I was running the service under the 'NETWORK SERVICES' user account, when I changed the account to that of the session I...
It sounds like you're dealing with a .NET application that might be making use of some assemblies or resources that require permissions or access depending on the user context under which your service is running. When you run a Windows service, it runs in a specific user account context. The `NETWORK SERVICE` account ...
38,956
[ { "from": "human", "value": "I saw something about needing to have the assembly available for the type of the first argument passed to the function. I think it is, I can't figure out what am I missing.\nThis code is in a service. I was running the service under the 'NETWORK SERVICES' user account, when I ch...
I need to generate a new WSDL file in the document/literal style based on an old RPC/encoded one. I've viewed the other WSDL questions here - and read http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/. This suggests that the document/literal WSDL should have an additional part - but my old RPC/encod...
To convert a WSDL from RPC/encoded to document/literal, you will indeed need to make several changes, but it’s not just about altering the bindings. Here are the key steps to successfully transition your WSDL: ### Steps to Convert RPC/Encoded WSDL to Document/Literal WSDL 1. **Change the WSDL Definitions**: - Upda...
34,647
[ { "from": "human", "value": "I need to generate a new WSDL file in the document/literal style based on an old RPC/encoded one. I've viewed the other WSDL questions here - and read http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/. This suggests that the document/literal WSDL should have a...
It obviously depends on the context you are using them in but, I was wondering if there is a universally accepted way to name such variables, or at least in a mathematical context. I've often seen: float k = someValue; float oneMinusK = 1 - k; ...which seems as descriptive as much as meaningless to me. Please...
When naming variables, especially in a mathematical context, clarity and context are crucial. While conventions can vary between different fields or communities, some general principles can help create meaningful and universally understandable variable names. ### Principles for Naming Variables: 1. **Descriptiveness...
30,964
[ { "from": "human", "value": "It obviously depends on the context you are using them in but, I was wondering if there is a universally accepted way to name such variables, or at least in a mathematical context.\nI've often seen:\nfloat k = someValue;\nfloat oneMinusK = 1 - k;\n\n...which seems as des...
We have a large management software that is producing big reports of all kinds, based on numerous loops, with database retrievals, objects creations (many), and so on. On PHP4 it could run happily with a memory limit of 64 MB - now we have moved it on a new server and with the same database - same code, the same report...
When transitioning from PHP4 to PHP5 and experiencing significant increases in memory consumption, it's essential to take a structured approach to optimize your code. Here are some strategies to help reduce memory usage and make your scripts more efficient: ### 1. **Profile Your Code**: - Use profiling tools like X...
38,529
[ { "from": "human", "value": "We have a large management software that is producing big reports of all kinds, based on numerous loops, with database retrievals, objects creations (many), and so on.\nOn PHP4 it could run happily with a memory limit of 64 MB - now we have moved it on a new server and with the ...
Welcome! I very enjoyed programming artificial intelligence in my studies - neural networks, expert machines and other. But in work I develop mainly web applications. And now I think about returning to such programming, maybe in hobby, or maybe in work. Are there areas where AI is commonly used in applications develop...
Welcome! It's great to hear about your enthusiasm for artificial intelligence and your interest in integrating it into your work. There are many areas where AI can be applied in application development, and your background in neural networks and expert systems will definitely be an asset. Here are some ideas and areas ...
38,976
[ { "from": "human", "value": "Welcome!\nI very enjoyed programming artificial intelligence in my studies - neural networks, expert machines and other. But in work I develop mainly web applications. \nAnd now I think about returning to such programming, maybe in hobby, or maybe in work. Are there areas where ...
I'm having troubles with HttpWebRequest/HttpWebResponse and cookies/CookieContainer/CookieCollection. The thing is, if the web server does not send/use a "path" in the cookie, Cookie.Path equals the path-part of the request URI instead of "/" or being empty in my application. Therefore, those cookies do not work for th...
You're encountering a common issue when working with cookies in .NET using `HttpWebRequest` and `HttpWebResponse`. When cookies are received from a server without a specified path, the .NET `Cookie` class often sets the `Path` property to the path of the request URI, which may restrict the cookie to that path rather th...
39,001
[ { "from": "human", "value": "I'm having troubles with HttpWebRequest/HttpWebResponse and cookies/CookieContainer/CookieCollection.\nThe thing is, if the web server does not send/use a \"path\" in the cookie, Cookie.Path equals the path-part of the request URI instead of \"/\" or being empty in my applicatio...
Are there any tools that auto-generate the hibernate POJOs by gathering information from the database? I made a perl script to do this after the schema got changed for the third or fourth time in a project i'm working with and just wondered if there is any established tool that will do this for me as my script is rathe...
Yes, there are several established tools that can help you auto-generate Hibernate POJOs and mapping files from a database schema. Here are a few popular options: 1. **Hibernate Tools**: - Hibernate Tools is part of the Hibernate project and provides a set of utilities for working with Hibernate. It can reverse-en...
35,691
[ { "from": "human", "value": "Are there any tools that auto-generate the hibernate POJOs by gathering information from the database?\nI made a perl script to do this after the schema got changed for the third or fourth time in a project i'm working with and just wondered if there is any established tool that...
I'm able to get cells to format as Dates, but I've been unable to get cells to format as currency... Anyone have an example of how to create a style to get this to work? My code below show the styles I'm creating... the styleDateFormat works like a champ while styleCurrencyFormat has no affect on the cell. private HSS...
It looks like you're on the right track with your `styleCurrencyFormat`, but there may be a couple of issues causing it not to work as expected. 1. **Correct Data Format Identifier**: In Apache POI, there are specific built-in formats for currency. The built-in formats for currency can vary based on the version, but ...
37,724
[ { "from": "human", "value": "I'm able to get cells to format as Dates, but I've been unable to get cells to format as currency... Anyone have an example of how to create a style to get this to work? My code below show the styles I'm creating... the styleDateFormat works like a champ while styleCurrencyForm...
The HTML form shown below does not work as expected in Opera (Version: 9.52). The form does not have an onsubmit attribute nor does it have an input element with type=submit. It just has two input elements of type=button and both of them onclick calls a js method where I want the user to confirm the submission. If I re...
The issue you're experiencing with the Opera browser (Version: 9.52) is likely related to how it handles the `confirm()` dialog and the form submission process. In some older browsers, including older versions of Opera, the way JavaScript interacts with form submissions and blocking operations like `confirm()` may not ...
38,479
[ { "from": "human", "value": "The HTML form shown below does not work as expected in Opera (Version: 9.52). The form does not have an onsubmit attribute nor does it have an input element with type=submit. It just has two input elements of type=button and both of them onclick calls a js method where I want th...
I have recently converted 10 JavaScript files into one file, which I then run a JavaScript compiler on. I just had a bug where I had reused a function name. Is there a tool to check for duplicate rows/function names in the combined file? Or should I create a little program?
Yes, there are several tools and methods that can help you identify duplicate function names in your combined JavaScript file. Here are some options: 1. **Static Analysis Tools:** - **ESLint:** You can configure ESLint to check for duplicate function names. Install it and set up a configuration file (like `.eslintr...
38,750
[ { "from": "human", "value": "I have recently converted 10 JavaScript files into one file, which I then run a JavaScript compiler on. I just had a bug where I had reused a function name.\nIs there a tool to check for duplicate rows/function names in the combined file?\nOr should I create a little program?\n"...
Is it faster to do the following: if ($var != 'test1' && $var != 'test2' && $var != 'test3' && $var != 'test4') { ... } Or: if (!in_array($var, array('test1', 'test2', 'test3', 'test4') { ... } Is there a number of values at which point it's faster to do one or the other? (In this case, the array used in the second...
When comparing the two approaches: 1. **Multiple Comparisons**: ```php if ($var != 'test1' && $var != 'test2' && $var != 'test3' && $var != 'test4') { ... } ``` 2. **Using `in_array`**: ```php if (!in_array($var, array('test1', 'test2', 'test3', 'test4'))) { ... } ``` ### Performance Considerations...
39,981
[ { "from": "human", "value": "Is it faster to do the following:\n if ($var != 'test1' && $var != 'test2' && $var != 'test3' && $var != 'test4') { ... }\n\nOr:\n if (!in_array($var, array('test1', 'test2', 'test3', 'test4') { ... }\n\nIs there a number of values at which point it's faster to do one or the oth...
Try as I might, I'm unable to resolve an address to IP. The code snippet is shown below. I keep getting the No such host is known exception, even though I could access google with my browser (The DNS server is almost certainly working). I'm however behind company's firewall. try { foreach (IPAddress address in Dns.G...
When you encounter a "No such host is known" exception in your code while being behind a company's firewall, there are several potential issues to consider. Here are a few troubleshooting steps and suggestions to help you resolve the problem: 1. **Network Configuration**: Ensure that your application is running in an ...
39,324
[ { "from": "human", "value": "Try as I might, I'm unable to resolve an address to IP. The code snippet is shown below. I keep getting the No such host is known exception, even though I could access google with my browser (The DNS server is almost certainly working). I'm however behind company's firewall.\ntr...
I need to create an email in C# that is sent to a blackberry (or outlook) and recognized as an invite. For now I create an email with inclusion of a text.ics attachment so that in outlook, the user can click on the attachment and add it to his calendar, that work. The problem is that it's not recognized as an invite in...
To create an email that is recognized as a calendar invite (meeting request) in Outlook and on devices like BlackBerry, you need to send the email in a specific format rather than just attaching an `.ics` file. Instead of sending an `.ics` file as an attachment, you should send the email as an iCalendar formatted messa...
34,516
[ { "from": "human", "value": "I need to create an email in C# that is sent to a blackberry (or outlook) and recognized as an invite. For now I create an email with inclusion of a text.ics attachment so that in outlook, the user can click on the attachment and add it to his calendar, that work. The problem is...
I am working with an order system that has two tables Order and OrderLine pretty standard stuff. I want to work out an order line number for the order lines with respect to the order e.g. Orderid Orderlineid linenumber 1          1              1 2          2              1 2          3              2 3          4    ...
In SQL Server 2000, you don't have access to the windowing functions such as `ROW_NUMBER()` that were introduced in SQL Server 2005. However, you can still achieve the desired result using a correlated subquery or a self-join approach to calculate the line numbers. Here’s how you can do it using a correlated subquery....
41,289
[ { "from": "human", "value": "I am working with an order system that has two tables Order and OrderLine pretty standard stuff. I want to work out an order line number for the order lines with respect to the order e.g.\nOrderid Orderlineid linenumber\n1          1              1\n2          2              1\...
can two use cases extend or include each other at the same time? A extend/include B and B extend/include A
In UML (Unified Modeling Language), the relationships between use cases can be defined using "include" and "extend" relationships, but it’s important to understand their distinct purposes and how they can interact. 1. **Include Relationship**: This is used when a use case (the base use case) requires the behavior of a...
40,735
[ { "from": "human", "value": "can two use cases extend or include each other at the same time?\n A extend/include B and B extend/include A\n" }, { "from": "gpt", "value": "In UML (Unified Modeling Language), the relationships between use cases can be defined using \"include\" and \"extend\" rel...
I'm having some trouble navigating Java's rule for inferring generic type parameters. Consider the following class, which has an optional list parameter: import java.util.Collections; import java.util.List; public class Person { private String name; private List<String> nicknames; public Person(String name) {...
The issue you're encountering is related to Java's type inference and how generics are handled, particularly with the `Collections.emptyList()` method. ### Explanation of the Problem 1. **Type Inference with `Collections.emptyList()`:** - The method `Collections.emptyList()` is a generic method that returns a list...
40,018
[ { "from": "human", "value": "I'm having some trouble navigating Java's rule for inferring generic type parameters. Consider the following class, which has an optional list parameter:\nimport java.util.Collections;\nimport java.util.List;\n\npublic class Person {\n private String name;\n private List<Strin...
So I've setup an Ubuntu server running the 8.04 release. I set it up to authenticate with our Active Directory using the likewise-open package using these instructions. Part of that setup was giving Domain Admin users who login to the machine sudo access. Now I'd like to deny login rights for all domain logins except f...
To restrict login access to your Ubuntu 8.04 server so that only members of the "Domain Admins" group can log in while allowing local users to continue logging in, you can modify the PAM (Pluggable Authentication Module) settings. Here's how you can do that: 1. **Identify the Group for Domain Admins**: Ensure you know...
39,188
[ { "from": "human", "value": "So I've setup an Ubuntu server running the 8.04 release. I set it up to authenticate with our Active Directory using the likewise-open package using these instructions. Part of that setup was giving Domain Admin users who login to the machine sudo access.\nNow I'd like to deny l...
1) user A goes to the site, creates an account, and logs in 2) user b goes to the site. Rather than having to log in, user b enters as though user b is user a. User b gets access to all of user a's data and can brows the site as user a. Note: user b does not log in. User b just hits the site, and the site returns as...
The scenario you've described seems to depict a significant security vulnerability that could lead to unauthorized access to User A's account and data by User B. Below are potential causes for such behavior, along with steps you can take to investigate and secure your application. ### Potential Causes: 1. **Session M...
34,786
[ { "from": "human", "value": "1) user A goes to the site, creates an account, and logs in\n2) user b goes to the site. Rather than having to log in, user b enters as though user b is user a. User b gets access to all of user a's data and can brows the site as user a.\nNote: user b does not log in. User b ...
Reporting Services 2000 Standard Edition (currently RTM but hope to have SP2 soon). I have a report which takes in a parameter - PlantID I'd like to email a pdf of this report every month to the 80 different plant managers So I have a table: PlantID ManagerEmail 1 BillySmith@company.com 2 FredJones...
Your approach using a C# application to generate and send the reports with the correct parameters for each plant manager is a valid solution. Here's a general outline of how you can implement this: 1. **Create the Report Subscription**: While you cannot directly create a subscription for each recipient with a diff...
30,441
[ { "from": "human", "value": "Reporting Services 2000 Standard Edition (currently RTM but hope to have SP2 soon).\nI have a report which takes in a parameter - PlantID\nI'd like to email a pdf of this report every month to the 80 different plant managers\nSo I have a table:\nPlantID ManagerEmail\n1 ...
I'm working on cusomizing a Swing application by dynamically altering the UIDefaults. The end goal is to alter many of them (colors, fonts, sizes, borders, etc) and save the result on a per user basis. While it may give the application some non-standard looks, the client asketh and the client shall receive. The only pr...
The behavior you're experiencing may be related to the way `UIManager` manages the defaults and how `SwingUtilities.updateComponentTreeUI()` interacts with the component hierarchy. Here are a few suggestions and insights that may help you troubleshoot and resolve the issue of dynamic UI updates: 1. **Check for Caching...
34,321
[ { "from": "human", "value": "I'm working on cusomizing a Swing application by dynamically altering the UIDefaults. The end goal is to alter many of them (colors, fonts, sizes, borders, etc) and save the result on a per user basis. While it may give the application some non-standard looks, the client asketh ...
I've got this date time string: post["date"] = "2007-07-18 10:03:19" I'd like to extract just "2007-07-18" as a date. I've seen some reference to strptime but I'm not sure how to use it. How can I extract the date from this string?
To extract just the date part ("2007-07-18") from the datetime string ("2007-07-18 10:03:19") in Python, you can use the `datetime` module along with the `strptime` function to parse the string into a datetime object and then format it back to a date string. Here is how you can do it: ```python from datetime import d...
41,753
[ { "from": "human", "value": "I've got this date time string:\npost[\"date\"] = \"2007-07-18 10:03:19\"\n\nI'd like to extract just \"2007-07-18\" as a date. I've seen some reference to strptime but I'm not sure how to use it. How can I extract the date from this string?\n" }, { "from": "gpt", "...
I am using the SharpZipLib open source .net library from www.icsharpcode.net My goal is to unzip an xml file and read it into a dataset. However I get the following error reading the file into a dataset: "Data at the root level is invalid. Line 1, position 1." I believe what is happening is the unzipping code is not re...
The issue you're encountering with reading the unzipped XML file into a `DataSet` could likely be related to the file not being fully flushed and closed before you attempt to read it. Although you are closing the `FileStream`, there are some improvements and best practices you can apply to ensure that the unzipping pro...
40,208
[ { "from": "human", "value": "I am using the SharpZipLib open source .net library from www.icsharpcode.net\nMy goal is to unzip an xml file and read it into a dataset. However I get the following error reading the file into a dataset: \"Data at the root level is invalid. Line 1, position 1.\"\nI believe what...
I am developing iPhone application and In that application I've one TableViewController, and that TableViewController made up of Custom table cell. into those cell I am loading image from URL, but the scrolling is not that smooth, (because each cell load images every time when scrolling happen). So I decided to store t...
When it comes to storing images for an iPhone application, you generally have two main options: the Documents directory or using a database like SQLite. Both have their pros and cons, and the best choice depends on your specific use case. Let’s explore both options: ### Storing Images in the Documents Directory 1. **...
33,412
[ { "from": "human", "value": "I am developing iPhone application and In that application I've one TableViewController,\nand that TableViewController made up of Custom table cell.\ninto those cell I am loading image from URL, but the scrolling is not that smooth, (because each cell load images every time when...
Is there a way to prompt the user for input during a NAnt build? I want to execute a command that takes a password, but I don't want to put the password into the build script.
In NAnt, there isn't a built-in way to prompt for user input directly during a build, since NAnt scripts are typically executed non-interactively. However, you can work around this limitation by using a couple of approaches to get input securely, especially if you want to avoid hardcoding sensitive information like pas...
40,102
[ { "from": "human", "value": "Is there a way to prompt the user for input during a NAnt build? I want to execute a command that takes a password, but I don't want to put the password into the build script.\n" }, { "from": "gpt", "value": "In NAnt, there isn't a built-in way to prompt for user inp...
I have a piece of C# code that add the values of an enum to a drop down list by type. It requires that it be called with T1 being an enum type, although I cannot specify this as a type constraint because enums are special case in which this isn't possible. This is not a major concern as this is only used internally and...
The issue you are experiencing appears to stem from the way enums and their underlying types are being treated in different environments (Visual Studio's web development server versus IIS 6). The exception you are seeing, `System.InvalidCastException`, suggests that there is a problem with the casting or conversion pro...
37,601
[ { "from": "human", "value": "I have a piece of C# code that add the values of an enum to a drop down list by type. It requires that it be called with T1 being an enum type, although I cannot specify this as a type constraint because enums are special case in which this isn't possible. This is not a major co...
If I have something like a loop or a set of if/else statements, and I want to return a value from within the nest (see below), is the best way of doing this to assign the value to a field or property and return that? See below: bool b; public bool ifelse(int i) { if(i == 5) { b = true; } else { b = false; } return b;...
In the example you've provided, you're using a class-level field (`b`) to store the result of your computation. While this approach works, it isn't the most effective or recommended way to achieve your goal, especially in terms of maintaining the state and readability of your code. A better practice would be to return...
40,503
[ { "from": "human", "value": "If I have something like a loop or a set of if/else statements, and I want to return a value from within the nest (see below), is the best way of doing this to assign the value to a field or property and return that?\nSee below:\nbool b;\n\npublic bool ifelse(int i)\n{\nif(i == ...
Ours is an upcoming company, so we cannot buy two three third party controls and find out by ourselves which the best one is.(One of the better solutions) We have a budget to buy just one. So we would like to know which is third party control is the best to use in ASP.NET based on your experiences. And also I definitel...
Choosing the right third-party controls for your ASP.NET application can significantly impact your development process and the performance of your application. Below, I've outlined some popular third-party control suites and their features based on your criteria: bug-free performance, speed, documentation, and support....
38,842
[ { "from": "human", "value": "Ours is an upcoming company, so we cannot buy two three third party controls and find out by ourselves which the best one is.(One of the better solutions)\nWe have a budget to buy just one.\nSo we would like to know which is third party control is the best to use in ASP.NET base...
I am working on cleaning up a bug in a large code base where no one was paying attention to local time vs. UTC time. What we want is a way of globally ignoring time zone information on DateTime objects sent to and from our ASP.NET web services. I've got a solution for retrieve operations. Data is only returned in d...
To tackle the issue of consistently handling `DateTime` objects without time zone considerations in your ASP.NET web service, you can approach the problem from both the server-side and client-side perspectives. Here are some strategies to implement: ### Server-Side Strategy 1. **Custom Model Binder or Action Filter**...
38,725
[ { "from": "human", "value": "I am working on cleaning up a bug in a large code base where no one was paying attention to local time vs. UTC time. \nWhat we want is a way of globally ignoring time zone information on DateTime objects sent to and from our ASP.NET web services. I've got a solution for retrie...
What is JDBC and where can I start learning about? I know it's a way to access databases with Java, but what problems does it solve? Is it an ORM (or does it try to be)? Does it abstract away differences between databases, at the syntax level? What does it do? and what does it not do?
### What is JDBC? **JDBC** (Java Database Connectivity) is a Java-based API that allows Java applications to interact with various databases in a standard way. It provides a set of interfaces and classes to connect to databases, execute SQL statements, and manage the results. ### Problems JDBC Solves 1. **Database C...
36,203
[ { "from": "human", "value": "What is JDBC and where can I start learning about?\nI know it's a way to access databases with Java, but what problems does it solve? Is it an ORM (or does it try to be)? Does it abstract away differences between databases, at the syntax level? What does it do? and what does it ...
How can I tell the preprocessor not to replace a specific macro? The specific problem is the following: Windows header files define the GetMessage macro. My C++ header files with my API have a GetMessage method. I do not want to rename my method. But when using the API on Windows, including windows.h replaces my GetMes...
To prevent the `GetMessage` macro from interfering with your function name in C++ when including `windows.h`, you can `#undef` the macro right after including the Windows header. Here's a step-by-step approach to solving your problem: 1. **Include the Windows Header**: First, you should include the Windows header file...
41,139
[ { "from": "human", "value": "How can I tell the preprocessor not to replace a specific macro?\nThe specific problem is the following: Windows header files define the GetMessage macro.\nMy C++ header files with my API have a GetMessage method. I do not want to rename my method. But when using the API on Wind...
It's easy to wrap optional memcached caching around your existing database queries. For example: Old (DB-only): function getX x = get from db return x end New (DB with memcache): function getX x = get from memcache if found return x endif x = get from db set x in memcache return...
Caching strategies, especially with an optional caching layer like Memcached, can indeed introduce complexity to your data access patterns. To achieve an effective caching mechanism without duplicating data or making your codebase unwieldy, consider the following strategies: ### 1. Unified Caching Layer Instead of ma...
38,930
[ { "from": "human", "value": "It's easy to wrap optional memcached caching around your existing database queries. For example:\nOld (DB-only):\nfunction getX\n x = get from db\n return x\nend\n\nNew (DB with memcache):\nfunction getX\n x = get from memcache\n if found\n return x\n endif\...
How can i find out this information? Ie, I can install boost 1.35 with a command like sudo port install boost only to get boost 1.36 via port i would do something like this? sudo port install boost-1.36 Hope that clears up my question
To find specific versions of software that can be installed using a package manager like MacPorts, you can follow these general steps: 1. **List Available Versions**: Use the `port` command to list all available versions of a package. You can use the `search` command to see what versions are available: ``` port ...
41,401
[ { "from": "human", "value": "How can i find out this information?\n\nIe, \nI can install boost 1.35 with a command like\nsudo port install boost\n\nonly to get boost 1.36 via port i would do something like this? \nsudo port install boost-1.36\n\nHope that clears up my question\n" }, { "from": "gpt",...
A client of mine is looking to convert a critical 'application' based on multiple (very complex) spreadsheets into a web app. As part of this they'd like some of the web pages they use to enter/model data to resemble a spreadsheet as much as possible. I'd be interested to know if anyone has any experience/recommendati...
Converting a complex spreadsheet-based application into a web app while maintaining a spreadsheet-like interface is a common challenge. There are several libraries and frameworks designed specifically for this purpose. Here are some suggestions that might meet your requirements: ### JavaScript Libraries for Spreadshee...
31,055
[ { "from": "human", "value": "A client of mine is looking to convert a critical 'application' based on multiple (very complex) spreadsheets into a web app. As part of this they'd like some of the web pages they use to enter/model data to resemble a spreadsheet as much as possible.\nI'd be interested to know...
If I define a struct in C# using automatic properties like this: public struct Address { public Address(string line1, string line2, string city, string state, string zip) { Line1 = line1; Line2 = line2; City = city; State = state; Zip = zip; } public string Line1...
Your understanding is generally on the right track, and you're quite close to the core concepts involved with structs, auto-properties, and initialization in C#. Let's break down the situation a bit more to clarify what's happening under the hood. ### Structs and Default Constructors 1. **Struct Initialization**: In ...
39,760
[ { "from": "human", "value": "If I define a struct in C# using automatic properties like this:\npublic struct Address\n{\n public Address(string line1, string line2, string city, string state, string zip)\n {\n Line1 = line1;\n Line2 = line2;\n City = city;\n State = state;\...
I would like to store data persistently for my application, but I don't really need a full blown relational database. I really could get by with a basic "cache"-like persistent storage where the structure is just a (key, value) pair. In lieu of a database what are my best, scalable options?
If you’re looking for lightweight, key-value pair storage solutions for your application, there are several options that can provide persistence without the overhead of a full-fledged relational database. Here are some scalable options for key-value storage: 1. **NoSQL Databases**: - **Redis**: Although primarily a...
39,702
[ { "from": "human", "value": "I would like to store data persistently for my application, but I don't really need a full blown relational database. I really could get by with a basic \"cache\"-like persistent storage where the structure is just a (key, value) pair.\nIn lieu of a database what are my best, sc...
The current guidlelines for explicit member implementation recommend: Using explicit members to approximate private interface implementations. If you need to implement an interface for only infrastructure reasons and you never expect developers to directly call methods on that interface from this type then implement t...
In the context of your code, when you invoke the `WriteXml` method via the explicit interface implementation `((IXmlSerializable)this).WriteXml(writer)`, you are not actually incurring the cost of boxing. Boxing typically occurs when you convert a value type (like an `int`, `struct`, etc.) to a reference type (like `ob...
39,874
[ { "from": "human", "value": "The current guidlelines for explicit member implementation recommend:\n\nUsing explicit members to approximate private interface implementations. If you need to implement an interface for only infrastructure reasons and you never expect developers to directly call methods on tha...
I'm looking for a way to select until a sum is reached. My "documents" table has "tag_id" and "size" fields. I want to select all of the documents with tag_id = 26 but I know I can only handle 600 units of size. So, there's no point in selecting 100 documents and discarding 90 of them when I could have known that the ...
In MySQL, to select rows from a table until a certain condition is met (such as a cumulative sum reaching a specified value), you can utilize a combination of variables in a subquery. However, MySQL does not have built-in functionality like window functions for row-wise calculations in a straightforward SELECT statemen...
38,292
[ { "from": "human", "value": "I'm looking for a way to select until a sum is reached.\nMy \"documents\" table has \"tag_id\" and \"size\" fields.\nI want to select all of the documents with tag_id = 26 but I know I can only handle 600 units of size. So, there's no point in selecting 100 documents and discar...
I want to parse this XML Document http://www.google.de/ig/api?weather=Braunschweig,%20Deutschland I want to be able to read out condition, temp_c and humidity. All this I want to do inside of JavaScript without using any server sided scripts such as PHP and I want it to work on modern browsers as well as IE7 and if wit...
To parse the XML document from the provided URL and extract the `condition`, `temp_c`, and `humidity` values using JavaScript, you can follow these steps. However, please note that due to the Same-Origin Policy in web browsers, you may encounter issues when trying to fetch data from a different domain (like `http://www...
38,864
[ { "from": "human", "value": "I want to parse this XML Document http://www.google.de/ig/api?weather=Braunschweig,%20Deutschland I want to be able to read out condition, temp_c and humidity. All this I want to do inside of JavaScript without using any server sided scripts such as PHP and I want it to work on ...
I've encountered a weird situation: Messages are sent from ServerA to ServerB. It goes into ServerA outgoing queue and then sent to ServerB's queue. ServerB crashed. We had to reformat. When we brought it up, we forgot to install the MSMQ Service. Messages begin pilling up in ServerA's outgoing queue until the program ...
Yes, the behavior you encountered with MSMQ (Microsoft Message Queuing) is consistent with its design and handling of message delivery. In MSMQ, when a message is sent to a queue that doesn't exist on the receiving server, the following typically happens: 1. **Message Delivery Attempt**: When ServerA attempts to send...
40,001
[ { "from": "human", "value": "I've encountered a weird situation:\nMessages are sent from ServerA to ServerB. It goes into ServerA outgoing queue and then sent to ServerB's queue.\nServerB crashed. We had to reformat. When we brought it up, we forgot to install the MSMQ Service.\nMessages begin pilling up in...
Just trying to get my head around Generics by reading this enlightening article by Juval Lowy Paraphrasing.. When you define a Generic class definition, it is compiled into IL. For value-types, as soon as you request for a specific value-type, it substitutes the T with your specific value type to obtain the IL for th...
The performance considerations surrounding boxing, unboxing, and type conversions in C# generics can be a bit nuanced, so let’s break it down. ### Performance Hit when Downcasting from `Object` to Specific Reference Type When you downcast from an `Object` to a specific reference type (like `string` in your example), ...
37,820
[ { "from": "human", "value": "Just trying to get my head around Generics by reading this enlightening article by Juval Lowy \nParaphrasing.. When you define a Generic class definition, it is compiled into IL.\n\nFor value-types, as soon as you request for a specific value-type, it substitutes the T with your...
How can I create EPS files in C#? Are there any opensource libraries available or do I have to resort to the spec and do it by hand?
Creating EPS (Encapsulated PostScript) files in C# can be accomplished in a few different ways. You can either use libraries that facilitate the creation of EPS files or generate the EPS format manually according to the PostScript specification. Here are some options you can consider: ### 1. **Using Open Source Librar...
39,061
[ { "from": "human", "value": "How can I create EPS files in C#? Are there any opensource libraries available or do I have to resort to the spec and do it by hand?\n" }, { "from": "gpt", "value": "Creating EPS (Encapsulated PostScript) files in C# can be accomplished in a few different ways. You ...
This problem has been solved thanks to your suggestions. See the bottom for details. Thanks very much for your help! Our ASP.NET website is accessed from several specific and highly secure international locations. It has been operating fine, but we have added another client location which is exhibiting very strange beh...
It's great to hear that you were able to resolve the issue with your ASP.NET website! This case demonstrates how network configurations and application behavior can sometimes interact in unexpected ways, leading to frustrating bugs. Here’s a recap of what you discovered, which can be valuable for others facing similar ...
39,787
[ { "from": "human", "value": "This problem has been solved thanks to your suggestions. See the bottom for details. Thanks very much for your help!\nOur ASP.NET website is accessed from several specific and highly secure international locations. It has been operating fine, but we have added another client loc...
Should my program support IA64, or should it only support x64? I haven't been able to easily find IA64 computers myself. Is IA64 dead? MS seems to have a wide support for IA64, but it took me a long time to be able to find an IA64, and I had to end up getting it on eBay.
IA64 (Itanium) is largely considered a legacy architecture. While it had its niche primarily in high-performance computing and enterprise servers, the x64 (AMD64) architecture has become the dominant standard for both consumer and server markets. Here are some points to consider when deciding whether to support IA64 or...
40,660
[ { "from": "human", "value": "Should my program support IA64, or should it only support x64?\nI haven't been able to easily find IA64 computers myself. Is IA64 dead?\nMS seems to have a wide support for IA64, but it took me a long time to be able to find an IA64, and I had to end up getting it on eBay.\n" ...
I would like to create a strongly type list and decide the type in runtime. This is my code.I thought it should work, but it doesn't :) Type elementType = Type.GetType(parts[0].Trim(),false,true); var elementsBeingSet = new List<elementType>(); would you have any ideat how to create a strongly typed ...
In C#, you cannot directly create a strongly typed list (or any generic type) with a runtime-determined type using the syntax you provided. Generics in C# require the type to be known at compile time. However, you can achieve this using reflection. Here’s how you can create a strongly typed list with a type determined...
40,322
[ { "from": "human", "value": "I would like to create a strongly type list and decide the type in runtime. This is my code.I thought it should work, but it doesn't :) \n Type elementType = Type.GetType(parts[0].Trim(),false,true);\n var elementsBeingSet = new List<elementType>();\n\nwould you h...
I am binding an SPGridView to a SPList. As code samples suggest, I am using the following code to create a dataview based on the list. dim data as DataView = myList.Items.GetDataTable.DefaultView grid.DataSource = data etc... What I am finding is that the column names in the resulting dataview do not always match the...
The issue you're experiencing with the column names in the `DataView` being different from the original field names in the `SPList` is likely due to the way SharePoint handles internal field names. When you retrieve items from a SharePoint list using the `SPList.Items` collection, it creates a DataTable where each fi...
37,205
[ { "from": "human", "value": "I am binding an SPGridView to a SPList. As code samples suggest, I am using the following code to create a dataview based on the list. \ndim data as DataView = myList.Items.GetDataTable.DefaultView\ngrid.DataSource = data\netc...\n\nWhat I am finding is that the column names in ...
I am using WinCVS as client and CVSNT as my source control server. Some of the files I wanted to add to my CVS repo, were added as Unicode files. Now, I want to recommit the same as ANSI (aka ASCII) files. However, despite deleting the old files from the repo, every time I add the file with the same name, it automatic...
In CVS, the encoding of files is typically determined by how they are initially added to the repository, as well as the configuration settings in the CVSROOT directory and the file itself. When a file is added to CVS, it can inherit the encoding properties from previous versions, particularly if the file already existe...
37,960
[ { "from": "human", "value": "I am using WinCVS as client and CVSNT as my source control server. Some of the files I wanted to add to my CVS repo, were added as Unicode files. Now, I want to recommit the same as ANSI (aka ASCII) files. However, despite deleting the old files from the repo, every time I add t...
If I have a template function, for example like this: template<typename T> void func(const std::vector<T>& v) Is there any way I can determine within the function whether T is a pointer, or would I have to use another template function for this, ie: template<typename T> void func(const std::vector<T*>& v) Thanks
Yes, you can determine whether the template type `T` is a pointer within the function by using type traits from the `<type_traits>` header in C++. Specifically, you can use `std::is_pointer<T>::value` to check if `T` is a pointer. Here's how you can implement it: ```cpp #include <iostream> #include <vector> #include <...
40,285
[ { "from": "human", "value": "If I have a template function, for example like this:\ntemplate<typename T>\nvoid func(const std::vector<T>& v)\n\nIs there any way I can determine within the function whether T is a pointer, or would I have to use another template function for this, ie:\ntemplate<typename T>\nv...
I have a web service that acts as an interface between a farm of websites and some analytics software. Part of the analytics tracking requires harvesting the page title. Rather than passing it from the webpage to the web service, I would like to use HTTPWebRequest to call the page. I have code that will get the entire...
Using the `HttpWebRequest` class in C# to fetch only the title from a web page can be tricky, especially because the HTTP `HEAD` request method retrieves only the headers and not the body (which contains the title). Unfortunately, there is no built-in way to retrieve only the head section without downloading the whole ...
37,078
[ { "from": "human", "value": "I have a web service that acts as an interface between a farm of websites and some analytics software. Part of the analytics tracking requires harvesting the page title. Rather than passing it from the webpage to the web service, I would like to use HTTPWebRequest to call the pa...
I'm working on a star schema for analysis of posted form data. The site that the form data will be posted to is actually external to the site hosting the form, so only the data in the form will be available. I'm going to give the option to include some extra useful information with hidden fields, original referrer, ses...
Hi Simon, It sounds like you’re tackling a challenging problem with an interesting use case! When it comes to designing a star schema for your form data, the key is to focus on what you can measure and analyze, even if you don’t have traditional numerical values in the fact table. Here’s how you can approach this prob...
39,693
[ { "from": "human", "value": "I'm working on a star schema for analysis of posted form data. The site that the form data will be posted to is actually external to the site hosting the form, so only the data in the form will be available. I'm going to give the option to include some extra useful information w...
My app needs to build a buffer from all the selected cells on a worksheet. I have it working correctly when the selected cells are all one contiguous group, but if the user selects a group of cells, then holds down the control key and selects other cells that are not contiguous to the first set of cells, the Worksheet...
To handle non-contiguous selections in an Excel worksheet, you'll want to utilize the `Areas` property of the `Range` object. This property allows you to access all the individual ranges in a non-contiguous selection, rather than just the first contiguous block. Here is a sample VBA code snippet that demonstrates how ...
39,801
[ { "from": "human", "value": "My app needs to build a buffer from all the selected cells on a worksheet. I have it working correctly when the selected cells are all one contiguous group, but if the user selects a group of cells, then holds down the control key and selects other cells that are not contiguous...
This is what I have: $observer = $this->getMock('SomeObserverClass', array('method')); $observer->expects($this->once()) ->method('method') ->with($this->equalTo($arg1)); But the method should take two parameters. I am only testing that the first parameter is being passed correctly (as $arg1). How do...
When testing a method that takes multiple parameters, you can use the `with()` method from PHPUnit to specify expectations for all parameters. Since you want to verify the first parameter while not caring about the second, you can use the `anything()` matcher for the second parameter. Here is how you can modify your co...
42,733
[ { "from": "human", "value": "This is what I have:\n$observer = $this->getMock('SomeObserverClass', array('method'));\n$observer->expects($this->once())\n ->method('method')\n ->with($this->equalTo($arg1));\n\nBut the method should take two parameters. I am only testing that the first paramet...
I am using windows authentication within an ASP.NET application. I am wondering how to best get the objectGuid from the currently logged in user? Regards, Egil.
To retrieve the `objectGUID` of the currently logged-in user in an ASP.NET application using Windows Authentication, you can query the Active Directory (AD) for the user's details. Below are the steps and code snippets that can help you achieve this. ### Step-by-Step Guide 1. **Add Necessary References**: Make sure y...
39,031
[ { "from": "human", "value": "I am using windows authentication within an ASP.NET application. I am wondering how to best get the objectGuid from the currently logged in user?\nRegards, Egil.\n" }, { "from": "gpt", "value": "To retrieve the `objectGUID` of the currently logged-in user in an ASP.N...
Before I ask my question, here's the offending code: var coords = dojo.coords(g); g.style.left = coords.x + "px"; g.style.top = coords.y + "px"; g.style.position = "absolute"; Now imagine that g is a relatively positioned element with an x position of 70 and a y position of 30. If I comment out the last line of the a...
It seems you're encountering issues with the way the position of an element is being affected by changes in its CSS styles, specifically when you modify its `style.position`. The behavior you're observing with `dojo.coords()` returning different values is actually expected due to how positioning works in CSS. Here's w...
39,498
[ { "from": "human", "value": "Before I ask my question, here's the offending code:\nvar coords = dojo.coords(g);\ng.style.left = coords.x + \"px\";\ng.style.top = coords.y + \"px\";\ng.style.position = \"absolute\";\n\nNow imagine that g is a relatively positioned element with an x position of 70 and a y pos...
I'm using a UITableView to show some data from an array. This array can be changed at any time by other threads. (I believe that whether the array is mutable, or just replaced entirely, doesn't make a difference.) Access to the array itself is threadsafe. What's the proper way to ensure thread safety with regard to the...
To ensure thread safety when working with a UITableView and a data array that might be modified from multiple threads, you have a few strategies you can consider. It’s essential to ensure that UI updates, including changes to the UITableView, are performed on the main thread. ### Recommended Approach 1. **Main Thread...
39,806
[ { "from": "human", "value": "I'm using a UITableView to show some data from an array. This array can be changed at any time by other threads. (I believe that whether the array is mutable, or just replaced entirely, doesn't make a difference.) Access to the array itself is threadsafe.\nWhat's the proper way ...
Is it possible to stop visual studio from debugging external javascript? We have a window which displays external webpage. If the page contains bad javascript then my entire session comes to a halt and breaks. Hitting continue won't move past the problem. It's really irritating and tedious, is there an equivalent setti...
Yes, you can configure Visual Studio to avoid debugging external JavaScript while still allowing you to debug your own code. Here's how you can do it: 1. **Disable Script Debugging for External Sources**: - Open Visual Studio. - Go to `Tools` > `Options`. - In the Options dialog, expand the `Debugging` node a...
38,712
[ { "from": "human", "value": "Is it possible to stop visual studio from debugging external javascript? We have a window which displays external webpage. If the page contains bad javascript then my entire session comes to a halt and breaks. Hitting continue won't move past the problem.\nIt's really irritating...
Setup Have you ever had the experience of going into a piece of code to make a seemingly simple change and then realizing that you've just stepped into a wasteland that deserves some serious attention? This usually gets followed up with an official FREAK OUT moment, where the overwhelming feeling of rewriting everythin...
Balancing code improvement and responsible development is a common challenge for many developers, especially in a fast-paced or high-pressure environment. Here are several strategies that can help strike that balance: ### 1. **Incremental Improvements** - **Small Refactorings:** Instead of a complete rewrite, aim f...
39,420
[ { "from": "human", "value": "Setup\nHave you ever had the experience of going into a piece of code to make a seemingly simple change and then realizing that you've just stepped into a wasteland that deserves some serious attention? This usually gets followed up with an official FREAK OUT moment, where the o...
I'm having an issue with a USB project using LIB-USB. The USB device is based on a PIC18F4550 and has a single control endpoint. The PC front-end is written in MSVC and uses Lib-Usb 1.12. On the PC end, the program begins by setting the configuration, claiming the interface, then sending (and receiving) control message...
The issue you're encountering with the `usb_control_msg` returning `rc=-5` could be due to several factors in your USB communication setup. An error code of `-5` corresponds to `-EIO`, which generally indicates an input/output error. Here are some potential causes and troubleshooting steps that may help you resolve the...
40,146
[ { "from": "human", "value": "I'm having an issue with a USB project using LIB-USB. The USB device is based on a PIC18F4550 and has a single control endpoint. The PC front-end is written in MSVC and uses Lib-Usb 1.12.\nOn the PC end, the program begins by setting the configuration, claiming the interface, th...
If you've ever used SharePoint Designer, you'll know it's bad. Really bad. Is there any good replacement for that? Is there any consideration I must take account of if I want to build my own Visual Studio Add-in connector to connect to it? Anything you know that I should be aware of? I just hate the slowness and the wa...
SharePoint Designer (SPD) has indeed received a lot of criticism over the years for its performance issues and its tendency to reformat code, making it challenging for developers and users to maintain clean and organized workflows. Fortunately, there are several alternatives and approaches you can consider: ### Altern...
38,067
[ { "from": "human", "value": "If you've ever used SharePoint Designer, you'll know it's bad. Really bad.\nIs there any good replacement for that? Is there any consideration I must take account of if I want to build my own Visual Studio Add-in connector to connect to it?\nAnything you know that I should be aw...
I have two C DLLs that I need to access in the same executable. I have header files and .LIB files for both libraries. Unfortunately a subset of the functions that I need to access have the exact same names. The best solution I have been able to come up with so far is to use LoadLibrary to load one of the DLLs and expl...
Using `LoadLibrary` and `GetProcAddress` can indeed make your code more complex and error-prone as you've described. However, if you have two DLLs with conflicting function names, using these functions is often the most practical solution in terms of ensuring that the correct function is called. Since you wish to avoi...
38,497
[ { "from": "human", "value": "I have two C DLLs that I need to access in the same executable. I have header files and .LIB files for both libraries. Unfortunately a subset of the functions that I need to access have the exact same names. The best solution I have been able to come up with so far is to use Loa...
I've got a VS 2008 C# Web project and whenever I make some changes to the files in it (not even to the project file itself) VS will remove some lines like this from the csproj file: <SubType>ASPXCodeBehind</SubType> So something like this: <Compile Include="Default.aspx.cs"> <DependentUpon>Default.aspx</DependentUpo...
The issue you're experiencing with Visual Studio 2008 modifying the .csproj file by adding and removing the `<SubType>ASPXCodeBehind</SubType>` element is indeed a known quirk with the way Visual Studio handles project files, particularly when there are discrepancies between the local environment and the project config...
37,002
[ { "from": "human", "value": "I've got a VS 2008 C# Web project and whenever I make some changes to the files in it (not even to the project file itself) VS will remove some lines like this from the csproj file:\n<SubType>ASPXCodeBehind</SubType>\n\nSo something like this:\n<Compile Include=\"Default.aspx.cs...
I have this current problem with data I have to represent in a MySQL database: I have to support different kinds of products with different data each one, for example, cars, hotel rooms, books, etc. For my application there is some data which is common for each product, like name, description, price, etc. So I think o...
To design a MySQL database that supports different types of products (like cars, hotel rooms, books, etc.) while keeping a common structure for shared attributes, you can adopt a few different strategies. Here are two approaches you might consider: ### 1. Single Table Inheritance (STI) In this approach, you can have ...
37,300
[ { "from": "human", "value": "I have this current problem with data I have to represent in a MySQL database:\nI have to support different kinds of products with different data each one, for example, cars, hotel rooms, books, etc. For my application there is some data which is common for each product, like na...
Did the recent purchase of MySQL by Sun and the subsequent buggy releases kill the MySQL brand? I whole heartedly embraced MySQL when it first came out as I used to be a poor developer and all the RDBMs were too expensive. I have fond feelings for MySQL and their being able to compete with Oracle and SQL Server. I cr...
Your reflections on MySQL, its acquisition by Sun, and its subsequent trajectory highlight a sentiment shared by many in the developer community. When MySQL was first introduced, it was a game changer, especially for small developers and startups seeking an affordable and open-source alternative to established RDBMS so...
40,803
[ { "from": "human", "value": "Did the recent purchase of MySQL by Sun and the subsequent buggy releases kill the MySQL brand?\nI whole heartedly embraced MySQL when it first came out as I used to be a poor developer and all the RDBMs were too expensive. I have fond feelings for MySQL and their being able to...
I am writing a xslt style sheet to transform a xml to another xml. Here is the simplified version of original xml: <eml> <datatable> <physical> <distribution id="100"/> </physical> </datatable> <software> <impleme...
To filter the `<describes>` elements in your XSLT stylesheet based on the condition that their value is not equal to the `id` attributes of any `<distribution>` element in either `<physical>` or `<implementation>`, you need to adjust your XPath expression. The existing expression compares the `@id` values against the c...
39,484
[ { "from": "human", "value": "I am writing a xslt style sheet to transform a xml to another xml.\nHere is the simplified version of original xml:\n <eml>\n <datatable>\n <physical>\n <distribution id=\"100\"/>\n </physical>\n </datatable> ...
Does ODBC support asynchronous calls? If it does, then can you tell me about any reference materials? My preferred language is C++.
Yes, ODBC (Open Database Connectivity) supports asynchronous calls, allowing applications to execute database operations without blocking the main execution thread. Asynchronous processing in ODBC is achieved through the use of specific API functions designed for this purpose. ### Key ODBC Functions for Asynchronous P...
38,278
[ { "from": "human", "value": "Does ODBC support asynchronous calls? If it does, then can you tell me about any reference materials?\nMy preferred language is C++.\n" }, { "from": "gpt", "value": "Yes, ODBC (Open Database Connectivity) supports asynchronous calls, allowing applications to execute ...
I have researched and haven't found a way to run INTERSECT and MINUS operations in MS Access. Does any way exist
In MS Access, there are no direct implementations of the `INTERSECT` or `MINUS` SQL operations like there are in other SQL databases. However, you can achieve similar results using other SQL constructs. Here's how you can implement these operations in MS Access: ### 1. INTERSECT Operation To perform an `INTERSECT` op...
41,403
[ { "from": "human", "value": "I have researched and haven't found a way to run INTERSECT and MINUS operations in MS Access. Does any way exist\n" }, { "from": "gpt", "value": "In MS Access, there are no direct implementations of the `INTERSECT` or `MINUS` SQL operations like there are in other SQ...
When is it appropriate to use <cflock scope="application"> or it's ilk as opposed to <cflock name="foo">? Specifically, I'm interested in using CFLock to protect shared objects in the application, session, or server scopes, but I'm also interested in finding out about different uses of locking in ColdFusion.
In ColdFusion, the `<cflock>` tag is used to manage concurrency by ensuring that only one thread can access a block of code or a shared resource at any given time. Understanding when to use different scopes with `<cflock>` is critical for maintaining data integrity, especially in multi-threaded environments like web ap...
35,962
[ { "from": "human", "value": "When is it appropriate to use <cflock scope=\"application\"> or it's ilk as opposed to <cflock name=\"foo\">? \nSpecifically, I'm interested in using CFLock to protect shared objects in the application, session, or server scopes, but I'm also interested in finding out about dif...
Up until now I've been using Active records in all my c# database driven applications. But now my application requires my persistence code being split from my business objects. I have read a lot of posts regarding Martin Fowler's data mapping pattern, but my knowledge of this pattern is still very limited. Let's use t...
The concerns you've raised about implementing the Data Mapper pattern in your C# application are quite valid, and it's great that you're considering these design principles for maintaining separation between your business logic and data access code. Let's address your questions in order: ### 1. Transferring Data TO & ...
34,524
[ { "from": "human", "value": "Up until now I've been using Active records in all my c# database driven applications. But now my application requires my persistence code being split from my business objects. I have read a lot of posts regarding Martin Fowler's data mapping pattern, but my knowledge of this pa...
I am working in a project where there are configuration files, one in number for each of the environments where the application would be deployed. When a developer modifies one of these files, the developer should not be allowed to check-in the file individually, but check-in all the files together or at least the deve...
To enforce a policy that requires developers to check in all configuration files together or at least be informed that they need to do so, you can implement one of several approaches depending on the version control system you are using (e.g., Git, Mercurial, etc.). Below are some methods that can help you achieve this...
36,581
[ { "from": "human", "value": "I am working in a project where there are configuration files, one in number for each of the environments where the application would be deployed.\nWhen a developer modifies one of these files, the developer should not be allowed to check-in the file individually, but check-in a...
ActiveRecord doesn't seem to cater for record locking and database updates. How does one synchronise updates in disconnected multi-user environments such as websites and web services?
Synchronizing updates in disconnected multi-user environments, like websites and web services, is a common challenge, particularly when using ORM frameworks like ActiveRecord. While ActiveRecord provides basic mechanisms for handling concurrency (like optimistic locking), more advanced techniques are often necessary fo...
36,030
[ { "from": "human", "value": "ActiveRecord doesn't seem to cater for record locking and database updates. How does one synchronise updates in disconnected multi-user environments such as websites and web services?\n" }, { "from": "gpt", "value": "Synchronizing updates in disconnected multi-user e...
I have authentication mode set to forms in my asp.net web.config but am still getting a windows login prompt when i browse to the website. Could authentication mode be set elsewhere, in IIS for example? My site runs on IIS 6. Thanks.
Yes, the issue you are encountering could indeed be related to settings in IIS rather than just your ASP.NET `web.config`. Even if you have set the authentication mode to `Forms` in your ASP.NET application, the IIS configuration may override this setting if it is configured to require Windows Authentication. Here are ...
34,060
[ { "from": "human", "value": "I have authentication mode set to forms in my asp.net web.config but am still getting a windows login prompt when i browse to the website.\nCould authentication mode be set elsewhere, in IIS for example? My site runs on IIS 6.\nThanks.\n" }, { "from": "gpt", "value":...
Or better said: When to use array as a field data type in a table? Which solution provides better search results?
Using an array as a field data type in a database table can be beneficial in certain scenarios, but it also comes with trade-offs regarding searchability, maintainability, and performance. Here are some considerations for when to use arrays and the implications for search results: ### When to Use Arrays 1. **One-to-M...
39,165
[ { "from": "human", "value": "Or better said: When to use array as a field data type in a table?\nWhich solution provides better search results?\n" }, { "from": "gpt", "value": "Using an array as a field data type in a database table can be beneficial in certain scenarios, but it also comes with ...