instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am currently calling the following line of code: java.net.URL connection_url = new java.net.URL("http://<ip address>:<port>/path"); and I get the exception above when it executes. Any ideas as to why this is happening?
To assist you better with your issue related to creating a `java.net.URL`, I need to know the specific exception you're encountering, as this can guide us to the root cause. However, I can outline several common issues that could lead to exceptions when instantiating a `URL` object: 1. **MalformedURLException**: This ...
5,700
[ { "from": "human", "value": "I am currently calling the following line of code:\njava.net.URL connection_url = new java.net.URL(\"http://<ip address>:<port>/path\");\n\nand I get the exception above when it executes. Any ideas as to why this is happening?\n" }, { "from": "gpt", "value": "To ass...
I have a multi dimensional OLAP cube with a number of dimensions. Some of these dimensions have hierarchies. The users would like to perform 'what-if' analysis on the measures in the cube by changing the hierarchies in the dimensions. For example, they want to know the impact on departmental resource budgets by moving...
Performing 'what-if' analysis in a multi-dimensional OLAP cube can be an engaging way for users to explore scenarios and assess impacts on measures by manipulating hierarchies. Here are some strategies you could employ using modern OLAP engines: ### 1. **Data Modeling** - **Dynamic Hierarchies**: Ensure your dimens...
4,512
[ { "from": "human", "value": "I have a multi dimensional OLAP cube with a number of dimensions. Some of these dimensions have hierarchies. The users would like to perform 'what-if' analysis on the measures in the cube by changing the hierarchies in the dimensions. \nFor example, they want to know the impact ...
Why can't you do this and is there are work around? You get this error. Msg 2714, Level 16, State 1, Line 13 There is already an object named '#temptable' in the database. declare @x int set @x = 1 if (@x = 0) begin select 1 as Value into #temptable end else begin select 2 as Value into #temptable end select ...
The error you are encountering occurs because the temporary table `#temptable` is already created in the current session when the second `SELECT INTO` statement is executed. This happens because the temporary table is scoped to the session and is not dropped until the end of the session or until you explicitly drop it....
6,098
[ { "from": "human", "value": "Why can't you do this and is there are work around?\nYou get this error.\nMsg 2714, Level 16, State 1, Line 13\nThere is already an object named '#temptable' in the database.\ndeclare @x int\n\nset @x = 1\n\nif (@x = 0)\nbegin\n select 1 as Value into #temptable\nend\nelse\nb...
What is the best (or as good as possible) general SVN ignore pattern to use? There are a number of different IDE, editor, compiler, plug-in, platform, etc. specific files and some file types that "overlap" (i.e. desirable for some types projects and not for others). There are however, a large number of file types tha...
Creating a general SVN ignore pattern that can serve as a solid starting point for various projects involves including common file types and patterns that are typically unnecessary or undesirable to track in source control. Below is a comprehensive list of SVN ignore patterns that can be adapted for different environme...
4,800
[ { "from": "human", "value": "What is the best (or as good as possible) general SVN ignore pattern to use? \nThere are a number of different IDE, editor, compiler, plug-in, platform, etc. specific files and some file types that \"overlap\" (i.e. desirable for some types projects and not for others). \nThere ...
Here is a quick test program: public static void main( String[] args ) { Date date = Calendar.getInstance().getTime(); System.out.println("Months:"); printDate( "MMMM", "en", date ); printDate( "MMMM", "es", date ); printDate( "MMMM", "fr", date ); printDate( "MMMM", "de", date ); Syst...
The behavior you're observing is related to the conventions of the specific locales for the languages in question. In many languages, including Spanish and French, the names of months and days are typically written in lowercase when they appear within running text, as per the grammatical rules of those languages. If y...
7,285
[ { "from": "human", "value": "Here is a quick test program:\n public static void main( String[] args )\n{\n Date date = Calendar.getInstance().getTime();\n\n System.out.println(\"Months:\");\n printDate( \"MMMM\", \"en\", date );\n printDate( \"MMMM\", \"es\", date );\n printDate( \"MMMM\",...
I'm trying to find a simple way to change the colour of the text and background in listview and treeview controls in WTL or plain Win32 code. I really don't want to have to implement full owner drawing for these controls, simply change the colours used. I want to make sure that the images are still drawn with proper tr...
In WTL (Windows Template Library) and Win32 programming, modifying the text and background colors of ListView and TreeView controls can be accomplished with the use of the `WM_CTLCOLOR` message. This allows you to change the colors without needing to implement full owner drawing. Here are simple methods to change the ...
2,597
[ { "from": "human", "value": "I'm trying to find a simple way to change the colour of the text and background in listview and treeview controls in WTL or plain Win32 code.\nI really don't want to have to implement full owner drawing for these controls, simply change the colours used.\nI want to make sure tha...
Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state? Specifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (which may change over time). Do people usuall...
Writing test code for database-backend development can be challenging, especially when dealing with state-dependent data. Here are some approaches and best practices that you can use to manage this complexity: ### 1. Use a Test Database - **Dedicated Test Database**: Create a separate database specifically for testing...
2,540
[ { "from": "human", "value": "Does anyone have some good hints for writing test code for database-backend development where there is a heavy dependency on state?\nSpecifically, I want to write tests for code that retrieve records from the database, but the answers will depend on the data in the database (whi...
What would be the best way to implement a simple crash / error reporting mechanism? Details: my app is cross-platform (mac/windows/linux) and written in Python, so I just need something that will send me a small amount of text, e.g. just a timestamp and a traceback (which I already generate and show in my error dialog...
Implementing a crash/error reporting mechanism for a cross-platform Python application is a great idea, and you have several options to consider. Here are some approaches you can take: ### 1. HTTP Reporting to a Web Service Creating a simple web service is a robust solution for collecting error reports. You can implem...
3,829
[ { "from": "human", "value": "What would be the best way to implement a simple crash / error reporting mechanism? \nDetails: my app is cross-platform (mac/windows/linux) and written in Python, so I just need something that will send me a small amount of text, e.g. just a timestamp and a traceback (which I al...
What is the best approach to write hooks for Subversion in Windows? As far as I know, only executable files can be used. So what is the best choice? Plain batch files (very limited but perhaps OK for very simple solutions) Dedicated compiled executable applications (sledgehammer to crack a nutshell?) Some other hybri...
When it comes to writing hooks for Subversion (SVN) on Windows, there are indeed several approaches you can take. The best choice depends on your specific needs, complexity of the tasks, and your familiarity with different scripting and programming languages. Here’s a breakdown of the options you mentioned: ### 1. **P...
2,119
[ { "from": "human", "value": "What is the best approach to write hooks for Subversion in Windows? As far as I know, only executable files can be used. So what is the best choice? \n\nPlain batch files (very limited but perhaps OK for very simple solutions)\nDedicated compiled executable applications (sledgeh...
In a JSP page, I created a <h:form enctype="multipart/form-data"> with some elements: <t:inputText>, <t:inputDate>, etc. Also, I added some <t:message for="someElement"> And I wanted to allow the user upload several files (one at a time) within the form (using <t:inputFileUpload> ) At this point my code works fine. Th...
The issue you are facing with the `<t:message>` tags not working properly when nesting forms and using a tabbed pane is a common challenge when dealing with JSF component libraries that manipulate IDs, especially with nested components. From your description, it sounds like you're encountering a problem related to the...
3,585
[ { "from": "human", "value": "In a JSP page, I created a <h:form enctype=\"multipart/form-data\"> with some elements: <t:inputText>, <t:inputDate>, etc. Also, I added some <t:message for=\"someElement\"> And I wanted to allow the user upload several files (one at a time) within the form (using <t:inputFileUp...
I have two collections of the same object, Collection<Foo> oldSet and Collection<Foo> newSet. The required logic is as follow: if foo is in(*) oldSet but not newSet, call doRemove(foo) else if foo is not in oldSet but in newSet, call doAdd(foo) else if foo is in both collections but modified, call doUpdate(oldFoo, ne...
Converting your `oldSet` and `newSet` collections into `HashMap<Foo>` structures can indeed improve both the readability and efficiency of your comparison logic. Let's break down the benefits and considerations of this approach: ### Benefits of Using `HashMap<Foo>` 1. **O(1) Lookup Time**: Using a `HashMap` allows fo...
3,298
[ { "from": "human", "value": "I have two collections of the same object, Collection<Foo> oldSet and Collection<Foo> newSet. The required logic is as follow:\n\nif foo is in(*) oldSet but not newSet, call doRemove(foo)\nelse if foo is not in oldSet but in newSet, call doAdd(foo)\nelse if foo is in both colle...
Our application commonly used an ActiveX control to download and install our client on IE (XP and prior), however as our user base has drifted towards more Vista boxes with "Protected Mode" on, we are required to investigate. So going forward, is it worth the headache of trying to use the protected mode API? Is this g...
Transitioning from using an ActiveX control for downloads and installations to a more modern and secure approach is essential, especially with the changes in how modern operating systems and browsers manage security. Here are some considerations and alternatives you might want to explore: ### 1. **Protected Mode API C...
4,231
[ { "from": "human", "value": "Our application commonly used an ActiveX control to download and install our client on IE (XP and prior), however as our user base has drifted towards more Vista boxes with \"Protected Mode\" on, we are required to investigate.\nSo going forward, is it worth the headache of tryi...
What role should I give a sql login if I need the login to be able to create a database, and create additional logins and add users based on those logins to the database i created? This is sql 2005.
In SQL Server 2005, to grant a SQL login the ability to create a database and manage logins and users within that database, you would typically assign the following roles: 1. **`dbcreator` Server Role**: This role allows the login to create, alter, and drop any database. 2. **`securityadmin` Server Role**: This role ...
5,668
[ { "from": "human", "value": "What role should I give a sql login if I need the login to be able to create a database, and create additional logins and add users based on those logins to the database i created? This is sql 2005.\n" }, { "from": "gpt", "value": "In SQL Server 2005, to grant a SQL...
I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map. Then I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this? At first I decided to create a system of linear equations for the three nearest ...
To plot your additional latitude/longitude pair onto an arbitrarily distorted map using the existing lat/long to x/y mappings, you can take a few different approaches. Since you've noted that your mapping is not linear and you're working with a small geographical area, a piecewise interpolation or a weighted nearest ne...
1,012
[ { "from": "human", "value": "I have a bunch of latitude/longitude pairs that map to known x/y coordinates on a (geographically distorted) map.\nThen I have one more latitude/longitude pair. I want to plot it on the map as best is possible. How do I go about doing this?\nAt first I decided to create a system...
Is there an easy way to discover a File's creation time with Java? The File class only has a method to get the "last modified" time. According to some resources I found on Google, the File class doesn't provide a getCreationTime() method because not all file systems support the idea of a creation time. The only worki...
To retrieve a file's creation time in Java, you're correct that the `File` class does not provide direct access to this information. However, since Java 7, you can use the `java.nio.file` package, which provides a more flexible and powerful way to interact with files and file metadata, including creation time. Here's ...
4,179
[ { "from": "human", "value": "Is there an easy way to discover a File's creation time with Java? The File class only has a method to get the \"last modified\" time. According to some resources I found on Google, the File class doesn't provide a getCreationTime() method because not all file systems support ...
Does anybody know if there is a way to create an SQLite database based on an XSD DataSet? In the past, I've just used a basic SQLite manager, but I want to fuse things a bit more with my .NET development if possible.
Yes, you can create an SQLite database based on an XSD (XML Schema Definition) DataSet using .NET. Here’s a step-by-step approach to achieve this: ### Step 1: Read the XSD and Create the DataSet You can use the `System.Data.DataSet` class to read the XSD file and create a DataSet that mirrors the schema defined in th...
2,239
[ { "from": "human", "value": "Does anybody know if there is a way to create an SQLite database based on an XSD DataSet? In the past, I've just used a basic SQLite manager, but I want to fuse things a bit more with my .NET development if possible.\n" }, { "from": "gpt", "value": "Yes, you can crea...
Is there a way to search the latest version of every file in TFS for a specific string or regex? This is probably the only thing I miss from Visual Source Safe... Currently I perform a Get Latest on the entire codebase and use Windows Search, but this gets quite painful with over 1GB of code in 75,000 files. EDIT: ...
Searching for a specific string or regex across all files in a TFS (Team Foundation Server) repository can indeed be a challenge, especially with large codebases. Although TFS does not natively support content search like Visual SourceSafe, here are some alternative approaches you can consider: 1. **Use a Local Checko...
5,404
[ { "from": "human", "value": "Is there a way to search the latest version of every file in TFS for a specific string or regex? This is probably the only thing I miss from Visual Source Safe... \nCurrently I perform a Get Latest on the entire codebase and use Windows Search, but this gets quite painful with ...
When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you need to cut and paste properties about, or delete them and re-...
Reordering properties in the LINQ to SQL designer can indeed be cumbersome since the designer doesn't provide a straightforward way to reorder properties directly. The properties in the generated classes reflect the order in which they appear in the database schema. Here are a few approaches you could consider to ach...
4,043
[ { "from": "human", "value": "When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you need to cut and paste...
I have a form like this: <form name="mine"> <input type=text name=one> <input type=text name=two> <input type=text name=three> </form> When user types a value in 'one', I sometimes want to skip the field 'two', depending on what he typed. For example, if user types '123' and uses Tab to move to next field,...
To achieve the desired behavior of skipping the second input field based on the value typed in the first input field, you can use the `keydown` event listener for the first input. This will allow you to check the value when the user presses the Tab key and control the focus accordingly. Here's how to implement it: ```...
5,588
[ { "from": "human", "value": "I have a form like this:\n<form name=\"mine\">\n <input type=text name=one>\n <input type=text name=two>\n <input type=text name=three>\n</form>\n\nWhen user types a value in 'one', I sometimes want to skip the field 'two', depending on what he typed. For example, if us...
Is there a way to have TortoiseSVN (or any other tool) auto-add any new .cs files I create within a directory to my working copy so I don't have to remember which files I created at the end of the day?
TortoiseSVN itself does not have a built-in feature to automatically add new files to your working copy. However, you can use a combination of scripts and TortoiseSVN commands to streamline the process. Here’s a step-by-step guide on how to achieve that: ### Method 1: Using a Script You can create a script that runs ...
4,490
[ { "from": "human", "value": "Is there a way to have TortoiseSVN (or any other tool) auto-add any new .cs files I create within a directory to my working copy so I don't have to remember which files I created at the end of the day?\n" }, { "from": "gpt", "value": "TortoiseSVN itself does not have...
I have a postgres database with a user table (userid, firstname, lastname) and a usermetadata table (userid, code, content, created datetime). I store various information about each user in the usermetadata table by code and keep a full history. so for example, a user (userid 15) has the following metadata: 15, 'QHS', ...
Fetching the latest values for each user and their corresponding user metadata can be done efficiently using PostgreSQL's window functions and Common Table Expressions (CTEs). Instead of joining multiple sub-selects, you can use the `ROW_NUMBER()` window function to rank the rows for each user and metadata code combina...
3,990
[ { "from": "human", "value": "I have a postgres database with a user table (userid, firstname, lastname) and a usermetadata table (userid, code, content, created datetime). I store various information about each user in the usermetadata table by code and keep a full history. so for example, a user (userid 15...
In my work environment, Visual Studio currently crashes every time I start our main project unless I delete the .suo (solution options) and .ncb (C++ Intellisense symbols) files. Obviously, I've found a workaround. Is there a more permanent solution than this?
Crashes in Visual Studio when opening a solution can be frustrating, especially if you have to repeatedly delete the `.suo` and `.ncb` files. Here are several strategies to potentially resolve the issue more permanently: 1. **Update Visual Studio**: Ensure you are using the latest version of Visual Studio. Microsoft f...
4,624
[ { "from": "human", "value": "In my work environment, Visual Studio currently crashes every time I start our main project unless I delete the .suo (solution options) and .ncb (C++ Intellisense symbols) files.\nObviously, I've found a workaround. Is there a more permanent solution than this?\n" }, { "...
Does anyone know of a way to force a nolock hint on all transactions issued by a certain user? I'd like to provide a login for a support team to query the production system, but I want to protect it by forcing a nolock on everything they do. I'm using SQL Server 2005.
In SQL Server, you cannot globally apply the `NOLOCK` hint to all queries executed by a specific user or login directly. However, you can achieve similar results by using a couple of strategies. Here are some options to consider: ### 1. **Creating a Stored Procedure** You could create stored procedures that encapsula...
6,326
[ { "from": "human", "value": "Does anyone know of a way to force a nolock hint on all transactions issued by a certain user? I'd like to provide a login for a support team to query the production system, but I want to protect it by forcing a nolock on everything they do. I'm using SQL Server 2005.\n" }, ...
Is there a way to check to see if an Microsoft Office process (i.e. Word, Excel) has hung when using Office Automation? Additionally, if the process is hung, is there a way to terminate it?
Yes, you can check if a Microsoft Office process (like Word or Excel) has hung when using Office Automation. In addition, you can terminate it if it is unresponsive. Here are some ways to achieve this using programming and system tools. ### Checking if the Process is Hung 1. **Using Windows API**: You can use the Win...
4,114
[ { "from": "human", "value": "Is there a way to check to see if an Microsoft Office process (i.e. Word, Excel) has hung when using Office Automation? Additionally, if the process is hung, is there a way to terminate it?\n" }, { "from": "gpt", "value": "Yes, you can check if a Microsoft Office pro...
Sometimes, in PL SQL you want to add a parameter to a Package, Function or Procedure in order to prepare future functionality. For example: create or replace function doGetMyAccountMoney( Type_Of_Currency IN char := 'EUR') return number is Result number(12,2); begin Result := 10000; IF char <> 'EUR' THEN --...
In PL/SQL, if you want to define a parameter for future use but you don't want to generate compilation warnings about it being declared but not used, you have a couple of strategies you could employ: ### 1. Use the Parameter in a Comment One simple way to avoid the warning is to reference the parameter in a comment. ...
4,331
[ { "from": "human", "value": "Sometimes, in PL SQL you want to add a parameter to a Package, Function or Procedure in order to prepare future functionality. For example:\ncreate or replace function doGetMyAccountMoney( Type_Of_Currency IN char := 'EUR') return number \nis\n Result number(12,2);\nbegin\n ...
I once read that one way to obtain a unique filename in a shell for temp files was to use a double dollar sign ($$). This does produce a number that varies from time to time... but if you call it repeatedly, it returns the same number. (The solution is to just use the time.) I am curious to know what $$ actually is,...
In a Unix-like shell environment, `$$` is a special variable that represents the process ID (PID) of the currently executing shell or script. Each time you start a new shell session or run a script, the operating system assigns it a unique PID. This number is unique for the duration of the process, but it doesn't chang...
4,433
[ { "from": "human", "value": "I once read that one way to obtain a unique filename in a shell for temp files was to use a double dollar sign ($$). This does produce a number that varies from time to time... but if you call it repeatedly, it returns the same number. (The solution is to just use the time.)\...
Why wouldn't I choose abstract? What are the limitations to declaring a class member virtual? Can only methods be declared virtual?
Choosing whether to use abstract classes or virtual methods in a programming context often involves understanding their implications, advantages, and limitations. Here’s an overview that addresses your questions: ### Why Wouldn't I Choose Abstract? 1. **Overhead of Inheritance**: Abstract classes introduce a level of ...
5,339
[ { "from": "human", "value": "Why wouldn't I choose abstract? What are the limitations to declaring a class member virtual? Can only methods be declared virtual?\n" }, { "from": "gpt", "value": "Choosing whether to use abstract classes or virtual methods in a programming context often involves un...
Suppose I have: Toby Tiny Tory Tily Is there an algorithm that can easily create a list of common characters in the same positions in all these strings? (in this case the common characters are 'T' at position 0 and 'y' at position 3) I tried looking at some of the algorithms used for DNA sequence matching but it see...
Yes, you can create an algorithm that identifies common characters at the same positions in a list of strings. Here's a simple approach to achieve this using Python as an example: ### Step-by-Step Algorithm 1. **Initialize a result list** to store common characters. 2. **Find the length of the shortest string**. This...
4,908
[ { "from": "human", "value": "Suppose I have:\n\nToby\nTiny\nTory\nTily\n\nIs there an algorithm that can easily create a list of common characters in the same positions in all these strings? (in this case the common characters are 'T' at position 0 and 'y' at position 3)\nI tried looking at some of the alg...
There are various documents describing threading on Solaris/Linux, but nowwhere describing the Windows implementation. I have a passing interest in this, it seems strange that something so critical is (seemingly) not documented. Threading is not the same on different OS' - "Write Once, Run Anywhere" isn't true for thre...
You're correct that threading implementations can vary significantly between operating systems, and understanding these differences is crucial for developers working with multithreaded applications. Java's "Write Once, Run Anywhere" paradigm does indeed have limitations, especially when it comes to threading. ### Over...
4,251
[ { "from": "human", "value": "There are various documents describing threading on Solaris/Linux, but nowwhere describing the Windows implementation. I have a passing interest in this, it seems strange that something so critical is (seemingly) not documented.\nThreading is not the same on different OS' - \"Wr...
Does anyone know of a web based IDE (Like VS, Eclipse, IDEA)? Besides ECCO?
Yes, there are several web-based IDEs that you might find useful. Here are a few popular options: 1. **Replit**: An online IDE that supports multiple programming languages and provides collaborative features. It allows you to write, run, and share code easily. 2. **GitHub Codespaces**: A cloud-based development envir...
4,997
[ { "from": "human", "value": "Does anyone know of a web based IDE (Like VS, Eclipse, IDEA)?\nBesides ECCO?\n" }, { "from": "gpt", "value": "Yes, there are several web-based IDEs that you might find useful. Here are a few popular options:\n\n1. **Replit**: An online IDE that supports multiple prog...
I have been tasked with going through a number of ColdFusion sites that have recently been the subject of a rather nasty SQL Injection attack. Basically my work involves adding <cfqueryparam> tags to all of the inline sql. For the most part I've got it down, but can anybody tell me how to use cfqueryparam with the LI...
When using `<cfqueryparam>` with the `LIKE` operator in ColdFusion, you need to make sure to include the wildcards (in this case, the `%` symbols) within the value you pass to `<cfqueryparam>`. This is because the `LIKE` operator relies on these wildcards to match the pattern. Here's how you can modify your SQL query ...
8,153
[ { "from": "human", "value": "I have been tasked with going through a number of ColdFusion sites that have recently been the subject of a rather nasty SQL Injection attack. Basically my work involves adding <cfqueryparam> tags to all of the inline sql. For the most part I've got it down, but can anybody te...
I would like to reload an <iframe> using JavaScript. The best way I found until now was set the iframe’s src attribute to itself, but this isn’t very clean. Any ideas?
Reloading an `<iframe>` in JavaScript can indeed be done by resetting its `src` attribute to its current value, but as you mentioned, this isn't the cleanest solution. There are a couple of alternative methods you could consider: ### Method 1: Use `contentWindow.location.reload()` You can call the `reload()` method o...
4,222
[ { "from": "human", "value": "I would like to reload an <iframe> using JavaScript. The best way I found until now was set the iframe’s src attribute to itself, but this isn’t very clean. Any ideas?\n" }, { "from": "gpt", "value": "Reloading an `<iframe>` in JavaScript can indeed be done by resett...
I'm trying to use Python with ReportLab 2.2 to create a PDF report. According to the user guide, Special TableStyle Indeces [sic] In any style command the first row index may be set to one of the special strings 'splitlast' or 'splitfirst' to indicate that the style should be used only for the last row of a split tabl...
The functionality you're trying to use in ReportLab with 'splitfirst' and 'splitlast' is indeed specific and needs to be used correctly according to the library's requirements. Here are a few points to note: 1. **Valid Indices**: The special indices 'splitfirst' and 'splitlast' are designed to be used in specific con...
4,364
[ { "from": "human", "value": "I'm trying to use Python with ReportLab 2.2 to create a PDF report.\nAccording to the user guide,\n\nSpecial TableStyle Indeces [sic]\nIn any style command the first row index may be set to one of the special strings 'splitlast' or 'splitfirst' to indicate that the style should ...
Is it possible to manipulate the components, such as year, month, day of a date in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.
Yes, it's definitely possible to manipulate date components such as year, month, and day in VBA (Visual Basic for Applications). You can create a function that takes the day, month, and year as arguments and returns the corresponding date. Here is a simple example of how you can achieve this using a function: ```vba ...
5,897
[ { "from": "human", "value": "Is it possible to manipulate the components, such as year, month, day of a date in VBA? I would like a function that, given a day, a month, and a year, returns the corresponding date.\n" }, { "from": "gpt", "value": "Yes, it's definitely possible to manipulate date ...
I need to select data when a page is viewed and update the 'views' column is there a way to do this in one query, or do I have to use to distinct queries?
You can achieve this in a single query by using an `UPDATE` statement with a `SELECT` in your SQL database. Depending on the database system you are using, the syntax may vary slightly. Here's a general example using SQL: Assuming you have a table called `pages` with columns `id`, `title`, and `views`, you can update ...
5,995
[ { "from": "human", "value": "I need to select data when a page is viewed and update the 'views' column is there a way to do this in one query, or do I have to use to distinct queries?\n" }, { "from": "gpt", "value": "You can achieve this in a single query by using an `UPDATE` statement with a `S...
I'm trying to write a Crystal Report which has totals grouped in a different way to the main report. The only way I've been able to do this so far is to use a subreport for the totals, but it means having to hit the data source again to retrieve the same data, which seems like nonsense. Here's a simplified example: ...
In Crystal Reports, it's common to face situations where you need to display summarized data in different ways than the main report presents the details. While you've correctly identified that using a subreport can lead to performance issues (due to additional data retrieval), there are alternative strategies you can u...
3,905
[ { "from": "human", "value": "I'm trying to write a Crystal Report which has totals grouped in a different way to the main report. The only way I've been able to do this so far is to use a subreport for the totals, but it means having to hit the data source again to retrieve the same data, which seems like n...
I've been trying to get pretty charts to work in GWT on our internal network. Playing around with GWT-Ext's charts is nice, but it requires flash and is really messy to control (it seems buggy, in general). I'd like to hear about something that works with the least amount of dependencies and it also must work without...
If you're looking for a client-side charting library that can work seamlessly with GWT and doesn't require any dependencies like Flash or an internet connection, here are a few options you might consider: 1. **Chart.js**: - **Description**: Chart.js is a simple yet flexible JavaScript charting library for designers...
2,514
[ { "from": "human", "value": "I've been trying to get pretty charts to work in GWT on our internal network.\nPlaying around with GWT-Ext's charts is nice, but it requires flash and is really messy to control (it seems buggy, in general). \nI'd like to hear about something that works with the least amount of...
I have a few Visual Studio Solutions/Projects that are being worked on in my company, which now require a scheme for automatic nightly builds. Such a scheme needs to be able to check the latest versions from SVN, build the solutions, create the appropriate downloadable files (including installers, documentation, etc.),...
For setting up an automated nightly build system for your Visual Studio solutions and projects, there are several tools and toolsets that can help you accomplish the task you're describing. Below are a few popular options: ### 1. **Jenkins** - **Overview**: Jenkins is a widely used open-source automation server that c...
2,815
[ { "from": "human", "value": "I have a few Visual Studio Solutions/Projects that are being worked on in my company, which now require a scheme for automatic nightly builds. Such a scheme needs to be able to check the latest versions from SVN, build the solutions, create the appropriate downloadable files (in...
Unfortunately it looks like for various reasons I'm going to have to use Visual Studio 6 instead of a newer version of VS. It's been a long time since I've used it. I'm looking through its menus and don't see any obvious way to set up any custom build steps (pre-build, post-build, pre-link... anything would help actual...
Using Visual Studio 6 for custom build steps can be somewhat limited compared to more modern versions. However, you can still set up pre-build and post-build steps using a workaround. Here’s how to do it: ### Setting Up Custom Build Steps in Visual Studio 6 1. **Open your project** in Visual Studio 6. 2. **Access Pr...
3,995
[ { "from": "human", "value": "Unfortunately it looks like for various reasons I'm going to have to use Visual Studio 6 instead of a newer version of VS.\nIt's been a long time since I've used it. I'm looking through its menus and don't see any obvious way to set up any custom build steps (pre-build, post-bui...
How do I determine which version of comctl32.dll is being used by a C# .NET application? The answers I've seen to this question usually involve getting version info from the physical file in Windows\System, but that isn't necessarily the version that's actually in use due to side-by-side considerations.
To determine which version of `comctl32.dll` is being used by a C# .NET application, you can use the following approaches: ### 1. Using `System.Diagnostics` to Check Loaded Modules You can check which version of `comctl32.dll` is loaded in your application by using the `System.Diagnostics` namespace to examine the pr...
5,154
[ { "from": "human", "value": "How do I determine which version of comctl32.dll is being used by a C# .NET application? The answers I've seen to this question usually involve getting version info from the physical file in Windows\\System, but that isn't necessarily the version that's actually in use due to si...
I'm downloading an entire directory from a web server. It works OK, but I can't figure how to get the file size before download to compare if it was updated on the server or not. Can this be done as if I was downloading the file from a FTP server? import urllib import re url = "http://www.someurl.com" # Download the ...
To retrieve the file size from a web server before downloading, you can make use of the `HEAD` request instead of `GET`. A `HEAD` request returns the headers of the file, including the `Content-Length`, which indicates the file size. Here's how you can modify your script to use `HEAD` requests for checking the file siz...
4,510
[ { "from": "human", "value": "I'm downloading an entire directory from a web server. It works OK, but I can't figure how to get the file size before download to compare if it was updated on the server or not. Can this be done as if I was downloading the file from a FTP server?\nimport urllib\nimport re\n\nur...
I'm working on a DCOM application with the server and client on two machines, both of which are running WinXP with Service Pack 2. On both machines, I'm logged in with the same username and password. When the client on one machine calls CoCreateInstanceEx, asking the other machine to start up the server application, it...
The E_ACCESSDENIED error you are encountering when using DCOM (Distributed Component Object Model) can occur due to various security settings and configurations, especially since you're working with Windows XP with Service Pack 2, which introduced stricter security settings compared to Windows 2000. Here are some steps...
3,375
[ { "from": "human", "value": "I'm working on a DCOM application with the server and client on two machines, both of which are running WinXP with Service Pack 2. On both machines, I'm logged in with the same username and password.\nWhen the client on one machine calls CoCreateInstanceEx, asking the other mach...
On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI. Will it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platform toolkit like Qt or GTK? (I will have t...
Creating separate GUIs for Mac and Windows using their respective native frameworks (Cocoa for macOS and WinForms for Windows) can indeed provide a more intuitive user experience, as these frameworks are designed to adhere to the design guidelines and behaviors expected by users on each platform. However, there are sev...
4,441
[ { "from": "human", "value": "On my side job as programmer, I am to write a program in C++ to convert audio files from/to various formats. Probably, this will involve building a simple GUI.\nWill it be a great effort to build seperate GUIs for Mac and Windows using Cocoa and WinForms instead of a cross-platf...
I am looking for guidance regarding the best practice around the use of the Profile feature in ASP.NET. How do you decide what should be kept in the built-in user Profile, or if you should create your own database table and add a column for the desired fields? For example, a user has a zip code, should I save the zip c...
When deciding whether to use ASP.NET's built-in Profile feature or to create your own database table for user-related data like a zip code, there are several factors to consider. Each approach has its advantages and disadvantages, so here are some points to help guide your decision: ### ASP.NET Profile Feature #### P...
480
[ { "from": "human", "value": "I am looking for guidance regarding the best practice around the use of the Profile feature in ASP.NET.\nHow do you decide what should be kept in the built-in user Profile, or if you should create your own database table and add a column for the desired fields? For example, a us...
For our application, we keep large amounts of data indexed by three integer columns (source, type and time). Loading significant chunks of that data can take some time and we have implemented various measures to reduce the amount of data that has to be searched and loaded for larger queries, such as storing larger gran...
The concept you're proposing—consolidating multiple rows of data into a single row with a BLOB field to reduce disk I/O and potentially speed up queries—has merit, but there are several factors to consider regarding its feasibility and performance impact. ### Potential Advantages 1. **Reduced Disk I/O:** By combining...
2,100
[ { "from": "human", "value": "For our application, we keep large amounts of data indexed by three integer columns (source, type and time). Loading significant chunks of that data can take some time and we have implemented various measures to reduce the amount of data that has to be searched and loaded for la...
I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. How does one go about writing 'hooks' into their code so that plugins can attach to specific events?
Creating a plugin system with hooks in your PHP web application is a great way to make your application extensible. Below, I'll outline the steps involved in implementing a basic hook system. ### Step 1: Define Your Hook System A hook system allows you to define "hooks" at various points in your application. These ho...
170
[ { "from": "human", "value": "I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. \nHow does one go about writing 'hooks' into their code so that plugins can attach to specific events?\n" }, { "from": "gpt", ...
Hopefully, I can get answers for each database server. For an outline of how indexing works check out: How does database indexing work?
Certainly! Database indexing is a crucial concept in database management systems (DBMS) that significantly enhances the speed of data retrieval operations. Here’s a general outline of how indexing works, along with some considerations for different database servers: ### What is Indexing? 1. **Definition**: An index i...
3,549
[ { "from": "human", "value": "Hopefully, I can get answers for each database server.\nFor an outline of how indexing works check out: How does database indexing work?\n" }, { "from": "gpt", "value": "Certainly! Database indexing is a crucial concept in database management systems (DBMS) that sign...
How do I make a tree data structure in C++ that uses iterators instead of pointers? I couldn't find anything in the STL that can do this. What I would like to do is to be able to create and manipulate trees like this: #include <iostream> #include <tree> using namespace std; int main() { tree<int> myTree; tr...
Creating a tree data structure in C++ that uses iterators instead of pointers can indeed be challenging, particularly since the Standard Template Library (STL) does not include a built-in tree structure like the one you've described. However, you can implement your own tree class with a custom iterator. Below is an exa...
3,334
[ { "from": "human", "value": "How do I make a tree data structure in C++ that uses iterators instead of pointers? I couldn't find anything in the STL that can do this. What I would like to do is to be able to create and manipulate trees like this:\n#include <iostream>\n#include <tree>\nusing namespace std;...
I have 2 time values which have the type datetime.time. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type datetime.datetime but not for datetime.time. So what is the best way to do this?
To find the difference between two `datetime.time` objects in Python, you cannot directly subtract them as you would with `datetime.datetime` objects. However, you can convert the `datetime.time` objects to `datetime.datetime` objects (specifically, to a common date) and then perform the subtraction. Here's a straigh...
6,802
[ { "from": "human", "value": "I have 2 time values which have the type datetime.time. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type datetime.datetime but not for datetime.time. So what is the best way to do this?\n" }, { "from...
I want to implement in Java a class for handling graph data structures. I have a Node class and an Edge class. The Graph class maintains two list: a list of nodes and a list of edges. Each node must have an unique name. How do I guard against a situation like this: Graph g = new Graph(); Node n1 = new Node("#1"); Nod...
Your concern about maintaining the integrity of the graph is valid. The issue arises from allowing external modifications to the nodes and edges that could lead to inconsistencies in the graph's internal state. Cloning or encapsulating your nodes and edges is a common approach to prevent this kind of problem. Here's a ...
2,652
[ { "from": "human", "value": "I want to implement in Java a class for handling graph data structures. I have a Node class and an Edge class. The Graph class maintains two list: a list of nodes and a list of edges. Each node must have an unique name. How do I guard against a situation like this:\n\nGraph g = ...
We have some files on our website that users of our software can download. Some of the files are in virtual folders on the website while others are on our ftp. The files on the ftp are generally accessed by clicking on an ftp:// link in a browser - most of our customers do not have an ftp client. The other files are ac...
Deciding whether to move all your files to FTP or keep them accessible via HTTP depends on several factors, including user experience, accessibility, security, and technical requirements. Here’s a breakdown of the differences and considerations for each option: ### 1. **Accessibility and User Experience** - **HTTP (H...
2,024
[ { "from": "human", "value": "We have some files on our website that users of our software can download. Some of the files are in virtual folders on the website while others are on our ftp. The files on the ftp are generally accessed by clicking on an ftp:// link in a browser - most of our customers do not h...
I love the ease that the ASP.NET Ajax control Toolkit provides to ASP.NET developers. However, I've not found it to be a scalable solution at all. I have a page with 2 date input fields. By putting a TextBox and an CalendarExtendar control attached to it for each date field, I get several (11, in fact) external Javascr...
It sounds like you're experiencing scalability issues with the ASP.NET Ajax Control Toolkit due to the multiple external JavaScript resource calls generated for each control. This is a common concern, especially in applications where performance is critical. Each instance of a control may require its own JavaScript res...
4,975
[ { "from": "human", "value": "I love the ease that the ASP.NET Ajax control Toolkit provides to ASP.NET developers. However, I've not found it to be a scalable solution at all. I have a page with 2 date input fields. By putting a TextBox and an CalendarExtendar control attached to it for each date field, I g...
I downloaded ChartFx Lite and am using it successfully in my windows forms application on my development machine. I have added the ChartFX.Lite.dll assembly to my source repository and am trying to build the project on my build server that does not have ChartFx Lite installed. I get the error: Exception occurred cre...
The error you're encountering indicates that the build server is trying to access a design-time license for ChartFX Lite, which is typically required when a component is used within a designer (e.g., Windows Forms Designer). Here are a few steps you can take to resolve this issue and successfully build your project on ...
3,226
[ { "from": "human", "value": "I downloaded ChartFx Lite and am using it successfully in my windows forms application on my development machine. I have added the ChartFX.Lite.dll assembly to my source repository and am trying to build the project on my build server that does not have ChartFx Lite installed. ...
Using reflection, how can I get all types that implement an interface with C# 3.0/.NET 3.5 with the least code, and minimizing iterations? This is what I want to re-write: foreach (Type t in this.GetType().Assembly.GetTypes()) if (t is IMyInterface) ; //do stuff
In C# 3.0/.NET 3.5, you can accomplish the task of finding all types that implement a specific interface with a bit more succinct code, while still being efficient. The `Assembly.GetTypes()` method does iterate over all types in the assembly, but you can optimize the process by using LINQ to filter the results. However...
5,804
[ { "from": "human", "value": "Using reflection, how can I get all types that implement an interface with C# 3.0/.NET 3.5 with the least code, and minimizing iterations?\nThis is what I want to re-write:\nforeach (Type t in this.GetType().Assembly.GetTypes())\n if (t is IMyInterface)\n ; //do stuff\...
I'm new to NHibernate (my 1st big project with it). I had been using a simple method of data access by creating the ISession object within a using block to do my grab my Object or list of Objects, and in that way the session was destroyed after exiting the code block. This doesn't work in a situation where lazy-loadi...
Welcome to NHibernate! It can indeed be a bit tricky to work with sessions and lazy loading, especially when you're new to it. The key issue you're encountering is due to the fact that NHibernate requires an open session to access lazy-loaded properties. When you create the `ISession` object in a `using` block, that se...
4,436
[ { "from": "human", "value": "I'm new to NHibernate (my 1st big project with it).\nI had been using a simple method of data access by creating the ISession object within a using block to do my grab my Object or list of Objects, and in that way the session was destroyed after exiting the code block. \nThis d...
While in the final throws of upgrading MS-SQL Server 2005 Express Edition to MS-SQL Server 2005 Enterprise Edition, I came across this error: The certificate cannot be dropped because one or more entities are either signed or encrypted using it. To continue, correct the problem... So, how do I find and decouple the e...
To resolve the error you're encountering while trying to drop the certificate in SQL Server 2005, you will need to identify the entities (e.g., stored procedures, functions, triggers, etc.) that are either signed or encrypted with that certificate. Here's how you can do that: ### Step 1: Identify Entities Using the Ce...
3,300
[ { "from": "human", "value": "While in the final throws of upgrading MS-SQL Server 2005 Express Edition to MS-SQL Server 2005 Enterprise Edition, I came across this error:\n\nThe certificate cannot be dropped because one or more entities are either signed or encrypted using it. To continue, correct the probl...
Is there a way to select data where any one of multiple conditions occur on the same field? Example: I would typically write a statement such as: select * from TABLE where field = 1 or field = 2 or field = 3 Is there a way to instead say something like: select * from TABLE where field = 1 || 2 || 3 Any help is apprec...
Yes, in SQL, you can simplify your query using the `IN` operator, which allows you to specify multiple values for a single field without the need to use multiple `OR` conditions. Your example can be rewritten as follows: ```sql SELECT * FROM TABLE WHERE field IN (1, 2, 3); ``` This statement will return all rows wher...
7,366
[ { "from": "human", "value": "Is there a way to select data where any one of multiple conditions occur on the same field?\nExample: I would typically write a statement such as:\nselect * from TABLE where field = 1 or field = 2 or field = 3\n\nIs there a way to instead say something like:\nselect * from TABLE...
How can a sdbm hash function (such as this) be implemented in C# ?
The SDBM hash function is a simple yet effective hashing algorithm that generates a hash value from a given string. It is particularly known for its good distribution properties and speed. Here’s how you can implement the SDBM hash function in C#: ```csharp using System; public class SDBMHash { public static ulon...
5,672
[ { "from": "human", "value": "How can a sdbm hash function (such as this) be implemented in C# ?\n" }, { "from": "gpt", "value": "The SDBM hash function is a simple yet effective hashing algorithm that generates a hash value from a given string. It is particularly known for its good distribution ...
I installed VS SP1 and played around with Entity Framework. I created a schema from an existing database and tried some basic operations. Most of it went well, except the database schema update. I changed the database in every basic way: added a new table deleted a table added a new column to an existing table deleted...
Entity Framework (EF) has certain limitations when it comes to updating the model based on changes made to an existing database schema, particularly with certain operations like changing the type of a column or deleting a column. Here are some options to consider for handling these changes: 1. **Update the Model from ...
3,567
[ { "from": "human", "value": "I installed VS SP1 and played around with Entity Framework.\nI created a schema from an existing database and tried some basic operations.\nMost of it went well, except the database schema update.\nI changed the database in every basic way:\n\nadded a new table\ndeleted a table\...
The company I just started working for is using Stripes for parts of its web page development these days, and while it seems to be a nice enough web framework it no one really uses it-- it is almost non existent on the 'net. It's not even first in it's google search and the result you do get is for its old home page. S...
Stripes is a lightweight Java web framework that is designed to facilitate the development of web applications. While it may not be as widely known or used as other frameworks like Spring or JSF, it has its own strengths, particularly in its simplicity and focus on convention over configuration. Here are some resource...
4,253
[ { "from": "human", "value": "The company I just started working for is using Stripes for parts of its web page development these days, and while it seems to be a nice enough web framework it no one really uses it-- it is almost non existent on the 'net. It's not even first in it's google search and the resu...
I am looking for either a FireFox extension, or a similar program, that allows you to craft GET and POST requests. The user would put in a form action, and as many form key/value pairs as desired. It would also send any cookie information (or send the current cookies from any domain the user chooses.) The Web Developer...
You might want to check out the following Firefox extensions and tools that can help you craft GET and POST requests with customizable parameters: 1. **RESTClient**: This is a powerful RESTful API client that allows you to craft HTTP requests (GET, POST, PUT, DELETE) easily. You can enter the URL, select the request m...
4,700
[ { "from": "human", "value": "I am looking for either a FireFox extension, or a similar program, that allows you to craft GET and POST requests. The user would put in a form action, and as many form key/value pairs as desired. It would also send any cookie information (or send the current cookies from any do...
I am looking into mechanisms for better search capabilities against our database. It is currently a huge bottleneck (causing long-lasting queries that are hurting our database performance). My boss wanted me to look into Solr, but on closer inspection, it seems we actually want some kind of DB integration mechanism wi...
Integrating search capabilities into an existing application, especially one built with JSP, Tomcat, and JDBC, can be challenging. Given your requirements, let's break down some of the options you're considering and also explore some alternative approaches. ### Options You Mentioned 1. **Hibernate Search**: - **P...
4,171
[ { "from": "human", "value": "I am looking into mechanisms for better search capabilities against our database. It is currently a huge bottleneck (causing long-lasting queries that are hurting our database performance).\nMy boss wanted me to look into Solr, but on closer inspection, it seems we actually wan...
We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation. Therefore, we've been looking at some alternative memory allocatio...
Memory fragmentation can indeed lead to allocation failures, particularly in long-running server processes where memory is allocated and freed over time. Your concerns regarding fragmentation in Windows Server 2003 are valid, and choosing an appropriate memory allocator can help alleviate some of those issues. Let's lo...
2,624
[ { "from": "human", "value": "We've occasionally been getting problems whereby our long-running server processes (running on Windows Server 2003) have thrown an exception due to a memory allocation failure. Our suspicion is these allocations are failing due to memory fragmentation.\nTherefore, we've been lo...
What are the ways to retrieve data submitted to the web server from a form in the client HTML in ASP.NET?
In ASP.NET, there are several ways to retrieve data submitted to the web server from a client HTML form. Here are the most common methods: ### 1. **Using Request.Form** You can access form data directly through the `Request.Form` collection in your ASP.NET code. This is typically done in the code-behind of a Web Forms...
2,135
[ { "from": "human", "value": "What are the ways to retrieve data submitted to the web server from a form in the client HTML in ASP.NET?\n" }, { "from": "gpt", "value": "In ASP.NET, there are several ways to retrieve data submitted to the web server from a client HTML form. Here are the most commo...
Using C#, I need a class called User that has a username, password, active flag, first name, last name, full name, etc. There should be methods to authenticate and save a user. Do I just write a test for the methods? And do I even need to worry about testing the properties since they are .Net's getter and setters?
When creating a `User` class in C#, it's important to design it thoughtfully while also considering how you will test it. Here's a basic outline for the `User` class with properties and methods for authentication and saving. ### User Class Implementation Here’s an example of how you might implement the `User` class:...
1,803
[ { "from": "human", "value": "Using C#, I need a class called User that has a username, password, active flag, first name, last name, full name, etc. \nThere should be methods to authenticate and save a user. Do I just write a test for the methods? And do I even need to worry about testing the properties s...
Are there any good grid-hosting companies out there that offer .NET stacks? Something like MediaTemple - which won't host the worlds fastest websites, but for the price is far better than "shared hosting". I've used Rackspace's Mosso, but it sucked - it never felt like a normal .NET stack (caching was odd, site recompi...
Yes, there are several grid-hosting companies that offer .NET stacks and provide better performance than traditional shared hosting. Here are some options to consider: 1. **SmarterASP.NET**: This hosting provider specializes in ASP.NET hosting and offers a range of plans, including options for dedicated application po...
5,494
[ { "from": "human", "value": "Are there any good grid-hosting companies out there that offer .NET stacks? Something like MediaTemple - which won't host the worlds fastest websites, but for the price is far better than \"shared hosting\". I've used Rackspace's Mosso, but it sucked - it never felt like a norma...
Here is some code I could not get to format properly in markdown, this is straight C code, pasted into the text box with the '4 spaces' format to denote code: #define PRINT(x, format, ...) \ if ( x ) { \ if ( debug_fd != NULL ) { \ fprintf(debug_fd, format, ##__VA_ARGS__); \ } \ else { \ fpr...
It seems like you're encountering issues with how Markdown handles backslashes in your code snippet. In Markdown, the backslash (`\`) is used as an escape character, which can sometimes lead to confusion when displaying code that includes backslashes at the end of lines. To properly format your C code in Markdown whil...
5,471
[ { "from": "human", "value": "Here is some code I could not get to format properly in markdown, this is straight C code, pasted into the text box with the '4 spaces' format to denote code:\n#define PRINT(x, format, ...) \\\nif ( x ) { \\\n if ( debug_fd != NULL ) { \\\n fprintf(debug_fd, format, ##...
A tutorial I have on Regex in python explains how to use the re module in python, I wanted to grab the URL out of an A tag so knowing Regex I wrote the correct expression and tested it in my regex testing app of choice and ensured it worked. When placed into python it failed: result = re.match("a_regex_of_pure_awesomen...
In Python's `re` module, the `re.match` function checks for a match only at the beginning of the string. If you want to find a pattern anywhere in the string, you should use `re.search` instead. This function scans through the entire string to find a match. If your goal is to simplify the regex pattern from using `.*`...
6,535
[ { "from": "human", "value": "A tutorial I have on Regex in python explains how to use the re module in python, I wanted to grab the URL out of an A tag so knowing Regex I wrote the correct expression and tested it in my regex testing app of choice and ensured it worked. When placed into python it failed:\nr...
I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why? (defun biggerElems(x xs) (let ((xst)) (dolist (elem xs) (if (> x elem) (setf xst (remove elem xs)))) xst))
The issue with your `biggerElems` function lies in the way you're using `remove` and how you're trying to construct the new list. Specifically, each time you call `remove`, it processes the entire list `xs` to create a new list without the current `elem`. This means that you're not building up the `xst` list correctly;...
5,153
[ { "from": "human", "value": "I have a function that gets x(a value) and xs(a list) and removes all values that are bigger than x from the list. Well it doesn't work, can you tell me why?\n(defun biggerElems(x xs) \n (let ((xst))\n (dolist (elem xs)\n (if (> x elem)\n (setf xst (remove elem...
Jeff has previously blogged about using the cache to perform "out of band" processing on his websites, however I was wondering what other techniques people are using to process these sorts of tasks?
There are several techniques and approaches that developers use for "out of band" processing or to handle tasks that don’t need to be processed immediately in a web application. Here are some commonly used methods: 1. **Message Queues**: Tools like RabbitMQ, Apache Kafka, or Amazon SQS can be used to queue up tasks th...
5,620
[ { "from": "human", "value": "Jeff has previously blogged about using the cache to perform \"out of band\" processing on his websites, however I was wondering what other techniques people are using to process these sorts of tasks?\n" }, { "from": "gpt", "value": "There are several techniques and ...
On Mac OS X 10.5 I downloaded the latest version of Apache 2.2.9. After the usual configure, make, make install dance I had a build of apache without mod_rewrite. This wasn't statically linked and the module was not built in the /modules folder either. I had to do the following to build Apache and mod_rewrite: ./config...
To build Apache with all modules as shared (DSOs), you can use the `--enable-so` option during the configuration stage. This option allows Apache to load shared modules dynamically. Here's how to do it: 1. **Configure with `--enable-so`**: When you run the `./configure` command, include the `--enable-so` option: ``...
4,850
[ { "from": "human", "value": "On Mac OS X 10.5 I downloaded the latest version of Apache 2.2.9. After the usual configure, make, make install dance I had a build of apache without mod_rewrite. This wasn't statically linked and the module was not built in the /modules folder either.\nI had to do the following...
Where should I start learning about version control systems? I've used SVN, Team Foundation, and Sourcesafe in the past but I don't really feel like I grasp it completely, and my team doesn't seem to grasp it either. Which points are the most important to master? I realise this differs from VCS to VCS, but for the sake...
Learning about version control systems (VCS), particularly Subversion (SVN), is a great investment for improving your development workflow. Since you already have experience with SVN and other systems, you have a foundation to build on. Here are some key points to focus on: ### Key Concepts to Master 1. **Basic Comma...
4,325
[ { "from": "human", "value": "Where should I start learning about version control systems? I've used SVN, Team Foundation, and Sourcesafe in the past but I don't really feel like I grasp it completely, and my team doesn't seem to grasp it either.\nWhich points are the most important to master? I realise this...
So, I am a total beginner in any kind of Windows related programming. I have been playing around with the Windows API and came across a couple of examples on how to initialize create windows and such. One example creates a regular window (I abbreviated some of the code): int WINAPI WinMain( [...] ) { [...] /...
Creating a dialog box in Windows programming is indeed a bit different from creating a standard window using the `CreateWindow` function. Let's clarify a few points and explore whether registering a window class for a dialog is necessary or beneficial. ### Differences Between Regular Windows and Dialogs 1. **Dialog B...
4,600
[ { "from": "human", "value": "So, I am a total beginner in any kind of Windows related programming. I have been playing around with the Windows API and came across a couple of examples on how to initialize create windows and such. \nOne example creates a regular window (I abbreviated some of the code):\nint ...
What does it mean when you get or create a date in UTC format in JavaScript?
When you get or create a date in UTC format in JavaScript, it means that the date and time are represented in Coordinated Universal Time (UTC), which is a time standard that is not affected by time zones or Daylight Saving Time adjustments. This is important for ensuring consistency in time representation across differ...
2,379
[ { "from": "human", "value": "What does it mean when you get or create a date in UTC format in JavaScript?\n" }, { "from": "gpt", "value": "When you get or create a date in UTC format in JavaScript, it means that the date and time are represented in Coordinated Universal Time (UTC), which is a ti...
What is the general feeling amongst developers regarding the changing of files in the 12 hive. For example if you were asked to remove the sign is a different user menu item, you would need to modify the relevent user control on the filesystem. Now if you just go and modify it via notepad or copy over and then if you ...
The general feeling among developers regarding changes to files in the 12 hive of SharePoint (or similar systems) tends to be cautious and somewhat apprehensive. Here are several key points that outline the rationale behind this sentiment: 1. **Supportability**: Direct modifications to the default installed files can ...
6,314
[ { "from": "human", "value": "What is the general feeling amongst developers regarding the changing of files in the 12 hive. \nFor example if you were asked to remove the sign is a different user menu item, you would need to modify the relevent user control on the filesystem. Now if you just go and modify it...
What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space? Let's say the screen looks like this ('#' represents filled area): .................... ..............###### ##.................. .................### .................### #####............... #####..........
To find the largest rectangle that fits in an empty space on a grid (where certain areas are filled), you can use a well-known algorithm related to finding the largest rectangle in a histogram. The approach is efficient and works with a time complexity of \( O(n \times m) \), where \( n \) is the number of rows and \( ...
2,824
[ { "from": "human", "value": "What's the most efficient algorithm to find the rectangle with the largest area which will fit in the empty space?\nLet's say the screen looks like this ('#' represents filled area):\n....................\n..............######\n##..................\n.................###\n..........
How do you go about the requirements gathering phase? Does anyone have a good set of guidelines or tips to follow? What are some good questions to ask the stakeholders? I am currently working on a new project and there are a lot of unknowns. I am in the process of coming up with a list of questions to ask the stakehol...
Requirements gathering is a crucial phase in any project, as it sets the foundation for the entire development process. Here are some guidelines and tips to ensure a thorough and effective requirements gathering process: ### Guidelines for Requirements Gathering 1. **Identify Stakeholders**: Recognize everyone who ha...
3,913
[ { "from": "human", "value": "How do you go about the requirements gathering phase? Does anyone have a good set of guidelines or tips to follow? What are some good questions to ask the stakeholders? \nI am currently working on a new project and there are a lot of unknowns. I am in the process of coming up wi...
I've got an old, legacy VB6 application that uses the DHTML editing control as an HTML editor. The Microsoft DHTML editing control, a.k.a. DHTMLEd, is probably nothing more than an IE control using IE's own native editing capability internally. I'd like to modify the app to implement smart quotes like Word. Specificall...
You can implement smart quotes in a DHTML editing control by leveraging JavaScript. Below, I will provide you with a solution that should work in a contentEditable region in modern web browsers. You can adapt this logic to your VB6 application using the DHTML editing control. ### JavaScript Code for Smart Quotes This...
3,152
[ { "from": "human", "value": "I've got an old, legacy VB6 application that uses the DHTML editing control as an HTML editor. The Microsoft DHTML editing control, a.k.a. DHTMLEd, is probably nothing more than an IE control using IE's own native editing capability internally.\nI'd like to modify the app to imp...
Dijkstra's Shunting Yard algorithm is used to parse an infix notation and generate RPN output. I am looking for the opposite, a way to turn RPN into highschool-math-class style infix notation, in order to represent RPN expressions from a database to lay users in an understandable way. Please save your time and don't co...
You can transform Reverse Polish Notation (RPN) back to infix notation using a stack-based approach. While I can't directly reference a specific textbook, I can guide you through how to implement it and suggest resources that typically cover this topic. ### General Approach 1. **Use a Stack**: Just like with the Shunt...
4,749
[ { "from": "human", "value": "Dijkstra's Shunting Yard algorithm is used to parse an infix notation and generate RPN output.\nI am looking for the opposite, a way to turn RPN into highschool-math-class style infix notation, in order to represent RPN expressions from a database to lay users in an understandab...
I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires. I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609 This is the full script that I'm trying to modify, changing: window.addEventListener ("load", doStuff, false); to window.addEventListen...
In older versions of Firefox, such as 2.0.0.16, the `DOMContentLoaded` event may not behave consistently or might not be supported as it is in more recent versions. In your case, changing from `window.addEventListener("load", ...)` to `window.addEventListener("DOMContentLoaded", ...)` could lead to issues since the `DO...
6,052
[ { "from": "human", "value": "I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires.\nI'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609\nThis is the full script that I'm trying to modify, changing:\nwindow.addEventListener (\"load...
What's the best framework for creating mock objects in Java? Why? What are the pros and cons of each framework?
When it comes to creating mock objects in Java for unit testing, several frameworks are commonly used. Each has its own strengths and weaknesses. Here are some of the most popular ones: ### 1. Mockito **Pros:** - **Ease of Use:** Mockito has a simple and intuitive API, making it easy to create and use mocks. - **Flue...
935
[ { "from": "human", "value": "What's the best framework for creating mock objects in Java? Why? What are the pros and cons of each framework?\n" }, { "from": "gpt", "value": "When it comes to creating mock objects in Java for unit testing, several frameworks are commonly used. Each has its own st...
First off, I understand the reasons why an interface or abstract class (in the .NET/C# terminology) cannot have abstract static methods. My question is then more focused on the best design solution. What I want is a set of "helper" classes that all have their own static methods such that if I get objects A, B, and C f...
You're correct that in C# (and .NET in general), you cannot define abstract static methods in interfaces or abstract classes. This limitation indeed makes it challenging when you want a set of static helper methods across different classes that share the same functionality. Given your requirements, here are a few desi...
4,632
[ { "from": "human", "value": "First off, I understand the reasons why an interface or abstract class (in the .NET/C# terminology) cannot have abstract static methods. My question is then more focused on the best design solution.\nWhat I want is a set of \"helper\" classes that all have their own static meth...
I'm trying to run powershell commands through a web interface (ASP.NET/C#) in order to create mailboxes/etc on Exchange 2007. When I run the page using Visual Studio (Cassini), the page loads up correctly. However, when I run it on IIS (v5.1), I get the error "unknown user name or bad password". The biggest problem tha...
To run PowerShell commands that require authentication against Exchange from an ASP.NET application, you'll need to impersonate a user with appropriate permissions. In IIS, the ASP.NET application runs under the identity of the application pool (in your case, `ASPNET`), which typically doesn't have the necessary permis...
2,902
[ { "from": "human", "value": "I'm trying to run powershell commands through a web interface (ASP.NET/C#) in order to create mailboxes/etc on Exchange 2007. When I run the page using Visual Studio (Cassini), the page loads up correctly. However, when I run it on IIS (v5.1), I get the error \"unknown user name...
What are the basic steps to compile an OpenGL application using GLUT (OpenGL Utility Toolkit) under Visual C++ Express Edition?
Compiling an OpenGL application using GLUT in Visual C++ Express Edition involves a few straightforward steps. Here's a guide to get you started: ### Step 1: Install Visual C++ Express Edition Make sure you have Visual C++ Express Edition installed on your machine. If not, you can download and install it from the Mic...
2,025
[ { "from": "human", "value": "What are the basic steps to compile an OpenGL application using GLUT (OpenGL Utility Toolkit) under Visual C++ Express Edition?\n" }, { "from": "gpt", "value": "Compiling an OpenGL application using GLUT in Visual C++ Express Edition involves a few straightforward st...
I have a web application that sometimes just hangs over heavy load. To make it come back I have to kill the "dllhost.exe" process. Does someone know what to do? This is an Classic ASP (VBScript) app with lots of COM+ objects. The server has the following configuration: Intel Core 2 Duo 2.2 GHz / 4 GB RAM Windows Serve...
The issues you're experiencing with your Classic ASP application and COM+ objects can stem from various factors, especially given the legacy nature of your setup with Windows Server 2003 and IIS 6.0. Below are some potential reasons for the hanging issue and suggestions for addressing them: ### Possible Causes of Hang...
3,339
[ { "from": "human", "value": "I have a web application that sometimes just hangs over heavy load. To make it come back I have to kill the \"dllhost.exe\" process. Does someone know what to do?\nThis is an Classic ASP (VBScript) app with lots of COM+ objects.\nThe server has the following configuration:\n\nIn...
If I have an XElement that has child elements, and if I remove a child element from the parent, removing all references between the two, will the child XElement have the same namespaces as the parent? In other words, if I have the following XML: <parent xmlns:foo="abc"> <foo:child /> </parent> and I remove the chi...
When you remove a child XElement from its parent XElement in LINQ to XML, the namespaces associated with that child XElement do not carry over to the removed element when you access or serialize it after the removal. The child element will only retain its original namespace declaration if you explicitly preserve that i...
7,462
[ { "from": "human", "value": "If I have an XElement that has child elements, and if I remove a child element from the parent, removing all references between the two, will the child XElement have the same namespaces as the parent?\nIn other words, if I have the following XML:\n<parent xmlns:foo=\"abc\">\n ...
ASP.NET server-side controls postback to their own page. This makes cases where you want to redirect a user to an external page, but need to post to that page for some reason (for authentication, for instance) a pain. An HttpWebRequest works great if you don't want to redirect, and JavaScript is fine in some cases, bu...
In ASP.NET, when you want to post data to an external URL and then redirect the user to the response of that request, you can't directly redirect the user to that URL with the POST data. However, you can achieve this with a two-step process that involves making a server-side HTTP request and then using a JavaScript wor...
2,308
[ { "from": "human", "value": "ASP.NET server-side controls postback to their own page. This makes cases where you want to redirect a user to an external page, but need to post to that page for some reason (for authentication, for instance) a pain.\nAn HttpWebRequest works great if you don't want to redirect...
If you are using HAML and SASS in your Rails application, then any templates you define in public/stylesheet/*.sass will be compiled into *.css stylesheets. From your code, you use stylesheet_link_tag to pull in the asset by name without having to worry about the extension. Many people dislike storing generated code o...
When working with SASS and HAML in a Rails application, it's important to keep your project organized and maintainable, while also following best practices for asset management. Here's a suggested layout and pattern for organizing your SASS resources in a Rails project: ### Suggested SASS Layout 1. **Asset Pipeline**...
3,863
[ { "from": "human", "value": "If you are using HAML and SASS in your Rails application, then any templates you define in public/stylesheet/*.sass will be compiled into *.css stylesheets. From your code, you use stylesheet_link_tag to pull in the asset by name without having to worry about the extension. \nMa...
I'm writing a plugin that will parse a bunch of files in a project. But for the moment I'm stuck searching through the Eclipse API for answers. The plugin works like this: Whenever I open a source file I let the plugin parse the source's corresponding build file (this could be further developed with caching the parse r...
To retrieve the build path and source paths in an Eclipse CDT environment, you'll want to use the Eclipse C/C++ Development Tooling (CDT) APIs. Here's a step-by-step approach to help you access both the build path and the source path for a given project. ### Step 1: Retrieve the Project from the File You already have...
3,254
[ { "from": "human", "value": "I'm writing a plugin that will parse a bunch of files in a project. But for the moment I'm stuck searching through the Eclipse API for answers.\nThe plugin works like this: Whenever I open a source file I let the plugin parse the source's corresponding build file (this could be ...
Tomcat fails to start even if i remove all my applications from the WEBAPPS directory leaving everything just like after the OS installation. The log (catalina.out) says: Using CATALINA_BASE: /usr/share/tomcat5 Using CATALINA_HOME: /usr/share/tomcat5 Using CATALINA_TMPDIR: /usr/share/tomcat5/temp Using JRE_HOME: ...
The error message you're encountering indicates that Tomcat is unable to find a required class, specifically `org.apache.commons.modeler.Registry`, which is crucial for Tomcat's startup process. This class is part of the Apache Commons Modeler library, which is typically included in Tomcat's `lib` directory. Here are ...
3,545
[ { "from": "human", "value": "Tomcat fails to start even if i remove all my applications from the WEBAPPS directory leaving everything just like after the OS installation.\nThe log (catalina.out) says:\nUsing CATALINA_BASE: /usr/share/tomcat5\nUsing CATALINA_HOME: /usr/share/tomcat5\nUsing CATALINA_TMPDI...
I am in the process of figuring out a cache strategy for our current setup, currently have multiple web servers and wanted to know what is the best way to cache data in this environment. I have done research about MemCache and the native asp.net caching but wanted to get some feedback first. Should I go with a Linux bo...
When deciding on a caching strategy for a setup with multiple web servers, there are several factors to consider, especially regarding the choice between Memcached and ASP.NET caching, as well as whether to use a Linux box or a Windows version of Memcached. ### Caching Options 1. **ASP.NET Caching**: - **In-Proces...
4,605
[ { "from": "human", "value": "I am in the process of figuring out a cache strategy for our current setup, currently have multiple web servers and wanted to know what is the best way to cache data in this environment. I have done research about MemCache and the native asp.net caching but wanted to get some fe...
I've recently switched from being an employee of a small consulting company to being an independent consultant and as time goes on I will need to upgrade Windows and Visual Studio. So what is the most affordable way to go about this for a small time developer? My previous boss suggested I get a TechNet Plus subscriptio...
As an independent consultant, managing software costs is crucial. Here are some insights on your questions about Windows, Visual Studio, and affordable alternatives: ### Windows Licensing Your approach with a TechNet Plus subscription for OS licenses is valid. However, note that TechNet subscriptions have been retired...
5,034
[ { "from": "human", "value": "I've recently switched from being an employee of a small consulting company to being an independent consultant and as time goes on I will need to upgrade Windows and Visual Studio. So what is the most affordable way to go about this for a small time developer?\nMy previous boss ...
How do I obtain the serial number of the CPU in a PC?
To obtain the serial number of the CPU in a PC, you can use different methods depending on your operating system. Here are some ways to do this for Windows, Linux, and macOS: ### For Windows: 1. **Using Command Prompt**: - Press `Windows Key + R` to open the Run dialog. - Type `cmd` and press Enter to open Comm...
6,425
[ { "from": "human", "value": "How do I obtain the serial number of the CPU in a PC?\n" }, { "from": "gpt", "value": "To obtain the serial number of the CPU in a PC, you can use different methods depending on your operating system. Here are some ways to do this for Windows, Linux, and macOS:\n\n##...
I had the idea of a search engine that would index web items like other search engines do now but would only store the file's title, url and a hash of the contents. This way it would be easy to find items on the web if you already had them and didn't know where they came from or wanted to know all the places that somet...
Your idea of a search engine that indexes web items by storing just the title, URL, and a hash of the contents is intriguing and does touch on some existing concepts, but it also presents a unique approach. ### Similar Existing Concepts: 1. **Image and File Search Engines**: There are search engines specifically foc...
5,781
[ { "from": "human", "value": "I had the idea of a search engine that would index web items like other search engines do now but would only store the file's title, url and a hash of the contents.\nThis way it would be easy to find items on the web if you already had them and didn't know where they came from o...
I'm new to MVC (and ASP.Net routing). I'm trying to map *.aspx to a controller called PageController. routes.MapRoute( "Page", "{name}.aspx", new { controller = "Page", action = "Index", id = "" } ); Wouldn't the code above map *.aspx to PageController? When I run this and type in any .aspx page I get the...
It looks like you're on the right track with trying to set up ASP.NET routing to route `.aspx` pages to your `PageController`, but there are a few potential issues to address. Here are some steps you can take to troubleshoot and properly configure your routing: 1. **Ensure Controller Exists**: Make sure that you have...
3,056
[ { "from": "human", "value": "I'm new to MVC (and ASP.Net routing). I'm trying to map *.aspx to a controller called PageController. \nroutes.MapRoute(\n \"Page\",\n \"{name}.aspx\",\n new { controller = \"Page\", action = \"Index\", id = \"\" }\n);\n\nWouldn't the code above map *.aspx to PageControl...
When attempting to print using the SSRS Viewer Web Part in SharePoint I get the following error. An error occured during printing. (0x8007F303) The settings we are using in this box (production) are exactly the same as the settings in testing where this works perfectly fine. Anyone have any good ideas or faced this ...
The error "An error occurred during printing. (0x8007F303)" in the context of the SSRS Viewer Web Part in SharePoint usually indicates a problem with the rendering or configuration settings rather than an issue with the actual report itself. Here are several troubleshooting steps and suggestions to help you resolve thi...
5,971
[ { "from": "human", "value": "When attempting to print using the SSRS Viewer Web Part in SharePoint I get the following error.\n\nAn error occured during printing. (0x8007F303)\n\nThe settings we are using in this box (production) are exactly the same as the settings in testing where this works perfectly fin...
I have always used || (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: |. What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable?
In C# and PHP, the difference between `||` (logical OR) and `|` (bitwise OR) is significant, and they are not interchangeable. ### C# Usage 1. **Logical OR (`||`)**: - **Short-circuiting**: The `||` operator will evaluate the second operand only if the first operand is `false`. This is known as short-circuit evalu...
3,920
[ { "from": "human", "value": "I have always used || (two pipes) in OR expressions, both in C# and PHP. Occasionally I see a single pipe used: |. What is the difference between those two usages? Are there any caveats when using one over the other or are they interchangeable?\n" }, { "from": "gpt", ...
When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them?
Yes, in Drupal, you can remove the default Title and Body fields that are automatically created when you generate a new content type using the Content Creation Kit (CCK). Here’s how you can do it: 1. **Navigate to Content Types**: - Go to the Drupal admin menu. - Click on "Structure" and then "Content types". 2...
5,745
[ { "from": "human", "value": "When you create a new content type in Drupal using the Content Creation Kit, you automatically get Title and Body fields in the generated form. Is there a way to remove them?\n" }, { "from": "gpt", "value": "Yes, in Drupal, you can remove the default Title and Body f...
How can I find the origins of conflicting DNS records?
Finding the origins of conflicting DNS records involves a systematic approach to analyze and troubleshoot the issue. Here’s how you can do it: ### 1. **Identify the Conflicting Records** - Use tools like `nslookup`, `dig`, or online DNS lookup services to query the DNS records. Check for A, AAAA, CNAME, MX, TXT, an...
5,191
[ { "from": "human", "value": "How can I find the origins of conflicting DNS records?\n" }, { "from": "gpt", "value": "Finding the origins of conflicting DNS records involves a systematic approach to analyze and troubleshoot the issue. Here’s how you can do it:\n\n### 1. **Identify the Conflicting...
I'm used to doing all my coding in one C file. However, I'm working on a project large enough that it becomes impractical to do so. I've been #including them together but I've run into cases where I'm #including some files multiple times, etc. I've heard of .h files, but I'm not sure what their function is (or why havi...
It's great that you're looking to organize your code better! As your projects grow, separating your code into multiple files and using header (`.h`) files becomes essential for maintainability, readability, and collaboration. Let's break down your questions and provide strategies for organizing your C code. ### Purpos...
3,986
[ { "from": "human", "value": "I'm used to doing all my coding in one C file. However, I'm working on a project large enough that it becomes impractical to do so. I've been #including them together but I've run into cases where I'm #including some files multiple times, etc. I've heard of .h files, but I'm not...