instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I've found a few samples online but I'd like to get feedback from people who use PHP daily as to potential security or performance considerations and their solutions. Note that I am only interested in uploading a single file at a time. Ideally no browser plugin would be required (Flash/Java), although it would be inter...
Certainly! When handling file uploads in PHP, there are several security and performance considerations to keep in mind. Below, I provide a basic example of an HTML form for file uploads and the corresponding PHP processing code. I also include security and performance tips. ### HTML Form Code Here’s a simple HTML fo...
20,714
[ { "from": "human", "value": "I've found a few samples online but I'd like to get feedback from people who use PHP daily as to potential security or performance considerations and their solutions.\nNote that I am only interested in uploading a single file at a time.\nIdeally no browser plugin would be requir...
I have a user sign off report where it shows a users rights/access to the system which all fits nicely onto one page when I hit preview. However when I then go to print layout it shows me two pages with the second page only containg the footer. Any ideas please?
It sounds like you are experiencing an issue with the page layout when switching from a preview to a print layout. Here are some steps you can take to troubleshoot and potentially resolve the issue: 1. **Check Page Margins**: Ensure that the margins set for your document are not too large. Go to the Page Layout or Lay...
27,164
[ { "from": "human", "value": "I have a user sign off report where it shows a users rights/access to the system which all fits nicely onto one page when I hit preview. However when I then go to print layout it shows me two pages with the second page only containg the footer. \nAny ideas please?\n" }, { ...
What language or method would I use to listen to the event when a removeable drive is plugged into the PC?
To listen for events when a removable drive is plugged into a PC, you can use different programming languages and methods, depending on your operating system. Below are a few approaches for both Windows and Linux: ### Windows 1. **Using C# with WMI (Windows Management Instrumentation)** You can use C# to subscribe...
24,505
[ { "from": "human", "value": "What language or method would I use to listen to the event when a removeable drive is plugged into the PC?\n" }, { "from": "gpt", "value": "To listen for events when a removable drive is plugged into a PC, you can use different programming languages and methods, depe...
Lets assume my classes are loaded from a compressed .war file or loaded elsewhere, how can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current classloader? Is there a library out there that does something l...
When working with a `.war` file or any Java archive file like a `.jar`, enumerating resources in a specific package can indeed be tricky. You are correct that simply listing files won't work since the resources are typically compressed. One effective way to find resources in a given package is by using the `ClassLoade...
20,861
[ { "from": "human", "value": "Lets assume my classes are loaded from a compressed .war file or loaded elsewhere, \nhow can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current classloader?\nIs ther...
My fact table looks like this yesterday a yesterday a yesterday a yesterday b yesterday b yesterday c today a today a today b today b tommorow a tommorow a tommorow c tommorow d In the end I need an Excel report like this repetition count 1 2 3 yesterday 1...
Creating a "repetition count" dimension in SQL Server Analysis Services (SSAS) can be accomplished by utilizing a named query within your Data Source View (DSV). The process involves calculating the count of occurrences of each unique entry in your fact table and then aggregating that data into the required format. #...
24,867
[ { "from": "human", "value": "My fact table looks like this\nyesterday a\nyesterday a\nyesterday a\nyesterday b\nyesterday b\nyesterday c\ntoday a\ntoday a\ntoday b\ntoday b\ntommorow a\ntommorow a\ntommorow c\ntommorow d\n\nIn the end I need an Excel report like this\n repe...
I'm writing an application and I'm trying to tie simple AJAX functionality in. It works well in Mozilla Firefox, but there's an interesting bug in Internet Explorer: Each of the links can only be clicked once. The browser must be completely restarted, simply reloading the page won't work. I've written a very simple exa...
The issue you're encountering with Internet Explorer where links can only be clicked once is likely due to how you are handling the XMLHttpRequest. In your current implementation, the `xmlHttp` variable is defined globally and reused for every request, which can lead to issues with state and event handling in some vers...
25,707
[ { "from": "human", "value": "I'm writing an application and I'm trying to tie simple AJAX functionality in. It works well in Mozilla Firefox, but there's an interesting bug in Internet Explorer: Each of the links can only be clicked once. The browser must be completely restarted, simply reloading the page w...
My RMI enabled application seems to be leaking sockets. I have a Java application providing a service over RMI. It is using the Java SE 1.6 RMI implementation running on Linux. The problem I am observing is that if a client obtains a reference to my Remote object, using the Registry, and then the connection is sever...
Your approach to addressing the socket leak issue in your RMI-enabled application by implementing a custom socket factory is a good strategy. It allows you to enable TCP keepalives on the sockets used by RMI without modifying the underlying RMI framework significantly. This helps mitigate the problem of lingering socke...
23,488
[ { "from": "human", "value": "My RMI enabled application seems to be leaking sockets. I have a Java application providing a service over RMI. It is using the Java SE 1.6 RMI implementation running on Linux. The problem I am observing is that if a client obtains a reference to my Remote object, using the R...
Is there a way to change name of company to which the Visual Studio 2008 is registered without reinstalling it?
Yes, you can change the registered name of Visual Studio 2008 without reinstalling the application. This involves modifying the Windows Registry. However, please be cautious when editing the registry, as incorrect changes can lead to system issues. Here are the steps to change the registered name: 1. **Open the Regis...
28,295
[ { "from": "human", "value": "Is there a way to change name of company to which the Visual Studio 2008 is registered without reinstalling it?\n" }, { "from": "gpt", "value": "Yes, you can change the registered name of Visual Studio 2008 without reinstalling the application. This involves modifyin...
I'm trying to parse dates using the user's date preferences [NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4]; NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateStyle:NSDateFormatterShortStyle]; NSDate *date = [ dateFormatter dateFromString:@"7/...
The behavior you're observing is due to the fact that when you create an `NSDateFormatter` and set its date style, it uses the default date format associated with the locale at the time of initialization. The `NSDateFormatter` is indeed sensitive to locale settings, but it also depends on how you've initialized it. To...
27,653
[ { "from": "human", "value": "I'm trying to parse dates using the user's date preferences\n[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];\nNSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];\n[dateFormatter setDateStyle:NSDateFormatterShortStyle];\nNSDat...
I'm using an Oracle database with a collation different to my OS language. I'm accessing the database using the ODBC driver. When I prepare a statement (e.g. a "select * from x where=?"), that involves special non-ASCII characters supported by the DB's collation, I'm finding the data row with the characters. When I exe...
When working with Oracle databases and ODBC drivers, there are a few key points to consider regarding character encoding and collations, especially when dealing with non-ASCII characters. Here are some potential reasons and solutions for the behavior you’re encountering: 1. **Character Encoding Mismatch**: - The ...
24,691
[ { "from": "human", "value": "I'm using an Oracle database with a collation different to my OS language. I'm accessing the database using the ODBC driver. When I prepare a statement (e.g. a \"select * from x where=?\"), that involves special non-ASCII characters supported by the DB's collation, I'm finding t...
I'm also interested in other Symbian SDKs that allow to set their emulator's IMEI.
If you are looking to set the IMEI on Symbian SDK emulators, you can consider the following SDKs: 1. **Symbian^3 SDK**: This SDK is used for developing applications for Symbian^3 devices. You can set the IMEI in the emulator settings, allowing you to test applications that may behave differently based on the device's ...
29,215
[ { "from": "human", "value": "I'm also interested in other Symbian SDKs that allow to set their emulator's IMEI.\n" }, { "from": "gpt", "value": "If you are looking to set the IMEI on Symbian SDK emulators, you can consider the following SDKs:\n\n1. **Symbian^3 SDK**: This SDK is used for develop...
Sometime I see many application such as msn, windows media player etc that are single instance applications (when user executes while application is running a new application instance will not created). In C#, I use Mutex class for this but I don't know how to do this in Java.
In Java, you can achieve a similar "single instance" behavior using a combination of a `ServerSocket` and exception handling to ensure that only one instance of your application runs at a time. Here's a step-by-step guide to creating a simple single instance Java application: ### Method 1: Using ServerSocket 1. **Use...
24,370
[ { "from": "human", "value": "Sometime I see many application such as msn, windows media player etc that are single instance applications (when user executes while application is running a new application instance will not created).\nIn C#, I use Mutex class for this but I don't know how to do this in Java.\...
If I need a varchar(30) field, for example, that needs to contain several different foreign character sets, is there one particular language type that I can use in MySQL? For example, I have a field contains names in Chinese, Russian, English, Spanish and Portuguese, and possibly more in the future. How do I enable t...
To accommodate a variety of foreign character sets in a `VARCHAR(30)` field in MySQL, you should use the `utf8mb4` character set. The `utf8mb4` character set supports a wide range of characters, including all Unicode characters, which allows you to store text in multiple languages, including Chinese, Russian, English, ...
28,465
[ { "from": "human", "value": "If I need a varchar(30) field, for example, that needs to contain several different foreign character sets, is there one particular language type that I can use in MySQL? For example, I have a field contains names in Chinese, Russian, English, Spanish and Portuguese, and possib...
When deploying a ready to use erlang application I don't want the user to Find the right erl release on the internet. Install the erl vm unzip and decide a location for the beam files (with the application) read a readme modify anything that even looks like a config file I have a couple of ideas of what could be a w...
When deploying an Erlang application with the goal of minimizing user hassle, you can consider several strategies to package and distribute your application effectively. Here are some ideas: ### 1. **Docker Containerization** - **Description:** Package your Erlang application in a Docker container. This way, users onl...
20,184
[ { "from": "human", "value": "When deploying a ready to use erlang application I don't want the user to \n\nFind the right erl release on the\ninternet.\nInstall the erl vm\nunzip and decide a location for the beam files (with the application)\nread a readme\nmodify anything that even looks like a config fil...
Which of Crystal Reports and SSRS (SQL Server Reporting Services) is better to use?
Choosing between Crystal Reports and SQL Server Reporting Services (SSRS) depends on various factors, including your specific reporting needs, organizational environment, and existing technology stack. Here are some considerations to help you decide which reporting tool may be better suited for your use case: ### Crys...
20,779
[ { "from": "human", "value": "Which of Crystal Reports and SSRS (SQL Server Reporting Services) is better to use?\n" }, { "from": "gpt", "value": "Choosing between Crystal Reports and SQL Server Reporting Services (SSRS) depends on various factors, including your specific reporting needs, organiz...
I have a webpp which works fine when under a light load. However, when we run a lot of threads each with their own database connection, then we start getting the error ORA-12519: TNS:no appropriate service handler found After looking online I found that running lsnrctl services was a good diagnostic step, so I did th...
It sounds like you were dealing with an Oracle database configuration issue related to session handling when under high load. The error `ORA-12519: TNS:no appropriate service handler found` indicates that Oracle was unable to allocate a dedicated server process for a new connection request, which often happens when the...
27,527
[ { "from": "human", "value": "I have a webpp which works fine when under a light load. However, when we run a lot of threads each with their own database connection, then we start getting the error\nORA-12519: TNS:no appropriate service handler found\n\nAfter looking online I found that running lsnrctl serv...
I'm doing some FK analysis of our tables by making a directed graph representing FK dependencies and then traversing the graph. In my code, I name everything using directed graph terminology, but I'd like to have something a bit more "user friendly" in the report. In this scenario: create table t1(a varchar2(20)); alt...
In the context of foreign key (FK) relationships between tables, the terminology is often described using the following terms: - The table that contains the foreign key is called the **"child" table**. - The table that contains the primary key (or unique constraint) that the foreign key references is called the **"par...
30,639
[ { "from": "human", "value": "I'm doing some FK analysis of our tables by making a directed\ngraph representing FK dependencies and then traversing the\ngraph. In my code, I name everything using directed graph\nterminology, but I'd like to have something a bit more\n\"user friendly\" in the report.\nIn thi...
I am using git on a project, that generates lots of data-files (simulation-results). I am "forced" to version and track all those results in the same repository. (This is a hard requirement and can not be changed) However I don't need them. We have about 50 MB for the project and 5 GB results in the repository. Is it ...
Using Git to manage a project that generates a lot of data files can be challenging, especially when you have hard requirements to version those files in the same repository. However, you can certainly create a workflow that allows you to manage the situation effectively. Let's address your questions and explore some s...
16,364
[ { "from": "human", "value": "I am using git on a project, that generates lots of data-files (simulation-results). \nI am \"forced\" to version and track all those results in the same repository. (This is a hard requirement and can not be changed)\nHowever I don't need them. We have about 50 MB for the proje...
I have a controller method that returns a list for a drop down that gets rendered in a partial, but depending on where the partial is being used, the RJS template needs to be different. Can I pass a parameter to the controller that will determine which RJS gets used? Here is the controller method, it is very simple: de...
Yes, you can certainly pass a parameter to the controller method that determines which RJS template to use. A common approach is to introduce an additional parameter (e.g., `template_type`) to indicate which partial should be rendered. Here's how you can modify your controller method to achieve this: ```ruby def serv...
22,999
[ { "from": "human", "value": "I have a controller method that returns a list for a drop down that gets rendered in a partial, but depending on where the partial is being used, the RJS template needs to be different. Can I pass a parameter to the controller that will determine which RJS gets used?\nHere is th...
I've heard that the automotive industry has something called MISRA C. What are the relevant standards for other high reliability/availability/security industries, such as Space Aircraft Banking/financial Automotive Medical Defense/Military ??? -Adam
MISRA C is indeed a widely recognized standard for the automotive industry, specifically for C programming in embedded systems to ensure safety and reliability. Below is a list of relevant standards for various high reliability/availability/security industries: ### Space - **NASA Software Safety Assurance Process (NSS...
21,247
[ { "from": "human", "value": "I've heard that the automotive industry has something called MISRA C.\nWhat are the relevant standards for other high reliability/availability/security industries, such as\n\nSpace\nAircraft\nBanking/financial\nAutomotive\nMedical\nDefense/Military\n???\n\n-Adam\n" }, { ...
...just like packages do. I use Emacs (maybe, it can offer some kind of solution). For example (defun the-very-very-long-but-good-name () ...) is not to useful later in code. But the name like Fn-15 or the first letters abbreviation is not useful too. Is it possible either to have an alias like for packages or to acces...
Yes, Emacs provides several ways to work with function names that can help you maintain self-documentation while also keeping function names manageable. Here are some approaches you can consider: ### 1. Use `defun` with Documentation Strings You can still use meaningful names for functions and rely on documentation s...
23,701
[ { "from": "human", "value": "...just like packages do.\nI use Emacs (maybe, it can offer some kind of solution).\nFor example (defun the-very-very-long-but-good-name () ...) is not to useful later in code. But the name like Fn-15 or the first letters abbreviation is not useful too.\nIs it possible either to...
I have a text file which contains some data. I am trying to search for EA in ID column only and prints the whole row. But the code recognize all EA and prints all rows. What code I should add to satisfy the condition? Thanks Again:-)! DATA: Name Age ID --------------------- KRISTE,22,EA2008 JEAN,21,ES4567 JAK,45,E...
It looks like you want to modify your code so that it only prints rows from the text file where the "ID" column specifically starts with "EA". You are currently matching "EA" anywhere in the line, which is why all rows are being printed. Here is an updated version of your code that focuses on only checking the "ID" c...
27,904
[ { "from": "human", "value": "I have a text file which contains some data. I am trying to search for EA in ID column only and prints the whole row. But the code recognize all EA and prints all rows. What code I should add to satisfy the condition? Thanks Again:-)!\nDATA: \nName Age ID \n------------------...
I have a list view that after a double click, a record opens a new form to show the details, but the record in the list view lost the "selection".... How do I know which record was clicked ??? Thanks Maria João
To keep track of which record was clicked in a list view after a double click, you can implement a few strategies depending on the technology or framework you are using (e.g., WinForms, WPF, Web application, etc.). Below are some general approaches you can consider: ### 1. **Using Event Arguments** If your list view s...
24,838
[ { "from": "human", "value": "I have a list view that after a double click, a record opens a new form to show the details, but the record in the list view lost the \"selection\"....\nHow do I know which record was clicked ???\nThanks \nMaria João\n" }, { "from": "gpt", "value": "To keep track of ...
How can I bind arguments to a Python function so that I can call it later without arguments (or with fewer additional arguments)? For example: def add(x, y): return x + y add_5 = magic_function(add, 5) assert add_5(3) == 8 What is the magic_function I need here? It often happens with frameworks and libraries tha...
To create a `magic_function` that binds arguments to a Python function, you can use `functools.partial`. This utility allows you to fix a certain number of arguments of a function and generate a new function. Here's how you can implement it: ```python from functools import partial def magic_function(func, *args): ...
29,758
[ { "from": "human", "value": "How can I bind arguments to a Python function so that I can call it later without arguments (or with fewer additional arguments)?\nFor example:\ndef add(x, y):\n return x + y\n\nadd_5 = magic_function(add, 5)\nassert add_5(3) == 8\n\nWhat is the magic_function I need here?\n\...
I can access the database either from a .NET program (using ODBC) or through a database management tool (written in Java). If I write a 'é' character to the database from the .NET program, it appears as 'Õ' (capital O with tilde) in the DB management tool. If I write a 'é' character to the database from the DB manageme...
Based on your description and the information about the character mismatches, it appears that there is a character encoding issue at play. The character 'é' has the Unicode code point U+00E9, which corresponds to the hexadecimal value E9 in Latin-1 (ISO 8859-1). When you mention that writing 'é' from the .NET program...
26,493
[ { "from": "human", "value": "I can access the database either from a .NET program (using ODBC) or through a database management tool (written in Java).\nIf I write a 'é' character to the database from the .NET program, it appears as 'Õ' (capital O with tilde) in the DB management tool.\nIf I write a 'é' cha...
I am currently in the process of searching for a rules engine that works in .NET. Our logic is pretty simple, +, -, *, /, and, or, basic order of operations stuff. However we are going to need to store this information in the database and then generate the rules file when a new version is pulled from the database. S...
Given your requirements for a rules engine that works with .NET, supports simple logic, allows for programmatic configuration, and can be integrated with ASP.NET, there are a few options you might consider: ### 1. **NRules** - **Overview**: NRules is a .NET rules engine that allows you to define rules in code, which f...
23,825
[ { "from": "human", "value": "I am currently in the process of searching for a rules engine that works in .NET. Our logic is pretty simple, +, -, *, /, and, or, basic order of operations stuff. However we are going to need to store this information in the database and then generate the rules file when a ne...
I need write an update statement that used multiple tables to determine which rows to update, since in Oracle, multiple tables aren't allowed. The following query will return a "ORA-00971: Missing SET keyword" error UPDATE TABLE1 a, TABLE2 b SET a.COL1 = 'VALUE' WHERE a.FK = b.PK AND b.COL2 IN ('SET OF VALUE...
In Oracle, when you want to perform an update that depends on multiple tables, the correct syntax requires using a subquery or a `JOIN`. The error you encountered is due to the way Oracle handles updates and the need for "key preservation". To achieve your goal of updating `TABLE1` based on the conditions of `TABLE2`...
23,943
[ { "from": "human", "value": "I need write an update statement that used multiple tables to determine which rows to update, since in Oracle, multiple tables aren't allowed. The following query will return a \"ORA-00971: Missing SET keyword\" error\nUPDATE\n TABLE1 a,\n TABLE2 b\nSET\n a.COL1 = 'VALUE'\nW...
I have a Python script that needs to execute an external program, but for some reason fails. If I have the following script: import os; os.system("C:\\Temp\\a b c\\Notepad.exe"); raw_input(); Then it fails with the following error: 'C:\Temp\a' is not recognized as an internal or external command, operable program or ...
In your situation, it seems that you're facing issues with command execution in Python when dealing with spaces in paths and parameters. The best approach to execute an external program while handling paths and parameters correctly is to use the `subprocess` module, which provides more powerful facilities for spawning ...
28,927
[ { "from": "human", "value": "I have a Python script that needs to execute an external program, but for some reason fails.\nIf I have the following script:\nimport os;\nos.system(\"C:\\\\Temp\\\\a b c\\\\Notepad.exe\");\nraw_input();\n\nThen it fails with the following error:\n\n'C:\\Temp\\a' is not recogniz...
What's the difference between a string and a symbol in Ruby and when should you use one over the other?
In Ruby, both strings and symbols are used to represent text, but they have distinct characteristics and use cases. Here are the key differences: ### Strings 1. **Mutable**: Strings are mutable, meaning you can modify them after they are created. You can change their content, append new content, etc. ```ruby str...
26,581
[ { "from": "human", "value": "What's the difference between a string and a symbol in Ruby and when should you use one over the other?\n" }, { "from": "gpt", "value": "In Ruby, both strings and symbols are used to represent text, but they have distinct characteristics and use cases. Here are the k...
A very often scenario of unit test is as follows: public void SetUp() { this.callLog = new StringBuilder(); } public void TestBuzzBar() { var bar = new Bar(new MockFoo(callLog)); bar.Buzz(17); Assert.AreEqual("MockFoo.Init(17) MockFoo.PrepareStuff MockFoo.DoTheJob ", callLog.ToString()); } ... with MockFoo im...
Using a logging framework like log4net to collect a call log in unit tests is generally not recommended for several reasons: 1. **Separation of Concerns**: Unit tests are designed to verify specific behaviors of code in isolation. Using log4net (or any other logging framework) could introduce additional complexity tha...
26,837
[ { "from": "human", "value": "A very often scenario of unit test is as follows:\npublic void SetUp()\n{\n this.callLog = new StringBuilder();\n}\n\npublic void TestBuzzBar()\n{\n var bar = new Bar(new MockFoo(callLog));\n bar.Buzz(17);\n Assert.AreEqual(\"MockFoo.Init(17) MockFoo.PrepareStuff MockFoo.DoT...
I've declared Javascript arrays in such a way that I could then access them by a key, but it was a long time ago, and I've forgotten how I did it. Basically, I have two fields I want to store, a unique key, and its value. I know there is a way to do it.. something like: var jsArray = new {key: 'test test', value: 'valu...
It looks like you're trying to create a structure to store key-value pairs in JavaScript. The syntax you provided resembles object literals, but the way you're trying to declare an array of objects is incorrect. In JavaScript, you can use an array of objects to store your key-value pairs. Here's how you can do it: ``...
26,049
[ { "from": "human", "value": "I've declared Javascript arrays in such a way that I could then access them by a key, but it was a long time ago, and I've forgotten how I did it.\nBasically, I have two fields I want to store, a unique key, and its value. I know there is a way to do it.. something like:\nvar js...
I am wondering what the correct mechanism to enable communication between controls in WPF is. My goal is to not use conventional events and have to manually wire them up. The default behavior of routed commands (tunneling, bubbling) seems to be along the right lines but I guess I'm missing something. Routed events ar...
In WPF, the desire to have controls communicate without direct references or manual event wiring is a common scenario, and there are a few mechanisms to facilitate this. The routed events and commands provide great utility, but they typically operate within a specific visual tree context. Here are some approaches you c...
23,202
[ { "from": "human", "value": "I am wondering what the correct mechanism to enable communication between controls in WPF is. My goal is to not use conventional events and have to manually wire them up. The default behavior of routed commands (tunneling, bubbling) seems to be along the right lines but I guess...
I don't like WYIWYG editors, I want to be responsible for the selection and placement of each tag and attribute! Is there a good editor out there that allows you complete control over the HTML but offers useful features such as: syntax highlighting (of course) suggestions of tags, attributes etc. e.g. as dropdown lis...
If you're looking for a code editor that gives you complete control over your HTML while still offering useful features like syntax highlighting, tag suggestions, validation, accessibility checking, and a live preview, here are a few options you might consider: 1. **Visual Studio Code (VSCode)**: - **Syntax Highlig...
24,740
[ { "from": "human", "value": "I don't like WYIWYG editors, I want to be responsible for the selection and placement of each tag and attribute! Is there a good editor out there that allows you complete control over the HTML but offers useful features such as:\n\nsyntax highlighting (of course)\nsuggestions o...
I am new to SVN and make heavy use of the externals property. I have a repository located on my PC and the externals properties have a hardcoded 'localhost' in the name, which is now giving me problems. For example: /project1/trunk /shared/trunk project1/trunk depends on the shared folder so has an svn:externals pro...
It sounds like you're trying to use SVN externals in a way that makes your repositories more portable across different servers. Using the `^/` syntax is indeed the right approach to make your externals relative to the root of the repository, which avoids hardcoding the hostname. However, the error you're encountering ...
27,142
[ { "from": "human", "value": "I am new to SVN and make heavy use of the externals property. I have a repository located on my PC and the externals properties have a hardcoded 'localhost' in the name, which is now giving me problems. For example:\n/project1/trunk\n/shared/trunk\n\nproject1/trunk depends on ...
Is there a tool that creates a diff of a file structure, perhaps based on an MD5 manifest. My goal is to send a package across the wire that contains new/updated files and a list of files to remove. It needs to copy over new/updated files and remove files that have been deleted on the source file structure?
Yes, there are several tools and methods you can use to create a diff of a file structure and manage file transfers based on that. Here are some options to consider: ### 1. **rsync** `rsync` is a powerful tool that can synchronize files and directories between two locations. It can handle new/updated files and can del...
26,066
[ { "from": "human", "value": "Is there a tool that creates a diff of a file structure, perhaps based on an MD5 manifest. My goal is to send a package across the wire that contains new/updated files and a list of files to remove. It needs to copy over new/updated files and remove files that have been deleted...
Is there a csh script/command to list all the files in source source tree which have line endings that show up as "^M" in emacs (under linux). Thanks!
Certainly! The `^M` character indicates that a file has Windows-style line endings (CRLF, `\r\n`) instead of Unix-style line endings (LF, `\n`). To find files in your source tree that contain these line endings, you can use a combination of `find`, `grep`, and other command-line utilities. Here's a `csh` script that ...
27,075
[ { "from": "human", "value": "Is there a csh script/command to list all the files in source source tree which have line endings that show up as \"^M\" in emacs (under linux).\nThanks!\n" }, { "from": "gpt", "value": "Certainly! The `^M` character indicates that a file has Windows-style line endin...
I want to set IE as my default browser for running Silver light applications from Expression Blend, but I don't want to change my windows default from Mozilla. Is there a settings option in Blend to do this?
In Expression Blend, you can set the default browser for testing your Silverlight applications without changing the system-wide default browser setting in Windows. Here's how you can set Internet Explorer as the browser specifically for Expression Blend: 1. **Open Expression Blend**: Launch Expression Blend and load y...
29,997
[ { "from": "human", "value": "I want to set IE as my default browser for running Silver light applications from Expression Blend, but I don't want to change my windows default from Mozilla. Is there a settings option in Blend to do this?\n" }, { "from": "gpt", "value": "In Expression Blend, you c...
I haven't really done any Windows scripting at all, so I am at a loss on how to pull this one off. Anyway, basically what we want to do is have a script that will take an argument on which IIS AppPool to recycle. I have done some research on Google and haven't had much success on getting things to work. Here is what ...
You're on the right track, but there are a few changes needed in your script to properly recycle an IIS Application Pool. The `Get-WmiObject` command you're using has some syntax issues. Here’s a step-by-step breakdown of how you can recycle an IIS Application Pool using PowerShell: ### Step 1: Fix the Object Query W...
22,947
[ { "from": "human", "value": "I haven't really done any Windows scripting at all, so I am at a loss on how to pull this one off. Anyway, basically what we want to do is have a script that will take an argument on which IIS AppPool to recycle. I have done some research on Google and haven't had much success...
When IE8 is released, will the following code work to add a conditional stylesheet? <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="ie-8.0.css" /> <![endif]--> I've read conflicting reports as to whether this works with the beta. I'm hoping someone can share their experience. Thanks.
Yes, the code you provided is valid and will work to add a conditional stylesheet specifically for Internet Explorer 8. Conditional comments were a feature introduced by Microsoft that allowed developers to target specific versions of Internet Explorer. The code snippet you included: ```html <!--[if IE 8]> <link r...
29,995
[ { "from": "human", "value": "When IE8 is released, will the following code work to add a conditional stylesheet?\n<!--[if IE 8]>\n <link rel=\"stylesheet\" type=\"text/css\" href=\"ie-8.0.css\" />\n<![endif]-->\n\nI've read conflicting reports as to whether this works with the beta. I'm hoping someone can...
I'm about to enter the 1st phases of designing a commodities trading application. A major function of this application is the capture and evaluation of pricing information. Pricing in this market is not fixed. It is usually a market benchmark +/- a premium. For example: (A and B are market benchmarks) Price = A + $1 P...
Designing a commodities trading application with a focus on capturing and evaluating pricing information is indeed a complex task, especially when the pricing formulas can vary and need to be flexible. Here are some tools, techniques, and considerations that can help you in this process: ### 1. **Data Modeling:** -...
24,862
[ { "from": "human", "value": "I'm about to enter the 1st phases of designing a commodities trading application.\nA major function of this application is the capture and evaluation of pricing information.\nPricing in this market is not fixed. It is usually a market benchmark +/- a premium. For example: (A and...
Before I get into the details of this problem, I'd like to make the situation clear. Our web analytics company works as a consultant for large sites, and (other than adding a single SCRIPT tag) we have no control over the pages themselves. Our existing script installs handlers using "old" way (a fancy version of elemen...
To handle this situation where you need to add your event handler without interfering with existing handlers—regardless of whether they were added via the older method (e.g., `element.onclick = ...`) or the newer method (`addEventListener` or `attachEvent`)—you can follow a strategy that ensures your handler works corr...
21,921
[ { "from": "human", "value": "Before I get into the details of this problem, I'd like to make the situation clear. Our web analytics company works as a consultant for large sites, and (other than adding a single SCRIPT tag) we have no control over the pages themselves.\nOur existing script installs handlers ...
I'm using my code-behind page to create a save button programmatically: Button btnSave = new Button(); btnSave.ID = "btnSave"; btnSave.Text = "Save"; However I think this must create an html button or perhaps needs something else as I cannot seem to set the OnClick attribute in the following line, I can sp...
You're on the right track, but you need to set the `OnClick` event handler for the `Button` control in the code-behind. Here's how you can do that: 1. Define a method in your code-behind that will handle the button click event. 2. Assign that method to the `OnClick` event of the button. Here's an example: ```csharp ...
29,065
[ { "from": "human", "value": "I'm using my code-behind page to create a save button programmatically:\n Button btnSave = new Button();\n btnSave.ID = \"btnSave\";\n btnSave.Text = \"Save\";\n\nHowever I think this must create an html button or perhaps needs something else as I cannot seem to set the...
How can I create a new Word document pro grammatically using Visual Studio Tools for Office?
To create a new Word document programmatically using Visual Studio Tools for Office (VSTO), you'll need to follow a series of steps. This example assumes you're working with C# and Visual Studio. ### Prerequisites 1. Ensure you have Microsoft Office installed on your machine. 2. Install Visual Studio with the VSTO dev...
25,025
[ { "from": "human", "value": "How can I create a new Word document pro grammatically using Visual Studio Tools for Office? \n" }, { "from": "gpt", "value": "To create a new Word document programmatically using Visual Studio Tools for Office (VSTO), you'll need to follow a series of steps. This ex...
How would you begin improving on a really bad system? Let me explain what I mean before you recommend creating unit tests and refactoring. I could use those techniques but that would be pointless in this case. Actually the system is so broken it doesn't do what it needs to do. For example the system should count how ma...
Improving a deeply flawed system, particularly one as complex as you describe, can be a daunting task, especially when working solo and under time constraints. Here’s a step-by-step strategy that might help you make meaningful improvements while managing the risks associated with such a fragile system: ### 1. **Priori...
22,656
[ { "from": "human", "value": "How would you begin improving on a really bad system?\nLet me explain what I mean before you recommend creating unit tests and refactoring. I could use those techniques but that would be pointless in this case.\nActually the system is so broken it doesn't do what it needs to do....
I have an interface - here's a nicely contrived version as an example: public interface Particle { enum Charge { POSITIVE, NEGATIVE } Charge getCharge(); double getMass(); etc... } Is there any difference in how implementations of this would behave if I defined the Charge enum as static...
In Java, the `enum` keyword already indicates that the enum is a static type. When you declare an enum within an interface, that enum is implicitly static and can be referenced without needing an instance of the interface. Therefore, declaring the `Charge` enum as `static` in your example is unnecessary and does not ch...
27,163
[ { "from": "human", "value": "I have an interface - here's a nicely contrived version as an example:\npublic interface Particle {\n\n enum Charge {\n POSITIVE, NEGATIVE\n }\n\n Charge getCharge();\n\n double getMass();\n\n etc...\n}\n\nIs there any difference in how implementations of t...
Can you have smart behavior for the home key in Emacs? By smart I mean that instead of going to the character number 0, it should go to the first non-blank character, and go to 0 on a second pressing, and back to the first non-blank in a third and so on. Having smart end would be nice as well.
Yes, you can achieve smart behavior for the Home and End keys in Emacs using some custom Elisp code. The idea is to define two functions that handle the behavior you described: moving to the first non-blank character when the Home key is pressed, and moving to the end of the line when the End key is pressed, with toggl...
24,738
[ { "from": "human", "value": "Can you have smart behavior for the home key in Emacs? By smart I mean that instead of going to the character number 0, it should go to the first non-blank character, and go to 0 on a second pressing, and back to the first non-blank in a third and so on.\nHaving smart end would ...
I have a situation where I have two models, companies and permissions, where companies is in a separate database from my permissions database. This is a has and belongs to many relationship because each company can have many permissions and each permission can belong to many companies. The reason the two databases are...
Handling a `has_and_belongs_to_many` (HABTM) relationship across two separate databases in Ruby on Rails requires some workarounds, as Rails doesn't natively support joining tables across databases in a straightforward manner. However, you can manage this scenario using several approaches: ### 1. **Custom Join Model w...
25,619
[ { "from": "human", "value": "I have a situation where I have two models, companies and permissions, where companies is in a separate database from my permissions database. This is a has and belongs to many relationship because each company can have many permissions and each permission can belong to many co...
I tried to use DriveInfo.IsReady, but it returns false if an unformatted floppy is in the drive.
When using the `DriveInfo.IsReady` property in .NET, it is important to note that it checks whether the drive is ready for use, which means that it can be accessed and has the necessary media present (e.g., a formatted disk). If you have an unformatted floppy disk (or any media that is not formatted) in the drive, the ...
26,132
[ { "from": "human", "value": "I tried to use DriveInfo.IsReady, but it returns false if an unformatted floppy is in the drive.\n" }, { "from": "gpt", "value": "When using the `DriveInfo.IsReady` property in .NET, it is important to note that it checks whether the drive is ready for use, which mea...
I use wxGlade to create Python scripts, which use wxWidgets. wxGlade directly manipulates XML files, which describe the wxWidgets based GUI. Those files have the *.wxg extension. From the *.wxg files, it is possible to generate code which actually runs the GUI in one of several languages, and I am using it to generate...
Adding a copyright statement directly in the XML format of `.wxg` files might not be supported if wxGlade does not preserve comments upon saving. However, there are some alternative approaches you can consider to ensure your copyright statement is included in a manageable way. ### Option 1: Use a Post-Processing Scrip...
28,966
[ { "from": "human", "value": "I use wxGlade to create Python scripts, which use wxWidgets.\nwxGlade directly manipulates XML files, which describe the wxWidgets based GUI. Those files have the *.wxg extension.\nFrom the *.wxg files, it is possible to generate code which actually runs the GUI in one of sever...
The CSS syntax highlighting in vim is not entirely optimal. For example: div.special_class stops the highlighting at the _. Is there an improved highlighter that doesn't bite on an underscore? Update: I'm using VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 17 2008 15:22:40) and the header of my css.vim is: " Vim ...
It appears that you're using an older version of Vim (7.1) and the default CSS syntax file which might not fully support the highlighting of CSS class names containing underscores. To improve the CSS syntax highlighting in Vim, you can try the following options: ### Option 1: Update Vim First, consider updating your v...
26,281
[ { "from": "human", "value": "The CSS syntax highlighting in vim is not entirely optimal. For example: \ndiv.special_class\n\nstops the highlighting at the _. \nIs there an improved highlighter that doesn't bite on an underscore?\nUpdate:\nI'm using VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 17 2008 15...
I'd like to return an object with the following signature class AnonClass{ string Name {get;} IEnumerable<Group> Groups {get;} } I have tried the following query, but g only returns a single entity, not all the joined entities var q = from t in dc.Themes join g in dc.Groups on t.K equals g.ThemeK select new {...
To achieve your goal of returning an object with the signature you provided (`AnonClass` with a property for `IEnumerable<Group>`), you'll need to group your results appropriately after performing the join. The issue with your current query is that you're only projecting a single `Group` instead of collecting all the `...
27,959
[ { "from": "human", "value": "I'd like to return an object with the following signature\nclass AnonClass{\n string Name {get;}\n IEnumerable<Group> Groups {get;}\n}\n\nI have tried the following query, but g only returns a single entity, not all the joined entities\nvar q = from t in dc.Themes\njoin g ...
Is there a simple way to prevent browser from downloading and displaying images, best would be via some magic style tag or javasctipe. The thing is, I'd like to tweak the company's website a bit to be more usable via mobile devices. The company is a gaming one, there's like 5MBs of images on it's main page (and those c...
To achieve your goal of preventing images from being loaded on a webpage, particularly for mobile users, there are several approaches you can consider. Let's explore the options you mentioned: ### 1. Using JavaScript to Remove Image Sources You can use JavaScript to loop through all the `<img>` elements on the page an...
25,915
[ { "from": "human", "value": "Is there a simple way to prevent browser from downloading and displaying images, best would be via some magic style tag or javasctipe.\nThe thing is, I'd like to tweak the company's website a bit to be more usable via mobile devices. The company is a gaming one, there's like 5MB...
How to count distinct values in a node in XSLT? Example: I want to count the number of existing countries in Country nodes, in this case, it would be 3. <Artists_by_Countries> <Artist_by_Country> <Location_ID>62</Location_ID> <Artist_ID>212</Artist_ID> <Country>Argentina</Country> </Arti...
In XSLT, counting distinct values requires a slightly more complex approach because XSLT does not provide a built-in function for counting distinct values directly. However, you can achieve this by leveraging a combination of `xsl:key` and `xsl:for-each` to gather the distinct values first and then count them. Here's ...
27,302
[ { "from": "human", "value": "How to count distinct values in a node in XSLT?\nExample: I want to count the number of existing countries in Country nodes, in this case, it would be 3.\n<Artists_by_Countries>\n <Artist_by_Country>\n <Location_ID>62</Location_ID>\n <Artist_ID>212</Artist_ID>\n...
Is it possible at all to query (WMI?) the virus defnintions date of definitions installed on remote computers? I'd like to start specificially with Symantec Endpoint Protection, and then branch out to other antivirus products. This is a WinForms, .NET project.
Yes, it is possible to query the virus definitions date of antivirus products like Symantec Endpoint Protection on remote computers using Windows Management Instrumentation (WMI) or other methods. However, querying specific antivirus data through WMI can vary significantly by product. Symantec Endpoint Protection has a...
25,300
[ { "from": "human", "value": "Is it possible at all to query (WMI?) the virus defnintions date of definitions installed on remote computers? I'd like to start specificially with Symantec Endpoint Protection, and then branch out to other antivirus products.\nThis is a WinForms, .NET project.\n" }, { "...
When I download my program from my website to my windows 2003 machine, it has a block on it and you have to right click on the exe, then properties, then select the button "Unblock". I would like to add detection in my installer for when the file is blocked and hence doesn't have enough permissions. But I can't eaisl...
When a file is downloaded from the internet on a Windows machine, it may be marked as "blocked" by the operating system for security reasons. This can prevent the file from being executed until it is unblocked. You can simulate this behavior on your Windows 2003 machine by following these steps: ### Method 1: Use Wind...
26,252
[ { "from": "human", "value": "When I download my program from my website to my windows 2003 machine, it has a block on it and you have to right click on the exe, then properties, then select the button \"Unblock\".\nI would like to add detection in my installer for when the file is blocked and hence doesn't ...
Can you do ajax on ASP.net webform without using ajax toolkit? (Please post a example link)
Yes, you can use AJAX in ASP.NET Web Forms without the AJAX Control Toolkit by utilizing jQuery or native JavaScript `XMLHttpRequest`. This involves making asynchronous calls to the server-side methods through web services or page methods. Here is a simple example of how you can implement AJAX in an ASP.NET Web Forms ...
24,378
[ { "from": "human", "value": "Can you do ajax on ASP.net webform without using ajax toolkit? (Please post a example link)\n" }, { "from": "gpt", "value": "Yes, you can use AJAX in ASP.NET Web Forms without the AJAX Control Toolkit by utilizing jQuery or native JavaScript `XMLHttpRequest`. This in...
I'm messing around with 2D game development using C++ and DirectX in my spare time. I'm finding that the enterprisey problem domain modeling approach doesn't help as much as I'd like ;) I'm more or less looking for a "best practices" equivalent to basic game engine design. How entities should interact with each other, ...
Game development, especially for 2D games, can indeed benefit from a clear architecture and a set of best practices. Here are some fundamental concepts and best practices that you might find useful, along with resources for further learning. ### Key Concepts in Game Engine Design 1. **Entity-Component-System (ECS)**:...
21,626
[ { "from": "human", "value": "I'm messing around with 2D game development using C++ and DirectX in my spare time. I'm finding that the enterprisey problem domain modeling approach doesn't help as much as I'd like ;)\nI'm more or less looking for a \"best practices\" equivalent to basic game engine design. Ho...
Are there any tools to have a more robust clipboard type feature in windows? I am using vs.net 2008 (if it has it built-in and I don't know about it?) I used to have this tool where I created lots of items in my clipboard that I could access using short-cuts, but I forgot that name of that app! Tips?
Yes, there are several clipboard management tools that can enhance the clipboard functionality in Windows, allowing you to store multiple items, organize them, and access them more easily. Here are some popular options: 1. **Ditto**: Ditto is a free and open-source clipboard manager that extends the standard clipboard...
27,677
[ { "from": "human", "value": "Are there any tools to have a more robust clipboard type feature in windows?\nI am using vs.net 2008 (if it has it built-in and I don't know about it?)\nI used to have this tool where I created lots of items in my clipboard that I could access using short-cuts, but I forgot that...
I am looking for an expression for the .hgignore file, to ignore all files beneath a specified folder. eg: I would like to ignore all files and folders beneath bin Actually any advice on how the expressions are formed would be great
The `.hgignore` file is used in Mercurial (hg) to specify files and directories that should be ignored by version control. The syntax for the `.hgignore` file supports regular expressions as well as glob patterns to match files and directories. To ignore all files and folders beneath a specified folder (for example, t...
28,810
[ { "from": "human", "value": "I am looking for an expression for the .hgignore file, to ignore all files beneath a specified folder.\neg: I would like to ignore all files and folders beneath bin\nActually any advice on how the expressions are formed would be great\n" }, { "from": "gpt", "value": ...
I have a client who is using one TFS project just for source control only and now wants to manage work items in a totally different TFS project, using a different process template, and intends to link changesets to work items across TFS projects. I know that this is possible in TFS, but don't know what the limitations ...
Using separate TFS (Team Foundation Server) projects for source control and work item management can work, but it comes with its own set of challenges and limitations. Here's an overview of what to expect with this configuration: ### Benefits of Using Separate TFS Projects 1. **Process Flexibility**: You can use diff...
22,855
[ { "from": "human", "value": "I have a client who is using one TFS project just for source control only and now wants to manage work items in a totally different TFS project, using a different process template, and intends to link changesets to work items across TFS projects.\nI know that this is possible in...
I have a SQL script that I want to output progress messages as it runs. Having it output messages between SQL statements is easy, however I have some very long running INSERT INTO SELECTs. Is there a way to have a select statement output messages as it goes, for example after every 1000 rows, or every 5 seconds? Note: ...
In SQL, the capability to output progress messages during long-running operations such as `INSERT INTO SELECT` is not natively supported in most databases. However, you can implement a workaround to achieve this by using a combination of loop constructs and temporary tables. Here's how you can do it, specifically for S...
22,791
[ { "from": "human", "value": "I have a SQL script that I want to output progress messages as it runs. Having it output messages between SQL statements is easy, however I have some very long running INSERT INTO SELECTs. Is there a way to have a select statement output messages as it goes, for example after ev...
I'm having trouble getting the right number of elements in the ArrayList alt in the JSP page below. When I view the JSP it shows the size is 1 (<%=alt.size()%>) when it should be 3; I think I'm adding that method to the array in the generator class, so I don't understand why it's showing 1. This is my jsp page: <% A...
The issue you are encountering arises from the way you are adding alerts to your `ArrayList` in the `AlertGenerator` class. Currently, you are only creating and adding a single `Alert` object to the list. This is why when you check the size of the `ArrayList` in your JSP, it returns 1 instead of the expected 3. To gen...
27,063
[ { "from": "human", "value": "I'm having trouble getting the right number of elements in the ArrayList alt in the JSP page below. When I view the JSP it shows the size is 1 (<%=alt.size()%>) when it should be 3; I think I'm adding that method to the array in the generator class, so I don't understand why it'...
curious if anyone might have some insight in how I would do the following to a binary number: convert 01+0 -> 10+1 (+ as in regular expressions, one or more) 01 -> 10 10 -> 01 so, 10101000010100011100 01010100101010100010 and to clarify that this isn't a simple inversion: 000000100000000000 000001010...
To achieve the transformation you've described on a binary string, you can leverage a series of bit manipulation techniques that mimic the specified rules. Let's break down how we can conceptualize these transformations without diving into specific programming code. ### Overview of the Transformation Rules 1. **Trans...
13,733
[ { "from": "human", "value": "curious if anyone might have some insight in how I would do the following to a binary number:\nconvert \n 01+0 -> 10+1 (+ as in regular expressions, one or more)\n 01 -> 10 \n 10 -> 01 \n\nso,\n10101000010100011100\n01010100101010100010\n\nand to clarify that this isn...
I'm trying to write an iterator for results from a PDO statement but I can't find any way of rewinding to the first row. I would like to avoid the overhead of calling fetchAll and storing all the result data. // first loop works fine foreach($statement as $result) { // do something with result } // but subsequent ...
When using PDO to fetch results from a database, the PDOStatement object behaves like an iterator but does not support rewinding to the first row after you have iterated through the results. Once you've iterated through the results, the cursor is moved to the end of the result set, and subsequent attempts to iterate ov...
30,099
[ { "from": "human", "value": "I'm trying to write an iterator for results from a PDO statement but I can't find any way of rewinding to the first row. I would like to avoid the overhead of calling fetchAll and storing all the result data.\n// first loop works fine\nforeach($statement as $result) {\n // do...
I want to make a link call a Javascript function through the onclick event and not do anything else (follow the link). What is the best way to do that? I usually do this: <a href="#" onclick="foo()">Click</a> But I'm not sure that is the best way and in this case it is navigating to page.html# which isn't good for wha...
Using an `<a>` tag with `href="#"` can indeed cause undesired behavior, such as navigating to the top of the page or updating the URL with a hash. A better approach is to prevent the default action of the link when it is clicked. You can achieve this by using the `onclick` event to call the function and prevent the de...
28,411
[ { "from": "human", "value": "I want to make a link call a Javascript function through the onclick event and not do anything else (follow the link). What is the best way to do that? I usually do this:\n<a href=\"#\" onclick=\"foo()\">Click</a>\n\nBut I'm not sure that is the best way and in this case it is n...
I am currently developing a Java Struts application and i been wondering how is it possible to display chinese characters in AJAX and also when generating excel file by servlet response. Anyone can share any pointers?
To display Chinese characters correctly in a Java Struts application using AJAX and to generate Excel files with Chinese characters, you'll need to ensure proper handling of character encoding. Here are some key points to consider for both scenarios: ### Displaying Chinese Characters in AJAX 1. **Set Character Encodi...
26,477
[ { "from": "human", "value": "I am currently developing a Java Struts application and i been wondering how is it possible to display chinese characters in AJAX and also when generating excel file by servlet response.\nAnyone can share any pointers?\n" }, { "from": "gpt", "value": "To display Chin...
What does Mozilla Firefox's XPCSafeJSObject wrapper actually do? MDC's documentation is as follows: This wrapper was created to address some problems with XPCNativeWrapper. In particular, some extensions want to be able to safely access non-natively-implemented content defined objects (and to access the underlying Jav...
The XPCSafeJSObject wrapper in Mozilla Firefox is a security feature designed to allow privileged code (like browser extensions or internal Firefox code) to safely interact with unprivileged code (such as web pages and scripts running in the context of those pages). This interaction can be risky due to the potential fo...
27,641
[ { "from": "human", "value": "What does Mozilla Firefox's XPCSafeJSObject wrapper actually do?\nMDC's documentation is as follows:\n\nThis wrapper was created to address some problems with XPCNativeWrapper. In particular, some extensions want to be able to safely access non-natively-implemented content defin...
Creating an XPathDocument with referenced DTD sometimes throws a web exception. Why?
When working with `XPathDocument` in .NET to parse XML that references a DTD (Document Type Definition), you might encounter a `WebException` for several reasons. Here are some common causes and potential solutions: 1. **Missing DTD File**: If the XML document references a DTD that cannot be found (either because the ...
26,761
[ { "from": "human", "value": "Creating an XPathDocument with referenced DTD sometimes throws a web exception. Why?\n" }, { "from": "gpt", "value": "When working with `XPathDocument` in .NET to parse XML that references a DTD (Document Type Definition), you might encounter a `WebException` for sev...
Can anyone provide a clear explanation / example of what these functions do, and when it's appropriate to use them?
Of course! However, I need to know which specific functions you are referring to in order to provide a clear explanation and relevant examples. Functions can span many areas, including mathematics, programming languages, and more. Please provide the names of the functions you're interested in, and I'll be happy to help...
31,715
[ { "from": "human", "value": "Can anyone provide a clear explanation / example of what these functions do, and when it's appropriate to use them?\n" }, { "from": "gpt", "value": "Of course! However, I need to know which specific functions you are referring to in order to provide a clear explanati...
I have an XML schema that includes multiple addresses: <xs:element name="personal_address" maxOccurs="1"> <!-- address fields go here --> </xs:element> <xs:element name="business_address" maxOccurs="1"> <!-- address fields go here --> </xs:element> Within each address element, I include a "US State" enumeration: <...
You're on the right track! To define the "US State" enumeration once and reuse it in multiple address elements, you can define your `state` simple type as a separate type outside of the address elements, and then reference it in each of your address elements. Here's how you can do it: 1. Define the `state` simple ty...
23,645
[ { "from": "human", "value": "I have an XML schema that includes multiple addresses:\n<xs:element name=\"personal_address\" maxOccurs=\"1\">\n <!-- address fields go here -->\n</xs:element>\n<xs:element name=\"business_address\" maxOccurs=\"1\">\n <!-- address fields go here -->\n</xs:element>\n\nWithin ea...
I guess I'll illustrate with an example: In this game you are able to draw 2D shapes using the mouse and what you draw is rendered to the screen in real-time. I want to know what the best ways are to render this type of drawing using hardware acceleration (OpenGL). I had two ideas: Create a screen-size texture when dr...
When rendering 2D drawings in real-time using OpenGL, you have several options, each with its own trade-offs regarding performance, ease of implementation, and flexibility. Here are some common approaches along with the two you've already mentioned, as well as some recommendations based on typical scenarios: ### 1. Sc...
23,907
[ { "from": "human", "value": "I guess I'll illustrate with an example:\nIn this game you are able to draw 2D shapes using the mouse and what you draw is rendered to the screen in real-time. I want to know what the best ways are to render this type of drawing using hardware acceleration (OpenGL). I had two id...
I'm trying to copy a bunch of files below a directory and a number of the files have spaces and single-quotes in their names. When I try to string together find and grep with xargs, I get the following error: find .|grep "FooBar"|xargs -I{} cp "{}" ~/foo/bar xargs: unterminated quote Any suggestions for a more robust...
The error you are encountering with `xargs` is due to the way spaces and quotes in filenames are being handled. When filenames contain spaces or quotes, it can cause `xargs` to misinterpret the command line arguments. Instead of using `xargs`, you can achieve your goal by utilizing `find`'s `-exec` option, which is de...
27,862
[ { "from": "human", "value": "I'm trying to copy a bunch of files below a directory and a number of the files have spaces and single-quotes in their names. When I try to string together find and grep with xargs, I get the following error:\nfind .|grep \"FooBar\"|xargs -I{} cp \"{}\" ~/foo/bar\nxargs: unterm...
I have a report that is used by a windows service and a form application. So, I want to put embed the report in a DLL file that can be used by both. The problem is that if I try to set the ReportEmbeddedResource property of a ReportViewer control in my windows form app, it will search the windows form app for the reso...
To resolve the issue of embedding a report in a DLL and ensuring that it can be accessed by both a Windows Service and a Windows Forms application, you need to make some adjustments in how you load the embedded resource. Here’s how you can do it: ### Step 1: Embed the Report in Your DLL 1. Add the `.rdlc` report file...
27,763
[ { "from": "human", "value": "I have a report that is used by a windows service and a form application. So, I want to put embed the report in a DLL file that can be used by both.\nThe problem is that if I try to set the ReportEmbeddedResource property of a ReportViewer control in my windows form app, it wil...
I've never had a reason to put a label element inside of a legend element (never really thought about it or seen it done). But with the design I'm implementing, it's tempting to do so. Here's what I'm tempted to do: <fieldset> <legend><label for="formInfo">I would like information on</label></legend> <select id="formIn...
Using a `<label>` inside a `<legend>` element is not a common practice, and there are several considerations you should keep in mind regarding accessibility, semantics, and general best practices. 1. **Semantics**: The `<legend>` element is meant to provide a caption for the content of a `<fieldset>`. By placing a `<l...
26,845
[ { "from": "human", "value": "I've never had a reason to put a label element inside of a legend element (never really thought about it or seen it done). But with the design I'm implementing, it's tempting to do so.\nHere's what I'm tempted to do:\n<fieldset>\n<legend><label for=\"formInfo\">I would like info...
I am currently developing an approval routing WCF service that will allow an user to create "rules" which determine how an request is routed. The route is determined by comparing the "ObjectToEvaluate" property of the Request class against the "ObjectToEvaluate" property of the "Rule" class. The "UnitOfMeasurement" e...
To implement the method for casting the `ObjectToEvaluate` property based on the `UnitOfMeasurement` enum in your `Rule` class, you can create a method that takes the `UnitOfMeasurement` value as a parameter, checks the type of object you need to cast to, and performs the casting accordingly. Here's a suggested implem...
21,218
[ { "from": "human", "value": "I am currently developing an approval routing WCF service that will allow an user to create \"rules\" which determine how an request is routed. The route is determined by comparing the \"ObjectToEvaluate\" property of the Request class against the \"ObjectToEvaluate\" property ...
I have a image button. I wanted to add a text "Search" on it. I am not able to add it because the "imagebutton" property in VS 2008 does not have text control in it. Can anyone tell me how to add text to a image button?? <asp:ImageButton ID="Searchbutton" runat="server" AlternateText="Search" CssClas...
In ASP.NET, the `<asp:ImageButton>` control does not support adding text directly on top of the image because it is meant to display only an image. However, you can achieve the desired effect by using CSS to position the text over the image or by using a different approach altogether. Here are two common methods to ad...
29,357
[ { "from": "human", "value": "I have a image button. I wanted to add a text \"Search\" on it. I am not able to add it because the \"imagebutton\" property in VS 2008 does not have text control in it. Can anyone tell me how to add text to a image button?? \n <asp:ImageButton ID=\"Searchbutton\" runat=...
I've recently searched how I could get the application's directory in Java. I've finally found the answer but I've needed surprisingly long because searching for such a generic term isn't easy. I think it would be a good idea to compile a list of how to achieve this in multiple languages. Feel free to up/downvote if yo...
That's a great idea! Compiling a list of methods to obtain the application's directory (both the directory containing the executable and the current working directory) across multiple programming languages can be helpful for many developers. Below, I've provided examples in several popular languages. ### Java - **Ex...
24,363
[ { "from": "human", "value": "I've recently searched how I could get the application's directory in Java. I've finally found the answer but I've needed surprisingly long because searching for such a generic term isn't easy. I think it would be a good idea to compile a list of how to achieve this in multiple ...
What is the best way to enable site-wide filters in an ASP.NET MVC application? To clarify, I have a form in my master page which has a drop down list =, the value of which filters every page on the site. Each individual page also has it's own form elements. I'd really rather not have a form element across the whole ...
To implement site-wide filters in an ASP.NET MVC application effectively, you can take advantage of several features in MVC, including model binding, action filters, and AJAX to provide a seamless experience without needing to redesign your entire layout with forms. Here's a step-by-step approach to achieve this: ### ...
24,157
[ { "from": "human", "value": "What is the best way to enable site-wide filters in an ASP.NET MVC application?\nTo clarify, I have a form in my master page which has a drop down list =, the value of which filters every page on the site. Each individual page also has it's own form elements. I'd really rather...
What are they and how do they work? Context happens to be SQL Server
In the context of SQL Server, "they" could refer to various concepts, such as databases, tables, indexes, stored procedures, triggers, or something else entirely. Below, I'll explain a few fundamental components of SQL Server and how they work: ### 1. Databases **What they are**: A database in SQL Server is a structur...
24,643
[ { "from": "human", "value": "What are they and how do they work?\nContext happens to be SQL Server\n" }, { "from": "gpt", "value": "In the context of SQL Server, \"they\" could refer to various concepts, such as databases, tables, indexes, stored procedures, triggers, or something else entirely....
So what I'm looking for here is something like PHP's print_r function. This is so I can debug my scripts by seeing what's the state of the object in question.
In PHP, the `print_r` function is often used for debugging purposes because it displays the contents of a variable, especially arrays and objects, in a human-readable format. If you're looking for something similar for debugging objects in a programming context, here are a few options depending on the language you are ...
23,730
[ { "from": "human", "value": "So what I'm looking for here is something like PHP's print_r function.\nThis is so I can debug my scripts by seeing what's the state of the object in question.\n" }, { "from": "gpt", "value": "In PHP, the `print_r` function is often used for debugging purposes becaus...
We are designing a survey application with the following features The users will be able to select questions from a set of predefined questions. Each question has a question type defined which dictates the type of answer (multiple choice, DB look up, free text etc) The user can create a hierarchy of sections with mul...
Developing a survey application can be a complex task, but there are several strategies and tools you can consider to streamline your development process and reduce effort. Below are some suggestions, including both commercial and open-source solutions, as well as libraries that can help you create dynamic ASP.NET page...
24,970
[ { "from": "human", "value": "We are designing a survey application with the following features\n\nThe users will be able to select questions from a set of predefined questions.\nEach question has a question type defined which dictates the type of answer (multiple choice, DB look up, free text etc) \nThe use...
At a new job I started, we have both a Java application that handles most of the heavy lifting in the core business logic, and we also have a Rails application that of course handles the web interface to this server. Both of these access the same database. Up until now, most of the focus has been on the Java applicati...
Combining two different codebases (in your case, a Java application and a Rails application) can be a complex decision, especially when both access the same database. Below are some suggestions and approaches to manage migrations and improve your workflow without necessarily merging the codebases: ### 1. Adopt a Unifi...
24,893
[ { "from": "human", "value": "At a new job I started, we have both a Java application that handles most of the heavy lifting in the core business logic, and we also have a Rails application that of course handles the web interface to this server. Both of these access the same database.\nUp until now, most o...
Possible Duplicate: How to install the application on real device without publishing and Eclipse? Besides the Android Marketplace, what are my options as far as deploying an Android application to someone remotely? The particular issues I am up against are that I have an application which I have written which addre...
There are several methods to deploy an Android application to a device without using the Google Play Store or development tools like Eclipse. Here are some of the most common options: 1. **APK File Distribution**: - You can build the APK file of your application and share it with your sister. She can then install ...
27,295
[ { "from": "human", "value": "\nPossible Duplicate:\nHow to install the application on real device without publishing and Eclipse? \n\nBesides the Android Marketplace, what are my options as far as deploying an Android application to someone remotely? \nThe particular issues I am up against are that I have a...
I made a panel and set it to fill the screen, now I can see the windows under it but I want it to be click through, meaning they could click a file or see a tool tip of another object through the transparency. RE: This may be too obvious, but have you tried sending the panel to the back by right clicking and choosing...
To create a click-through effect for a panel in a desktop application, you generally need to adjust the window style to allow mouse clicks to pass through the panel to the underlying windows (such as the desktop or other applications like Firefox). The specific approach can vary depending on the programming framework o...
18,370
[ { "from": "human", "value": "I made a panel and set it to fill the screen, now I can see the windows under it but I want it to be click through, meaning they could click a file or see a tool tip of another object through the transparency.\n\n\nRE: This may be too obvious, but have you tried sending the pane...
I have been trying to read a picture saved in Access DB as a OLE object in a PictureBox in a C# windows Application. The code that does this is presented below: string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Rajesh\SampleDB_2003.mdb;"; OleDbConnection oConn = new OleDbConnection(c...
The error "Parameter is not valid" typically occurs when the data provided to the `Bitmap` constructor is not in a valid image format. In your case, it seems that the image data being read from the Access database may not be in a proper format that the `Bitmap` class can recognize. Here are a few suggestions to help y...
23,827
[ { "from": "human", "value": "I have been trying to read a picture saved in Access DB as a OLE object in a PictureBox in a C# windows Application.\nThe code that does this is presented below:\n string connString = @\"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\\Rajesh\\SampleDB_2003.mdb;\";\n ...
I have a text file of this format: L O A D C A S E 1 O F 2 ... J O I N T D I S P L A C E M E N T S (global) Joint X-dsp Y-dsp Z-dsp X-rot Y-rot Z-rot 1 0.0 0.0 0.0 0.0 0.0 -0.001712 2 ...
In C#, there isn't a built-in library specifically tailored to parsing the exact format you've provided. However, you can utilize general-purpose libraries for text parsing and manipulation, such as: 1. **Regular Expressions (Regex)**: This is a powerful tool for matching patterns in text, which could be useful to ext...
21,446
[ { "from": "human", "value": "I have a text file of this format: \nL O A D C A S E 1 O F 2 ... \nJ O I N T D I S P L A C E M E N T S (global)\n Joint X-dsp Y-dsp Z-dsp X-rot Y-rot Z-rot\n 1 0.0 0.0 0.0 ...
When you think about it, doesn't the REST paradigm of being resource-oriented boil down to being object-oriented (with constrained functionality, leveraging HTTP as much as possible)? I'm not necessarily saying it's a bad thing, but rather that if they are essentially the same very similar then it becomes much easier t...
You've raised an interesting perspective on the comparison between REST (Representational State Transfer) and object-oriented programming (OOP). While there are certainly similarities, it's important to also acknowledge some key distinctions. Let’s break it down based on your points: ### Similarities 1. **Resource as...
25,931
[ { "from": "human", "value": "When you think about it, doesn't the REST paradigm of being resource-oriented boil down to being object-oriented (with constrained functionality, leveraging HTTP as much as possible)?\nI'm not necessarily saying it's a bad thing, but rather that if they are essentially the same ...
How do I generate excel reports with rich formatting including charts with a ASP.Net application? As per http://support.microsoft.com/kb/257757 server-side automation of office is not advisable and also our admin does not allow installation of office on the server Customer is not ready to spend a lot on 3rd party compo...
Generating Excel reports with rich formatting and charts in an ASP.NET application while adhering to the requirements you've laid out can be challenging, especially when considering the constraints regarding server-side automation and the use of Excel 2003. However, since you are using `ExcelXmlWriter`, you can leverag...
25,047
[ { "from": "human", "value": "How do I generate excel reports with rich formatting including charts with a ASP.Net application?\nAs per http://support.microsoft.com/kb/257757 server-side automation of office is not advisable and also our admin does not allow installation of office on the server\nCustomer is ...
We're currently running an svnserve instance as NT service. While this works, it's needlessly cumbersome to administer, and I'd like to move on to the much simpler VisualSVN Server. (Bonus side benefits include Windows-integrated authentication and, thanks to HTTP/WebDAV, browsing of the latest revision.) That said, th...
VisualSVN Server does provide some flexibility when it comes to configuring the URLs for your repositories, but there are some inherent design choices to consider. 1. **Removing the /svn from the URL:** Unfortunately, the `/svn` part of the URL is a part of VisualSVN Server's design. This prefix is included to clea...
28,079
[ { "from": "human", "value": "We're currently running an svnserve instance as NT service. While this works, it's needlessly cumbersome to administer, and I'd like to move on to the much simpler VisualSVN Server. (Bonus side benefits include Windows-integrated authentication and, thanks to HTTP/WebDAV, browsi...
I would like to create a Crystal Reports report using pre-existing LINQ classes that live in a different project than where the report lives. I can't find a way to do this. I'm using VS2008. Whenever I expand the "Project Data" tree, I see only classes in my current project. The "History" tree shows me the last 5 cl...
Creating a Crystal Reports report using pre-existing LINQ classes that are located in a different project can be a bit challenging, especially when working with Visual Studio 2008. Here's a general approach to achieve this: ### Step 1: Create a DataSet 1. **Create a DataSet in your reporting project:** - In your C...
20,377
[ { "from": "human", "value": "I would like to create a Crystal Reports report using pre-existing LINQ classes that live in a different project than where the report lives. I can't find a way to do this. I'm using VS2008.\nWhenever I expand the \"Project Data\" tree, I see only classes in my current project...
Is there a good way to remove HTML from a Java string? A simple regex like replaceAll("\\<.*?>", "") will work, but some things like &amp; won't be converted correctly and non-HTML between the two angle brackets will be removed (i.e. the .*? in the regex will disappear).
Yes, while using a regular expression like `replaceAll("\\<.*?>", "")` can effectively remove HTML tags from a string, it won't handle entities such as `&amp;`, `&lt;`, etc., and can also lead to incorrect behavior if there is non-HTML content between angle brackets. To remove HTML tags and correctly decode HTML enti...
27,893
[ { "from": "human", "value": "Is there a good way to remove HTML from a Java string? A simple regex like\nreplaceAll(\"\\\\<.*?>\", \"\") \n\nwill work, but some things like &amp; won't be converted correctly and non-HTML between the two angle brackets will be removed (i.e. the .*? in the regex will disappea...
What are your favorite ways to encapsulate LINQ to SQL entity classes and data-context classes into business objects? What have you found to work in a given situation? Have you invented or taken to any specific patterns?
Encapsulating LINQ to SQL entity classes and data-context classes into business objects is a common practice aimed at creating a clean separation between the data layer and the business logic layer. This encapsulation can lead to a more maintainable and testable application architecture. Below are some effective strate...
24,353
[ { "from": "human", "value": "What are your favorite ways to encapsulate LINQ to SQL entity classes and data-context classes into business objects?\nWhat have you found to work in a given situation?\nHave you invented or taken to any specific patterns?\n" }, { "from": "gpt", "value": "Encapsulati...
Possible Duplicate: How to determine total number of open/active connections in ms sql server 2005 In Oracle, there's a view called V$SESSION that lists all active sessions in database. Is there any similar view in SQL Server 2005?
In SQL Server, you can use the `sys.dm_exec_sessions` dynamic management view (DMV) to obtain information about all active sessions in the database. This view provides details such as session ID, login name, and the status of the session, among other information. Here’s a basic query to retrieve a list of active sessi...
28,964
[ { "from": "human", "value": "\nPossible Duplicate:\nHow to determine total number of open/active connections in ms sql server 2005 \n\nIn Oracle, there's a view called V$SESSION that lists all active sessions in database. Is there any similar view in SQL Server 2005?\n" }, { "from": "gpt", "valu...
I am starting a new distributed project. Should I use SVN or Git, and why?
When deciding between SVN (Subversion) and Git for a distributed project, Git is generally the preferred choice for several reasons: 1. **Distributed Nature**: Git is designed as a distributed version control system, meaning that every developer has a complete copy of the repository, including its history. This allows...
26,097
[ { "from": "human", "value": "I am starting a new distributed project. Should I use SVN or Git, and why?\n" }, { "from": "gpt", "value": "When deciding between SVN (Subversion) and Git for a distributed project, Git is generally the preferred choice for several reasons:\n\n1. **Distributed Nature...
I'm sorry for this very newbish question, I'm not much given into web development. I've got this cool JavaScript in a .js file that we want to use on a small web site. (It's a script to run Cooliris on it). How do use the .js file or attach it to my HTML code?
No problem at all! It's great that you're diving into web development. To use a JavaScript file in your HTML, you’ll need to link the `.js` file within your HTML code. Here’s how you can do it: 1. **Create Your HTML File**: If you haven't already, create an HTML file. You can name it something like `index.html`. 2. *...
27,089
[ { "from": "human", "value": "I'm sorry for this very newbish question, I'm not much given into web development. I've got this cool JavaScript in a .js file that we want to use on a small web site. (It's a script to run Cooliris on it).\nHow do use the .js file or attach it to my HTML code?\n" }, { "...
How do I get a status report of all files currently being uploaded via HTTP form based file upload on an Apache Server?
To get a status report of all files currently being uploaded via HTTP form-based file uploads on an Apache server, you'll need to implement a combination of server-side scripting and some monitoring techniques. Here’s a general approach to achieve this: ### Step 1: Set Up File Uploads with Progress Tracking 1. **HTML...
21,748
[ { "from": "human", "value": "How do I get a status report of all files currently being uploaded via HTTP form based file upload on an Apache Server?\n" }, { "from": "gpt", "value": "To get a status report of all files currently being uploaded via HTTP form-based file uploads on an Apache server,...
I have a Tab Control with multiple Tab Pages. I want to be able to fade the tabs back and forth. I don't see an opacity option on the Tab Controls. Is there a way to cause a fade effect when I switch from one Tab Page to another?
To create a fade effect between tab pages in a Tab Control, you can employ a workaround since the Tab Control itself does not have built-in opacity settings for its tabs. Here’s a simple approach using a `Panel` or `UserControl` for each tab page, combined with a fade effect using a timer or animation. This example ass...
25,168
[ { "from": "human", "value": "I have a Tab Control with multiple Tab Pages. I want to be able to fade the tabs back and forth. I don't see an opacity option on the Tab Controls. Is there a way to cause a fade effect when I switch from one Tab Page to another?\n" }, { "from": "gpt", "value": "To c...
The other day I set up an Ubuntu installation in a VM and went to gather the tools and libraries I figured I would need for programming mostly in C++. I had a problem though, where to put things such as 3rd party source libraries, etc. From what I can gather, a lot of source distributions assume that a lot of their dep...
Setting up a programming environment on Linux, especially for C++, can be quite different from what you are used to in Windows. Here are some conventions and best practices you can follow to organize your projects, libraries, and dependencies effectively on Ubuntu (or any Linux system): ### Directory Structure 1. **P...
23,294
[ { "from": "human", "value": "The other day I set up an Ubuntu installation in a VM and went to gather the tools and libraries I figured I would need for programming mostly in C++.\nI had a problem though, where to put things such as 3rd party source libraries, etc. From what I can gather, a lot of source di...
When you call RedirectToAction within a controller, it automatically redirects using an HTTP GET. How do I explicitly tell it to use an HTTP POST? I have an action that accepts both GET and POST requests, and I want to be able to RedirectToAction using POST and send it some values. Like this: this.RedirectToAction( ...
In ASP.NET MVC, the `RedirectToAction` method performs a redirect using an HTTP GET request, which means any parameters passed will be added to the query string, not the body of a POST request. If you need to redirect with a POST request and include data in the body of that request, you have a couple of alternatives si...
22,112
[ { "from": "human", "value": "When you call RedirectToAction within a controller, it automatically redirects using an HTTP GET. How do I explicitly tell it to use an HTTP POST?\nI have an action that accepts both GET and POST requests, and I want to be able to RedirectToAction using POST and send it some v...
I found this extremely old document which appears to say that many of the web client features are not availiable when running on express edition--scheduling, subscription, etc--as well as no access to the report builder. Is that information still current, and are there any other features which are unavailable?
The information you've found about the limitations of SQL Server Reporting Services (SSRS) Express Edition is generally accurate, though the specific details may vary based on the version you are referencing. SQL Server Express editions have historically had several limitations compared to their Standard and Enterprise...
28,350
[ { "from": "human", "value": "I found this extremely old document which appears to say that many of the web client features are not availiable when running on express edition--scheduling, subscription, etc--as well as no access to the report builder. Is that information still current, and are there any other...