instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have a problem while showing .flv video file through apache 5.5 server. I am using jsp2.0 & javascript, flash video player in html. Whenever i am trying to run the video.jsp page which contains 10mb .flv video file through apache 5.5 server, my c drive is getting full. It also does not show the video on page & my who...
It sounds like you're encountering a few different issues while trying to serve an FLV video file using Apache Tomcat 5.5. Here are a few steps and suggestions that might help you resolve these problems: ### 1. Check Disk Space Management First, you should investigate why your C: drive is getting full when trying to s...
36,676
[ { "from": "human", "value": "I have a problem while showing .flv video file through apache 5.5 server.\nI am using jsp2.0 & javascript, flash video player in html.\nWhenever i am trying to run the video.jsp page which contains 10mb .flv video file through apache 5.5 server, my c drive is getting full. It al...
The short question: Is it safe skip ib_logfile* files while creating custom-made backup of MySQL installation with InnoDB engine used? Custom-made backup is just copy all (or subset of) /var/lib/mysql + /etc/my.cnf to safe place. As I know ib_logfile* files are recreated by MySQL on start + the files are really huge, s...
Yes, it is generally safe to skip the `ib_logfile*` files when creating a custom backup of a MySQL installation that uses the InnoDB engine, provided that you have properly shut down the MySQL server before taking the backup. Here are a few key points to consider: 1. **Recreation of Log Files**: The `ib_logfile*` fi...
39,753
[ { "from": "human", "value": "The short question:\nIs it safe skip ib_logfile* files while creating custom-made backup of MySQL installation with InnoDB engine used?\nCustom-made backup is just copy all (or subset of) /var/lib/mysql + /etc/my.cnf to safe place.\nAs I know ib_logfile* files are recreated by M...
I'm getting the following error in Eclipse using the Cusp plug-in: Package LISP-UNIT is not loaded How do I fix it?
The error message you are encountering indicates that the Cusp plug-in is unable to find or load the `LISP-UNIT` package. This typically occurs when the necessary libraries or packages are not correctly set up in your environment. Here are some steps you can take to resolve the issue: 1. **Install LISP-UNIT**: Ensu...
37,850
[ { "from": "human", "value": "I'm getting the following error in Eclipse using the Cusp plug-in:\n\nPackage LISP-UNIT is not loaded\n\nHow do I fix it?\n" }, { "from": "gpt", "value": "The error message you are encountering indicates that the Cusp plug-in is unable to find or load the `LISP-UNIT`...
Question says it all, I've got a 500,000 line file that gets generated as part of an automated build process on a Windows box and it's riddled with ^M's. When it goes out the door it needs to *nix friendly, what's the best approach here, is there a handy snippet of code that could do this for me? Or do I need to write ...
To convert a file from Windows line endings (CRLF, represented by `^M` or `\r\n`) to Unix line endings (LF, represented by `\n`), you can use several approaches. Here are some of the simplest methods: ### 1. Using `sed` in Git Bash or WSL If you have Git for Windows installed, you can use Git Bash, or if you're using...
36,012
[ { "from": "human", "value": "Question says it all, I've got a 500,000 line file that gets generated as part of an automated build process on a Windows box and it's riddled with ^M's. When it goes out the door it needs to *nix friendly, what's the best approach here, is there a handy snippet of code that cou...
I have signed up with BizSpark and it is a great deal, especially for people like myself in perennial startup mode. As part of BizSpark you get 3 year deployment licenses for software such as Windows Server and SQL Server. Is there any dedicated hosting companies that will allow you to use these licenses without having...
Yes, there are hosting providers that allow you to use your own licenses for software like Windows Server and SQL Server, particularly if you are part of a program like BizSpark that offers such licenses. This is often referred to as "License Mobility" or "Bring Your Own License" (BYOL). Here are some options to consid...
39,887
[ { "from": "human", "value": "I have signed up with BizSpark and it is a great deal, especially for people like myself in perennial startup mode. As part of BizSpark you get 3 year deployment licenses for software such as Windows Server and SQL Server. Is there any dedicated hosting companies that will allow...
I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app? In other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things): class Movie(models.Model): title = models.CharField(max_length=255) and in ...
In Django, it's perfectly acceptable to define a foreign key to a model in another app. The issue you're encountering is likely related to the way you're importing the model and how you're specifying the foreign key. Here are a few ways to properly set up a foreign key from one app to a model in another app: ### Optio...
38,622
[ { "from": "human", "value": "I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app?\nIn other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things):\nclass Movie(models.Model):\n title...
I'm working on a pipe and am having trouble with combining two lists of items. List 1: [0] letter - a [1] letter - b [2] letter - c List 2: [1] word - apple [2] word - banana [3] word - cake I'd like something which emits the following: List 3: [1] letter - a word - apple [2] letter - b word - banana [3] lett...
Combining the two lists in the way you described can be achieved using a simple loop in most programming languages. Below is an example of how you could do this in Python. Assuming you have the two lists as follows: ```python list1 = [ {"type": "letter", "value": "a"}, {"type": "letter", "value": "b"}, {"...
40,180
[ { "from": "human", "value": "I'm working on a pipe and am having trouble with combining two lists of items.\nList 1:\n[0] letter - a\n[1] letter - b\n[2] letter - c\n\nList 2:\n[1] word - apple\n[2] word - banana\n[3] word - cake\n\nI'd like something which emits the following:\nList 3:\n[1] letter - a\n ...
In short: what is the best way to design and implement a factory+plugin mechanism, so that plugins can replace objects in the main application. We have a code base from which we build our applications. The code base is fine for 70-95% of the applications, meaning that in each new application we need to change 5-30% of ...
Designing a plugin system with a flexible factory mechanism involves creating an architecture that allows for easy customization and extension of the application. Here are several approaches and best practices to consider for implementing such a system. ### 1. **Use Factory Pattern with Dependency Injection** Incorpo...
37,741
[ { "from": "human", "value": "In short: what is the best way to design and implement a factory+plugin mechanism, so that plugins can replace objects in the main application.\nWe have a code base from which we build our applications. The code base is fine for 70-95% of the applications, meaning that in each n...
The thing is I've been using the lock statement to protect a critical part of my code, but now, I realize I could allow concurrent execution of that critical code is some conditions are met. Is there a way to condition the lock?
Yes, it is possible to conditionally allow concurrent execution of your code while still using the `lock` statement in C#. However, the traditional `lock` does not support conditional locking directly. Instead, you can implement a custom mechanism using a combination of a lock and flags or other synchronization primiti...
40,095
[ { "from": "human", "value": "The thing is I've been using the lock statement to protect a critical part of my code, but now, I realize I could allow concurrent execution of that critical code is some conditions are met.\nIs there a way to condition the lock?\n" }, { "from": "gpt", "value": "Yes,...
Let's say I want to create the alias %xed for %edit -x. How would I do it?
To create an alias in a shell (like Bash or Zsh) for the command `%edit -x` with the alias `%xed`, you would typically use the `alias` command. Here’s how you can do it: 1. Open your terminal. 2. To create the alias for the current session, you can run the following command: ```bash alias %xed='%edit -x' ```...
41,591
[ { "from": "human", "value": "Let's say I want to create the alias %xed for %edit -x. How would I do it?\n" }, { "from": "gpt", "value": "To create an alias in a shell (like Bash or Zsh) for the command `%edit -x` with the alias `%xed`, you would typically use the `alias` command. Here’s how you ...
As the title really, I'm in one part of my code and I would like to invoke any methods that have been added to the Button.Click handler. How can I do this?
In C#, if you want to invoke all the methods that have been added to the `Click` event of a `Button`, you can do so by directly invoking the event itself. The `Button.Click` event is essentially a delegate, and you can invoke it by calling its invocation list. Here's a simple way to achieve this: ```csharp using Syst...
39,828
[ { "from": "human", "value": "As the title really, I'm in one part of my code and I would like to invoke any methods that have been added to the Button.Click handler.\nHow can I do this?\n" }, { "from": "gpt", "value": "In C#, if you want to invoke all the methods that have been added to the `Cli...
In my page, I am displaying a report after the user selects some information. On a button onclick event, I am displaying an image which rotates itself to indicate to the user that the request is being processed. The image rotates in the Firefox but not in IE(it just displays the image). Please give me your suggestions...
The issue you're experiencing with the rotating image in Internet Explorer (IE) compared to Firefox is likely due to differences in how the two browsers handle CSS animations or JavaScript. Here are some suggestions to ensure that the image rotates in both browsers: ### 1. Use CSS Animations If you're using CSS for th...
34,478
[ { "from": "human", "value": "In my page, I am displaying a report after the user selects some information. On a button onclick event, I am displaying an image which rotates itself to indicate to the user that the request is being processed. The image rotates in the Firefox but not in IE(it just displays the...
When trying to kill a buffer that contains changes in Emacs, the message: " Buffer [buffer] modified; kill anyway? (yes or no)" is displayed. Instead of this I'd like to have Emacs ask me if I want to: 1. View a diff of what changed, 2. Save the buffer, 3. Kill the buffer. How?
To customize the behavior of Emacs when trying to kill a modified buffer, you can use advice to add the functionality you want. Specifically, you can redefine the behavior when `kill-buffer` is called to show a diff, prompt to save, or proceed to kill the buffer. Here is a way to implement this in your Emacs configura...
38,789
[ { "from": "human", "value": "When trying to kill a buffer that contains changes in Emacs, the message:\n\" Buffer [buffer] modified; kill anyway? (yes or no)\" is displayed. \nInstead of this I'd like to have Emacs ask me if I want to:\n 1. View a diff of what changed, \n 2. Save the buffer, \n 3. Kill the ...
Can anyone please help me to get all the domains in Active Directory. I have tried many times, but all the programs are listing only the current working domain. How can I do this?
To retrieve all domains in an Active Directory (AD) forest, you can use various methods depending on your preferred tools and environment. Here are a few approaches using PowerShell, which is one of the most common and effective ways to interact with Active Directory. ### Method 1: Using PowerShell If you have the Ac...
38,432
[ { "from": "human", "value": "Can anyone please help me to get all the domains in Active Directory. I have tried many times, but all the programs are listing only the current working domain. \nHow can I do this?\n" }, { "from": "gpt", "value": "To retrieve all domains in an Active Directory (AD) ...
I have a problem with the following Linq query using Entity Framework: from o in ctx.Entity where o.EntityID = entityid select o; Simple enough right? Well the 'Entity' set is the parent class of a whole lot of other classes. The generated SQL for this simple query is about 20K worth of characters with a slew of 'case...
When working with Entity Framework and inheritance, especially in a scenario involving a table-per-hierarchy (TPH) or table-per-type (TPT) mapping, the SQL generated can become complex and inefficient. Here are several strategies to improve performance and simplify the SQL generated for your LINQ queries: ### 1. Use D...
38,883
[ { "from": "human", "value": "I have a problem with the following Linq query using Entity Framework:\nfrom o in ctx.Entity\nwhere o.EntityID = entityid\nselect o;\n\nSimple enough right? Well the 'Entity' set is the parent class of a whole lot of other classes. The generated SQL for this simple query is abou...
I currently have two XSD schemes and one is a "light" version of the other. Right now I have everything in the "light" version repeated in the "complete" schema, but this becomes a pain when I need to make a change, and it goes against the DRY principle anyways, so I was wondering if there was an element that served to...
Yes, you can achieve a form of inheritance or reusability in XML Schema Definitions (XSD) by using the `xs:include` or `xs:import` elements. These elements allow you to include another schema file in your schema, which can help you adhere to the DRY (Don't Repeat Yourself) principle. Here’s a brief overview of how eac...
39,864
[ { "from": "human", "value": "I currently have two XSD schemes and one is a \"light\" version of the other. Right now I have everything in the \"light\" version repeated in the \"complete\" schema, but this becomes a pain when I need to make a change, and it goes against the DRY principle anyways, so I was w...
Consider two tables transaction and category each having their own ID and information. A transaction can have more than one category, I have read creating a 3rd table to link transaction and category using their IDs is best. But what would you call this table, assuming you would have many like it? transactionCategories...
The name `transactionCategories` is quite clear and follows common naming conventions for junction tables. However, there are several alternative names you might consider that could improve clarity or maintain consistency with your naming conventions, especially if you have multiple similar junction tables. Here are so...
41,426
[ { "from": "human", "value": "Consider two tables transaction and category each having their own ID and information.\nA transaction can have more than one category, I have read creating a 3rd table to link transaction and category using their IDs is best. But what would you call this table, assuming you woul...
I have a working makefile that builds with mingw32. Now i renamed that makefile to Makefile.w32 (source -> http://pastie.org/319964) Now i have a Makefile with the following. The problem is, it does not build my source all: make mingw32 clean: @echo "causes an infinite loop -> make mingw32 clean" mingw32: ...
The issue you're encountering stems from how Make interprets the command you're using to invoke the `Makefile.w32`. The command `make Makefile.w32` is not actually telling make to use that Makefile; it's checking whether there is a target named `Makefile.w32`. Since you haven't defined any targets with that name in you...
40,090
[ { "from": "human", "value": "I have a working makefile that builds with mingw32. Now i renamed that makefile to Makefile.w32 (source -> http://pastie.org/319964)\nNow i have a Makefile with the following. The problem is, it does not build my source\nall:\n make mingw32\n\nclean:\n @echo \"causes an in...
Is it possible to show other processes in progress on an Oracle database? Something like Sybases sp_who
Yes, in Oracle databases, you can query the dynamic performance views to get information about current sessions and their status, similar to what you would obtain with Sybase's `sp_who`. The key views you can use include `V$SESSION` and `V$PROCESS`. Here’s a simple query that shows currently active sessions in an Orac...
29,139
[ { "from": "human", "value": "Is it possible to show other processes in progress on an Oracle database? Something like Sybases sp_who\n" }, { "from": "gpt", "value": "Yes, in Oracle databases, you can query the dynamic performance views to get information about current sessions and their status,...
How can I tell if a method is running in the context of an AJAX postback (i.e as the result of a UpdatePanel (asynchronous) postback)? According to egoldin Page.IsAsync is a very common confusion that has absolutely nothing to do with AJAX. The correct approach is to use ScriptManager.GetCurrent ( Page ).IsInAsyncPostB...
In ASP.NET Web Forms, when you're dealing with asynchronous postbacks—specifically those triggered by an `UpdatePanel`—you can determine if a method is running in the context of an AJAX postback by checking the `IsInAsyncPostBack` property of the `ScriptManager`. Here's how you can implement this: 1. **Using ScriptMa...
40,918
[ { "from": "human", "value": "How can I tell if a method is running in the context of an AJAX postback (i.e as the result of a UpdatePanel (asynchronous) postback)?\nAccording to egoldin Page.IsAsync is a very common confusion that has absolutely nothing to do with AJAX.\nThe correct approach is to use Scrip...
I seem to remember reading that it's possible to declare taglib directives such as: <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> in web.xml. This eliminates the need to duplicate this directive in every JSP file where the taglib is used. Could someone tell me how these directives can be added to we...
Yes, you're correct that in JSP (JavaServer Pages), you can declare taglib directives in the `web.xml` file to avoid repeating them in each JSP page. However, it is important to note that this functionality is not part of the JSP specification itself but rather a feature provided by certain servlet containers. In some...
35,257
[ { "from": "human", "value": "I seem to remember reading that it's possible to declare taglib directives such as:\n<%@ taglib prefix=\"c\" uri=\"http://java.sun.com/jsp/jstl/core\" %>\n\nin web.xml. This eliminates the need to duplicate this directive in every JSP file where the taglib is used. Could someone...
How to do this in Java - passing a collection of subtype to a method requiring a collection of base type? The example below gives: The method foo(Map<String,List>) is not applicable for the arguments (Map<String,MyList>) I can implement by creating a class hierarchy for the typed collections - but is it possible other...
In Java, you cannot directly pass a `Map<String, MyList>` to a method expecting a `Map<String, List>`, even though `MyList` is a subtype of `List`. This is because generics in Java are invariant, meaning `Map<String, List>` and `Map<String, MyList>` are considered completely different types. However, you can use bound...
39,720
[ { "from": "human", "value": "How to do this in Java - passing a collection of subtype to a method requiring a collection of base type?\nThe example below gives:\nThe method foo(Map<String,List>) is not applicable for the arguments (Map<String,MyList>)\n\nI can implement by creating a class hierarchy for the...
Given: from django.db import models class Food(models.Model): """Food, by name.""" name = models.CharField(max_length=25) class Cat(models.Model): """A cat eats one type of food""" food = models.ForeignKey(Food) class Cow(models.Model): """A cow eats one type of food""" food = models.Fo...
In Django, you can access the reverse relationships from a model using the `related_name` attribute on the foreign key or many-to-many field. However, if you haven't explicitly set a `related_name`, Django automatically creates one based on the name of the related model with a `_set` suffix for `ForeignKey` fields and ...
37,609
[ { "from": "human", "value": "Given:\nfrom django.db import models\n\nclass Food(models.Model):\n \"\"\"Food, by name.\"\"\"\n name = models.CharField(max_length=25)\n\nclass Cat(models.Model):\n \"\"\"A cat eats one type of food\"\"\"\n food = models.ForeignKey(Food)\n\nclass Cow(models.Mode...
Please let me know how can I disable HTTP MEthods like OPTIONS, PUT, DELETE for the web server Apache Coyote HTTP 1.1 Connector (Tomcat 5.5.27)
To disable specific HTTP methods such as OPTIONS, PUT, and DELETE for the Apache Coyote HTTP/1.1 Connector in Apache Tomcat 5.5.27, you can implement a few different approaches. Here are some common methods to achieve this: ### Method 1: Using a Valve 1. **Create a Custom Valve**: You can create a custom Valve that c...
37,898
[ { "from": "human", "value": "Please let me know how can I disable HTTP MEthods like OPTIONS, PUT, DELETE for the web server Apache Coyote HTTP 1.1 Connector (Tomcat 5.5.27)\n" }, { "from": "gpt", "value": "To disable specific HTTP methods such as OPTIONS, PUT, and DELETE for the Apache Coyote HT...
I'm looking for a solid ORM for .NET that can handle over a 1000 tables and entities. What can you suggest? Any comments would be appreciated, but those from people who have actually dealt with this challenge and a description of how with what they dealt with it would be appreciated even more.
When it comes to selecting an ORM (Object-Relational Mapping) solution for .NET that can efficiently handle a database with over 1000 tables and entities, there are a few popular choices that come to mind. Based on experiences and community feedback, here are some solid ORM options along with considerations from those ...
36,973
[ { "from": "human", "value": "I'm looking for a solid ORM for .NET that can handle over a 1000 tables and entities. What can you suggest? Any comments would be appreciated, but those from people who have actually dealt with this challenge and a description of how with what they dealt with it would be appreci...
In organisations where you have large numbers of applications, written in a myriad of languages running on innumerable platforms and databases how do folks manage the release of builds and patches, particularly when some of the releases are 3rd party? I know there a whole bunch of "Release Management" applications out ...
Managing software releases in organizations with a diverse ecosystem of applications, languages, platforms, and databases can be a complex challenge. Here are some strategies and best practices that organizations have found effective in managing releases and their associated interdependencies, particularly when third-p...
34,728
[ { "from": "human", "value": "In organisations where you have large numbers of applications, written in a myriad of languages running on innumerable platforms and databases how do folks manage the release of builds and patches, particularly when some of the releases are 3rd party? I know there a whole bunch ...
The function below prints a color raster image to a PCL-5 printer. The function was adapted from a 2-color (1bpp) printing function we had that worked perfectly, except for the grainy 2-color printing. The problem is that the image comes out with a large black bar extending from the right of the image to the edge of ...
It sounds like you're encountering a common issue when dealing with PCL (Printer Command Language) and the way it handles raster images, particularly regarding the rotation of the image when printing. The command `stream("\u001b*r0F");` is used to follow the logical page layout, which allows the printer to determine h...
35,903
[ { "from": "human", "value": "The function below prints a color raster image to a PCL-5 printer. The function was adapted from a 2-color (1bpp) printing function we had that worked perfectly, except for the grainy 2-color printing. The problem is that the image comes out with a large black bar extending fr...
I am having issues using the :collection command for a partial within a form I am creating in rails. I would ideally like to use the :collection command, so I can easily manipulate this section in my .rjs templates (the form will submit and reload the form when the check box is changed, it's a to-do list). This code wo...
The issue you're encountering stems from how Rails expects parameters to be structured when using `form_for` with a collection. When you use the `:collection` option in the `render` method, Rails attempts to set up the local variable to represent each item in the collection as `list` (the name of the partial you are re...
37,823
[ { "from": "human", "value": "I am having issues using the :collection command for a partial within a form I am creating in rails. I would ideally like to use the :collection command, so I can easily manipulate this section in my .rjs templates (the form will submit and reload the form when the check box is ...
I haven't had to interact w/MSSQL much in my development career, though I've spent many an hour working with MySQL. An M.B.A. friend of mine is starting a job where she needs to gain functional knowledge of MSSQL Server, and I'd really like to help. What are the differences between MSSQL and MySQL? How would you recomm...
That's great that you want to help your friend learn about MSSQL Server! Understanding the differences between MSSQL and MySQL can provide a solid foundation for your friend to build on as she learns about databases. Below are some of the key differences and learning recommendations. ### Key Differences Between MSSQL ...
22,299
[ { "from": "human", "value": "I haven't had to interact w/MSSQL much in my development career, though I've spent many an hour working with MySQL.\nAn M.B.A. friend of mine is starting a job where she needs to gain functional knowledge of MSSQL Server, and I'd really like to help.\nWhat are the differences be...
I'm developing a set of applications that work together to create a system for processing metering data. There's several reasons I want to have them loosely coupled and the system should be extensible by third parties, so the apps will be tied together via messaging. I'm looking for a messaging system that offers bindi...
Based on your requirements for a messaging system that supports C#, Java, and Python with the desired messaging patterns and extensibility, there are several options that could meet your needs. Here's an overview of some popular messaging systems that might work for you: ### 1. **Apache Kafka** - **Bindings:** Kafka h...
32,990
[ { "from": "human", "value": "I'm developing a set of applications that work together to create a system for processing metering data. There's several reasons I want to have them loosely coupled and the system should be extensible by third parties, so the apps will be tied together via messaging.\nI'm lookin...
class Score { var $score; var $name; var $dept; var $date; function Score($score, $name, $dept, $date) { $this->scores = ($score); $this->name = ($name); $this->dept = ($dept); $this->date = ($date); } function return_score(){ return $this->score...
You're doing great for a beginner! The issue in your code is with the `return_score()` method. In PHP, once a `return` statement is executed, the function ends, so it won't return the other values after the first `return`. To return multiple values, you can either: 1. Return them as an associative array or an object...
36,571
[ { "from": "human", "value": "class Score\n{\n var $score;\n var $name;\n var $dept;\n var $date;\n\n function Score($score, $name, $dept, $date)\n {\n $this->scores = ($score);\n $this->name = ($name);\n $this->dept = ($dept);\n $this->date = ($date);\n }\n\n...
I am running the following: master..xp_cmdshell 'dtsrun /S ricmssql02 /U admindw /P letmein /N "scott - debug"' but also send parameters. I am seeing the following to do that: /A global_parameter_name:typeid=value And also that the whole thing can be repeated to send multiple. My questions are; What is the delimiter f...
In the context of the `dtsrun` command you are using, you can specify multiple parameters by separating them with spaces. Each parameter follows the format `/A global_parameter_name:typeid=value`. Here’s a breakdown of your questions: 1. **Delimiter for Multiple Parameters**: - You separate multiple parameters wit...
39,937
[ { "from": "human", "value": "I am running the following:\nmaster..xp_cmdshell 'dtsrun /S ricmssql02 /U admindw /P letmein /N \"scott - debug\"'\nbut also send parameters. I am seeing the following to do that:\n/A global_parameter_name:typeid=value\nAnd also that the whole thing can be repeated to send mult...
I'm pretty sure this is a simple question in regards to formatting but here's what I want to accomplish: I want to output data onto the screen using cout. I want to output this in the form of a table format. What I mean by this is the columns and rows should be properly aligned. Example: Test 1 Test2...
To achieve properly aligned columns in your output using `cout`, you can use `std::setw` from the `<iomanip>` library. This allows you to specify the width of each column, ensuring that the data aligns correctly regardless of the lengths of the strings. Here's how you can modify your output to ensure proper alignment:...
38,153
[ { "from": "human", "value": "I'm pretty sure this is a simple question in regards to formatting but here's what I want to accomplish:\nI want to output data onto the screen using cout. I want to output this in the form of a table format. What I mean by this is the columns and rows should be properly align...
How can I calculate the last business day of the month in .NET?
To calculate the last business day of the month in .NET, you can follow these steps: 1. Determine the last day of the month. 2. Check if that day is a weekend (Saturday or Sunday). 3. If it's a weekend, move back to the previous Friday (or adjust accordingly). 4. If it's a holiday, continue to move back until you find...
35,945
[ { "from": "human", "value": "How can I calculate the last business day of the month in .NET?\n" }, { "from": "gpt", "value": "To calculate the last business day of the month in .NET, you can follow these steps:\n\n1. Determine the last day of the month.\n2. Check if that day is a weekend (Saturd...
Suppose you have a GridView with a few columns like: | Foo | Bar | Total | and you use a style sheet to make the alternating rows different colors, say light blue and white. Is there a good way to make a particular column alternate in a different color? For example, I might want the Total column to alternate in medium...
To achieve the effect of alternating colors for a specific column in a GridView using only CSS, you can utilize the `nth-child` pseudo-class. This allows you to style specific cells within a column based on their row index. Here's a general approach: 1. **Set up your GridView**: Ensure that you have a GridView in you...
37,645
[ { "from": "human", "value": "Suppose you have a GridView with a few columns like:\n| Foo | Bar | Total |\nand you use a style sheet to make the alternating rows different colors, say light blue and white.\nIs there a good way to make a particular column alternate in a different color? For example, I might ...
From what variable can you pick up the username from Forms Authentication in Microsoft SQL Reporting Services? The User!UserId value comes back as the Windows Account that reporting services is running under.
In Microsoft SQL Server Reporting Services (SSRS), when you are using Forms Authentication, the `User!UserID` built-in field typically returns the username of the authenticated user in the context of the report execution. If `User!UserID` is returning the Windows account that the Reporting Services is running under (i...
40,149
[ { "from": "human", "value": "From what variable can you pick up the username from Forms Authentication in Microsoft SQL Reporting Services? The User!UserId value comes back as the Windows Account that reporting services is running under.\n" }, { "from": "gpt", "value": "In Microsoft SQL Server R...
I wrote a simple javascript image rotator which picks a random image on each page load. The issue is that if i use a default image, that default image will show up for a second before the javascript loads and replaces it. Obviously if someone has javascript disabled i want them to see an image. How can i have a defaul...
To achieve the desired functionality of displaying a default image without flickering during page load, you can use a combination of CSS and JavaScript. The basic idea is to hide the default image until the JavaScript has loaded and set a random image. ### Here's how you can do it: 1. **Set a Default Image in HTML:**...
38,376
[ { "from": "human", "value": "I wrote a simple javascript image rotator which picks a random image on each page load. The issue is that if i use a default image, that default image will show up for a second before the javascript loads and replaces it. Obviously if someone has javascript disabled i want them...
I know that when you add/change/remove methods in a COM interface you're supposed to change the interface/coclass GUID but what about type libraries. When should you change the type library's GUID? Do you change it if a GUID inside the type library has changed? Or should you only change it when something that doesn't ...
In COM (Component Object Model), a type library is a binary file that describes the interfaces, coclasses, and enums that are exposed by your COM components. The GUID for a type library (often referred to as the type library GUID or TLB GUID) serves as a unique identifier for that type library. ### When to Change the ...
40,202
[ { "from": "human", "value": "I know that when you add/change/remove methods in a COM interface you're supposed to change the interface/coclass GUID but what about type libraries. When should you change the type library's GUID? Do you change it if a GUID inside the type library has changed? Or should you on...
Is it possible to override the background color of the minimize and maximized buttons in WinForms?
In WinForms, the minimize and maximize buttons, which are part of the title bar of a form, cannot be directly overridden or customized using standard properties or methods. These buttons are part of the operating system's window frame and are rendered by the operating system, not the application itself. However, if yo...
40,048
[ { "from": "human", "value": "Is it possible to override the background color of the minimize and maximized buttons in WinForms?\n" }, { "from": "gpt", "value": "In WinForms, the minimize and maximize buttons, which are part of the title bar of a form, cannot be directly overridden or customized ...
I have an http module on a sharepoint site and this module instantiates a custom class and add it to the session and does other initial things for my site. However, I'm noticing that the http module is being called for all request types (.aspx, .js, .png, .jpg). Is there any way to have an http module only be called fo...
Yes, you can configure your HTTP module to only process requests for specific file types (like .aspx) by implementing logic within the `BeginRequest` method of your HTTP module. You can check the file extension of the incoming request and conditionally execute your logic based on that. Here’s a basic example of how to...
38,699
[ { "from": "human", "value": "I have an http module on a sharepoint site and this module instantiates a custom class and add it to the session and does other initial things for my site.\nHowever, I'm noticing that the http module is being called for all request types (.aspx, .js, .png, .jpg).\nIs there any w...
How can I decode a base64 encoded message in PHP? I know how to use PHP_base64_decode function, but I wanna know how to write little endian part, like the code below, it is base64 code with little endian: (how to write little endian part in php) Original Base64 Content ( as posted by original poster ) : https://stackov...
To decode a Base64 encoded message in PHP, especially when dealing with little-endian encoded data, you'll need to perform a few steps: 1. **Base64 Decode**: First, you need to decode the Base64 content using the `base64_decode` function. 2. **Handling Little Endian**: If the data is in little-endian format, you need ...
39,271
[ { "from": "human", "value": "How can I decode a base64 encoded message in PHP?\nI know how to use PHP_base64_decode function, but I wanna know how to write little endian part, like the code below, it is base64 code with little endian: (how to write little endian part in php)\nOriginal Base64 Content ( as po...
I would like to return a string with all of the contents of a CSS rule, like the format you'd see in an inline style. I'd like to be able to do this without knowing what is contained in a particular rule, so I can't just pull them out by style name (like .style.width etc.) The CSS: .test { width:80px; height:5...
To return a string with all of the contents of a CSS rule in the inline style format, you can iterate through the properties of the CSS rule once you've found the matching selector. Here's how you can modify your `getStyle` function to achieve this: ```javascript function getStyle(className) { var classes = docume...
39,625
[ { "from": "human", "value": "I would like to return a string with all of the contents of a CSS rule, like the format you'd see in an inline style. I'd like to be able to do this without knowing what is contained in a particular rule, so I can't just pull them out by style name (like .style.width etc.) \nThe...
I have an ASP.NET MVC application, when a user clicks on the submit button of that application, the server should capture all the information in the form, and call a local windows application ( located at "c:\Program Files..." and do some processing before passing back the data to the users. Now, is this possible? Is t...
In an ASP.NET MVC application, there are significant security and architectural considerations when it comes to starting a local application or executing a process on the server. ### Possible But Not Recommended 1. **Local vs. Web Application Context**: If your ASP.NET application is hosted on a server, any code that...
38,661
[ { "from": "human", "value": "I have an ASP.NET MVC application, when a user clicks on the submit button of that application, the server should capture all the information in the form, and call a local windows application ( located at \"c:\\Program Files...\" and do some processing before passing back the da...
I have a Probablistic Neural Network classification experiment set up in MATLAB. I can get the classes for unseen data using the sim command. Is there any way I can get the probabilities for the classes that the classifier calculates? Also, is there any direct way to plot the Reciever Operating Characterstic curve and ...
In MATLAB, if you are using a Probabilistic Neural Network (PNN), you can indeed obtain class probabilities along with the predicted classes when you simulate unseen data using the `sim` function. However, the specific way to extract these probabilities may depend on how your PNN is implemented and the functions you ar...
38,016
[ { "from": "human", "value": "I have a Probablistic Neural Network classification experiment set up in MATLAB. I can get the classes for unseen data using the sim command. Is there any way I can get the probabilities for the classes that the classifier calculates? Also, is there any direct way to plot the Re...
In asp.net 3.5, I'm rewriting the url http://www.abc.com/archive/1108/harpersdecember to the following http://www.abc.com/article.aspx?docId=78 I'm using this code to do it: Context.RewritePath("/article.aspx?docId=78"); It works fine locally but when I upload to the remote web server, I get a 404 when...
The issue you're experiencing could be due to a variety of reasons, especially considering the differences between your local environment and the remote web server. Here are some potential causes and suggestions for troubleshooting the 404 error: 1. **URL Routing Configuration**: Ensure that URL rewriting is properly ...
38,107
[ { "from": "human", "value": "In asp.net 3.5, I'm rewriting the url\nhttp://www.abc.com/archive/1108/harpersdecember\nto the following\nhttp://www.abc.com/article.aspx?docId=78\nI'm using this code to do it:\n Context.RewritePath(\"/article.aspx?docId=78\");\n\nIt works fine locally but when I...
when I apply the tag above my methods I get the error Type System.Runtime.CompilerServices.Extension is not defined. Here is my sample <System.Runtime.CompilerServices.Extension()> _ Public Sub test() End Sub Where am I going wrong? Edit ~ Straight from the MSDN Article here, the same error Imports System....
The error you encountered, "Type System.Runtime.CompilerServices.Extension is not defined," occurs because the `Extension` attribute is not available in the .NET Framework version you were initially targeting, which was 2.0. The extension methods feature was introduced in .NET Framework 3.0, but the `Extension` attribu...
39,879
[ { "from": "human", "value": "when I apply the tag above my methods I get the error \n\nType System.Runtime.CompilerServices.Extension is not defined.\n\nHere is my sample\n<System.Runtime.CompilerServices.Extension()> _\n Public Sub test()\n\nEnd Sub\n\nWhere am I going wrong?\nEdit ~ Straight from the...
Ease of installation/use is the most important factor here - not performance. Small is OK as large datasets are not expected.
It sounds like you are looking for a software solution or tool that emphasizes ease of installation and use over performance, particularly for handling smaller datasets. Here are some options you might consider depending on your specific needs: ### Data Analysis and Visualization Tools 1. **Excel**: - **Ease of I...
36,276
[ { "from": "human", "value": "Ease of installation/use is the most important factor here - not performance.\nSmall is OK as large datasets are not expected.\n" }, { "from": "gpt", "value": "It sounds like you are looking for a software solution or tool that emphasizes ease of installation and use...
Earlier versions of the Notes client would automatically turn a sent URL into a clickable link for the recipient (regardless of mail client) but with 6.5 (and presumably later) this no longer happens; that is, the URL is sent as plain text. The Notes UI allows it to be done via the Create->Hotspot->Link Hotspot menu bu...
In Lotus Notes, creating a Link Hotspot programmatically using LotusScript can indeed be challenging, as the functionality for automatically creating clickable links in emails wasn't directly supported in earlier versions, including version 6.5. However, you can achieve this by using rich text fields in your email docu...
39,626
[ { "from": "human", "value": "Earlier versions of the Notes client would automatically turn a sent URL into a clickable link for the recipient (regardless of mail client) but with 6.5 (and presumably later) this no longer happens; that is, the URL is sent as plain text. The Notes UI allows it to be done via ...
I'm developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the arguments I need (like this program.exe -file.txt) , but this way I can't debug. Is there somewhere I can specify the arguments for debugging?
Yes, you can easily specify command-line arguments for debugging in Visual Studio. Here’s how you can do that: 1. **Open your project** in Visual Studio. 2. **Right-click on your project** in the Solution Explorer, and select **Properties** from the context menu. This will open the Property Pages window. 3. In the P...
41,623
[ { "from": "human", "value": "I'm developing a C++ command-line application in Visual Studio and need to debug it with command-line arguments. At the moment I just run the generated EXE file with the arguments I need (like this program.exe -file.txt) , but this way I can't debug. Is there somewhere I can spe...
I work on a large project and want to disable the Eclipse compiler warning stating: Access to enclosing constructor ... is emulated by a synthetic accessor method. Increasing its visibility will improve your performance Eclipse version 3.3.2
To disable the specific compiler warning in Eclipse regarding the synthetic accessor methods, you can do the following steps: 1. **Open the Eclipse Preferences:** - Go to the menu bar and click on **Window** (or **Eclipse** on macOS) > **Preferences**. 2. **Navigate to Java Compiler Settings:** - In the Prefere...
38,935
[ { "from": "human", "value": "I work on a large project and want to disable the Eclipse compiler warning stating:\n\nAccess to enclosing constructor ... is emulated by a synthetic accessor method. Increasing its visibility will improve your performance\n\nEclipse version 3.3.2\n" }, { "from": "gpt", ...
The list sort() method is a modifier function that returns None. So if I want to iterate through all of the keys in a dictionary I cannot do: for k in somedictionary.keys().sort(): dosomething() Instead, I must: keys = somedictionary.keys() keys.sort() for k in keys: dosomething() Is there a pretty way to ite...
Yes, you can achieve this in a more concise way by using the `sorted()` function, which returns a new sorted list from the specified iterable. This allows you to sort the keys of the dictionary in a single line while iterating over them. Here's how you can do it: ```python for k in sorted(somedictionary.keys()): d...
42,695
[ { "from": "human", "value": "The list sort() method is a modifier function that returns None.\nSo if I want to iterate through all of the keys in a dictionary I cannot do:\nfor k in somedictionary.keys().sort():\n dosomething()\n\nInstead, I must:\nkeys = somedictionary.keys()\nkeys.sort()\nfor k in keys...
In another Stack Overflow question Leon Timmermans asserted: I would advice you not to use prototypes. They have their uses, but not for most cases and definitely not in this one. Why might this be true (or otherwise)? I almost always supply prototypes for my Perl functions, and I've never before seen anyone else say...
Leon Timmermans' advice about using prototypes in Perl may stem from several considerations, some of which can be valid depending on the context of your code and what you are trying to achieve. Here are some reasons why some developers might caution against using prototypes in Perl: 1. **Complexity**: Prototypes can i...
38,889
[ { "from": "human", "value": "In another Stack Overflow question Leon Timmermans asserted:\n\nI would advice you not to use prototypes. They have their uses, but not for most cases and definitely not in this one.\n\nWhy might this be true (or otherwise)? I almost always supply prototypes for my Perl function...
I wrote the following javascript to put in my startup folder to work around some problems with mapping drives. Unfortunately it has the side effect of starting command prompts with H:\ as current directory. How can I get around this? var objNetwork = WScript.CreateObject("WScript.Network"); /* Remove Network Drives ...
To avoid starting command prompts with `H:\` as the current directory, you can change the current working directory back to a different drive or directory after your script has executed the drive mapping. One way to do this is to set the current directory back to `C:\` or any other desired path. You can accomplish th...
39,793
[ { "from": "human", "value": "I wrote the following javascript to put in my startup folder to work around some problems with mapping drives. Unfortunately it has the side effect of starting command prompts with H:\\ as current directory. How can I get around this?\nvar objNetwork = WScript.CreateObject(\"W...
I'm trying to find the best solution for nonblocking IO via stdin/stdout with the following characteristics: As long as there is enough data, read in n-sized chunks. If there's not enough data, read in a partial chunk. If there is no data available, block until there is some (even though it may be smaller than n). Th...
For implementing non-blocking I/O with stdin/stdout while meeting your specified requirements, you can combine C++ standard I/O with some platform-specific features. The challenge lies in efficiently handling the data while ensuring control codes are processed immediately. Below is a general approach using standard C+...
37,655
[ { "from": "human", "value": "I'm trying to find the best solution for nonblocking IO via stdin/stdout with the following characteristics:\n\nAs long as there is enough data, read in n-sized chunks.\nIf there's not enough data, read in a partial chunk.\nIf there is no data available, block until there is som...
I am writing a windows service. This service runs another process I've developed through Process class methods, but I want to run this process on debug mode also, using breakpoints, for instance. How can I do this?
To run a process in debug mode while it's being managed by a Windows Service can be challenging due to the nature of services and how they are typically run. When debugging, you typically want to attach a debugger to a running process or run the process in a way that allows you to hit breakpoints. Here are a few strat...
37,912
[ { "from": "human", "value": "I am writing a windows service. This service runs another process I've developed through Process class methods, but I want to run this process on debug mode also, using breakpoints, for instance.\nHow can I do this?\n" }, { "from": "gpt", "value": "To run a process i...
I want to print styled html pages with their images from a script. Can anyone suggest an open-source solution? I'm using linux (Ubuntu 8.04) but would be also be interested in solutions for other operating systems.
To print styled HTML pages with images from a script on Linux (Ubuntu 8.04) and potentially other operating systems, you can consider the following open-source solutions: ### 1. **wkhtmltopdf** `wkhtmltopdf` is a command-line tool that uses the WebKit rendering engine to convert HTML to PDF, which can be printed. It s...
39,899
[ { "from": "human", "value": "I want to print styled html pages with their images from a script. Can anyone suggest an open-source solution?\nI'm using linux (Ubuntu 8.04) but would be also be interested in solutions for other operating systems.\n" }, { "from": "gpt", "value": "To print styled HT...
I teach a C++ course using Visual Studio. One of my students has a Mac and was looking for an IDE to use on his machine. What would be good to recommend?
For a student using a Mac who wants to program in C++, there are several good IDE options available: 1. **Xcode**: Apple's own IDE, Xcode, supports C++ and is well-integrated with macOS. It provides a robust development environment, including code completion, debugging tools, and interface design tools for macOS and i...
37,211
[ { "from": "human", "value": "I teach a C++ course using Visual Studio. One of my students has a Mac and was looking for an IDE to use on his machine. What would be good to recommend?\n" }, { "from": "gpt", "value": "For a student using a Mac who wants to program in C++, there are several good I...
In Ruby I have often written a number of small classes, and had a main class organize the little guys to get work done. I do this by writing require "converter.rb" require "screenFixer.rb" . . . at the top of the main class. How do I do this in Java? Is it "import?" Also, could someone please come up with a better ti...
Yes, in Java, you use the `import` statement to include other classes and packages in your program, similar to how you use `require` in Ruby. However, there are some key differences between Ruby and Java's importing system. In Java, when you want to include a class from a package, you would typically write something ...
40,661
[ { "from": "human", "value": "In Ruby I have often written a number of small classes, and had a main class organize the little guys to get work done. I do this by writing \nrequire \"converter.rb\"\nrequire \"screenFixer.rb\"\n.\n.\n.\n\nat the top of the main class. How do I do this in Java? Is it \"import?...
The vim * star / asterisk search (:help star) is a great feature which lets you find the next occurrence of the word the cursor is over. Unfortunately it treats dollar-prefixes as part of the string, so if I press * while over the "SearchTerm" in the class name it finds "SearchTerm" in the comment, and "$this->SearchTe...
Yes, you've identified the right approach to modify how Vim's `*` (star) search treats certain characters by changing the `iskeyword` setting. By default, Vim includes the dollar sign `$` as part of keywords, which can lead to the behavior you're seeing. To remove the dollar sign from being considered as part of the k...
38,781
[ { "from": "human", "value": "The vim * star / asterisk search (:help star) is a great feature which lets you find the next occurrence of the word the cursor is over. Unfortunately it treats dollar-prefixes as part of the string, so if I press * while over the \"SearchTerm\" in the class name it finds \"Sear...
The following exception is thrown: Error Message: Microsoft.SqlServer.Management.Smo.FailedOperationException: Drop failed for Database '4d982a46-58cb-4ddb-8999-28bd5bb900c7'. ---> Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch...
The error message you're encountering indicates that the SQL Server database you are trying to drop is currently in use by one or more active connections. SQL Server does not allow you to drop a database that has active sessions, as doing so could lead to data corruption or inconsistency. ### Possible Causes 1. **Acti...
39,030
[ { "from": "human", "value": "The following exception is thrown:\nError Message: Microsoft.SqlServer.Management.Smo.FailedOperationException: Drop failed for Database '4d982a46-58cb-4ddb-8999-28bd5bb900c7'. ---> Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while e...
Given a collection of user specified tags how do I determine which ones are not in the tags table with 1 SQL Statement? Assuming a table schema tags (id, tag) and I'm using mysql, if there's an optimization I'm unaware of. thanks
To determine which user-specified tags are not present in your `tags` table, you can utilize a `LEFT JOIN` or a `NOT IN` query combined with the `VALUES` clause (if your MySQL version supports it). Here is an efficient way to do this with one SQL statement, assuming your user-specified tags are provided in the query. ...
37,251
[ { "from": "human", "value": "Given a collection of user specified tags how do I determine which ones are not in the tags table with 1 SQL Statement?\nAssuming a table schema tags (id, tag) and I'm using mysql, if there's an optimization I'm unaware of.\nthanks\n" }, { "from": "gpt", "value": "To...
How do I pad a numeric string with zeroes to the left, so that the string has a specific length?
To pad a numeric string with zeroes to the left in Python, you can use several methods. Here are a few common ways to achieve this: ### Method 1: Using `str.zfill()` The `zfill()` method pads the string on the left with zeroes to fill the specified width. ```python numeric_string = "42" desired_length = 5 padded_stri...
40,268
[ { "from": "human", "value": "How do I pad a numeric string with zeroes to the left, so that the string has a specific length?\n" }, { "from": "gpt", "value": "To pad a numeric string with zeroes to the left in Python, you can use several methods. Here are a few common ways to achieve this:\n\n##...
When you deploy an application to IIS without all files that contains code (VB/C#) then how exactly are events & all things handled?
When you deploy an application to Internet Information Services (IIS) without including all the source code files (like VB or C# files), the way events and other functionalities are handled depends on how the application was built and compiled. Here’s a breakdown of how things work in such scenarios: ### 1. **Compiled...
32,469
[ { "from": "human", "value": "When you deploy an application to IIS without all files that contains code (VB/C#) then \nhow exactly are events & all things handled?\n" }, { "from": "gpt", "value": "When you deploy an application to Internet Information Services (IIS) without including all the sou...
I am preparing a lecture on files for the more junior students in programming class. One of the points I want to elaborate are good practices with files. What are the thing to keep in mind when using files in any programming language?
When preparing your lecture on good practices with files in programming, it’s important to cover several key points that are relevant across most programming languages. Here are some important practices to keep in mind: ### 1. **File Naming Conventions** - Use meaningful and descriptive names for your files. - F...
38,987
[ { "from": "human", "value": "I am preparing a lecture on files for the more junior students in programming class. One of the points I want to elaborate are good practices with files.\nWhat are the thing to keep in mind when using files in any programming language?\n" }, { "from": "gpt", "value":...
Background I am capturing video using the video4linux 2 spec. It is captured using a C program in real-time. I also have a Java frontend that can run both locally and remotely. The remote side was easy, I just compress the images to JPEG and ship them over a mini-http server to the client that decompresses them and ...
Moving video data from a video4linux2 (v4l2) memory-mapped buffer to a Java application for efficient display can be optimized in a few different ways. Since you've already made some good progress by using sockets and RGB formats, I’ll provide an overview of a more efficient approach by leveraging shared memory, and ou...
30,291
[ { "from": "human", "value": "Background\nI am capturing video using the video4linux 2 spec. It is captured using a C program in real-time. I also have a Java frontend that can run both locally and remotely. The remote side was easy, I just compress the images to JPEG and ship them over a mini-http server...
Suppose that I have a Java program within an IDE (Eclipse in this case). Suppose now that I execute the program and at some point terminate it or it ends naturally. Is there a convenient way to determine which lines executed at least once and which ones did not (e.g., exception handling or conditions that weren't reach...
Yes, there are several tools and techniques you can use to determine which lines of code were executed during the runtime of your Java program in Eclipse. Here are a few popular options: ### 1. **JaCoCo (Java Code Coverage Library)** JaCoCo is a widely used tool for measuring code coverage in Java applications. It ca...
39,270
[ { "from": "human", "value": "Suppose that I have a Java program within an IDE (Eclipse in this case).\nSuppose now that I execute the program and at some point terminate it or it ends naturally.\nIs there a convenient way to determine which lines executed at least once and which ones did not (e.g., exceptio...
In your practice, how do you effectively track and manage technical debt? Is there a specific metric, like SLOC, that you use? How do you visually display your results to stakeholders and management? What benefits have you seen in the process?
Tracking and managing technical debt is a crucial aspect of maintaining a healthy codebase and ensuring sustainable software development practices. Here’s how to effectively approach it: ### 1. **Identifying and Tracking Technical Debt** - **Documentation**: Start with documenting instances of technical debt in you...
37,518
[ { "from": "human", "value": "In your practice, how do you effectively track and manage technical debt? \nIs there a specific metric, like SLOC, that you use?\nHow do you visually display your results to stakeholders and management? \nWhat benefits have you seen in the process?\n" }, { "from": "gp...
I'm developing class to represent special kind of matrix: type DifRecord = record Field: String; Number: Byte; Value: smallint; end; type TData = array of array of MainModule.DataRecord; type TDifference = array of DifRecord; type TFogelMatrix = class private M: Byte; N: Byte; Dat...
In your implementation of the `TFogelMatrix` class, you are attempting to allocate memory for the `Data` and `DifVector` fields, which are pointers to dynamic arrays. Since you want to be able to allocate memory dynamically at runtime based on the size specified in the constructor, you'll need to follow a different app...
40,033
[ { "from": "human", "value": "I'm developing class to represent special kind of matrix:\ntype\n DifRecord = record\n Field: String;\n Number: Byte;\n Value: smallint;\n end;\n\ntype\n TData = array of array of MainModule.DataRecord;\n\ntype\n TDifference = array of DifRecord;\n\ntype\n TFogelMa...
I have some static images in a folder on my IIS 6-based website that I want to be downloaded as little as possible (to preserve bandwidth). I've set the Content Expiration to expire after 30 days. Is there anything else I can do in IIS to try to maximize the caching by browsers, proxy, and gateway caches? Such as addin...
To maximize caching of static images on your IIS 6-based website and ensure that they are downloaded as little as possible, you can take several steps beyond just setting the Content Expiration. Here's a list of recommendations: ### 1. Set Cache-Control Headers You can add `Cache-Control` headers to your static images...
39,261
[ { "from": "human", "value": "I have some static images in a folder on my IIS 6-based website that I want to be downloaded as little as possible (to preserve bandwidth). I've set the Content Expiration to expire after 30 days. Is there anything else I can do in IIS to try to maximize the caching by browsers,...
How can I make a variable (object) available for the whole lifetime of the webservice? Static variable seem to work but is there an other way to do it?
To make a variable or object available for the whole lifetime of a web service, there are several approaches you can consider beyond static variables. Here are some options: ### 1. Singleton Pattern You can implement a singleton pattern, which restricts the instantiation of a class to one single instance and provides ...
39,414
[ { "from": "human", "value": "How can I make a variable (object) available for the whole lifetime of the webservice?\nStatic variable seem to work but is there an other way to do it?\n" }, { "from": "gpt", "value": "To make a variable or object available for the whole lifetime of a web service, t...
I thought these were synonomous, but I wrote the following in Microsoft SQL: Select Unique col from (select col from table1 union select col from table2) alias And it failed. Changing it to Select Distinct col from (select col from table1 union select col from table2) alias fixed it. Can someone explai...
In SQL, the terms "unique" and "distinct" are often confused, but they have different uses and meanings. 1. **DISTINCT**: This is a keyword used in SQL to eliminate duplicate rows from the result set. When you use `SELECT DISTINCT`, it tells the database to return only unique values for the specified column(s). In you...
40,796
[ { "from": "human", "value": "I thought these were synonomous, but I wrote the following in Microsoft SQL:\nSelect Unique col from \n (select col from table1 union select col from table2) alias\n\nAnd it failed. Changing it to \nSelect Distinct col from \n (select col from table1 union select col fr...
Is there a clever way to determine which field is causing 'string or binary data would be truncated' with LINQ. I've always ended up doing it manually by stepping through a debugger, but with a batch using 'SubmitChanges' I have to change my code to inserting a single row to find the culprit in a batch of rows. Am I m...
The "string or binary data would be truncated" error in SQL Server can be frustrating because it doesn't specify which field is causing the issue. Unfortunately, SQL Server 2008 does not provide detailed information about the field causing the error when you attempt to submit changes through LINQ. You will typically re...
39,892
[ { "from": "human", "value": "Is there a clever way to determine which field is causing 'string or binary data would be truncated' with LINQ.\nI've always ended up doing it manually by stepping through a debugger, but with a batch using 'SubmitChanges' I have to change my code to inserting a single row to fi...
Currently we have a DLL that checks whether a username/password is a valid Windows user using the Windows API LogonUser method. We need to enhance it so it checks whether the user belongs to a specified group as well. Is there a Windows method that does that? Given a Windows username and password, find out whether the ...
Yes, you can enhance your DLL to check whether a user belongs to a specific group by using the Windows API, specifically the `LogonUser` method combined with the `CheckTokenMembership` function. Here's a general outline of how you can achieve this: 1. **Log on the user**: Use the `LogonUser` function to obtain a hand...
38,852
[ { "from": "human", "value": "Currently we have a DLL that checks whether a username/password is a valid Windows user using the Windows API LogonUser method. We need to enhance it so it checks whether the user belongs to a specified group as well. Is there a Windows method that does that?\nGiven a Windows us...
Assuming that the Application directory is writeable and that HD space is not an issue, are there any downsides to putting the VB6 dependency files (msvbvm60.dll, etc.) in the .EXE's directory? I've got the most up to date dependency files and I'm guessing MS isn't coming out with any new versions of those so I figure ...
Placing the VB6 dependency files (like `msvbvm60.dll`, etc.) in your application's directory does have some advantages, particularly in relation to the "DLL Hell" problem. However, there are also potential downsides to consider: ### Advantages: 1. **Isolation**: By bundling the required DLLs with your application, you...
32,881
[ { "from": "human", "value": "Assuming that the Application directory is writeable and that HD space is not an issue, are there any downsides to putting the VB6 dependency files (msvbvm60.dll, etc.) in the .EXE's directory?\nI've got the most up to date dependency files and I'm guessing MS isn't coming out w...
I am having some difficulty writing a function that will search through a directory for a file that matches a specific regular expression (which I have compiled using 're.compile'). So my question is: How do I search through a directory (I plan to use os.walk) for a file that matches a specific regular expression? An e...
You can use the `os.walk` function to traverse a directory and its subdirectories, and the `re` module to check if a filename matches a specific regular expression. Below is an example of how to implement a function that searches through a directory for files matching a compiled regular expression: ```python import os...
38,888
[ { "from": "human", "value": "I am having some difficulty writing a function that will search through a directory for a file that matches a specific regular expression (which I have compiled using 're.compile'). So my question is: How do I search through a directory (I plan to use os.walk) for a file that ma...
I'm trying to call a stored procedure that receives a parameter from the iReport plugin wizard of Netbeans 6.1, how can I successfully accomplish this task? Other technical details are: using MySQL 5.0.51a-17, and iReport designer 1.0. Thanks! Update: I'm voting this question to be closed, since it's from 2008.
To call a stored procedure with parameters from the iReport plugin in NetBeans, you can follow these general steps. The procedure may vary slightly depending on your exact setup and version, but this should guide you in the right direction: 1. **Create Your Stored Procedure**: Ensure you have a stored procedure in you...
39,740
[ { "from": "human", "value": "I'm trying to call a stored procedure that receives a parameter from the iReport plugin wizard of Netbeans 6.1, how can I successfully accomplish this task? \nOther technical details are: using MySQL 5.0.51a-17, and iReport designer 1.0.\nThanks!\nUpdate: I'm voting this questi...
I have an application running only on Windows and a batch file that launches it. I want to invoke this batch file from Linux, meaning something like Linux batch will launch the windows batch with parameters and this in its turn run my application. Can I do that? How?
Yes, you can run a Windows batch file from Linux by using a compatibility layer such as Wine or through virtualization using a Windows virtual machine. Here are a few options you can consider: ### Option 1: Using Wine Wine is a compatibility layer that allows you to run Windows applications on Unix-like operating sys...
37,315
[ { "from": "human", "value": "I have an application running only on Windows and a batch file that launches it.\nI want to invoke this batch file from Linux, meaning something like Linux batch will launch the windows batch with parameters and this in its turn run my application.\nCan I do that? How?\n" }, ...
I thought I'd get myself a Subversion setup at home for my hobby projects, and I'm trying to do it right, first time (my work's source control control policies or lack of them are, well, not perfect). The thing I'm struggling with is this: I'd like to version entire Eclipse projects. This will be good from Eclipse's ...
Setting up a Subversion (SVN) repository for your Eclipse projects and managing ignores correctly can indeed help streamline your workflow. Here’s a step-by-step guide to properly setting up SVN with your Eclipse projects while ensuring that your ignore settings are correctly applied. ### Step 1: Create an SVN Reposit...
37,987
[ { "from": "human", "value": "I thought I'd get myself a Subversion setup at home for my hobby projects, and I'm trying to do it right, first time (my work's source control control policies or lack of them are, well, not perfect).\nThe thing I'm struggling with is this: I'd like to version entire Eclipse pr...
I'm using FlexBuilder 3. I love the way the layout guides tell you when a component you're placing on a canvas is so far from the next component (presumably 8 pixels). Is it possible to change the distance at which the ruler guide pops up? I'm putting a series of labels close together and would like to change this t...
In FlexBuilder 3, the default settings for layout guides and snapping distances are fixed, and there is no built-in option to adjust the pixel distance at which the guides appear. However, you can consider a few workarounds to help you achieve better alignment with your components: 1. **Use the Alignment Tools**: Whil...
36,146
[ { "from": "human", "value": "I'm using FlexBuilder 3. I love the way the layout guides tell you when a component you're placing on a canvas is so far from the next component (presumably 8 pixels). Is it possible to change the distance at which the ruler guide pops up? I'm putting a series of labels close...
I believe I already know the answer, but I am not 100% sure, so just a quick question: What does Red/Green Testing actually mean? I understand it as "Write your tests first, so that they all fail (= all red), then write your code and watch how each test turns green, and when all are green, you're fine". I heard this in...
Your understanding of "Red/Green Testing" is essentially correct. This approach is commonly associated with Test-Driven Development (TDD). Here’s a breakdown of the process: 1. **Red**: Write a test for a new feature or functionality that you want to implement. Since the functionality doesn't exist yet, the test will ...
40,743
[ { "from": "human", "value": "I believe I already know the answer, but I am not 100% sure, so just a quick question: What does Red/Green Testing actually mean?\nI understand it as \"Write your tests first, so that they all fail (= all red), then write your code and watch how each test turns green, and when a...
In Python, how do I jump to a file in the Windows Explorer? I found a solution for jumping to folders: import subprocess subprocess.Popen('explorer "C:\path\of\folder"') but I have no solution for files.
To open a specific file in Windows Explorer using Python, you can use the `start` command with `subprocess.Popen`. This command will open the file in its associated application. If you want to highlight the file in Windows Explorer, you can use the `/select` option with the `explorer` command. Here’s how you can do th...
40,793
[ { "from": "human", "value": "In Python, how do I jump to a file in the Windows Explorer? I found a solution for jumping to folders:\nimport subprocess\nsubprocess.Popen('explorer \"C:\\path\\of\\folder\"')\n\nbut I have no solution for files.\n" }, { "from": "gpt", "value": "To open a specific f...
I am trying to make the Validation plugin work. It works fine for individual fields, but when I try to include the demo code for the error container that contains all of the errors, I have an issue. The problem is that it shows the container with all errors when I am in all fields, but I would like to display the error...
To achieve your desired functionality of showing inline error messages on focus out and displaying a summary of errors only after the user attempts to submit the form, you can adjust the error handling in the jQuery Validation plugin. Here’s an example of how you could implement this. You would need to modify the beha...
36,319
[ { "from": "human", "value": "I am trying to make the Validation plugin work. It works fine for individual fields, but when I try to include the demo code for the error container that contains all of the errors, I have an issue. The problem is that it shows the container with all errors when I am in all fiel...
I'm fairly new to c# so that's why I'm asking this here. I am consuming a web service that returns a long string of XML values. Because this is a string all the attributes have escaped double quotes string xmlSample = "<root><item att1=\"value\" att2=\"value2\" /></root>" Here is my problem. I want to do a simple stri...
In C#, if you're dealing with a string that contains escaped double quotes, you need to handle those quotes correctly. In your case, the string `xmlSample` is formatted correctly, but it seems like there is some misunderstanding about how to replace the escaped double quotes. Here’s how you can replace the escaped do...
37,690
[ { "from": "human", "value": "I'm fairly new to c# so that's why I'm asking this here.\nI am consuming a web service that returns a long string of XML values. Because this is a string all the attributes have escaped double quotes\nstring xmlSample = \"<root><item att1=\\\"value\\\" att2=\\\"value2\\\" /></ro...
I'd like to dump the contents of an X window. Like this: xwd -id | convert - capture.png ... which works quite well as long as the target window is not hidden (totally or partially behind other windows) or minimized. Any idea on how to do this? I guess we somehow have to send a "repaint" signal to the hidden window an...
To capture the contents of a hidden or minimized X window, you'll need to use a slightly different approach, as tools like `xwd` or `xwininfo` only capture visible window content. Unfortunately, directly forcing a hidden window to repaint itself is not straightforward due to X's design principles. However, you can try...
39,791
[ { "from": "human", "value": "I'd like to dump the contents of an X window. Like this:\nxwd -id | convert - capture.png\n... which works quite well as long as the target window is not hidden (totally or partially behind other windows) or minimized.\nAny idea on how to do this?\nI guess we somehow have to se...
Do you have any tricks for generating SQL statements, mainly INSERTs, in Excel for various data import scenarios? I'm really getting tired of writing formulas with like ="INSERT INTO Table (ID, Name) VALUES (" & C2 & ", '" & D2 & "')"
Certainly! Generating SQL `INSERT` statements in Excel can be tedious if you're writing the formulas manually. Here are a few tricks to streamline the process. ### 1. Use Concatenation with Helper Columns If you're working with a lot of data, it's often easier to break down your formula into parts using helper column...
39,665
[ { "from": "human", "value": "Do you have any tricks for generating SQL statements, mainly INSERTs, in Excel for various data import scenarios?\nI'm really getting tired of writing formulas with like \n=\"INSERT INTO Table (ID, Name) VALUES (\" & C2 & \", '\" & D2 & \"')\"\n" }, { "from": "gpt", ...
I am attempting to use Textured fonts as so that I can display text in my openGL scene. However I am having trouble finding glBlendFunc values that will work. The background that the text will be placed on is a grayscale image but will change throughout the execution. Because the background changes the text could poss...
Using textured fonts in OpenGL can be a bit tricky, especially when dealing with transparency and blending over varying backgrounds. Given that you're using a grayscale background that can change dynamically, you'll want to use a blend function that maintains the visibility of your text across all shades of gray. Inst...
39,542
[ { "from": "human", "value": "I am attempting to use Textured fonts as so that I can display text in my openGL scene. However I am having trouble finding glBlendFunc values that will work. \nThe background that the text will be placed on is a grayscale image but will change throughout the execution. Because ...
What does the following error mean? Geeneration of designer file failed: Exception from HRESULT: 0x80042929 It started showing up in my application when building and I'm not sure what's causing it. I'm using VS.Net 2008 and .Net 3.5
The error message "Generation of designer file failed: Exception from HRESULT: 0x80042929" typically indicates a problem with the designer file for a Windows Forms or ASP.NET application in Visual Studio. This issue often arises when there is an underlying problem with the code or the design environment that prevents t...
37,965
[ { "from": "human", "value": "What does the following error mean? \nGeeneration of designer file failed: Exception from HRESULT: 0x80042929 \nIt started showing up in my application when building and I'm not sure what's causing it. I'm using VS.Net 2008 and .Net 3.5\n" }, { "from": "gpt", "val...
I want to do the inverse of sort(1) : randomize every line of stdin to stdout in Perl.
To achieve the task of randomizing every line of standard input (stdin) and outputting it to standard output (stdout) in Perl, you can utilize the `List::Util` module, which provides a `shuffle` function for randomizing lists. Here’s a simple Perl script that accomplishes this: ```perl #!/usr/bin/perl use strict; use...
40,411
[ { "from": "human", "value": "I want to do the inverse of sort(1) : randomize every line of stdin to stdout in Perl. \n" }, { "from": "gpt", "value": "To achieve the task of randomizing every line of standard input (stdin) and outputting it to standard output (stdout) in Perl, you can utilize the...
The comments on Steve Yegge's post about server-side Javascript started discussing the merits of type systems in languages and this comment describes: ... examples from H-M style systems where you can get things like: expected signature Int*Int->Int but got Int*Int->Int Can you give an example of a function definit...
The error message you mentioned sounds like a type mismatch that can occur in languages with Hindley-Milner (H-M) style type systems. This system is often used in functional programming languages like Haskell, OCaml, and even Miranda. To create an example where you would see an error like "expected signature Int * Int...
39,925
[ { "from": "human", "value": "The comments on Steve Yegge's post about server-side Javascript started discussing the merits of type systems in languages and this comment describes:\n\n... examples from H-M style systems where you can get things like: \nexpected signature Int*Int->Int but got Int*Int->Int\n\n...
I have a some .py files that use spaces for indentation, and I'd like to convert them to tabs. I could easily hack together something using regexes, but I can think of several edge cases where this approach could fail. Is there a tool that does this by parsing the file and determining the indentation level the same wa...
Yes, there are tools available that can convert spaces to tabs in Python files while properly handling indentation. One of the most common tools for this task is `autopep8`, which is designed to automatically format Python code to conform to the PEP 8 style guide. While its primary function is formatting code, it can a...
40,115
[ { "from": "human", "value": "I have a some .py files that use spaces for indentation, and I'd like to convert them to tabs.\nI could easily hack together something using regexes, but I can think of several edge cases where this approach could fail. Is there a tool that does this by parsing the file and det...
If I understand correctly the .net runtime will always clean up after me. So if I create new objects and I stop referencing them in my code, the runtime will clean up those objects and free the memory they occupied. Since this is the case why then do some objects need to have a destructor or dispose method? Won’t the r...
You are correct that the .NET runtime, specifically the Common Language Runtime (CLR), manages memory for you through a process called garbage collection (GC). When an object is no longer referenced, it becomes eligible for garbage collection, and the CLR will eventually reclaim that memory. However, there are a few i...
38,950
[ { "from": "human", "value": "If I understand correctly the .net runtime will always clean up after me. So if I create new objects and I stop referencing them in my code, the runtime will clean up those objects and free the memory they occupied.\nSince this is the case why then do some objects need to have a...
Is there a way on the CVS command line to list all files associated with a tag?
Yes, you can use the `cvs` command line to list all files associated with a specific tag. The command you would typically use is: ```bash cvs rls -r TAGNAME ``` Here's a breakdown of the command: - `cvs`: This is the command for the CVS (Concurrent Versions System). - `rls`: This stands for "release", and it will di...
42,417
[ { "from": "human", "value": "Is there a way on the CVS command line to list all files associated with a tag?\n" }, { "from": "gpt", "value": "Yes, you can use the `cvs` command line to list all files associated with a specific tag. The command you would typically use is:\n\n```bash\ncvs rls -r T...
Does anybody know a way with JavaScript or CSS to basically grey out a certain part of a form/div in HTML? I have a 'User Profile' form where I want to disable part of it for a 'Non-Premium' member, but want the user to see what is behind the form and place a 'Call to Action' on top of it. Does anybody know an easy way...
You can achieve the effect of greying out a specific part of a form or div in HTML using CSS combined with some JavaScript to toggle the state. Below are two methods you can use: one using pure CSS and another using a combination of JavaScript and CSS. ### Method 1: Using CSS for Greyed Out Effect You can use a combi...
20,344
[ { "from": "human", "value": "Does anybody know a way with JavaScript or CSS to basically grey out a certain part of a form/div in HTML?\nI have a 'User Profile' form where I want to disable part of it for a 'Non-Premium' member, but want the user to see what is behind the form and place a 'Call to Action' o...
Is there a way to query or just access newly added object (using ObjectContext.AddObject method) in Entity Framework? I mean situation when it is not yet saved to data store using SaveChanges I understand that queries are translated to underlying SQL and executed against data store, and it don't have this new object ye...
In Entity Framework (EF), when you use `ObjectContext.AddObject` or similar methods (such as `DbSet.Add()` in the newer DbContext API), the object is added to the context and marked as `Added`. However, it is not yet saved to the database until you call `SaveChanges()`. As you correctly noted, any LINQ queries you perf...
39,685
[ { "from": "human", "value": "Is there a way to query or just access newly added object (using ObjectContext.AddObject method) in Entity Framework? I mean situation when it is not yet saved to data store using SaveChanges\nI understand that queries are translated to underlying SQL and executed against data s...
The user of an application wants to assign a task to a programmer. The "Edit Task" form is presented to the User. A popup (actually an absolutely positioned div) window comes up with all the programmers to choose from. The programmer is not there so the user asks for a "new programmer" screen. The popup is replaced ...
Designing an application to avoid an infinite stack of lookup/entry forms requires a balance between usability and functionality. Here are several strategies you can implement to achieve this: ### 1. **Modal Dialogs Instead of Nested Popups** - Use modal dialogs that allow users to complete a task without navigatin...
39,622
[ { "from": "human", "value": "\nThe user of an application wants to\nassign a task to a programmer.\nThe \"Edit Task\" form is presented to the User. \nA popup (actually an absolutely\npositioned div) window comes up with\nall the programmers to choose from.\nThe programmer is not there so the\nuser asks fo...
how do I get information about a photo like the author, the license using PHP?
To extract metadata from a photo using PHP, you can utilize the `exif_read_data()` function, which is part of PHP's EXIF extension. This allows you to obtain metadata such as the author, camera settings, date, and more. However, note that not all images contain EXIF data, and the specific fields available may vary. Fo...
38,396
[ { "from": "human", "value": "how do I get information about a photo like the author, the license using PHP?\n" }, { "from": "gpt", "value": "To extract metadata from a photo using PHP, you can utilize the `exif_read_data()` function, which is part of PHP's EXIF extension. This allows you to obta...
SAP HR apparently has several models for describing the relationship between Position (S), Job (C), Organization (O) and Person (P) objects that the Organizational Management (OM) module is used to maintain. P (Person) objects are usually Holders of Positions (S). There is the S-S relationship model, which I am told is...
In SAP HR (Human Resources), particularly in the Organizational Management (OM) module, there are various models that describe the relationships between different objects such as Positions (S), Jobs (C), Organizational Units (O), and Persons (P). Below are some of the key models and their functions: ### 1. Supervisory...
35,345
[ { "from": "human", "value": "SAP HR apparently has several models for describing the relationship between Position (S), Job (C), Organization (O) and Person (P) objects that the Organizational Management (OM) module is used to maintain.\nP (Person) objects are usually Holders of Positions (S).\nThere is the...
I was always wondering why such a simple and basic operation like swapping the contents of two variables is not built-in for many languages. It is one of the most basic programming exercises in computer science classes; it is heavily used in many algorithms (e.g. sorting); every now and then one needs it and one must u...
The absence of a built-in swap operation in many programming languages is indeed an interesting topic. Let's explore some reasons why this might be the case: 1. **Simplicity and Language Philosophy**: Many programming languages are designed with simplicity and minimalism in mind. They aim to keep the core language sma...
39,009
[ { "from": "human", "value": "I was always wondering why such a simple and basic operation like swapping the contents of two variables is not built-in for many languages.\nIt is one of the most basic programming exercises in computer science classes; it is heavily used in many algorithms (e.g. sorting); ever...
We are experiencing a strange bug on our website which we think is related to the software installed on user's computers. We have an e-mail link on a lot of pages, which is created using Javascript (so spambots won't get it). It seems the link is "clicked" automatically on some user's machines. Some users then discard ...
It sounds like you're dealing with a tricky issue! The behavior you're describing—where the mailto link appears to be clicked automatically—could indeed be related to several factors, including: 1. **Browser Extensions/Add-ons**: Some browser extensions (like email clients or productivity tools) might try to interact ...
34,881
[ { "from": "human", "value": "We are experiencing a strange bug on our website which we think is related to the software installed on user's computers. We have an e-mail link on a lot of pages, which is created using Javascript (so spambots won't get it).\nIt seems the link is \"clicked\" automatically on so...
I'm currently developing a PHP application that's using an Access database as a backend. Not by choice you understand... the database is what the client used originally and using it is part of the requirements. One of the problems with this database is that the column names have the most insane naming convention you co...
In this situation, it sounds like you are taking a pragmatic approach by creating a mapping array to bridge the gap between the erratic naming conventions of the Access database and your PHP application. Here are some considerations to help you evaluate whether your approach is justified or if your colleague's perspect...
38,421
[ { "from": "human", "value": "I'm currently developing a PHP application that's using an Access database as a backend. Not by choice you understand... the database is what the client used originally and using it is part of the requirements.\nOne of the problems with this database is that the column names hav...