instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am working on an ASP.NET web application, it seems to be working properly when I try to debug it in Visual Studio. However when I emulate heavy load, IIS crashes without any trace -- log entry in the system journal is very generic, "The World Wide Web Publishing service terminated unexpectedly. It has done this 4 tim...
When IIS crashes without clear error messages, it can be quite challenging to troubleshoot. Here are several steps and approaches you can take to gather more information and resolve the issue: ### 1. **Enable Failed Request Tracing** Failed Request Tracing can help you diagnose issues by capturing detailed information...
1,919
[ { "from": "human", "value": "I am working on an ASP.NET web application, it seems to be working properly when I try to debug it in Visual Studio. However when I emulate heavy load, IIS crashes without any trace -- log entry in the system journal is very generic, \"The World Wide Web Publishing service termi...
I'm pretty keen to develop my first Ruby app, as my company has finally blessed its use internally. In everything I've read about Ruby up to v1.8, there is never anything positive said about performance, but I've found nothing about version 1.9. The last figures I saw about 1.8 had it drastically slower than just about...
Yes, Ruby 1.9 introduced several significant performance improvements over 1.8, and the changes were quite noticeable. The core of these improvements came from a new virtual machine (YARV - Yet Another Ruby VM), which brought a substantial increase in speed and efficiency. Many benchmarks showed Ruby 1.9 performing muc...
1,774
[ { "from": "human", "value": "I'm pretty keen to develop my first Ruby app, as my company has finally blessed its use internally.\nIn everything I've read about Ruby up to v1.8, there is never anything positive said about performance, but I've found nothing about version 1.9. The last figures I saw about 1.8...
What issues / pitfalls must be considered when overriding equals and hashCode?
When overriding the `equals` and `hashCode` methods in Java (or similar languages), there are several important issues and pitfalls to consider to ensure that the objects behave correctly when used in collections, particularly those that rely on hashing, such as `HashMap` and `HashSet`. Here are the key considerations:...
453
[ { "from": "human", "value": "What issues / pitfalls must be considered when overriding equals and hashCode?\n" }, { "from": "gpt", "value": "When overriding the `equals` and `hashCode` methods in Java (or similar languages), there are several important issues and pitfalls to consider to ensure t...
I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries: SELECT * FROM story_category WHERE category_id NOT IN ( SELECT DISTINCT category.id FROM category INNER JOIN story_category ON category_id=category.id); I tried to delete them executing: D...
The error you're encountering is because MySQL does not allow you to modify a table while also selecting from it in a subquery that is part of the same statement. To work around this limitation, you can utilize a temporary table or a derived table in your query to accomplish the deletion without directly referring to t...
2,070
[ { "from": "human", "value": "I have a table story_category in my database with corrupt entries. The next query returns the corrupt entries:\nSELECT * \nFROM story_category \nWHERE category_id NOT IN (\n SELECT DISTINCT category.id \n FROM category INNER JOIN \n story_category ON category_id=cat...
I am in the middle of a "discussion" with a colleague about the best way to implement the data layer in a new application. One viewpoint is that the data layer should be aware of business objects (our own classes that represent an entity), and be able to work with that object natively. The opposing viewpoint is that ...
This is indeed a classic debate in software architecture, and both approaches have their pros and cons. Here's a breakdown of each viewpoint and some considerations to help you and your colleague arrive at a productive conclusion: ### Business Object-Aware Data Layer **Pros:** 1. **Encapsulation of Logic**: When the ...
770
[ { "from": "human", "value": "I am in the middle of a \"discussion\" with a colleague about the best way to implement the data layer in a new application.\nOne viewpoint is that the data layer should be aware of business objects (our own classes that represent an entity), and be able to work with that object...
Currently I'm doing some unit tests which are executed from bash. Unit tests are initialized, executed and cleaned up in a bash script. This script usualy contains an init(), execute() and cleanup() functions. But they are not mandatory. I'd like to test if they are or are not defined. I did this previously by greping ...
Your `fn_exists` function is indeed a neat and efficient way to check if a function is defined in a Bash script. However, if you want to enhance it or present it in a different way, here are a couple of alternatives that also provide a way to check for function existence without using `grep`: ### Alternative 1: Using ...
3,768
[ { "from": "human", "value": "Currently I'm doing some unit tests which are executed from bash. Unit tests are initialized, executed and cleaned up in a bash script. This script usualy contains an init(), execute() and cleanup() functions. But they are not mandatory. I'd like to test if they are or are not d...
Should you set all the objects to null (Nothing in VB.NET) once you have finished with them? I understand that in .NET it is essential to dispose of any instances of objects that implement the IDisposable interface to release some resources although the object can still be something after it is disposed (hence the isD...
Setting objects to `null` (or `Nothing` in VB.NET) after you are done using them is a topic that generates some debate. Here are some points to consider regarding this practice: ### 1. Garbage Collection Basics: - In .NET, the garbage collector (GC) automatically manages memory. It periodically scans for objects that ...
2,491
[ { "from": "human", "value": "Should you set all the objects to null (Nothing in VB.NET) once you have finished with them? \nI understand that in .NET it is essential to dispose of any instances of objects that implement the IDisposable interface to release some resources although the object can still be som...
I have imported the kernel32 library. So, I have the createMutex function available but I am not quite sure of the various parameters and return values. This is classic Visual Basic, not Visual Basic.NET but I can probably work with either language in the form of an answer.
In classic Visual Basic (VB6), the `CreateMutex` function from the `kernel32.dll` library is used to create or open a mutex object. A mutex is a synchronization primitive that can be used to manage access to a resource across multiple threads or processes. ### Function Declaration To use the `CreateMutex` function, y...
3,246
[ { "from": "human", "value": "I have imported the kernel32 library. So, I have the createMutex function available but I am not quite sure of the various parameters and return values.\nThis is classic Visual Basic, not Visual Basic.NET but I can probably work with either language in the form of an answer.\n" ...
I'm toying with my first remoting project and I need to create a RemotableType DLL. I know I can compile it by hand with csc, but I wonder if there are some facilities in place on Visual Studio to handle the Remoting case, or, more specificly, to tell it that a specific file should be compiled as a .dll without having ...
In Visual Studio, you can create a RemotableType DLL without having to set up a completely separate project, but it does require a bit of manual configuration. Here's how you can do it: ### Option 1: Change Output Type of the Existing Project 1. **Open Your Existing Project**: Load your project in Visual Studio. 2. ...
4,135
[ { "from": "human", "value": "I'm toying with my first remoting project and I need to create a RemotableType DLL. I know I can compile it by hand with csc, but I wonder if there are some facilities in place on Visual Studio to handle the Remoting case, or, more specificly, to tell it that a specific file sho...
Is it possible to validate an xml file against its associated schema using Visual Studio 2005 IDE? I could only see options to create a schema based on the current file, or show the XSLT output
Yes, you can validate an XML file against its associated schema (XSD) in Visual Studio 2005. While the interface may not be as straightforward as in later versions, you can still achieve validation through a few steps. Here's how to do it: 1. **Ensure you have both XML and XSD files**: Make sure that your XML file is ...
2,609
[ { "from": "human", "value": "Is it possible to validate an xml file against its associated schema using Visual Studio 2005 IDE? \nI could only see options to create a schema based on the current file, or show the XSLT output\n\n" }, { "from": "gpt", "value": "Yes, you can validate an XML file ag...
What's the easiest way to convert a percentage to a color ranging from Green (100%) to Red (0%), with Yellow for 50%? I'm using plain 32bit RGB - so each component is an integer between 0 and 255. I'm doing this in C#, but I guess for a problem like this the language doesn't really matter that much. Based on Marius and...
Your approach to converting a percentage to a color representation from green (100%) to red (0%), with yellow (50%) as a midpoint, is quite straightforward and effective. Here’s a breakdown of your solution, along with a correction to ensure it handles edge cases properly: ### Understanding the Color Conversion The c...
3,201
[ { "from": "human", "value": "What's the easiest way to convert a percentage to a color ranging from Green (100%) to Red (0%), with Yellow for 50%?\nI'm using plain 32bit RGB - so each component is an integer between 0 and 255. I'm doing this in C#, but I guess for a problem like this the language doesn't re...
Basically I want tools which generate source code visualization like: function call graph dependency graph ...
There are several tools available that can help you generate various types of source code visualizations, such as function call graphs and dependency graphs. Here are some popular ones: ### 1. **Graphviz** - **Description**: A popular open-source graph visualization software that can be used to create diagrams of abst...
1,079
[ { "from": "human", "value": "Basically I want tools which generate source code visualization like:\n\nfunction call graph\ndependency graph\n...\n\n" }, { "from": "gpt", "value": "There are several tools available that can help you generate various types of source code visualizations, such as fu...
While I grew up using MSWindows, I transitioned to my much-loved Mac years ago. I don't want to start a flame war here on operating systems. I do, however, want a terminal a litle closer to what I'm used to. I'm not asking for full POSIX support - I don't have the patience to install Cygwin - but I miss tabbed termin...
If you're looking for a terminal application on Windows XP that provides a more Unix-like experience, you have a few good options: 1. **Cygwin**: Although you mentioned that you don’t want to install Cygwin, it does provide a comprehensive Unix-like environment on Windows, including a terminal emulator, many standard ...
4,506
[ { "from": "human", "value": "While I grew up using MSWindows, I transitioned to my much-loved Mac years ago. I don't want to start a flame war here on operating systems. I do, however, want a terminal a litle closer to what I'm used to.\nI'm not asking for full POSIX support - I don't have the patience to...
What I'm doing wrong that I get the ADMA5026E error when deployment an application with the NetworkDeployment Console?
The ADMA5026E error typically occurs during application deployment in environments such as IBM's WebSphere Application Server or similar platforms. Here are several steps you can take to troubleshoot and resolve the issue: 1. **Check for Detailed Error Messages**: Look at the full error log to get more context. The er...
1,920
[ { "from": "human", "value": "What I'm doing wrong that I get the ADMA5026E error when deployment an application with the NetworkDeployment Console?\n" }, { "from": "gpt", "value": "The ADMA5026E error typically occurs during application deployment in environments such as IBM's WebSphere Applicat...
Is there an Eclipse command to surround the current selection with parentheses? Creating a template is a decent workaround; it doesn't work with the "Surround With" functionality, because I want to parenthesize an expression, not an entire line, and that requires ${word_selection} rather than ${line_selection}. Is ther...
Eclipse does not have a built-in command specifically for surrounding the current selection with parentheses. However, you can achieve this functionality by creating a custom template and then binding a keyboard shortcut to it. Here’s how you can set it up: ### Step 1: Create a Template 1. Go to **Window** > **Prefer...
3,724
[ { "from": "human", "value": "Is there an Eclipse command to surround the current selection with parentheses?\nCreating a template is a decent workaround; it doesn't work with the \"Surround With\" functionality, because I want to parenthesize an expression, not an entire line, and that requires ${word_selec...
FCKeditor has InsertHtml API (JavaScript API document) that inserts HTML in the current cursor position. How do I insert at the very end of the document? Do I need to start browser sniffing with something like this if ( element.insertAdjacentHTML ) // IE element.insertAdjacentHTML( 'beforeBegin', html ) ; els...
To insert HTML at the very end of the content in FCKeditor (or any other similar content-editable element) without rewriting the entire document, you typically want to manipulate the selection or range directly instead of relying on browser sniffing. Fortunately, modern browsers support the Selection and Range APIs, wh...
4,027
[ { "from": "human", "value": "FCKeditor has InsertHtml API (JavaScript API document) that inserts HTML in the current cursor position. How do I insert at the very end of the document?\nDo I need to start browser sniffing with something like this\nif ( element.insertAdjacentHTML ) // IE \n element.inser...
I have a situation where I want to add hours to a date and have the new date wrap around the work-day. I cobbled up a function to determine this new date, but want to make sure that I'm not forgetting anything. The hours to be added is called "delay". It could easily be a parameter to the function instead. Please post ...
Your implementation effectively aims to wrap the time around the workday while adding a specified delay (in this case, 3 hours). However, there are some considerations and improvements you can implement to enhance the function. Below are some suggestions and an updated version of the function. ### Suggestions: 1. **Pa...
2,864
[ { "from": "human", "value": "I have a situation where I want to add hours to a date and have the new date wrap around the work-day. I cobbled up a function to determine this new date, but want to make sure that I'm not forgetting anything.\nThe hours to be added is called \"delay\". It could easily be a par...
I'm working on a side project that would be a simple web application to maintain a list of classes and their upcoming schedules. I would really like to use Linq to SQL for this project, but unfortunately the server environment I'm developing for only has MySql available. I've dabbled briefly with Subsonic but it just d...
Using an MDF file in the `App_Data` folder is a viable option for a simple web application that requires a lightweight database solution. If you're looking to avoid hand-coding SQL queries while working with MySQL, there are a few options you could consider: 1. **Entity Framework**: You might want to explore using Ent...
3,521
[ { "from": "human", "value": "I'm working on a side project that would be a simple web application to maintain a list of classes and their upcoming schedules.\nI would really like to use Linq to SQL for this project, but unfortunately the server environment I'm developing for only has MySql available. I've d...
I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder, and I'm using Atmega168. Clarification I have tried using an External Interrupt to listen to the pins, but it seems like it is too slow. When Pin A goes high, the interrupt procedure starts...
Getting a rotary encoder to work reliably with an AVR microcontroller like the ATmega168 can be tricky, especially with mechanical encoders that may produce bouncing and have a specific timing for their signals. Here are some suggestions and improvements to help you achieve better results: ### 1. Debouncing Mechanica...
1,742
[ { "from": "human", "value": "I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical ALPS encoder, and I'm using Atmega168.\nClarification\nI have tried using an External Interrupt to listen to the pins, but it seems like it is too slow. When Pin ...
How do you reference a bitmap on the stage in flash using actionscript 3? I have a bitmap on the stage in flash and at the end of the movie I would like to swap it out for the next in the sequence before the movie loops. in my library i have 3 images, exported for actionscript, with the class name img1/img2/img3. here ...
In ActionScript 3, when you place a bitmap image directly on the stage (as opposed to inside a MovieClip), you don't have the ability to assign an instance name to it in the properties panel (which is why the instance name field is greyed out). To reference these images programmatically, you will need to convert them i...
1,148
[ { "from": "human", "value": "How do you reference a bitmap on the stage in flash using actionscript 3?\nI have a bitmap on the stage in flash and at the end of the movie I would like to swap it out for the next in the sequence before the movie loops. in my library i have 3 images, exported for actionscript,...
When merging two code branches in Team Foundation Server I get the following error: The given key was not present in the dictionary. Some files are checked out and show up in "Pending Changes", but no changes are actually made. I have a workaround: Attempt to merge (fails with error) Get latest from trunk Und...
The error message "The given key was not present in the dictionary" during a merge operation in Team Foundation Server (TFS) often indicates that there is some inconsistency or corruption in the workspace, particularly with the pending changes or the state of the files involved in the merge. Here are some common cause...
2,963
[ { "from": "human", "value": "When merging two code branches in Team Foundation Server I get the following error: \n\nThe given key was not present in the dictionary.\n\nSome files are checked out and show up in \"Pending Changes\", but no changes are actually made. \nI have a workaround:\n\nAttempt to merg...
When a user hits Refresh on their browser, it reloads the page but keeps the contents of form fields. While I can see this being a useful default, it can be annoying on some dynamic pages, leading to a broken user experience. Is there a way, in HTTP headers or equivalents, to change this behaviour?
The behavior of retaining form data upon refreshing a page is typically due to how browsers handle form inputs and their associated state. However, there are several strategies you can employ to mitigate this issue, though it's important to note that there isn't a direct HTTP header that can entirely control this behav...
2,095
[ { "from": "human", "value": "When a user hits Refresh on their browser, it reloads the page but keeps the contents of form fields. While I can see this being a useful default, it can be annoying on some dynamic pages, leading to a broken user experience.\nIs there a way, in HTTP headers or equivalents, to c...
If you have Subversion installed on your development machine and you don't work in a team, is there any reason why you should use the svn protocol instead of file?
If you are working on a development machine alone and do not collaborate with others in a team, using the `file://` protocol with Subversion (SVN) can be more advantageous than using the `svn://` protocol. Here are several reasons why you might prefer the `file://` protocol in such a scenario: 1. **Simplicity**: The `...
4,362
[ { "from": "human", "value": "If you have Subversion installed on your development machine and you don't work in a team, is there any reason why you should use the svn protocol instead of file?\n" }, { "from": "gpt", "value": "If you are working on a development machine alone and do not collabora...
As a part of the signup process for my online application, I'm thinking of tracking the source and/or search keywords used to get to my site. This would allow me to see what advertising is working and from where with a somewhat finer grain than Google Analytics would. I assume I could set some kind of cookie with this ...
Yes, it is possible to track the source and search keywords used to get to your site. You can achieve this through a combination of URL parameters, cookies, and server-side code. Here’s a step-by-step guide to implement this in your Rails application: ### Step 1: Capture Referral Data 1. **Use URL Parameters:** When ...
2,464
[ { "from": "human", "value": "As a part of the signup process for my online application, I'm thinking of tracking the source and/or search keywords used to get to my site. This would allow me to see what advertising is working and from where with a somewhat finer grain than Google Analytics would.\nI assume ...
What is the simplest and most elegant way to simulate the hover pseudo-class for non-Anchor tags in IE6? I am specifically trying to change the cursor in this instance to that of a pointer.
In Internet Explorer 6, simulating the `:hover` pseudo-class for non-anchor tags can be a bit tricky because IE6 does not support `:hover` on elements other than `<a>`. However, you can achieve a similar effect using JavaScript. To change the cursor to a pointer when hovering over non-anchor elements, you can use Java...
2,549
[ { "from": "human", "value": "What is the simplest and most elegant way to simulate the hover pseudo-class for non-Anchor tags in IE6?\nI am specifically trying to change the cursor in this instance to that of a pointer.\n" }, { "from": "gpt", "value": "In Internet Explorer 6, simulating the `:ho...
I know that default cron's behavior is to send normal and error output to cron's owner local email box. Is there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ?
Yes, there are several ways to manage the output of cron jobs beyond the default behavior of sending output to the local user's email box. Here are some common methods to redirect or manage output from cron jobs: ### 1. Redirect Output to a File You can redirect the output (both stdout and stderr) of a cron job to a s...
1,147
[ { "from": "human", "value": "I know that default cron's behavior is to send normal and error output to cron's owner local email box.\nIs there other ways to get theses results (for example to send it by email to a bunch of people, to store them somewhere, and so on) ?\n" }, { "from": "gpt", "val...
In a Flex AdvancedDatGrid, we're doing a lot of grouping. Most of the columns are the same for the parents and for the children, so I'd like to show the first value of the group as the summary rather than the MAX, MIN or AVG This code works on numerical but not textual values (without the commented line you get NaN's)...
The issue you're encountering with the `firstValue` function in your Flex AdvancedDataGrid relates to how you're trying to retrieve and handle textual values. The commented line that checks for `NaN` is primarily used for numeric types, and it can interfere with string data. In your case, since you're trying to retrie...
4,252
[ { "from": "human", "value": "In a Flex AdvancedDatGrid, we're doing a lot of grouping. Most of the columns are the same for the parents and for the children, so I'd like to show the first value of the group as the summary rather than the MAX, MIN or AVG\nThis code works on numerical but not textual values ...
I'm looking for patterns that concern coding parts of a GUI. Not as global as MVC, that I'm quite familiar with, but patterns and good ideas and best practices concerning single controls and inputs. Let say I want to make a control that display some objects that may overlap. Now if I click on an object, I need to find ...
When designing user interface controls that involve complex interactions, such as selecting overlapping objects while considering various user inputs (like modifier keys or active objects), it's helpful to employ specific patterns and best practices. Here are several concepts and patterns that may be particularly relev...
1,939
[ { "from": "human", "value": "I'm looking for patterns that concern coding parts of a GUI. Not as global as MVC, that I'm quite familiar with, but patterns and good ideas and best practices concerning single controls and inputs.\nLet say I want to make a control that display some objects that may overlap. No...
I have a route that I am calling through a RedirectToRoute like this: return this.RedirectToRoute("Super-SuperRoute", new { year = selectedYear }); I have also tried: return this.RedirectToRoute("Super-SuperRoute", new { controller = "Super", action = "SuperRoute", id = "RouteTopic", year = selectedYear }); The rout...
It looks like you're facing a routing issue in your ASP.NET MVC application due to a `null` value being passed to your `RedirectToRoute`. Here’s a breakdown of what’s happening and some steps you can take to resolve it: 1. **Understanding the Error**: The error message "No route in the route table matches the supplied...
3,490
[ { "from": "human", "value": "I have a route that I am calling through a RedirectToRoute like this:\nreturn this.RedirectToRoute(\"Super-SuperRoute\", new { year = selectedYear });\n\nI have also tried:\n return this.RedirectToRoute(\"Super-SuperRoute\", new { controller = \"Super\", action = \"SuperRoute\",...
Assume you are doing something like the following List<string> myitems = new List<string> { "Item 1", "Item 2", "Item 3" }; ComboBox box = new ComboBox(); box.DataSource = myitems; ComboBox box2 = new ComboBox(); box2.DataSource = myitems So now we have 2 combo boxes bound to that array, and everything w...
The behavior you're observing with the two `ComboBox` controls is due to the fact that they are both bound to the same underlying data source, which is the `List<string>` named `myitems`. When you bind a control's `DataSource` to a list (or any collection), both controls refer to the same instance of that list. Hence, ...
2,312
[ { "from": "human", "value": "Assume you are doing something like the following\nList<string> myitems = new List<string>\n{\n \"Item 1\",\n \"Item 2\",\n \"Item 3\"\n};\n\nComboBox box = new ComboBox();\nbox.DataSource = myitems;\n\nComboBox box2 = new ComboBox();\nbox2.DataSource = myitems\n\nSo no...
In a desktop application needing some serious re-factoring, I have several chunks of code that look like this: private void LoadSettings() { WindowState = Properties.Settings.Default.WindowState; Location = Properties.Settings.Default.WindowLocation; ... } private void SaveSettings() { Properties.Setti...
To refactor your `LoadSettings` and `SaveSettings` methods for better maintainability and readability, you can consider the following approaches: ### 1. **Use a Settings Object** Instead of directly interacting with `Properties.Settings.Default`, create a dedicated settings object that will encapsulate your settings....
552
[ { "from": "human", "value": "In a desktop application needing some serious re-factoring, I have several chunks of code that look like this:\nprivate void LoadSettings()\n{\n WindowState = Properties.Settings.Default.WindowState;\n Location = Properties.Settings.Default.WindowLocation;\n ...\n}\n\np...
I have to create something similiar to Google Calendar, so I created an events table that contains all the events for a user. The hard part is handling re-occurring events, the row in the events table has an event_type field that tells you what kind of event it is, since an event can be for a single date only, OR a re-...
Handling recurring events in a calendar application can indeed be challenging, but there are different strategies to manage them effectively. Here are some approaches you can consider, including the idea of using an additional table: ### Option 1: Store All Events in a Single Table (with De-normalization) This approa...
2,281
[ { "from": "human", "value": "I have to create something similiar to Google Calendar, so I created an events table that contains all the events for a user.\nThe hard part is handling re-occurring events, the row in the events table has an event_type field that tells you what kind of event it is, since an eve...
I was curious about how other people use the this keyword. I tend to use it in constructors, but I may also use it throughout the class in other methods. Some examples: In a constructor: public Light(Vector v) { this.dir = new Vector(v); } Elsewhere public void SomeMethod() { Vector vec = new Vector(); dou...
The `this` keyword in Java (and many other object-oriented programming languages) serves a few important purposes, primarily to distinguish between instance variables and parameters or local variables, as well as to refer to the current instance of the class. Your usage of `this` in the constructor and method you provi...
3,087
[ { "from": "human", "value": "I was curious about how other people use the this keyword. I tend to use it in constructors, but I may also use it throughout the class in other methods. Some examples:\nIn a constructor:\npublic Light(Vector v)\n{\n this.dir = new Vector(v);\n}\n\nElsewhere\npublic void Some...
I am currently working on a project with specific requirements. A brief overview of these are as follows: Data is retrieved from external webservices Data is stored in SQL 2005 Data is manipulated via a web GUI The windows service that communicates with the web services has no coupling with our internal web UI, exc...
When considering your two options for handling triggers for web service communication, let's analyze each approach in detail: ### Option 1: Extend the Trigger Table #### Pros: - **Single Source of Truth**: Using one table for both types of triggers (time-based and manual) centralizes your management of triggers, maki...
1,125
[ { "from": "human", "value": "I am currently working on a project with specific requirements. A brief overview of these are as follows: \n\nData is retrieved from external webservices\nData is stored in SQL 2005\nData is manipulated via a web GUI\nThe windows service that communicates with the web services...
Most of my C/C++ development involves monolithic module files and absolutely no classes whatsoever, so usually when I need to make a DLL with accessible functions I just export them using the standard __declspec(dllexport) directive. Then access them either dynamically via LoadLibrary() or at compile time with a heade...
Exporting a C++ class from a DLL can be done using the same `__declspec(dllexport)` directive, but it requires a few additional considerations. Here’s how you can accomplish this for both dynamic and compile-time linking. ### 1. Exporting a Class in a DLL To export a class, you would typically define the class in a h...
1,579
[ { "from": "human", "value": "Most of my C/C++ development involves monolithic module files and absolutely no classes whatsoever, so usually when I need to make a DLL with accessible functions I just export them using the standard __declspec(dllexport) directive. Then access them either dynamically via Load...
I have to POST some parameters to a URL outside my network, and the developers on the other side asked me to not use HTTP Parameters: instead I have to post my key-values in HTTP Headers. The fact is that I don't really understand what they mean: I tried to use a ajax-like post, with XmlHttp objects, and also I tried t...
To post key-value pairs in HTTP headers using .NET 2.0, you need to make an HTTP request manually, setting the headers before sending the request. You can't modify the request headers directly like you've tried with `Request.Headers.Add` since it relates to the incoming HTTP request and not a new outgoing request. Ins...
2,660
[ { "from": "human", "value": "I have to POST some parameters to a URL outside my network, and the developers on the other side asked me to not use HTTP Parameters: instead I have to post my key-values in HTTP Headers.\nThe fact is that I don't really understand what they mean: I tried to use a ajax-like post...
I'm parsing text from a file and storing it in a string. The problem is that some of the text in the original files contains ASCII art and whatnot that I would like to preserve. When I print out the string on the HTML page, even if it does have the same formatting and everything since it is in HTML, the spacing and l...
To preserve the formatting of text, including ASCII art, when displaying it on an HTML page, you can use a few different approaches: ### 1. Use the `<pre>` Tag The simplest and most common way to display preformatted text, including ASCII art, is to use the `<pre>` HTML tag. The `<pre>` tag preserves both whitespace ...
2,886
[ { "from": "human", "value": "I'm parsing text from a file and storing it in a string. The problem is that some of the text in the original files contains ASCII art and whatnot that I would like to preserve. When I print out the string on the HTML page, even if it does have the same formatting and everythi...
Here's the code from the ascx that has the repeater: <asp:Repeater ID="ListOfEmails" runat="server" > <HeaderTemplate><h3>A sub-header:</h3></HeaderTemplate> <ItemTemplate> [Some other stuff is here] <asp:Button ID="removeEmail" runat="server" Text="X" ToolTip="remove" /> </ItemTemplate> </a...
It seems like you're trying to handle events for a button inside a Repeater control, but neither the click nor the command event is being triggered. This is a common issue that can occur due to several reasons. Below are some possible explanations and solutions to troubleshoot and resolve the issue: 1. **Ensure Event ...
2,764
[ { "from": "human", "value": "Here's the code from the ascx that has the repeater:\n<asp:Repeater ID=\"ListOfEmails\" runat=\"server\" >\n <HeaderTemplate><h3>A sub-header:</h3></HeaderTemplate>\n <ItemTemplate>\n [Some other stuff is here]\n <asp:Button ID=\"removeEmail\" runat=\"server\...
We're running a custom application on our intranet and we have found a problem after upgrading it recently where IIS hangs with 100% CPU usage, requiring a reset. Rather than subject users to the hangs, we've rolled back to the previous release while we determine a solution. The first step is to reproduce the problem ...
Reproducing complex issues, especially those that occur intermittently in a production environment, can be challenging. Here are some strategies and considerations to help you reproduce the problem: ### 1. Analyze Load Patterns: - **Identify Specific User Actions**: Review logs to identify which specific user actions ...
2,045
[ { "from": "human", "value": "We're running a custom application on our intranet and we have found a problem after upgrading it recently where IIS hangs with 100% CPU usage, requiring a reset.\nRather than subject users to the hangs, we've rolled back to the previous release while we determine a solution. T...
I've done this before in C++ by including sqlite.h but is there a similarly easy way in C#?
Yes, you can easily work with SQLite in C# using a couple of libraries that provide straightforward access to SQLite databases. The most common approach is to use the `System.Data.SQLite` or `Microsoft.Data.Sqlite` packages. Here's how you can set it up in your C# project: ### Using `System.Data.SQLite` 1. **Install ...
2,099
[ { "from": "human", "value": "I've done this before in C++ by including sqlite.h but is there a similarly easy way in C#?\n" }, { "from": "gpt", "value": "Yes, you can easily work with SQLite in C# using a couple of libraries that provide straightforward access to SQLite databases. The most commo...
I'm looking for a method, or a code snippet for converting std::string to LPCWSTR
To convert a `std::string` to `LPCWSTR` (which is a pointer to a constant wide character string, typically used in Windows API), you need to convert the narrow string (`std::string`) to a wide string (`std::wstring`). Below is a simple method to perform this conversion, along with a code snippet. ### Method 1: Using `...
103
[ { "from": "human", "value": "I'm looking for a method, or a code snippet for converting std::string to LPCWSTR\n" }, { "from": "gpt", "value": "To convert a `std::string` to `LPCWSTR` (which is a pointer to a constant wide character string, typically used in Windows API), you need to convert the...
has anyone got NCover, TypeMock and MSTest to work together? and if so how. I've had 2 or 3 serious tries at this now and just can't get it to work. I'm using MSTest 9, NCover 2.1 and TypeMock 4.1. Ideally I would like to run them from an MSBuild task. Cheers Mat
Integrating NCover, TypeMock, and MSTest can indeed be challenging, but it is certainly possible. Below are some steps to help you set up an environment where these tools can work together. Note that the versions you mentioned are quite old, so some features and steps might differ for newer versions if you consider upg...
2,002
[ { "from": "human", "value": "has anyone got NCover, TypeMock and MSTest to work together? and if so how.\nI've had 2 or 3 serious tries at this now and just can't get it to work.\nI'm using MSTest 9, NCover 2.1 and TypeMock 4.1.\nIdeally I would like to run them from an MSBuild task.\nCheers\nMat\n" }, ...
In a LotusScript Agent that is being run via WebQueryOpen, how do you get the name of the current server?
In a LotusScript agent that is executed via the WebQueryOpen event, you can retrieve the name of the current server using the `Session` object. Here’s how you can do it: ```lotusscript Sub WebQueryOpen(Source As NotesUIDocument) Dim session As New NotesSession Dim serverName As String ' Get the server...
5,224
[ { "from": "human", "value": "In a LotusScript Agent that is being run via WebQueryOpen, how do you get the name of the current server?\n" }, { "from": "gpt", "value": "In a LotusScript agent that is executed via the WebQueryOpen event, you can retrieve the name of the current server using the `S...
How do I store binary data in MySQL?
In MySQL, you can store binary data using BLOB (Binary Large Object) data types. There are several types of BLOB that you can choose from based on the size of the data you want to store: 1. **TINYBLOB**: Can store up to 255 bytes of binary data. 2. **BLOB**: Can store up to 65,535 bytes (64 KB) of binary data. 3. **ME...
107
[ { "from": "human", "value": "How do I store binary data in MySQL?\n" }, { "from": "gpt", "value": "In MySQL, you can store binary data using BLOB (Binary Large Object) data types. There are several types of BLOB that you can choose from based on the size of the data you want to store:\n\n1. **TI...
In perl one would simply do the following to store and iterate over a list of names my @fruit = (apple, orange, kiwi); foreach (@fruit) { print $_; } What would the equivalent be in bash?
In Bash, you can store and iterate over a list of names using an array. Here’s how you can do it: ```bash # Declare an array fruit=(apple orange kiwi) # Iterate over the array for item in "${fruit[@]}"; do echo "$item" done ``` ### Explanation: 1. **Array Declaration**: The array `fruit` is declared and initiali...
4,569
[ { "from": "human", "value": "In perl one would simply do the following to store and iterate over a list of names\nmy @fruit = (apple, orange, kiwi);\nforeach (@fruit) {\n print $_;\n}\n\nWhat would the equivalent be in bash?\n" }, { "from": "gpt", "value": "In Bash, you can store and iter...
So in my simple learning website, I use the built in ASP.NET authentication system. I am adding now a user table to save stuff like his zip, DOB etc. My question is: In the new table, should the key be the user name (the string) or the user ID which is that GUID looking number they use in the asp_ tables. If the bes...
When adding a user table to store additional user information in an ASP.NET application that uses the built-in ASP.NET Identity system, it's important to choose a key that will help you maintain data integrity and facilitate efficient queries. Here are some considerations regarding your questions: ### Choosing the Key...
1,572
[ { "from": "human", "value": "So in my simple learning website, I use the built in ASP.NET authentication system. \nI am adding now a user table to save stuff like his zip, DOB etc. My question is:\n\nIn the new table, should the key be the user name (the string) or the user ID which is that GUID looking num...
What did I do wrong? Here is an excerpt from my code: public void createPartControl(Composite parent) { parent.setLayout(new FillLayout()); ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL); scrollBox.setExpandHorizontal(true); mParent = new Composite(scrollBox, SWT.NONE); scrollBox.se...
It looks like you're trying to create a scrollable area within a `ScrolledComposite` but are encountering issues with the layout, resulting in clipping of controls and potentially losing scrollbars. Here are some suggestions to help you resolve these problems: 1. **Set the Size of the ScrolledComposite**: You need to ...
2,832
[ { "from": "human", "value": "What did I do wrong?\nHere is an excerpt from my code:\npublic void createPartControl(Composite parent) {\n parent.setLayout(new FillLayout());\n ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL);\n scrollBox.setExpandHorizontal(true);\n mParent = new...
When using a DataReader object to access data from a database (such as SQL Server) through stored procedures, any output parameter added to the Command object before executing are not being filled after reading. I can read row data just fine, as well as all input parameters, but not output ones.
When you use a `DataReader` to access data from a database using stored procedures with output parameters, you need to ensure that you're correctly retrieving the output parameters after executing the command. The common reason you're seeing output parameters not being filled is that the output parameters must be retri...
4,427
[ { "from": "human", "value": "When using a DataReader object to access data from a database (such as SQL Server) through stored procedures, any output parameter added to the Command object before executing are not being filled after reading. I can read row data just fine, as well as all input parameters, bu...
I want to rename a database, but keep getting the error that 'couldn't get exclusive lock' on the database, which implies there is some connection(s) still active. How can I kill all the connections to the database so that I can rename it?
To rename a database, you need to ensure that no active connections are using it. If you're receiving an error regarding an exclusive lock, you can kill all connections to the database to proceed with the renaming. ### Steps to Kill All Connections and Rename the Database Here’s a general approach for PostgreSQL and ...
2,594
[ { "from": "human", "value": "I want to rename a database, but keep getting the error that 'couldn't get exclusive lock' on the database, which implies there is some connection(s) still active.\nHow can I kill all the connections to the database so that I can rename it?\n" }, { "from": "gpt", "va...
Is there any tool that can parse a valid C program and generate a report which contains list of functions, global variables, #define constants, local variables in each function, etc.
Yes, there are several tools available that can parse a valid C program and generate detailed reports about its structure, including functions, global variables, `#define` constants, local variables, and more. Here are a few popular ones: 1. **Doxygen**: - Doxygen is primarily a documentation generator, but it can ...
4,024
[ { "from": "human", "value": "Is there any tool that can parse a valid C program and generate a report which contains list of functions, global variables, #define constants, local variables in each function, etc.\n" }, { "from": "gpt", "value": "Yes, there are several tools available that can par...
ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location. The workaround I'm using is to add the keys from the non-standard location to the agent: ssh-agent ssh-add /path/to/where/keys/really/are/id_rsa (on Linux and MingW32 shell on Windows)
If you want to force SSH to always look for its keys in a non-standard location instead of using the default `~/.ssh` directory, you can do this by configuring your SSH client to use a specific identity file. Here's how you can accomplish this: ### 1. Create or Edit SSH Configuration File You can specify the path to ...
3,946
[ { "from": "human", "value": "ssh will look for its keys by default in the ~/.ssh folder. I want to force it to always look in another location.\nThe workaround I'm using is to add the keys from the non-standard location to the agent:\nssh-agent\nssh-add /path/to/where/keys/really/are/id_rsa \n\n(on Linux an...
I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds.
It looks like the values you're providing are in milliseconds, and you're trying to convert them to a more readable time format of minutes and seconds. Let's break down the examples: 1. **70966 milliseconds**: - 70966 milliseconds = 70.966 seconds - 70.966 seconds = 1 minute and 10.966 seconds (approximately 1 ...
1,399
[ { "from": "human", "value": "I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds. \n" }, { "from": "gpt", ...
I have an html file with an unordered list. I want to show the list items horizontally but still keep the bullets. No matter what I try, whenever I set the style to inline to meet the horizontal requirement I can't get the bullets to display.
To display an unordered list (`<ul>`) horizontally while keeping the bullets, you can use CSS to style the list items (`<li>`). Instead of setting the list items to `display: inline;`, you can use `display: inline-block;`. This will allow the items to be displayed next to each other while still preserving the list item...
4,577
[ { "from": "human", "value": "I have an html file with an unordered list. I want to show the list items horizontally but still keep the bullets. No matter what I try, whenever I set the style to inline to meet the horizontal requirement I can't get the bullets to display.\n" }, { "from": "gpt", ...
Any one know decent way to reference a SQLite database using the above mentioned tools? I tried using ODBC (the SQLite driver) but while the connection is good, I get no data returned. Like I can't see any tables in Data Connection (VS 2008). Is there a better way? Edit: corrected typos
If you're having trouble connecting to a SQLite database using ODBC in Visual Studio 2008 and not seeing any tables, here are a few alternative methods and tips you can consider for accessing SQLite databases: ### 1. Use SQLite.NET (SQLite Data Provider for .NET) SQLite.NET is a lightweight ADO.NET provider for SQLit...
2,505
[ { "from": "human", "value": "Any one know decent way to reference a SQLite database using the above mentioned tools? I tried using ODBC (the SQLite driver) but while the connection is good, I get no data returned. Like I can't see any tables in Data Connection (VS 2008). Is there a better way?\nEdit: correc...
Following on from my previous question I have been working on getting my object model to serialize to XML. But I have now run into a problem (quelle surprise!). The problem I have is that I have a collection, which is of a abstract base class type, which is populated by the concrete derived types. I thought it would be...
Serializing a collection of abstract base class types to XML can indeed pose a challenge with the `XmlSerializer`, particularly when you want to avoid using `XmlInclude` due to potential coupling issues. However, there are a few strategies you can consider that might help you achieve your serialization goals without ti...
1,990
[ { "from": "human", "value": "Following on from my previous question I have been working on getting my object model to serialize to XML. But I have now run into a problem (quelle surprise!).\nThe problem I have is that I have a collection, which is of a abstract base class type, which is populated by the con...
In my last job we ended up rewriting the complete ASP.NET stack (forms, controls, validation, postback handling, ajax library etc...) - the reason I was given was that the ASP.NET controls were not accessible enough, not were any of the third party controls that were assessed for the project. Can anyone point me to goo...
Creating accessible, AJAX-enabled controls in ASP.NET can be a challenge, especially if you aim to meet the needs of all users, including those with disabilities. While there may be some third-party libraries that offer accessible controls, you might also consider building your own. Below are some suggestions for both ...
1,874
[ { "from": "human", "value": "In my last job we ended up rewriting the complete ASP.NET stack (forms, controls, validation, postback handling, ajax library etc...) - the reason I was given was that the ASP.NET controls were not accessible enough, not were any of the third party controls that were assessed fo...
Regarding Agile development, what are the best practices for testing security per release? If it is a monthly release, are there shops doing pen-tests every month?
In Agile development, especially with frequent release cycles (like monthly releases), incorporating security testing into the development process is essential to maintain a secure product. Here are some best practices for testing security per release: ### Best Practices for Security Testing in Agile 1. **Shift Left ...
2,230
[ { "from": "human", "value": "Regarding Agile development, what are the best practices for testing security per release?\nIf it is a monthly release, are there shops doing pen-tests every month?\n" }, { "from": "gpt", "value": "In Agile development, especially with frequent release cycles (like m...
I need to determine when my Qt 4.4.1 application receives focus. I have come up with 2 possible solutions, but they both don’t work exactly as I would like. In the first possible solution, I connect the focusChanged() signal from qApp to a SLOT. In the slot I check the ‘old’ pointer. If it ‘0’, then I know we’ve swit...
In your case, you want to trigger an action only when your Qt application gains focus from an external source, ignoring focus changes that occur within the application itself. To achieve this, we need to handle focus events more carefully. Here are some strategies you could implement to achieve this: ### Option 1: Us...
1,804
[ { "from": "human", "value": "I need to determine when my Qt 4.4.1 application receives focus.\nI have come up with 2 possible solutions, but they both don’t work exactly as I would like.\nIn the first possible solution, I connect the focusChanged() signal from qApp to a SLOT. In the slot I check the ‘old’ ...
Is it possible to override default value of WebClientProtocol.Timeout property via web.config? <httpRuntime executionTimeout="500" /> <!-- this doesn't help -->
The `WebClientProtocol.Timeout` property is not directly configurable through the `web.config` file. The `Timeout` property is typically set programmatically in your code. However, if you need to manage timeout settings through configuration, you could create a custom class that inherits from the `WebClientProtocol` cl...
4,138
[ { "from": "human", "value": "Is it possible to override default value of WebClientProtocol.Timeout property via web.config?\n<httpRuntime executionTimeout=\"500\" /> <!-- this doesn't help -->\n\n" }, { "from": "gpt", "value": "The `WebClientProtocol.Timeout` property is not directly configurabl...
Conducting a user account cleanup accross Solaris and Redhat linux systems, many of which have a number of Samba shares. What preference do people have for creating the local unix accounts for non interactive Samba users? In particular, the shell entry: noshell nologin blank And why? JB
When configuring local UNIX accounts for non-interactive Samba users, the choice of shell can have implications for security and usability. Here's a breakdown of the three options you mentioned: `noshell`, `nologin`, and a blank entry. 1. **`/sbin/nologin` or `/usr/sbin/nologin`:** - This shell prevents users from ...
3,970
[ { "from": "human", "value": "Conducting a user account cleanup accross Solaris and Redhat linux systems, many of which have a number of Samba shares. \nWhat preference do people have for creating the local unix accounts for non interactive Samba users? In particular, the shell entry:\n\nnoshell\nnologin\nbl...
I have a database table and one of the fields (not the primary key) is having a unique index on it. Now I want to swap values under this column for two rows. How could this be done? Two hacks I know are: Delete both rows and re-insert them. Update rows with some other value and swap and then update to actual value. B...
Swapping values in a column that has a unique index can be a bit tricky because directly updating the values might violate the uniqueness constraint. However, there is a straightforward and efficient way to achieve this using a temporary value. Here's how you can do it with a single SQL statement: 1. Use a temporary v...
2,828
[ { "from": "human", "value": "I have a database table and one of the fields (not the primary key) is having a unique index on it. Now I want to swap values under this column for two rows. How could this be done? Two hacks I know are:\n\nDelete both rows and re-insert them.\nUpdate rows with some other value\...
How do I get today's date in C# in mm/dd/yyyy format? I need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day one piece at a time. BTW: I'm in the US so M/dd would be correct, e.g. September 11th is 9/11. Note: an answer from kronoz ...
To get today's date in the `mm/dd/yyyy` format in C#, you can use the `DateTime` class along with the `ToString` method, specifying a custom date format. Since you mentioned that you want it in the `M/dd` format (without the year), you can achieve this with a simple one-liner. Here's an example of how to do that: ```...
5,050
[ { "from": "human", "value": "How do I get today's date in C# in mm/dd/yyyy format?\nI need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day one piece at a time.\nBTW: I'm in the US so M/dd would be correct, e.g. September...
I'd like to know what the currently checked out revision number is for a file or directory. Is there a way to do this in TortoiseSVN on Windows ?
Yes, you can easily check the currently checked out revision number for a file or directory using TortoiseSVN on Windows. Here are the steps to do this: 1. **Navigate to the File/Directory**: Open Windows Explorer and navigate to the file or directory for which you want to check the revision number. 2. **Right-Click ...
5,773
[ { "from": "human", "value": "I'd like to know what the currently checked out revision number is for a file or directory. Is there a way to do this in TortoiseSVN on Windows ?\n" }, { "from": "gpt", "value": "Yes, you can easily check the currently checked out revision number for a file or direct...
I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a "lock" statement, because the processor might switch to another thread halfway through a write. However, I was looking through System.Web.Secur...
Your concerns about thread safety and synchronization in concurrent programming are valid, and the scenario you're describing touches on the subtle aspects of atomicity and visibility in multi-threaded environments. ### Why is `s_Initialized` read outside of the lock? The pattern you've encountered in the `Membership...
2,867
[ { "from": "human", "value": "I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a \"lock\" statement, because the processor might switch to another thread halfway through a write.\nHow...
I'm trying to find the best way to speed up the delivery of the static images that compose the design of an mvc site. The images are not gzipped, nor cached in the server or on the client (with content expire). Options are: Find why images are not cached and gzipped direcly from IIS6 Write a specialized http handler ...
Improving the delivery of static images on your MVC site is crucial for enhancing performance and user experience. Let's evaluate the options you've provided: 1. **Find why images are not cached and gzipped directly from IIS6**: - **Pros**: This is the most straightforward and least invasive solution. By configuri...
3,696
[ { "from": "human", "value": "I'm trying to find the best way to speed up the delivery of the static images that compose the design of an mvc site. The images are not gzipped, nor cached in the server or on the client (with content expire). Options are:\n\nFind why images are not cached and gzipped direcly ...
I am using js2-mode to edit Javascript in Emacs, but I can't seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w/ js2.
To configure `js2-mode` in Emacs to use spaces instead of tabs for indentation, you can set the relevant variables in your Emacs configuration file (usually `~/.emacs` or `~/.emacs.d/init.el`). You may need to add the following lines to ensure that `js2-mode` uses spaces for indentation: ```elisp ;; Use spaces instead...
4,382
[ { "from": "human", "value": "I am using js2-mode to edit Javascript in Emacs, but I can't seem to get it to stop using tabs instead of spaces for indentation. My other modes work fine, just having issues w/ js2.\n" }, { "from": "gpt", "value": "To configure `js2-mode` in Emacs to use spaces inst...
I'm maintaining some code that uses a *= operator in a query to a Sybase database and I can't find documentation on it. Does anyone know what *= does? I assume that it is some sort of a join. select * from a, b where a.id *= b.id I can't figure out how this is different from: select * from a, b where a.id = b.id
In Sybase SQL, the `*=` operator is indeed used to indicate an outer join, specifically a left outer join. This is an older syntax that comes from the SQL-92 standard and is not as commonly used today, but it might still be encountered in legacy code. In your query: ```sql SELECT * FROM a, b WHERE a.id *= b.id ``` T...
3,919
[ { "from": "human", "value": "I'm maintaining some code that uses a *= operator in a query to a Sybase database and I can't find documentation on it. Does anyone know what *= does? I assume that it is some sort of a join.\nselect * from a, b where a.id *= b.id\nI can't figure out how this is different from...
I have done Java and JSP programming in the past, but I am new to Java Server Faces and want to know if there's a set of best practices for JSF development.
Absolutely! JavaServer Faces (JSF) is a powerful framework for building web applications in Java, and following best practices can help you write cleaner, more maintainable code. Here are some best practices for JSF development: ### 1. **Use Managed Beans Appropriately** - **Scope**: Choose the right scope for your...
971
[ { "from": "human", "value": "I have done Java and JSP programming in the past, but I am new to Java Server Faces and want to know if there's a set of best practices for JSF development. \n" }, { "from": "gpt", "value": "Absolutely! JavaServer Faces (JSF) is a powerful framework for building web ...
The SQL Server Express 2008 setup allow you to assign different user account for each service. For a development environment, would you use a domain user, local user, NT Authority\NETWORK SERCVICE, NT Authority\Local System or some other account and why?
In a development environment, the choice of account to run SQL Server Express 2008 services can depend on several factors, including security considerations, the need for network access, and ease of management. Here's a breakdown of the options you provided: 1. **Domain User**: - **Pros**: This is often the best ch...
2,681
[ { "from": "human", "value": "The SQL Server Express 2008 setup allow you to assign different user account for each service. \nFor a development environment, would you use a domain user, local user, NT Authority\\NETWORK SERCVICE, NT Authority\\Local System or some other account and why? \n" }, { "fr...
How do I determine using TSQL what roles are granted execute permissions on a specific stored procedure? Is there a system stored procedure or a system view I can use?
To determine which roles have been granted EXECUTE permissions on a specific stored procedure in SQL Server using T-SQL, you can query the system views and catalog views provided by SQL Server. Specifically, you can make use of the following views: 1. `sys.database_permissions`: This view returns information about the...
4,524
[ { "from": "human", "value": "How do I determine using TSQL what roles are granted execute permissions on a specific stored procedure? Is there a system stored procedure or a system view I can use?\n" }, { "from": "gpt", "value": "To determine which roles have been granted EXECUTE permissions on ...
How can I add horizontal scroll capabilities to the asp.net listbox control?
In ASP.NET, the ListBox control does not have built-in support for horizontal scrolling, as it is typically designed for vertical lists of items. However, you can achieve horizontal scrolling by using CSS and some customization. Here are a couple of approaches you can take: ### Approach 1: CSS for Horizontal Scrolling...
2,633
[ { "from": "human", "value": "How can I add horizontal scroll capabilities to the asp.net listbox control?\n" }, { "from": "gpt", "value": "In ASP.NET, the ListBox control does not have built-in support for horizontal scrolling, as it is typically designed for vertical lists of items. However, yo...
I've got a table of URLs and I don't want any duplicate URLs. How do I check to see if a given URL is already in the table using PHP/MySQL?
To check if a given URL is already in your MySQL database using PHP, you'll need to follow these steps: 1. **Connect to the Database**: First, establish a connection to your MySQL database. 2. **Prepare a Query**: Use a SELECT query to check for the existence of the URL in your table. 3. **Execute the Query**: Run t...
2,733
[ { "from": "human", "value": "I've got a table of URLs and I don't want any duplicate URLs. How do I check to see if a given URL is already in the table using PHP/MySQL?\n" }, { "from": "gpt", "value": "To check if a given URL is already in your MySQL database using PHP, you'll need to follow the...
I'm not talking about bug tracking software (like Bugzilla or Jira). I'm looking for something that: Stores test specifications in text format Combines test specs into test coverage scenarios Keeps track of the progress through testing scenarios Links test specs with bug reports stored in Bugzilla Generates progress ...
It sounds like you're looking for a dedicated test management tool that offers comprehensive functionality tailored for test specification management and integration with bug tracking systems like Bugzilla. Here are a few options that could meet your requirements: 1. **TestRail**: - **Features**: TestRail allows yo...
1,788
[ { "from": "human", "value": "I'm not talking about bug tracking software (like Bugzilla or Jira). I'm looking for something that:\n\nStores test specifications in text format\nCombines test specs into test coverage scenarios\nKeeps track of the progress through testing scenarios \nLinks test specs with bug ...
If I select from a table group by the month, day, year, it only returns rows with records and leaves out combinations without any records, making it appear at a glance that every day or month has activity, you have to look at the date column actively for gaps. How can I get a row for every day/month/year, even when no...
To ensure that you get a row for every day/month/year even when there is no activity recorded in your dataset, you can create a date table or use a Common Table Expression (CTE) to generate the required date range. Here's a step-by-step approach: 1. **Create a Date Table**: This is a common practice, as it allows for ...
2,833
[ { "from": "human", "value": "If I select from a table group by the month, day, year, \nit only returns rows with records and leaves out combinations without any records, making it appear at a glance that every day or month has activity, you have to look at the date column actively for gaps. How can I get a ...
I would like to make a nightly cron job that fetches my stackoverflow page and diffs it from the previous day's page, so I can see a change summary of my questions, answers, ranking, etc. Unfortunately, I couldn't get the right set of cookies, etc, to make this work. Any ideas? Also, when the beta is finished, will my...
To create a nightly cron job that fetches your Stack Overflow page and diffs it from the previous day's page, you'll need to ensure you're authenticated properly and set up to store and compare the HTML content. Here’s a step-by-step guide to help you accomplish this: ### 1. Authentication and Cookie Management You ne...
2,502
[ { "from": "human", "value": "I would like to make a nightly cron job that fetches my stackoverflow page and diffs it from the previous day's page, so I can see a change summary of my questions, answers, ranking, etc.\nUnfortunately, I couldn't get the right set of cookies, etc, to make this work. Any ideas...
I would like to be able to display some dynamic text at the mouse cursor location in a win32 app, for instance to give an X,Y coordinate that would move with the cursor as though attached. I can do this during a mousemove event using a TextOut() call for the window at the mouse coordinates and invalidate a rectange...
Yes, there are better ways to display dynamic text at the mouse cursor location in a Win32 application without causing flickering or interfering with other drawing operations. One effective method is to use a combination of layering or off-screen buffering along with a transparent or semi-transparent overlay for the te...
2,513
[ { "from": "human", "value": "I would like to be able to display some dynamic text at the mouse \ncursor location in a win32 app, for instance to give an X,Y coordinate that \nwould move with the cursor as though attached. I can do this during a \nmousemove event using a TextOut() call for the window at the ...
With the rise of multicore CPUs on the desktop, multithreading skills will become a valuable asset for programmers. Can you recommend some good resources (books, tutorials, websites, etc.) for a programmer who is looking to learn about threaded programming?
Absolutely! Learning about multithreading and concurrent programming is essential for taking full advantage of multicore CPUs. Here are some recommended resources across various mediums to help you get started: ### Books 1. **"Concurrency in C# Cookbook" by Stephen Cleary** A practical guide to concurrency and as...
2,259
[ { "from": "human", "value": "With the rise of multicore CPUs on the desktop, multithreading skills will become a valuable asset for programmers. Can you recommend some good resources (books, tutorials, websites, etc.) for a programmer who is looking to learn about threaded programming?\n" }, { "from...
Should I still be using tables anyway? The table code I'd be replacing is: <table> <tr> <td>Name</td><td>Value</td> </tr> ... </table> From what I've been reading I should have something like <label class="name">Name</label><label class="value">Value</value><br /> ... Ideas and links to online sam...
Using tables in HTML for displaying tabular data is still a valid approach, especially if your data is inherently tabular (like a list of items with attributes). However, if your goal is to display data in a more flexible and stylable manner, or if you're moving toward a more semantic approach, you can consider using a...
3,001
[ { "from": "human", "value": "Should I still be using tables anyway?\nThe table code I'd be replacing is:\n<table>\n <tr>\n <td>Name</td><td>Value</td>\n </tr>\n ...\n</table>\n\nFrom what I've been reading I should have something like\n<label class=\"name\">Name</label><label class=\"value\"...
Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements?
Yes, there are performance differences between tuples and lists in Python, particularly regarding instantiation and retrieval of elements. Here’s a breakdown of these differences: ### Instantiation 1. **Tuples**: - Tuples are generally faster to create than lists because they are immutable, meaning that once a tup...
4,876
[ { "from": "human", "value": "Is there any performance difference between tuples and lists when it comes to instantiation and retrieval of elements? \n" }, { "from": "gpt", "value": "Yes, there are performance differences between tuples and lists in Python, particularly regarding instantiation an...
At work we are currently still using JUnit 3 to run our tests. We have been considering switching over to JUnit 4 for new tests being written but I have been keeping an eye on TestNG for a while now. What experiences have you all had with either JUnit 4 or TestNG, and which seems to work better for very large numbers o...
Both JUnit 4 and TestNG are popular testing frameworks in the Java ecosystem, and each has its own strengths and weaknesses. Here’s a comparison based on your requirements: ### JUnit 4 **Pros:** 1. **Simplicity and Familiarity**: If your team is already familiar with JUnit 3, transitioning to JUnit 4 is relatively st...
1,189
[ { "from": "human", "value": "At work we are currently still using JUnit 3 to run our tests. We have been considering switching over to JUnit 4 for new tests being written but I have been keeping an eye on TestNG for a while now. What experiences have you all had with either JUnit 4 or TestNG, and which seem...
PHP has a great function called htmlspecialcharacters() where you pass it a string and it replaces all of HTML's special characters with their safe equivalents, it's almost a one stop shop for sanitizing input. Very nice right? Well is there an equivalent in any of the .NET libraries? If not, can anyone link to any cod...
In .NET, there isn't a direct equivalent to PHP's `htmlspecialchars()` function, but you can achieve similar functionality using the `System.Net.WebUtility` or `System.Web.HttpUtility` classes to encode HTML. Here’s a brief overview of both options and how to use them: ### Using `System.Net.WebUtility` This class is ...
1,773
[ { "from": "human", "value": "PHP has a great function called htmlspecialcharacters() where you pass it a string and it replaces all of HTML's special characters with their safe equivalents, it's almost a one stop shop for sanitizing input. Very nice right?\nWell is there an equivalent in any of the .NET lib...
At work, we have a dedicated SEO Analyst who's job is to pour over lots of data (KeyNote/Compete etc) and generate up fancy reports for the executives so they can see how we are doing against our competitors in organic search ranking. He also leads initiatives to improve the SEO rankings on our sites by optimizing thin...
Compressing HTML can generally improve site performance, which is a critical factor in SEO. However, it's important to ensure that the compression process does not compromise the quality and validity of the HTML. Here are some key points to consider: 1. **Semantic HTML**: As your SEO analyst mentioned, semantic and va...
3,702
[ { "from": "human", "value": "At work, we have a dedicated SEO Analyst who's job is to pour over lots of data (KeyNote/Compete etc) and generate up fancy reports for the executives so they can see how we are doing against our competitors in organic search ranking. He also leads initiatives to improve the SEO...
Does anyone here use VB.NET and have a strong preference for or against using IsNothing as opposed to Is Nothing (for example, If IsNothing(anObject) or If anObject Is Nothing...)? If so, why? EDIT: If you think they're both equally acceptable, do you think it's best to pick one and stick with it, or is it OK to mix t...
In VB.NET, `IsNothing` and `Is Nothing` serve the same purpose of checking if an object is `Nothing`, but they differ in syntax and style. Here are some considerations regarding their use: ### Preference for IsNothing: 1. **Function Style**: `IsNothing` is a function, so it can be seen as more explicit and clear, espe...
3,672
[ { "from": "human", "value": "Does anyone here use VB.NET and have a strong preference for or against using IsNothing as opposed to Is Nothing (for example, If IsNothing(anObject) or If anObject Is Nothing...)? If so, why?\nEDIT: If you think they're both equally acceptable, do you think it's best to pick o...
When you data bind in C#, the thread that changes the data causes the control to change too. But if this thread is not the one on which the control was created, you'll get an Illegal Cross Thread Operation exception. Is there anyway to prevent this?
Yes, in C#, when working with Windows Forms (or WPF), you must interact with UI elements on the same thread that created them, which is usually the main UI thread. If you attempt to update UI controls from a different thread, you'll encounter a `InvalidOperationException`, often referred to as a "cross-thread operation...
1,136
[ { "from": "human", "value": "When you data bind in C#, the thread that changes the data causes the control to change too. But if this thread is not the one on which the control was created, you'll get an Illegal Cross Thread Operation exception.\nIs there anyway to prevent this?\n" }, { "from": "gpt...
I currently use subversion for my version control via AhnkSVN and Visual Studio. I recently started using Tree Surgeon to set up my projects. It creates a build script automatically using NAnt. I would like to be able to automate builds regularly projects within SVN. I like the idea of doing a build on every check ...
Automating builds for projects managed by Subversion (SVN) using NAnt is a great way to ensure code quality and streamline your development workflow. You have a couple of options for implementing this automation. Below are some suggestions and steps you can take to set up automated builds on check-in and/or nightly bui...
2,335
[ { "from": "human", "value": "I currently use subversion for my version control via AhnkSVN and Visual Studio. I recently started using Tree Surgeon to set up my projects. It creates a build script automatically using NAnt. I would like to be able to automate builds regularly projects within SVN. I like ...
In python, there are some special variables and filenames that are surrounded by double-underscores. For example, there is the __file__ variable. I am only able to get them to show up correctly inside of a code block. What do I need to enter to get double underscores in regular text without having them interpreted...
In Markdown, which is often used for formatting text in code documentation and other writing, double underscores are interpreted as emphasis, similar to how asterisks are used. To display double underscores in regular text without them being interpreted, you can escape each underscore with a backslash (`\`). Here’s h...
5,651
[ { "from": "human", "value": "In python, there are some special variables and filenames that are surrounded by double-underscores. For example, there is the\n__file__ \n\nvariable. I am only able to get them to show up correctly inside of a code block. What do I need to enter to get double underscores in ...
Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#.
Certainly! To implement a recursive lambda expression for traversing a tree structure in C#, you typically need to define a tree node class that represents each node in the tree. Then you can create a lambda expression that can call itself recursively. Here’s an example of how to implement this: ### Step 1: Define th...
2,878
[ { "from": "human", "value": "Can someone show me how to implement a recursive lambda expression to traverse a tree structure in C#. \n" }, { "from": "gpt", "value": "Certainly! To implement a recursive lambda expression for traversing a tree structure in C#, you typically need to define a tree n...
I am trying to generate a report by querying 2 databases (Sybase) in classic ASP. I have created 2 connection strings: connA for databaseA connB for databaseB Both databases are present on the same server (don't know if this matters) Queries: q1 = SELECT column1 INTO #temp FROM databaseA..table1 WHERE xyz="A" q2 = SE...
The error you're encountering is due to the use of the temporary table `#temp` across two different database connections. Temporary tables in SQL Server (and similar databases, including Sybase) are session-specific. When you create a temporary table in one connection (or session), it is not accessible in another conne...
840
[ { "from": "human", "value": "I am trying to generate a report by querying 2 databases (Sybase) in classic ASP.\nI have created 2 connection strings:\n\nconnA for databaseA\nconnB for databaseB\n\nBoth databases are present on the same server (don't know if this matters)\nQueries:\nq1 = SELECT column1 INTO #...
In the C programming language and Pthreads as the threading library; do variables/structures that are shared between threads need to be declared as volatile? Assuming that they might be protected by a lock or not (barriers perhaps). Does the pthread POSIX standard have any say about this, is this compiler-dependent or ...
In the context of the C programming language and Pthreads, the `volatile` qualifier does not directly address the issue of thread safety or the visibility of shared variables between threads. Let's clarify the key points regarding `volatile`, threading, and synchronization mechanisms. ### `volatile` in C The `volatil...
3,784
[ { "from": "human", "value": "In the C programming language and Pthreads as the threading library; do variables/structures that are shared between threads need to be declared as volatile? Assuming that they might be protected by a lock or not (barriers perhaps).\nDoes the pthread POSIX standard have any say ...
I have the need to read the Thunderbird address book on the fly. It is stored in a file format called Mork. Not a pleasant file format to read. I found a 1999 article explaining the file format. I would love to know if someone already has gone through this process and could make the code available. I found mork.pl...
Reading Thunderbird's address book in Mork format can indeed be challenging due to its complexity. As you mentioned, Jamie Zawinski's `mork.pl` script provides a reference implementation in Perl, but if you prefer a .NET solution, there may not be a widely-known library for Mork files specifically. However, you can ce...
1,781
[ { "from": "human", "value": "I have the need to read the Thunderbird address book on the fly. It is stored in a file format called Mork. Not a pleasant file format to read. I found a 1999 article explaining the file format. I would love to know if someone already has gone through this process and could ...
I hope everyone will pardon the length, and narrative fashion, of this question. I decided to describe the situation in some detail in my blog. I later saw Joel's invitation to this site, and I thought I'd paste it here to see if anyone has any insight into the situation. I wrote, and now support, an application that...
Your situation offers an interesting case study in COM interoperability and the potential pitfalls associated with versioning, especially when working with different client operating systems and evolving libraries. Let's tackle your two nagging questions one at a time. ### 1. Why does the proxy/stub infrastructure see...
2,642
[ { "from": "human", "value": "I hope everyone will pardon the length, and narrative fashion, of this question. I decided to describe the situation in some detail in my blog. I later saw Joel's invitation to this site, and I thought I'd paste it here to see if anyone has any insight into the situation.\nI w...
PERL? Perl? perl? What's good style? I know the answer—I just wanted to make sure the question was out there and questioners were aware that there is a correct form.
In terms of style for writing the name of the programming language, the convention is to use "Perl" with a capital "P." This is the most widely accepted format, especially in formal documentation and literature. While you may see it written in all lowercase (like "perl"), this is generally seen as informal. So, the goo...
6,490
[ { "from": "human", "value": "PERL? Perl? perl? What's good style?\nI know the answer—I just wanted to make sure the question was out there and questioners were aware that there is a correct form.\n" }, { "from": "gpt", "value": "In terms of style for writing the name of the programming language,...
I'm just wondering if it exists better solution for this. BitConverter.ToInt32(sample_guid.ToByteArray(), 0)
The code snippet you provided uses `BitConverter.ToInt32` to convert the byte array representation of a GUID (`sample_guid`) into an integer. This approach is valid if your intention is to interpret the first four bytes of the GUID as an integer. However, it's essential to note that a GUID is 16 bytes long, and direct...
2,701
[ { "from": "human", "value": "I'm just wondering if it exists better solution for this.\nBitConverter.ToInt32(sample_guid.ToByteArray(), 0)\n\n" }, { "from": "gpt", "value": "The code snippet you provided uses `BitConverter.ToInt32` to convert the byte array representation of a GUID (`sample_guid...
Can anyone recommend a good binary XML format? It's for a JavaME application, so it needs to be a) Easy to implement on the server, and b) Easy to write a low-footprint parser for on a low-end JavaME client device. And it goes without saying that it needs to be smaller than XML, and faster to parse. The data would be ...
For a JavaME application requiring a binary XML format that is easy to implement and lightweight for parsing, you might consider the following options: 1. **CBOR (Concise Binary Object Representation)**: - **Description**: CBOR is a binary data serialization format that is compact and designed to be simple and eff...
2,644
[ { "from": "human", "value": "Can anyone recommend a good binary XML format? It's for a JavaME application, so it needs to be a) Easy to implement on the server, and b) Easy to write a low-footprint parser for on a low-end JavaME client device.\nAnd it goes without saying that it needs to be smaller than XML...
I am trying to consume multiple Web Services that redefine some of the same common classes in their wsdl. I currently have them referenced in a Web Site, but I want to convert to Web Application. Since some of the same classes are redefined from multiple Web Service, the problem is that when adding them in a web Appli...
When consuming multiple web services that redefine common classes and you want to convert your Web Site project into a Web Application project, you'll run into issues with conflicting types in your generated service references. Since web applications do not allow you to have duplicate type definitions with the same nam...
2,064
[ { "from": "human", "value": "I am trying to consume multiple Web Services that redefine some of the same common classes in their wsdl. I currently have them referenced in a Web Site, but I want to convert to Web Application. \nSince some of the same classes are redefined from multiple Web Service, the probl...
How do I execute the "Copy Web Site" command for an ASP.NET project in VS2008 from the command line? If I need to script this, let me have some pointers on where I can learn that.
In Visual Studio 2008, the "Copy Web Site" command is typically executed through the graphical user interface, and unfortunately, there is no direct command-line equivalent for executing it from the command line. However, you can achieve similar functionality through alternative methods. ### 1. Using MSBuild One of th...
3,766
[ { "from": "human", "value": "How do I execute the \"Copy Web Site\" command for an ASP.NET project in VS2008 from the command line? If I need to script this, let me have some pointers on where I can learn that.\n" }, { "from": "gpt", "value": "In Visual Studio 2008, the \"Copy Web Site\" command...
In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. I'm dabbling in ASP.NET now, and I'm wondering if/how I might perform some...
Certainly! In ASP.NET, especially when working with IIS (including IIS 6), you can achieve a similar routing mechanism by using the URL rewriting capabilities provided by IIS. While ASP.NET MVC offers a rich routing framework, you can implement your custom routing logic if you want to take a more hands-on approach. He...
1,537
[ { "from": "human", "value": "In a recent project, I built my own MVC framework in PHP. One of the things I implemented was a routing system. I used Apache's mod_rewrite to send all requests to index.php, and then parsed the URI to extract information and route the request. \nI'm dabbling in ASP.NET now, and...
Say you've got a credit card number with an expiration date of 05/08 - i.e. May 2008. Does that mean the card expires on the morning of the 1st of May 2008, or the night of the 31st of May 2008?
A credit card with an expiration date of 05/08 (May 2008) typically expires at the end of the last day of that month. Therefore, the card would be valid until the night of May 31, 2008, and would no longer be valid as of June 1, 2008.
6,789
[ { "from": "human", "value": "Say you've got a credit card number with an expiration date of 05/08 - i.e. May 2008.\nDoes that mean the card expires on the morning of the 1st of May 2008, or the night of the 31st of May 2008?\n" }, { "from": "gpt", "value": "A credit card with an expiration date ...
I'm coding a framework along with a project which uses this framework. The project is a Bazaar repository, with the framework in a subfolder below the project. I want to give the framework a Bazaar repository of its own. How do I do it?
To create a separate Bazaar (bzr) repository for your framework within a project that is itself a Bazaar repository, you can follow these steps: 1. **Navigate to the Framework Directory**: First, make sure you are in the directory where your framework is located. You can do this using the command line: ```bash ...
3,893
[ { "from": "human", "value": "I'm coding a framework along with a project which uses this framework. The project is a Bazaar repository, with the framework in a subfolder below the project.\nI want to give the framework a Bazaar repository of its own. How do I do it?\n" }, { "from": "gpt", "value...
Ok, so I've been refactoring my code in my little Rails app in an effort to remove duplication, and in general make my life easier (as I like an easy life). Part of this refactoring, has been to move code that's common to two of my models to a module that I can include where I need it. So far, so good. Looks like it's...
In Ruby, if you want to ensure that you can safely call `super` without running into a `NoMethodError`, you typically need to be in a situation where the superclass has that method defined. However, in your case, you're dealing with mixins and you want to ensure that any `after_initialize` methods in included modules a...
751
[ { "from": "human", "value": "Ok, so I've been refactoring my code in my little Rails app in an effort to remove duplication, and in general make my life easier (as I like an easy life). Part of this refactoring, has been to move code that's common to two of my models to a module that I can include where I ...