instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I am writing a silly little app in C++ to test one of my libraries. I would like the app to display a list of commands to the user, allow the user to type a command, and then execute the action associated with that command. Sounds simple enough.
In C# I would end up writing a list/map of commands like so:
class Men... | You can achieve similar functionality in C++ by utilizing `std::function` and `std::map` (or `std::unordered_map`) from the Standard Template Library (STL). This approach allows you to store commands, their descriptions, and the corresponding actions in a way that's quite similar to your C# example. Below is a simple i... | 34,828 | [
{
"from": "human",
"value": "I am writing a silly little app in C++ to test one of my libraries. I would like the app to display a list of commands to the user, allow the user to type a command, and then execute the action associated with that command. Sounds simple enough.\nIn C# I would end up writing a l... |
I would like to do something like add a nice-to-Excel-functions Name property to the WorkBook class. Is there a good way to do this?
More detailed problem: In VBA you can assign a formula to a range in an Excel worksheet. I want to do so, and I want my formula to refer to a second workbook, which is an object called wb... | To achieve the desired functionality of creating a custom property (`FunName`) for your `Workbook` class in VBA, you will need to create a new class that extends the existing functionality of the `Workbook` object. In this case, `FunName` will sanitize the workbook's name by replacing single quotes with double single q... | 33,694 | [
{
"from": "human",
"value": "I would like to do something like add a nice-to-Excel-functions Name property to the WorkBook class. Is there a good way to do this?\nMore detailed problem: In VBA you can assign a formula to a range in an Excel worksheet. I want to do so, and I want my formula to refer to a sec... |
I read a properties-file at the webapplication startup phase (contextInitialized()) and I started to think about how to make these settings 'visible' to the servlets. Do I need to loop through the keys and add each and every one to the context, like this
Iterator i = settings.keySet().iterator();
while (i.hasNext()) {
... | You can definitely improve the way you handle the properties and make them accessible in your servlets without needing to loop through the keys and set each one individually in the context. Here are a few options you might consider:
### 1. Store the Properties Object Directly
Instead of setting each property individu... | 33,531 | [
{
"from": "human",
"value": "I read a properties-file at the webapplication startup phase (contextInitialized()) and I started to think about how to make these settings 'visible' to the servlets. Do I need to loop through the keys and add each and every one to the context, like this\nIterator i = settings.k... |
My application uses loads of Java threads. I am looking for a reliable understanding how the JVM (version 5 and 6) maps the Java threads to underlying Windows threads. I know there is a document for mapping to Solaris threads, but not Windows.
Why doesn't Sun publish this information?
I want to know if there's a 1:1 ma... | Understanding how Java threads map to underlying operating system threads, especially in the context of the JVM and Windows, is important for optimizing performance and debugging multithreaded applications.
### Java Thread to OS Thread Mapping
1. **Mapping Overview**:
- In most modern JVMs, including those from ... | 31,639 | [
{
"from": "human",
"value": "My application uses loads of Java threads. I am looking for a reliable understanding how the JVM (version 5 and 6) maps the Java threads to underlying Windows threads. I know there is a document for mapping to Solaris threads, but not Windows.\nWhy doesn't Sun publish this infor... |
In MonoRail you can just CancelLayout() to not render the layout. In ASP.NET MVC, the only way to affect the layout seems to be to pass the layout name into the View() method like View("myview", "mylayout"); only it seems that passing null or an empty string doesn't do what I'd want.
I ended up creating an empty layou... | In ASP.NET MVC, if you want to render a view without any layout, you can set the `Layout` property of your view to `null` in the view file or controller action. This is an effective way to achieve the same effect as `CancelLayout()` in MonoRail.
### Option 1: Set Layout to Null in the View
In the view file (e.g., `My... | 34,106 | [
{
"from": "human",
"value": "In MonoRail you can just CancelLayout() to not render the layout. In ASP.NET MVC, the only way to affect the layout seems to be to pass the layout name into the View() method like View(\"myview\", \"mylayout\"); only it seems that passing null or an empty string doesn't do what ... |
Here is a stripped down version of what I use to authenticate users, it works fine on my PHP v5.0.2/MySQL 4.0.21 server, but fails on my PHP v5.1.6/MySQL v5.0.45 server.
In the code below, should I be aware of anything that might not be supported by the newer version of PHP & MySQL? Global variables have been enabled.
... | Your code is written in an older style of PHP that utilizes global variables like `$HTTP_POST_VARS`, which is deprecated in later versions of PHP, including PHP 5.1.6. Here are some key points you should be aware of to make your code work on the newer server and improve overall security and best practices:
### 1. Use ... | 29,374 | [
{
"from": "human",
"value": "Here is a stripped down version of what I use to authenticate users, it works fine on my PHP v5.0.2/MySQL 4.0.21 server, but fails on my PHP v5.1.6/MySQL v5.0.45 server.\nIn the code below, should I be aware of anything that might not be supported by the newer version of PHP & M... |
What's your experience with doctrine?
I've never been much of an ORM kind of guy, I mostlymanaged with just some basic db abstraction layer like adodb.
But I understood all the concepts and benifits of it. So when a project came along that needed an ORM I thought that I'd give one of the ORM framework a try.
I've to ... | It's not uncommon to run into challenges when switching to a new ORM, especially if you're used to a simpler abstraction layer. Doctrine and Propel both have their unique advantages and learning curves, and your experience with Doctrine sounds like it could benefit from a few strategies and resources. Here are some tip... | 31,230 | [
{
"from": "human",
"value": "What's your experience with doctrine?\nI've never been much of an ORM kind of guy, I mostlymanaged with just some basic db abstraction layer like adodb. \nBut I understood all the concepts and benifits of it. So when a project came along that needed an ORM I thought that I'd giv... |
I'm currently maintaining some flex code and noticed very many functions which are declared like:
private function exampleFunc():void {
....
}
These functions are in the global scope, and aren't part of any specific class, so it's a bit unclear to me what effect declaring them as private would have. What restrict... | In ActionScript, which is the language used in Flex, the `private` access modifier is intended to restrict the visibility of the function to within the same class or instance. However, when you declare a function as `private` in the global scope (i.e., outside of any class), it does not serve its intended purpose, as t... | 36,307 | [
{
"from": "human",
"value": "I'm currently maintaining some flex code and noticed very many functions which are declared like:\nprivate function exampleFunc():void {\n ....\n}\n\nThese functions are in the global scope, and aren't part of any specific class, so it's a bit unclear to me what effect declar... |
Is there a way of ordering a list of objects by a count of a property which is a collection?
For arguments sake let's say I have a question object with a question name property, a property that is a collection of answer objects and another property that is a collection of user objects. The users join the question tabl... | It looks like you're trying to retrieve a list of `Question` objects ordered by the count of their associated `Answer` objects using HQL (Hibernate Query Language) with NHibernate. The error message you're encountering indicates that HQL requires all selected properties to be either included in an aggregate function (l... | 32,189 | [
{
"from": "human",
"value": "Is there a way of ordering a list of objects by a count of a property which is a collection? \nFor arguments sake let's say I have a question object with a question name property, a property that is a collection of answer objects and another property that is a collection of user... |
I have an array that contains a list of vertices which I copy to the GPU using a vertex buffer object. However the vertex coordinates on their own are meaningless as I also have an integer array that contains a list of indices into the vertex array.
In this scenario is it possible to create another buffer object to sto... | You're on the right track in terms of using vertex buffer objects (VBOs) for both your vertex data and your index data. In OpenGL, you can indeed create two different buffer objects: one for the vertex coordinates and another for the indices that reference those coordinates.
Here's a brief explanation of how this work... | 32,854 | [
{
"from": "human",
"value": "I have an array that contains a list of vertices which I copy to the GPU using a vertex buffer object. However the vertex coordinates on their own are meaningless as I also have an integer array that contains a list of indices into the vertex array.\nIn this scenario is it possi... |
I have an XSL stylesheet with content in an xsl:text node like this:
<xsl:text>
foo
bar
baz
</xsl:text>
The stylesheet itself is a text file with "unix-style" newline line terminators. I invoke this stylesheet on Windows as well as unix-like platforms. It would be nice to have the output conform to the conventions of ... | To ensure that the output from your XSLT transformation conforms to the platform-specific line ending conventions, you can use a couple of strategies.
### Method 1: Replace Newlines in XSLT
One common approach is to explicitly replace newlines in your `xsl:text` nodes with a platform-specific newline character. You c... | 30,566 | [
{
"from": "human",
"value": "I have an XSL stylesheet with content in an xsl:text node like this:\n<xsl:text>\nfoo\nbar\nbaz\n</xsl:text>\n\nThe stylesheet itself is a text file with \"unix-style\" newline line terminators. I invoke this stylesheet on Windows as well as unix-like platforms. It would be nice... |
How would you use set! in a simple procedure f such that evaluating (+ (f 0) (f 1)) will return 0 if the arguments to + are evaluated from left to right but will return 1 if the arguments are evaluated from right to left?
| To accomplish this, we can use `set!` to define a mutable state within our procedure `f`. The goal is to manipulate this state so that the results depend on the order of evaluation.
Here's a simple implementation of `f` in a Scheme-like syntax:
```scheme
(define f
(let ((state 0))
(lambda (x)
(set! state ... | 34,540 | [
{
"from": "human",
"value": "How would you use set! in a simple procedure f such that evaluating (+ (f 0) (f 1)) will return 0 if the arguments to + are evaluated from left to right but will return 1 if the arguments are evaluated from right to left?\n"
},
{
"from": "gpt",
"value": "To accomplis... |
In layman's terms, what's a RDF triple?
| An RDF triple is a simple way to represent information on the web using three parts:
1. **Subject**: This is what you are talking about. It can be a person, a place, an object, or any other entity.
2. **Predicate**: This describes the relationship or property of the subject. It's like a verb that tells you somethin... | 37,701 | [
{
"from": "human",
"value": "In layman's terms, what's a RDF triple?\n"
},
{
"from": "gpt",
"value": "An RDF triple is a simple way to represent information on the web using three parts:\n\n1. **Subject**: This is what you are talking about. It can be a person, a place, an object, or any other e... |
I'm trying to read the contents of a text file, in this case a list of computer names (Computer1, computer2 etc,) and I thought that StreamReader would be what you would use but when I do the following:
StreamReader arrComputer = new StreamReader(FileDialog.filename)();
I got this exception:
The type or namespace name... | The error you're encountering indicates that the compiler can't find the `StreamReader` class, which typically means you may be missing the appropriate `using` directive or the necessary assembly reference.
To read a text file using `StreamReader` in C#, you'll need to follow these steps:
1. **Include the necessary u... | 34,420 | [
{
"from": "human",
"value": "I'm trying to read the contents of a text file, in this case a list of computer names (Computer1, computer2 etc,) and I thought that StreamReader would be what you would use but when I do the following:\nStreamReader arrComputer = new StreamReader(FileDialog.filename)();\n\nI go... |
What's a good way to survive abnormally high traffic spikes?
My thought is that at some trigger, my website should temporarily switch into a "low bandwidth" mode: switch to basic HTML pages, minimal graphics, disable widgets that might put unnecessary load on the database, and so-on.
My thoughts are:
Monitor CPU usage... | Surviving high traffic spikes effectively requires a combination of proactive monitoring, dynamic response strategies, and effective resource management. Below are some approaches that can help you detect impending overload and respond accordingly, tailored for a typical Apache and PHP setup.
### Detection Strategies
... | 24,670 | [
{
"from": "human",
"value": "What's a good way to survive abnormally high traffic spikes?\nMy thought is that at some trigger, my website should temporarily switch into a \"low bandwidth\" mode: switch to basic HTML pages, minimal graphics, disable widgets that might put unnecessary load on the database, an... |
I have a type ahead text field, and when the user hits "Enter" I want to make an ajax call and not submit the form at the same time. My html looks like this:
<input id="drug_name" class="drugs_field" type="text" size="30" onkeypress="handleKeyPress(event,this.form); return false;" name="drug[name]" autocomplete="off"/>... | To ensure that an AJAX call is made when the user presses "Enter" in the type-ahead text field without submitting the form, you can modify your `handleKeyPress` function. You will want to check for the "Enter" key specifically and prevent the default form submission behavior. Here’s how you can achieve this:
1. Update... | 32,998 | [
{
"from": "human",
"value": "I have a type ahead text field, and when the user hits \"Enter\" I want to make an ajax call and not submit the form at the same time. My html looks like this:\n<input id=\"drug_name\" class=\"drugs_field\" type=\"text\" size=\"30\" onkeypress=\"handleKeyPress(event,this.form); ... |
I was hoping to implement a simple XMPP server in Java.
What I need is a library which can parse and understand xmpp requests from a client. I have looked at Smack (mentioned below) and JSO. Smack appears to be client only so while it might help parsing packets it doesn't know how to respond to clients. Is JSO maint... | Implementing a simple XMPP server in Java, particularly with a focus on extensibility and clustering, is indeed a challenging yet interesting project. While Openfire is a robust solution, building a lightweight custom server allows you to gain a deeper understanding of XMPP and tailor the server to your specific needs.... | 25,886 | [
{
"from": "human",
"value": "I was hoping to implement a simple XMPP server in Java. \nWhat I need is a library which can parse and understand xmpp requests from a client. I have looked at Smack (mentioned below) and JSO. Smack appears to be client only so while it might help parsing packets it doesn't kn... |
Everyone managing open-source-software runs into the problem, that with the time the process of releasing a new version gets more and more work. You have to tag the release in your version-control, create the distributions (that should be easy with automated builds), upload them to your website and/or open-source-hoste... | Yes, many open-source software projects have developed techniques and tools to automate various aspects of the release process. Automating these tasks can save time and reduce the potential for human error. Here are some strategies and tools that can help:
### 1. **Automated Build and Release Tools**
- **CI/CD Tools*... | 33,235 | [
{
"from": "human",
"value": "Everyone managing open-source-software runs into the problem, that with the time the process of releasing a new version gets more and more work. You have to tag the release in your version-control, create the distributions (that should be easy with automated builds), upload them... |
I have a Yahoo! Widgets Web object and I'd like to access elements inside of it when it's done loading. I'm already handling everything wonderfully via the WebEvents Y!W provides, but there's one small problem.
Web objects don't appear to have any DOM of their loaded page.
I can access webObj.html, which is the loade... | In Yahoo! Widgets (Y!W), you are indeed somewhat limited in how you can interact with the content of web objects due to security constraints and the design of the widget environment. Here are a few points to keep in mind based on the situation you described:
1. **No Direct DOM Access**: As you've noted, web objects do... | 35,920 | [
{
"from": "human",
"value": "I have a Yahoo! Widgets Web object and I'd like to access elements inside of it when it's done loading. I'm already handling everything wonderfully via the WebEvents Y!W provides, but there's one small problem.\nWeb objects don't appear to have any DOM of their loaded page.\nI... |
I have been given the task of modifying a VB6 project. Nothing incredibly serious, adding a couple forms and fixing a few bugs for the most part. The project uses SQL Server (if that is of any relevance).
My background in programming has been VB/C# .NET, PHP, C++ and mostly MySQL although I have used SQL Server on a mu... | Working with Visual Basic 6 (VB6) can indeed feel like a step back, especially if you're more familiar with modern languages and IDEs like VB.NET, C#, and others. Here are some tips and resources that may help you navigate VB6 programming, particularly with your task of modifying an existing project:
### General Advic... | 33,511 | [
{
"from": "human",
"value": "I have been given the task of modifying a VB6 project. Nothing incredibly serious, adding a couple forms and fixing a few bugs for the most part. The project uses SQL Server (if that is of any relevance).\nMy background in programming has been VB/C# .NET, PHP, C++ and mostly MyS... |
Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly we do not have any Perl skills in-house. This is what happens when Marketing people circumvent their in-house IT team!
I n... | To achieve the desired functionality of displaying "We currently have the following vacancies:" only when there are actual vacancies, you can use a simple approach. You can check if any vacancies are returned from your SQL query by using the `fetchrow_hashref` method within a loop. However, rather than just moving thro... | 34,434 | [
{
"from": "human",
"value": "Our website uses Perl to provide a simple mechanism for our HR people to post vacancies to our website. It was developed by a third party, but they have been long since kicked into touch, and sadly we do not have any Perl skills in-house. This is what happens when Marketing peop... |
I am dynamically adding steps to a Sql Server Agent Job, but I need to get the last step id to determine the next id in the sequence. I cannot seem to find any built in sps that can give me this information.
| To find the last step ID of a SQL Server Agent Job, you will typically query the `msdb` database, specifically the `sysjobs` and `sysjobsteps` tables. While there isn't a built-in stored procedure that directly returns the last step ID, you can write a simple SQL query to retrieve it.
Here's how you can do that:
1. Q... | 35,992 | [
{
"from": "human",
"value": "I am dynamically adding steps to a Sql Server Agent Job, but I need to get the last step id to determine the next id in the sequence. I cannot seem to find any built in sps that can give me this information.\n"
},
{
"from": "gpt",
"value": "To find the last step ID ... |
How do I create a toolbar for Excel using an XLA document?
| Creating a toolbar in Excel using an XLA (Excel Add-In) file is a way to enhance your Excel applications with custom functionality and a user-friendly interface. Here’s a step-by-step guide on how to create a toolbar using an XLA file:
### Step 1: Create Your XLA File
1. **Open Excel**: Start Microsoft Excel.
2. **Op... | 30,457 | [
{
"from": "human",
"value": "How do I create a toolbar for Excel using an XLA document?\n"
},
{
"from": "gpt",
"value": "Creating a toolbar in Excel using an XLA (Excel Add-In) file is a way to enhance your Excel applications with custom functionality and a user-friendly interface. Here’s a step... |
While in a call, if the user wants to use my application, and if the call finishes, and the user is still in the application, the toolbar moves up, well all the view moves up, and so the toolbar now has a space in the bottom. Basically the height "Touch to return to call" has. I am using a toolbar and a navigation cont... | To address the issue of your toolbar not adjusting its frame after a call ends, you can use `NSNotificationCenter` to listen for changes related to the call status.
While you might not have access to a specific notification for when a call ends, you can observe changes in the interface that are triggered by the call. ... | 35,040 | [
{
"from": "human",
"value": "While in a call, if the user wants to use my application, and if the call finishes, and the user is still in the application, the toolbar moves up, well all the view moves up, and so the toolbar now has a space in the bottom. Basically the height \"Touch to return to call\" has.... |
My Visual Studio is all messed up and I have no idea why. See the screenshot below. The controls are repeated 3 times. I tried reseting the toolbox; still no luck. The solution contains one ASP.NET Web Application and few class library. None of the projects have referenece to System.Windows.Form, still components from ... | Hi Zuhaib,
It sounds like you're encountering a frustrating issue with your Visual Studio toolbox. Here are a few steps you can take to troubleshoot and possibly resolve the problem:
1. **Reset Toolbox**: You've mentioned trying to reset the toolbox, but make sure to do it through `Tools -> Options -> Windows Forms D... | 34,670 | [
{
"from": "human",
"value": "My Visual Studio is all messed up and I have no idea why. See the screenshot below. The controls are repeated 3 times. I tried reseting the toolbox; still no luck. The solution contains one ASP.NET Web Application and few class library. None of the projects have referenece to Sy... |
The solution is crying out for the MSMQ solution but unfortunately the posting service is not on the domain. Is there anyway to post to the public queue that is on the domain from the machine in the DMZ?
I could use a webservice to post but this is a extra component to maintain. The database table is the alternative so... | If you need to post messages to a Microsoft Message Queuing (MSMQ) queue that resides on a domain from a machine in the DMZ, there are several approaches you can consider. Each has its trade-offs regarding security, complexity, and maintainability. Here are some possible solutions:
1. **Use a Relay Service (Web Servic... | 32,560 | [
{
"from": "human",
"value": "The solution is crying out for the MSMQ solution but unfortunately the posting service is not on the domain. Is there anyway to post to the public queue that is on the domain from the machine in the DMZ?\nI could use a webservice to post but this is a extra component to maintain... |
I'm looking for the .NET-preferred way of performing the same type of thing that ShellExecute does in Win32 (opening, printing, etc. for arbitrary file types).
I've been programming Windows for over 20 years, but I'm a complete newbie at .NET, so maybe I'm just looking in the wrong places. I'm currently using .NET 2.0 ... | In .NET, you can achieve similar functionality to `ShellExecute` using the `Process` class available in the `System.Diagnostics` namespace. This is the preferred way to start processes, open files, and print documents in .NET applications.
Here's how you can use the `Process` class in .NET to open files or print them... | 32,037 | [
{
"from": "human",
"value": "I'm looking for the .NET-preferred way of performing the same type of thing that ShellExecute does in Win32 (opening, printing, etc. for arbitrary file types).\nI've been programming Windows for over 20 years, but I'm a complete newbie at .NET, so maybe I'm just looking in the w... |
I have a login page where I authenticate the user. When the authentication pass, I then redirect the user to another page via Response.Redirect with the url defined in login control's destinationpageurl.
It work fine in firefox but when i test it with IE. It just redirect the user back to the login page.
does anyone kn... | The issue you're experiencing with Internet Explorer (IE) redirecting back to the login page after authentication could be caused by several factors. Here are a few common reasons and potential solutions:
1. **Session or Cookies**: Ensure that the authentication state is being correctly maintained through sessions or ... | 31,221 | [
{
"from": "human",
"value": "I have a login page where I authenticate the user. When the authentication pass, I then redirect the user to another page via Response.Redirect with the url defined in login control's destinationpageurl.\nIt work fine in firefox but when i test it with IE. It just redirect the u... |
Try clicking on the "Print" button on the following page:
(link removed - consensus is that everything was working fine and the problem was my setup)
For debugging purposes, I've replaced a chunk of javascript with a simple alert("test"), and even that isn't showing up in IE7 for me. It works totally fine in Safari, F... | Hi Mike,
It sounds like you're experiencing an issue with the JavaScript not executing properly in IE7, especially since it works fine in other browsers. Here are a few steps you can take to troubleshoot the problem:
1. **Check JavaScript is Enabled**: Ensure that JavaScript is enabled in your IE7 settings. Sometimes... | 36,087 | [
{
"from": "human",
"value": "Try clicking on the \"Print\" button on the following page:\n(link removed - consensus is that everything was working fine and the problem was my setup)\nFor debugging purposes, I've replaced a chunk of javascript with a simple alert(\"test\"), and even that isn't showing up in ... |
What kind of security issues am I going to run into when hosting a Flex site (with multiple modules) using Amazon S3's hosting?
Can I even communicate between two different swfs if they're loaded from two different subdomains? (These will be modules)
I dont yet know if i would host all modules on S3 or just some. For t... | When hosting a Flex site (or any Flash application) on Amazon S3, there are several security issues and considerations you should be aware of, especially when dealing with multiple modules, communication between SWFs, and subdomain hosting. Here’s a breakdown of what you might encounter:
### Security Issues
1. **Cros... | 33,069 | [
{
"from": "human",
"value": "What kind of security issues am I going to run into when hosting a Flex site (with multiple modules) using Amazon S3's hosting?\nCan I even communicate between two different swfs if they're loaded from two different subdomains? (These will be modules)\nI dont yet know if i would... |
I'd like to implement a big int class in C++ as a programming exercise—a class that can handle numbers bigger than a long int. I know that there are several open source implementations out there already, but I'd like to write my own. I'm trying to get a feel for what the right approach is.
I understand that the gener... | Implementing a big integer class in C++ is an excellent programming exercise that can help deepen your understanding of object-oriented programming and data structures. Here’s a general approach and advice to guide you through the process, particularly focusing on addition and multiplication.
### General Approach
1. ... | 29,130 | [
{
"from": "human",
"value": "I'd like to implement a big int class in C++ as a programming exercise—a class that can handle numbers bigger than a long int. I know that there are several open source implementations out there already, but I'd like to write my own. I'm trying to get a feel for what the right... |
Years ago when I was starting a small development project, the other developers and I sat down and agreed on a compromise brace and indentation style. It wasn't anybody's favourite, but it was something that nobody really hated. I wrote a .indentrc configuration file to that style, and had a check-in trigger that wou... | Your approach to handling code style within your development team is an interesting one, and it certainly has both pros and cons. Here’s a breakdown of the strengths and weaknesses of your method:
### Pros:
1. **Consistency**: By enforcing a specific style on check-in, you ensure that the codebase remains consistent, ... | 35,323 | [
{
"from": "human",
"value": "Years ago when I was starting a small development project, the other developers and I sat down and agreed on a compromise brace and indentation style. It wasn't anybody's favourite, but it was something that nobody really hated. I wrote a .indentrc configuration file to that s... |
I am using the Zend Framework.
I have a controller named 'UserController' that has a public function displayAction().
I would like to know how I can get that action method to use a different viewer than the default display.phtml.
Any help is appreciated.
| In the Zend Framework, each controller action typically renders a view script that follows the convention of `<controller>/<action>.phtml`. In your case, the `displayAction()` in the `UserController` would, by default, look for the view script located at `module/User/view/user/display.phtml`.
If you want to use a diff... | 35,026 | [
{
"from": "human",
"value": "I am using the Zend Framework.\nI have a controller named 'UserController' that has a public function displayAction().\nI would like to know how I can get that action method to use a different viewer than the default display.phtml.\nAny help is appreciated.\n"
},
{
"from... |
Sometimes you need to upgrade the database with many rows that you have in a datatable or you have an array full of data, instead of putting all this data together in a string and then splitting in SQL SERVER, or instead of iterating the datatable in the code row by row and updating database, is there any other way? Is... | In SQL Server 2005, there are a few approaches to efficiently handle bulk data updates without having to concatenate strings or iterate row by row in your application code. Here are some options you can consider:
### 1. **Table-Valued Parameters (TVPs)**
Although TVPs were introduced in SQL Server 2008, it's worth men... | 31,814 | [
{
"from": "human",
"value": "Sometimes you need to upgrade the database with many rows that you have in a datatable or you have an array full of data, instead of putting all this data together in a string and then splitting in SQL SERVER, or instead of iterating the datatable in the code row by row and upda... |
I'm looking for some help with creating a horizontal menubar in HTML. The menubar will have menus such as File, Edit, View and when you mouseover or click on the File menu (for example), the menu will be displayed showing menu items such as New, Open, etc.
Ideally, I'd like to create the menubar and menus using pure HT... | Creating a horizontal menubar with dropdown menus using pure HTML and CSS is a great way to build a custom navigation solution. Below is a simple example of how you can create a horizontal menubar with dropdown menus for the items "File," "Edit," and "View." This example includes basic HTML, CSS, and a small amount of ... | 30,452 | [
{
"from": "human",
"value": "I'm looking for some help with creating a horizontal menubar in HTML. The menubar will have menus such as File, Edit, View and when you mouseover or click on the File menu (for example), the menu will be displayed showing menu items such as New, Open, etc.\nIdeally, I'd like to ... |
a:3:{i:0;i:4;i:1;i:3;i:2;i:2;}
Am I right to say that this is an array of size 3 where the key value pairs are 0->4, 1->3, and 2->2?
If so, I find this representation awfully confusing. At first, I thought it was a listing of values (or the array contained {0, 4, 1, 3, 2, 2}), but I figured that the a:3: was the size ... | You are correct in interpreting the serialized string `a:3:{i:0;i:4;i:1;i:3;i:2;i:2;}` as an array of size 3, with the key-value pairs being 0->4, 1->3, and 2->2.
The `a:3:` indicates that this is an array containing 3 elements. Each key-value pair follows in the form `i:<key>;i:<value>;` where `i` denotes that the ke... | 31,492 | [
{
"from": "human",
"value": "a:3:{i:0;i:4;i:1;i:3;i:2;i:2;}\n\nAm I right to say that this is an array of size 3 where the key value pairs are 0->4, 1->3, and 2->2?\nIf so, I find this representation awfully confusing. At first, I thought it was a listing of values (or the array contained {0, 4, 1, 3, 2, 2}... |
I have a class that defines a CallRate type. I need to add the ability to create multiple instances of my class by reading the data from a file.
I added a static method to my class CallRate that returns a List<CallRate>. Is it ok for a class to generate new instances of itself by calling one of its own constructors? It... | Yes, it's perfectly acceptable for a class to create new instances of itself by calling one of its own constructors. This is a common pattern in object-oriented programming, and there are several reasons why it can be a good practice:
1. **Encapsulation**: By using a static method like `ProcessCallsFile`, you encapsul... | 34,191 | [
{
"from": "human",
"value": "I have a class that defines a CallRate type. I need to add the ability to create multiple instances of my class by reading the data from a file.\nI added a static method to my class CallRate that returns a List<CallRate>. Is it ok for a class to generate new instances of itself ... |
In C#, is there a way to instantiate an instance of a class without invoking its constructor?
Assume the class is public and is defined in a 3rd party library and the constructor is internal. The reasons I want to do this are complicated but it would be helpful to know if it's possible using some kind of C# hackery.
N... | In C#, it's generally not possible to create an instance of a class without invoking its constructor in the traditional sense. However, there are some advanced techniques that might achieve similar goals, but they come with caveats and potential risks.
### 1. Using `FormatterServices.GetUninitializedObject`
One possi... | 34,751 | [
{
"from": "human",
"value": "In C#, is there a way to instantiate an instance of a class without invoking its constructor?\nAssume the class is public and is defined in a 3rd party library and the constructor is internal. The reasons I want to do this are complicated but it would be helpful to know if it's... |
I have downloaded the silver light from this http://www.microsoft.com/silverlight//
I need to use this as custom toolbox in my Visual studio please let me know how to add this
and use the controls
| To use Silverlight controls in Visual Studio as a custom toolbox, you need to follow these steps to integrate Silverlight into your Visual Studio environment. Please keep in mind that Silverlight is no longer actively supported by Microsoft, and this may affect compatibility with newer versions of Visual Studio. Howeve... | 30,854 | [
{
"from": "human",
"value": "I have downloaded the silver light from this http://www.microsoft.com/silverlight//\nI need to use this as custom toolbox in my Visual studio please let me know how to add this\nand use the controls\n"
},
{
"from": "gpt",
"value": "To use Silverlight controls in Visu... |
Currently we call MiniDumpWriteDump with the MiniDumpNormal | MiniDumpWithIndirectlyReferencedMemory flags. That works just fine for internal builds in Debug configuration, but isn't giving as much information as we need in Release configuration.
In Release, the minidump data contains enough stack information for the d... | To enhance the amount of useful data captured in your minidump without resorting to the large size of `MiniDumpWithFullMemory`, you might consider a combination of the following flags:
1. **MiniDumpWithFullMemoryInfo**: This flag captures memory information, including the state of the memory heap at the time of the cr... | 35,451 | [
{
"from": "human",
"value": "Currently we call MiniDumpWriteDump with the MiniDumpNormal | MiniDumpWithIndirectlyReferencedMemory flags. That works just fine for internal builds in Debug configuration, but isn't giving as much information as we need in Release configuration.\nIn Release, the minidump data c... |
Or does it?
Should an object-oriented design use a language construct that exposes member data by default, if there is an equally useful construct that properly hides data members?
EDIT: One of the responders mentioned that if there's no invariant one can use a struct. That's an interesting observation: a struct is a d... | In object-oriented design, the general principle is to encapsulate data to protect the internal state of an object and to expose only what is necessary through a well-defined interface. This encapsulation is achieved through access modifiers (like `private`, `protected`, and `public` in languages such as C++, Java, and... | 35,417 | [
{
"from": "human",
"value": "Or does it?\nShould an object-oriented design use a language construct that exposes member data by default, if there is an equally useful construct that properly hides data members?\nEDIT: One of the responders mentioned that if there's no invariant one can use a struct. That's ... |
I am deploying a web application to a windows server 2003 machine.
The application uses WSE 3.0, and targets framework 3.5.
WSE is installed on the server under C:\Program Files(X86)\Microsoft WSE\v3.0.
WSE is installed in the GAC on the server also.
when I run the application I get the following error:
System.IO.FileN... | The error you are encountering, `System.IO.FileNotFoundException`, indicates that the .NET runtime is unable to find the `Microsoft.Web.Services3` assembly (WSE 3.0) or one of its dependencies on the server where your application is deployed. Here are several steps you can take to troubleshoot and resolve the issue:
1... | 33,294 | [
{
"from": "human",
"value": "I am deploying a web application to a windows server 2003 machine.\nThe application uses WSE 3.0, and targets framework 3.5.\nWSE is installed on the server under C:\\Program Files(X86)\\Microsoft WSE\\v3.0.\nWSE is installed in the GAC on the server also.\nwhen I run the applic... |
Is there any such thing as a virtual Lineprinter.I mean a software emulation of a printer, that outputs to screen.
I have a project to change the output of print job. My past experience with a lineprinter was tedious rounds of
loop:
print
walk down two flights
check the output
walk back up two flights
ed... | Yes, there are software solutions that can emulate line printers and redirect their output to a screen or a file instead of a physical printer. These tools can help you avoid the tedious physical process you described.
Here are a few approaches you can consider:
1. **Virtual Printer Software**: Some virtual printer s... | 34,866 | [
{
"from": "human",
"value": "Is there any such thing as a virtual Lineprinter.I mean a software emulation of a printer, that outputs to screen.\nI have a project to change the output of print job. My past experience with a lineprinter was tedious rounds of\nloop:\n print\n walk down two flights\n chec... |
I need my .net application to use the .html extension instead of .aspx
I'm converting a php app and there are external applications which depend on that extension to function.
What is the best way to do this?
Thanks
| To have your .NET application use the .html extension instead of .aspx files, you'll need to configure your application to handle requests for .html files and serve the appropriate content. Below are a few different methods to achieve this, depending on the specifics of your application and requirements:
### 1. Using ... | 27,701 | [
{
"from": "human",
"value": "I need my .net application to use the .html extension instead of .aspx \nI'm converting a php app and there are external applications which depend on that extension to function.\nWhat is the best way to do this?\nThanks\n"
},
{
"from": "gpt",
"value": "To have your ... |
The following code compiles correctly under VC++ 8 on XPSP3, but running it causes a runtime error.
My header looks like:
#include <stdexcept>
#include <iterator>
#include <list>
template<typename T>
class test_generator
{
public:
typedef T result_type;
//constructor
test_generator()
{
s... | The issue you're experiencing stems from the use of the `rand` function in the `std::generate_n` call within the `test_generator` class's constructor. The `rand` function is a C-style function that generates a random integer, but it does not take any parameters and does not have a defined behavior in terms of how it in... | 32,894 | [
{
"from": "human",
"value": "The following code compiles correctly under VC++ 8 on XPSP3, but running it causes a runtime error. \nMy header looks like:\n#include <stdexcept>\n#include <iterator>\n#include <list>\n\n\ntemplate<typename T>\nclass test_generator\n{\n public:\n typedef T result_type;\n\n... |
I have trouble using Perl grep() with a string that may contain chars that are interpreted as regular expressions quantifiers.
I got the following error when the grep pattern is "g++" because the '+' symbols
are interpreted as quantifiers. Here is the output of for program that follows:
1..3
ok 1 - grep, pattern not f... | The issue you're encountering arises because the `+` character in your pattern `"g++"` is being interpreted as a quantifier in a regular expression. To fix this, you'll want to escape the special characters in your pattern before using them in the regex.
You can use the `quotemeta` function, which escapes all non-wor... | 32,073 | [
{
"from": "human",
"value": "I have trouble using Perl grep() with a string that may contain chars that are interpreted as regular expressions quantifiers. \nI got the following error when the grep pattern is \"g++\" because the '+' symbols\nare interpreted as quantifiers. Here is the output of for program ... |
The Visual Basic 6.0 IDE checks for syntax errors on-the-fly. Every time it finds a syntax error, it pops up an alert dialog. This feature is driving me crazy, as every time I try to cut and paste in the middle of typing a statement, I have to deal with this pop-up.
Is there any way to disable this on-the-fly syntax ch... | In Visual Basic 6.0, the on-the-fly syntax checking feature can indeed be intrusive, especially when you're frequently cutting and pasting code. Unfortunately, there isn’t a direct setting to completely disable this feature in the IDE. However, there are a couple of workarounds you can try:
1. **Minimize Code Changes*... | 37,170 | [
{
"from": "human",
"value": "The Visual Basic 6.0 IDE checks for syntax errors on-the-fly. Every time it finds a syntax error, it pops up an alert dialog. This feature is driving me crazy, as every time I try to cut and paste in the middle of typing a statement, I have to deal with this pop-up.\nIs there an... |
I'm sure I'm going to have to write supporting javascript code to do this. I have an autocomplete extender set up that selects values from a database table, when a selection is made, i would like it to set the ID of the value selected to a hidden control. I can do that by handling a value change on the text box and m... | To achieve the functionality you're describing using an autocomplete extender with ASP.NET and JavaScript, you can indeed set it up to constrain the input of the text box so that it only accepts values from the autocomplete dropdown.
### Approach
1. **Use of the Autocomplete Extender**: The AJAX Control Toolkit's Au... | 25,627 | [
{
"from": "human",
"value": "I'm sure I'm going to have to write supporting javascript code to do this. I have an autocomplete extender set up that selects values from a database table, when a selection is made, i would like it to set the ID of the value selected to a hidden control. I can do that by hand... |
I'm writing a program that contains a generational garbage collector. There are just two generations. What I wonder is: When doing a full collection, do I gain anything (performance-wise) by first collecting the younger objects, promoting the survivors to the old generation, and then collecting the old generation, or s... | In a generational garbage collector with two generations, the idea of separate collections for the young and old generations is grounded in the observation that most objects have a short lifespan (i.e., they die young). This behavior leads to several benefits when implementing a two-step collection method:
### Advanta... | 30,925 | [
{
"from": "human",
"value": "I'm writing a program that contains a generational garbage collector. There are just two generations. What I wonder is: When doing a full collection, do I gain anything (performance-wise) by first collecting the younger objects, promoting the survivors to the old generation, and... |
Say I'm mapping a simple object to a table that contains duplicate records and I want to allow duplicates in my code. I don't need to update/insert/delete on this table, only display the records.
Is there a way that I can put a fake (generated) ID column in my mapping file to trick NHibernate into thinking the rows ar... | Yes, you can achieve this in NHibernate by mapping your entity with a generated ID that acts as a surrogate key, allowing you to treat the records as unique without actually modifying the underlying data.
Here's a general approach to create a fake ID using an autogenerated value for display purposes:
1. **Create a DT... | 35,210 | [
{
"from": "human",
"value": "Say I'm mapping a simple object to a table that contains duplicate records and I want to allow duplicates in my code. I don't need to update/insert/delete on this table, only display the records.\nIs there a way that I can put a fake (generated) ID column in my mapping file to ... |
A site I am working on that is built using PHP is sometimes showing a completely blank page.
There are no error messages on the client or on the server.
The same page may display sometimes but not others.
All pages are working fine in IE7, Firefox 3, Safari and Opera.
All pages are XHTML with this meta element:
<meta h... | Yes, there are several known issues that can lead to Internet Explorer 6 (IE6) displaying a blank page while other browsers render content correctly. Given the information you provided, here are some common causes and solutions:
### Possible Causes
1. **XHTML and MIME Type**:
- As you've pointed out, serving XHTML... | 34,500 | [
{
"from": "human",
"value": "A site I am working on that is built using PHP is sometimes showing a completely blank page.\nThere are no error messages on the client or on the server.\nThe same page may display sometimes but not others.\nAll pages are working fine in IE7, Firefox 3, Safari and Opera.\nAll pa... |
This is a winforms application.
In windows, I want the user to click and button, and then a popup should make the user select the path of where they want to save the file.
| To implement a file save dialog in a WinForms application where a user can click a button to select a path for saving a file, you can use the `SaveFileDialog` class provided by .NET. Below is a step-by-step example that demonstrates how to do this.
### Step-by-Step Implementation
1. **Create a WinForms Application:**... | 24,742 | [
{
"from": "human",
"value": "This is a winforms application.\nIn windows, I want the user to click and button, and then a popup should make the user select the path of where they want to save the file.\n"
},
{
"from": "gpt",
"value": "To implement a file save dialog in a WinForms application whe... |
We have a multi-tiered/hierarchical YUI menu activated via a YUI menu button. Everything in this menu works pretty well. If you mouseover a menu item with a submenu, the submenu appears as expected. You can select an item from this submenu just fine.
The problem, however, is that you can also click on the parent i... | To achieve the desired behavior where clicking on a parent menu item opens its submenu instead of closing the entire menu, you can modify the click event handling for the parent menu items. Below are steps and code snippets to help you implement this functionality:
### 1. Prevent Default Behavior
You will need to ove... | 32,505 | [
{
"from": "human",
"value": "We have a multi-tiered/hierarchical YUI menu activated via a YUI menu button. Everything in this menu works pretty well. If you mouseover a menu item with a submenu, the submenu appears as expected. You can select an item from this submenu just fine. \nThe problem, however, ... |
want to pass boost::bind to a method expecting a plain function pointer (same signature).
typedef void TriggerProc_type(Variable*,void*);
void InitVariable(TriggerProc_type *proc);
boost::function<void (Variable*, void*)> triggerProc ...
InitVariable(triggerProc);
error C2664: 'InitVariable' : cannot convert parameter... | The issue you're facing arises from the fact that `boost::function` and bound function objects cannot be converted implicitly to a plain function pointer type. This is due to the fact that function pointers are not the same as objects like `boost::function` or `boost::bind`.
The `InitVariable` function expects a funct... | 34,302 | [
{
"from": "human",
"value": "want to pass boost::bind to a method expecting a plain function pointer (same signature).\ntypedef void TriggerProc_type(Variable*,void*);\nvoid InitVariable(TriggerProc_type *proc);\nboost::function<void (Variable*, void*)> triggerProc ...\nInitVariable(triggerProc);\n\nerror C... |
I maintain a vb.net forms application that prints various labels to label printers. (Label printers are just like any printer, just smaller print area/lower resolution)
The system uses a legacy printing method that's supported in the printer hardware, but has been out of general use for over a decade. I'm adding lo... | When it comes to designing print layouts for VB.NET applications, there are several options, both commercial and open-source, that can help simplify the process of creating and managing print documents. Below are some suggestions that meet your criteria:
### Commercial Options
1. **Stimulsoft Reports**:
- Stimulso... | 33,484 | [
{
"from": "human",
"value": "I maintain a vb.net forms application that prints various labels to label printers. (Label printers are just like any printer, just smaller print area/lower resolution) \nThe system uses a legacy printing method that's supported in the printer hardware, but has been out of gen... |
My colleague has written a DLL which drives Excel.
When I reference his DLL in my .NET app, I get a warning:
The dependency 'Microsoft.Office.Interop.Excel' could not be found.
My app will compile.
However, when I get to the bit that uses my colleague's DLL to access Excel, an exception is thrown, with the message ab... | It looks like you've already identified the solution to your issue, but let's summarize the steps for clarity in case others find themselves in a similar situation.
### Problem Summary
When trying to use a colleague's DLL that drives Excel in a .NET application, you encountered a warning indicating that the dependency... | 35,352 | [
{
"from": "human",
"value": "My colleague has written a DLL which drives Excel.\nWhen I reference his DLL in my .NET app, I get a warning:\nThe dependency 'Microsoft.Office.Interop.Excel' could not be found. \n\nMy app will compile.\nHowever, when I get to the bit that uses my colleague's DLL to access Exce... |
Does anyone know of any specific DSL implementations used to import legacy Oracle database schemas. I have tried to just run db:schema:dump on my existing db I want to port to a new ruby app. However, the rake dies about halfway through with out any error. It kinda just locks up. I started looking for the best way to t... | Importing legacy Oracle database schemas into a Ruby on Rails application can be tricky, especially if you're running into issues with the `db:schema:dump` task. Here are a few strategies you can consider to make this process smoother:
### 1. Use a Database Migration Tool
There are tools that can help migrate Oracle ... | 34,446 | [
{
"from": "human",
"value": "Does anyone know of any specific DSL implementations used to import legacy Oracle database schemas. I have tried to just run db:schema:dump on my existing db I want to port to a new ruby app. However, the rake dies about halfway through with out any error. It kinda just locks up... |
I'm advising a friend who manages a SQL 2k5 box that has several users who have dbo access to multiple databases. The problem is:
These users haven't had their passwords changed for some months,
These users put their IDs into applications and the applications run as DBO.
So - aside from the obvious dbo rights to add/... | Having `dbo` (database owner) access to a SQL Server database grants users extensive privileges that can lead to significant security risks, especially in SQL Server 2005, where default configurations may allow certain actions that can compromise the entire server or other databases. Below are some potential dangers an... | 34,534 | [
{
"from": "human",
"value": "I'm advising a friend who manages a SQL 2k5 box that has several users who have dbo access to multiple databases. The problem is:\n\nThese users haven't had their passwords changed for some months,\nThese users put their IDs into applications and the applications run as DBO.\n\n... |
I know how to fill an std::vector with non-trivial initial values, e.g. sequence numbers:
void IndexArray( unsigned int length, std::vector<unsigned int>& v )
{
v.resize(length);
for ( unsigned int i = 0; i < length; ++i )
{
v[i] = i;
}
}
But this is a for-loop. Is there an elegant way to do th... | Yes, you can achieve this in a more concise way using the Standard Template Library (STL) with the help of `std::iota` from the `<numeric>` header. This function fills a range with sequentially increasing values. Here's how you can use it to fill an `std::vector` with index values:
```cpp
#include <vector>
#include <n... | 34,947 | [
{
"from": "human",
"value": "I know how to fill an std::vector with non-trivial initial values, e.g. sequence numbers:\nvoid IndexArray( unsigned int length, std::vector<unsigned int>& v )\n{\n v.resize(length);\n for ( unsigned int i = 0; i < length; ++i )\n {\n v[i] = i;\n }\n}\n\nBut t... |
My organization is using CppUnit and I am trying to run the same test using different parameters. Running a loop inside the test is not a good option as any failure will abort the test. I have looked at TestDecorator and TestCaller but neither seems to really fit. Code samples would be helpful.
| If you want to run the same test with different parameters in CppUnit without the risk of aborting the entire test on failure, one approach is to create a custom test suite that utilizes `CppUnit::TestSuite` along with `CppUnit::TestCaller` to encapsulate each parameter set as a separate test case. This way, each run c... | 34,383 | [
{
"from": "human",
"value": "My organization is using CppUnit and I am trying to run the same test using different parameters. Running a loop inside the test is not a good option as any failure will abort the test. I have looked at TestDecorator and TestCaller but neither seems to really fit. Code samples w... |
The UPSERT operation either updates or inserts a row in a table, depending if the table already has a row that matches the data:
if table t has a row exists that has key X:
update t set mystuff... where mykey=X
else
insert into t mystuff...
Since Oracle doesn't have a specific UPSERT statement, what's the best... | In Oracle, you can achieve the UPSERT functionality using the `MERGE` statement. The `MERGE` statement allows you to combine both the `UPDATE` and `INSERT` operations in a single SQL statement, depending on whether the target table contains a row that matches the specified criteria.
Here's the general syntax of the `M... | 35,538 | [
{
"from": "human",
"value": "The UPSERT operation either updates or inserts a row in a table, depending if the table already has a row that matches the data:\nif table t has a row exists that has key X:\n update t set mystuff... where mykey=X\nelse\n insert into t mystuff...\n\nSince Oracle doesn't ha... |
So my code is below. I'm not getting any errors and it places everything in the node just fine. But based on my debug statements Everytime anything is inserted it's finding the root. I'm not sure if that is right. But according to output file for the assignment, my answers are different when it comes to the height ... | It looks like you're working on a binary tree implementation in C++. Let's address some concerns regarding your `insert` function and `height` calculation.
### Insert Function
From the provided code, the `insert` function seems to be implemented correctly as a standard binary search tree (BST) insertion algorithm. Wh... | 32,513 | [
{
"from": "human",
"value": "So my code is below. I'm not getting any errors and it places everything in the node just fine. But based on my debug statements Everytime anything is inserted it's finding the root. I'm not sure if that is right. But according to output file for the assignment, my answers a... |
When I launch perfmon and try to add a counter, the displayed performance objects are all numbers. How can I reset these Performance objects?
| If you're seeing numerical values for the performance objects in Windows Performance Monitor (PerfMon) instead of their descriptive names, it usually indicates an issue with the Performance Counter registry settings or the counters being corrupted. You can follow these steps to reset or rebuild the Performance Counters... | 33,879 | [
{
"from": "human",
"value": "When I launch perfmon and try to add a counter, the displayed performance objects are all numbers. How can I reset these Performance objects?\n"
},
{
"from": "gpt",
"value": "If you're seeing numerical values for the performance objects in Windows Performance Monitor... |
I am working on a simple notification service that will be used to deliver messages to the users surfing a website. The notifications do not have to be sent in real time but it might be a better user experience if they happened more frequently than say every 5 minutes. The data being sent to and from the client is not ... | It sounds like you've made a well-considered decision to go with a polling solution for your notification service. Given your context, here are some points to keep in mind regarding both polling and push mechanisms:
### Polling
- **Simplicity**: Polling is often simpler to implement and requires less complex infrastru... | 32,642 | [
{
"from": "human",
"value": "I am working on a simple notification service that will be used to deliver messages to the users surfing a website. The notifications do not have to be sent in real time but it might be a better user experience if they happened more frequently than say every 5 minutes. The data ... |
I have an application with my object types that inherit from a base class that contains the majority of properties for the application objects. All the object types are stored in one table in the database. The "ClassType" column determines what object type I cast the SqlDataReader row to.
Here is my current impleme... | Yes, your current implementation is functional, but there are a few improvements you can consider for better maintainability, scalability, and readability. Here are some recommendations:
1. **Use a Factory Method or Abstract Factory Pattern**: Instead of using a switch statement, you can create a factory method that e... | 34,497 | [
{
"from": "human",
"value": "I have an application with my object types that inherit from a base class that contains the majority of properties for the application objects. All the object types are stored in one table in the database. The \"ClassType\" column determines what object type I cast the SqlData... |
In an Access (2002 / 2003) data-bound form, a turn of the mousewheel moves to the next/previous record, even if the cursor is inside a multiline text field or a listbox. This is a major annoyance to users and cannot be turned off easily.
I recently discovered a DLL called MouseHook (http://www.lebans.com/mousewheelonof... | Unfortunately, dealing with mouse wheel behavior in Access forms, especially when external ActiveX controls are involved, can be quite challenging. The MouseHook DLL you mentioned is indeed a good tool for general use, but it does have limitations when it comes to managing the behavior of ActiveX controls like FlexGrid... | 35,434 | [
{
"from": "human",
"value": "In an Access (2002 / 2003) data-bound form, a turn of the mousewheel moves to the next/previous record, even if the cursor is inside a multiline text field or a listbox. This is a major annoyance to users and cannot be turned off easily.\nI recently discovered a DLL called Mouse... |
I am using ASP.NET Dynamic Data and have a custom page.
In this page I have a handle on the DetailsView inserted event where I would like to do something based on the value of the recently updated object. However, I can't put the event handling in the model class of the respective object because it is also based on th... | In ASP.NET Dynamic Data, if you want to handle the `Inserted` event of a `DetailsView` and access both the recently updated object and an additional form element from your custom page, you can achieve this by leveraging the `DetailsView`'s `DataItem` property after the insertion is complete.
Here's a step-by-step guid... | 33,355 | [
{
"from": "human",
"value": "I am using ASP.NET Dynamic Data and have a custom page.\nIn this page I have a handle on the DetailsView inserted event where I would like to do something based on the value of the recently updated object. However, I can't put the event handling in the model class of the respec... |
I'm trying to find a way to generate an enums class dynamically from lookup tables in a database and still have the convenience of a normal class (i.e. intellisense).
I've spent the past few hours trying to figure out how to get a custom BuildProvider to work inside an ASP.NET Web Application. The code works perfect... | Generating enums dynamically from a database lookup table and using them with IntelliSense in an ASP.NET Web Application can be challenging, especially because Web Application projects compile all code at build time rather than at runtime. Here are a few strategies that you might find helpful:
### 1. **Code Generation... | 33,406 | [
{
"from": "human",
"value": "I'm trying to find a way to generate an enums class dynamically from lookup tables in a database and still have the convenience of a normal class (i.e. intellisense). \nI've spent the past few hours trying to figure out how to get a custom BuildProvider to work inside an ASP.NE... |
When I enable common control visual style support (InitCommonControls()) and I am using any theme other then Windows Classic Theme, buttons inside a group box appear with a black border with square corners.
Windows Classic Theme appears normal, as well as when I turn off visual styling.
I am using the following code:
... | The issue you are experiencing with the black border around buttons inside a group box when using visual styles in a Windows application seems to be a common problem that arises when mixing common controls with non-standard styles, especially when creating controls programmatically using `CreateWindow` instead of using... | 31,017 | [
{
"from": "human",
"value": "When I enable common control visual style support (InitCommonControls()) and I am using any theme other then Windows Classic Theme, buttons inside a group box appear with a black border with square corners. \nWindows Classic Theme appears normal, as well as when I turn off visua... |
I am writing an internal application where we let users to do a few different types of queries.
The application allows users to search a database by either of the following keys:
employeeId
name (first or last)
companyId
status (workingFullTime, sickLeave, maternityLeave, etc)
The brute force way is to simply make o... | Hi Joakim!
Creating a flexible search functionality with a single text box can enhance the user experience significantly. To achieve this, you can create a method that uses regular expressions to determine the type of query based on the input string. Below is an example of how you might implement this in C#.
### Step... | 33,218 | [
{
"from": "human",
"value": "I am writing an internal application where we let users to do a few different types of queries. \nThe application allows users to search a database by either of the following keys:\n\nemployeeId\nname (first or last)\ncompanyId\nstatus (workingFullTime, sickLeave, maternityLeave... |
I need to do a join with a table/result-set/whatever that has the integers n to m inclusive. Is there a trivial way to get that without just building the table?
(BTW what would that type of construct be called, a "Meta query"?)
m-n is bounded to something reasonable ( < 1000's)
| To create a range of integers from \( n \) to \( m \) for a join in SQL without explicitly building a temporary table, you can use a Common Table Expression (CTE) or a series-generating function, depending on your SQL dialect. This method generates the integers on-the-fly.
Here’s how you can do it in different SQL da... | 34,972 | [
{
"from": "human",
"value": "I need to do a join with a table/result-set/whatever that has the integers n to m inclusive. Is there a trivial way to get that without just building the table?\n(BTW what would that type of construct be called, a \"Meta query\"?)\nm-n is bounded to something reasonable ( < 1000... |
I found out how to get the content of the NSPasteboard, and to copy it into my active application. I haven't found a way to paste it into another application, just how to paste it into my current application.
If you're wondering why I would want to do this, I'm researching if there is a way to improve Jumpcut open sour... | To programmatically paste content from the NSPasteboard into another application on macOS, you'll need to simulate key presses that correspond to the paste operation for that application. Since you've mentioned that you're working with Jumpcut and you have issues with different key bindings (like `Cmd+V` for macOS apps... | 33,702 | [
{
"from": "human",
"value": "I found out how to get the content of the NSPasteboard, and to copy it into my active application. I haven't found a way to paste it into another application, just how to paste it into my current application.\nIf you're wondering why I would want to do this, I'm researching if t... |
I need to build a function which parses the domain from a URL.
So, with
http://google.com/dhasjkdas/sadsdds/sdda/sdads.html
or
http://www.google.com/dhasjkdas/sadsdds/sdda/sdads.html
it should return google.com
with
http://google.co.uk/dhasjkdas/sadsdds/sdda/sdads.html
it should return google.co.uk.
| You can create a function in Python to parse the domain from a given URL using the `urlparse` module from the `urllib.parse` library. Here’s a function that extracts the main domain from the input URL:
```python
from urllib.parse import urlparse
def get_domain(url):
# Parse the URL
parsed_url = urlparse(url)
... | 36,584 | [
{
"from": "human",
"value": "I need to build a function which parses the domain from a URL.\nSo, with\nhttp://google.com/dhasjkdas/sadsdds/sdda/sdads.html\n\nor\nhttp://www.google.com/dhasjkdas/sadsdds/sdda/sdads.html\n\nit should return google.com\nwith\nhttp://google.co.uk/dhasjkdas/sadsdds/sdda/sdads.htm... |
Trying to transfer servers but a connection string is encrypted and there is no machinekey set in the web.config. Is there anyway to find out what the machinekey was on the old server so we can set it on the new server?
| When migrating an application that uses ASP.NET forms authentication, view state, or other features that rely on machine keys, it's essential to ensure that the machine key settings are consistent across servers. If the machine key is not explicitly defined in the `web.config` file, ASP.NET generates a default machine ... | 34,065 | [
{
"from": "human",
"value": "Trying to transfer servers but a connection string is encrypted and there is no machinekey set in the web.config. Is there anyway to find out what the machinekey was on the old server so we can set it on the new server?\n"
},
{
"from": "gpt",
"value": "When migratin... |
I try to get rounded corners on a UIImage, what I read so far, the easiest way is to use a mask images. For this I used code from TheElements iPhone Example and some image resize code I found. My problem is that resizedImage is always nil and I don't find the error...
- (UIImage *)imageByScalingProportionallyToSize:(CG... | It looks like you're trying to create a UIImage with rounded corners using a mask image, but you're encountering an issue where `resizedImage` is always `nil`. Let's troubleshoot the code step by step and make some suggestions to help you resolve the problem.
### Potential Issues and Fixes
1. **Bitmap Context Creatio... | 29,469 | [
{
"from": "human",
"value": "I try to get rounded corners on a UIImage, what I read so far, the easiest way is to use a mask images. For this I used code from TheElements iPhone Example and some image resize code I found. My problem is that resizedImage is always nil and I don't find the error...\n- (UIImag... |
I've begun to the the built-in TraceSource and TraceListener classes and I would like to modify the output format of the events independently of the TraceSources and TraceListeners. It seems that the TraceListeners apply their own formatting. Is it possible to completely change the formatting without creating a new c... | Yes, you can modify the output format of tracing events without creating a new class for each `TraceListener`. One effective way to do this is by using a custom `TraceListener` that formats the output the way you want. However, if you want to avoid duplicating code for each `TraceListener`, you can centralize your form... | 33,859 | [
{
"from": "human",
"value": "I've begun to the the built-in TraceSource and TraceListener classes and I would like to modify the output format of the events independently of the TraceSources and TraceListeners. It seems that the TraceListeners apply their own formatting. Is it possible to completely chang... |
I have a solution in Visual Studio 2008 which has multiple projects. One of the projects is a WCF project. Sometimes I just want to debug other projects, but when I press F5, Visual Studio has wcfsvchost.exe launched to host the WCF project even it is not "StartUp Project".
Currently, every time I debugging other proj... | When you are working with a solution in Visual Studio 2008 that includes multiple projects, and you want to debug other projects without the WCF project being hosted (which causes `wcfsvchost.exe` to launch), there are a couple of approaches you can take to mitigate this issue without needing to unload the WCF project ... | 34,595 | [
{
"from": "human",
"value": "I have a solution in Visual Studio 2008 which has multiple projects. One of the projects is a WCF project. Sometimes I just want to debug other projects, but when I press F5, Visual Studio has wcfsvchost.exe launched to host the WCF project even it is not \"StartUp Project\". \n... |
I'm creating a CSS editor and am trying to create a regular expression that can get data from a CSS document. This regex works if I have one property but I can't get it to work for all properties. I'm using preg/perl syntax in PHP.
Regex
(?<selector>[A-Za-z]+[\s]*)[\s]*{[\s]*((?<properties>[A-Za-z0-9-_]+)[\s]*:[\s]*(?<... | Creating a regex pattern that captures multiple properties and values in CSS can be tricky, especially since CSS can have a variety of syntaxes (including vendor prefixes, spaces, etc.). In your case, the main issue with the regex you've provided is that it doesn't allow for the correct capturing of multiple properties... | 33,051 | [
{
"from": "human",
"value": "I'm creating a CSS editor and am trying to create a regular expression that can get data from a CSS document. This regex works if I have one property but I can't get it to work for all properties. I'm using preg/perl syntax in PHP.\nRegex\n(?<selector>[A-Za-z]+[\\s]*)[\\s]*{[\\s... |
digging around subsonic, i came across this
link text
good article but have some ?'s
now i want the option to return either a IList or Dataset, would I create an abstarct factory for this, if so can I have one generic method which would take in either IList or Dataset as a ref parameter and populate the passed in objec... | In your scenario, where you want the option to return either an `IList` or a `DataSet`, using an Abstract Factory pattern is indeed a valid approach. However, let's break down your questions and considerations more thoroughly.
### Abstract Factory for IList or DataSet
1. **Abstract Factory Pattern**: You can create a... | 31,782 | [
{
"from": "human",
"value": "digging around subsonic, i came across this\nlink text\ngood article but have some ?'s\nnow i want the option to return either a IList or Dataset, would I create an abstarct factory for this, if so can I have one generic method which would take in either IList or Dataset as a re... |
Does anyone have any info on creating/drawing a customised ListView object?
Currently Im working on a project that requires a customised look and feel within the application. I am using a standard (Windows.Forms) ListView which is not in the same style as the rest of the GUI. We are NOT using a toolbox for custom contr... | Creating a customized `ListView` in a Windows Forms application requires a combination of owner-draw techniques and careful handling of the underlying data and user interface elements. Below, I'll provide an overview of how to customize the drawing for a `ListView`, including scroll bars and column headers.
### Step 1... | 31,196 | [
{
"from": "human",
"value": "Does anyone have any info on creating/drawing a customised ListView object?\nCurrently Im working on a project that requires a customised look and feel within the application. I am using a standard (Windows.Forms) ListView which is not in the same style as the rest of the GUI. W... |
I'm using th WebBrowser control in the .net 2.0 framework. Is it possible to change the printing behavior so it always prints to the default printer, without showing any dialog to the user? This is for a kiosk so there will always be a printer directly connected to the Kiosk, and printing should be seemless to the use... | In the .NET 2.0 framework, the `WebBrowser` control does not provide built-in support to directly control the printing behavior to automatically print to the default printer without showing a dialog. However, you can achieve this by using the `PrintDocument` class along with the `WebBrowser` control to capture the HTML... | 28,796 | [
{
"from": "human",
"value": "I'm using th WebBrowser control in the .net 2.0 framework. Is it possible to change the printing behavior so it always prints to the default printer, without showing any dialog to the user? This is for a kiosk so there will always be a printer directly connected to the Kiosk, a... |
I have an ASP.NET 1.1 application that uses the following code to write out a file in the response:
Dim objStream As Object
objStream = Server.CreateObject("ADODB.Stream")
objStream.open()
objStream.type = 1
objStream.loadfromfile(localfile)
Response.BinaryWrite(objStream.read)
This code is called by a pop up window t... | The issue you're encountering with the ASP.NET 1.1 application when transitioning from Internet Explorer 6 to Internet Explorer 7 may be related to changes in how IE7 handles file downloads and pop-up windows. Below are some suggestions to help you troubleshoot and resolve this issue:
### Suggestions:
1. **Ensure Pro... | 35,025 | [
{
"from": "human",
"value": "I have an ASP.NET 1.1 application that uses the following code to write out a file in the response:\nDim objStream As Object\nobjStream = Server.CreateObject(\"ADODB.Stream\")\nobjStream.open()\nobjStream.type = 1\nobjStream.loadfromfile(localfile)\nResponse.BinaryWrite(objStrea... |
Windows NLB works great and removes computer from the cluster when the computer is dead.
But what happens if the application dies but the server still works fine? How have you solved this issue?
Thanks
| Windows Network Load Balancing (NLB) is designed to distribute network traffic across multiple servers. However, it has limitations, particularly in scenarios where the application on a server crashes or becomes unresponsive while the server itself remains operational. In such cases, NLB will not remove the server from... | 34,884 | [
{
"from": "human",
"value": "Windows NLB works great and removes computer from the cluster when the computer is dead.\nBut what happens if the application dies but the server still works fine? How have you solved this issue?\nThanks\n"
},
{
"from": "gpt",
"value": "Windows Network Load Balancing... |
Excuting the line of SQL:
SELECT *
INTO assignment_20081120
FROM assignment ;
against a database in oracle to back up a table called assignment gives me the following ORACLE error:
ORA-00905: Missing keyword
| The error ORA-00905: Missing keyword indicates that there is a syntax issue with your SQL statement. The syntax you're trying to use is not valid for Oracle databases. In Oracle SQL, the `SELECT INTO` statement is used differently than in other SQL databases.
To create a new table and copy the data from the existing t... | 37,515 | [
{
"from": "human",
"value": "Excuting the line of SQL:\nSELECT * \n INTO assignment_20081120 \n FROM assignment ;\n\nagainst a database in oracle to back up a table called assignment gives me the following ORACLE error: \nORA-00905: Missing keyword\n"
},
{
"from": "gpt",
"value": "The error OR... |
Where can I find a list of all the C# Color constants and the associated R,G,B (Red, Green, Blue) values?
e.g.
Color.White == (255,255,255)
Color.Black == (0,0,0)
etc...
| In C#, the `System.Drawing.Color` structure includes a variety of predefined color constants. Each color constant corresponds to an RGB value. You can find a complete list of these colors in the official .NET documentation or directly in the source code of the .NET Framework.
Here’s a list of some common color constan... | 31,931 | [
{
"from": "human",
"value": "Where can I find a list of all the C# Color constants and the associated R,G,B (Red, Green, Blue) values?\ne.g.\nColor.White == (255,255,255)\nColor.Black == (0,0,0)\netc...\n"
},
{
"from": "gpt",
"value": "In C#, the `System.Drawing.Color` structure includes a varie... |
I have some text displaying in a larger font size than what it is supposed to. I used Firebug and it shows that the text is 12px as defined in the element's CSS. However Web Developer and CSSViewer both report that the text is 16px, which is what is currently displaying.
With all these tools I am unable to quickly dete... | When you encounter a discrepancy between the defined font size in your CSS and the rendered font size, it's essential to understand the source of the calculated styles effectively. Here are some steps and tools you can use to diagnose the issue more efficiently:
### 1. Use Developer Tools
Instead of relying solely on ... | 32,373 | [
{
"from": "human",
"value": "I have some text displaying in a larger font size than what it is supposed to. I used Firebug and it shows that the text is 12px as defined in the element's CSS. However Web Developer and CSSViewer both report that the text is 16px, which is what is currently displaying.\nWith a... |
In Windows XP, Microsoft took the decision to limit the number of half open connections in later service packs. Patching tcpip.sys was rumoured to fix this. Does such a limit exist in Windows 2008, and if so, is it configurable?
| Yes, Windows Server 2008 does impose limits on the number of half-open TCP connections, similar to earlier versions of Windows like Windows XP. This is primarily due to security concerns and the need to mitigate certain types of network attacks, such as SYN flood attacks.
In Windows 2008, the limit on half-open connec... | 36,360 | [
{
"from": "human",
"value": "In Windows XP, Microsoft took the decision to limit the number of half open connections in later service packs. Patching tcpip.sys was rumoured to fix this. Does such a limit exist in Windows 2008, and if so, is it configurable?\n"
},
{
"from": "gpt",
"value": "Yes, ... |
I'm looking for best practices to integrate log4net to SharePoint for web request, feature activation and all timer stuff.
I have several subprojects in my farm, and I would like to have only one Log4Net.config file.
[Edit]
Not only I need to configure log4net for the web application, which is easy to do (I use globa... | Integrating log4net with SharePoint for various logging purposes, including web requests, feature activations, event handlers, and timer jobs, can be achieved with careful consideration of how you manage your loggers, configurations, and initialization. Below are best practices and steps to effectively set this up:
##... | 32,105 | [
{
"from": "human",
"value": "I'm looking for best practices to integrate log4net to SharePoint for web request, feature activation and all timer stuff. \nI have several subprojects in my farm, and I would like to have only one Log4Net.config file.\n[Edit]\nNot only I need to configure log4net for the web a... |
I have the following tuple, which contains tuples:
MY_TUPLE = (
('A','Apple'),
('C','Carrot'),
('B','Banana'),
)
I'd like to sort this tuple based upon the second value contained in inner-tuples (i.e., sort Apple, Carrot, Banana rather than A, B, C).
Any thoughts?
| You can sort the outer tuple by the second element of the inner tuples by using the `sorted()` function along with a custom key. Here's how you can do it:
```python
MY_TUPLE = (
('A', 'Apple'),
('C', 'Carrot'),
('B', 'Banana'),
)
# Sorting based on the second element of the inner tuples
sorted_tuple = tup... | 37,368 | [
{
"from": "human",
"value": "I have the following tuple, which contains tuples:\nMY_TUPLE = (\n ('A','Apple'),\n ('C','Carrot'),\n ('B','Banana'),\n)\n\nI'd like to sort this tuple based upon the second value contained in inner-tuples (i.e., sort Apple, Carrot, Banana rather than A, B, C).\nAny tho... |
How can I debug a MinGW EXE with the Microsoft Visual C++ debugger?
| Debugging a MinGW-built executable (EXE) using the Microsoft Visual C++ (MSVC) debugger is not a straightforward process due to differences in debugging formats and symbols between the two environments. However, it is possible with some workarounds. Here’s how you can do it:
### Prerequisites
1. **Install MinGW**: En... | 31,798 | [
{
"from": "human",
"value": "How can I debug a MinGW EXE with the Microsoft Visual C++ debugger?\n"
},
{
"from": "gpt",
"value": "Debugging a MinGW-built executable (EXE) using the Microsoft Visual C++ (MSVC) debugger is not a straightforward process due to differences in debugging formats and s... |
So let's say you wanted to make a copy of a Web Form page within a .Net Project.
Is there an easier way than:
Copy Source Page
Page Source Page within project to get new page
Exclude Source Page
Rename code behind class for new page
Add Source Page Back
Sometimes I miss something obvious is there a better way to d... | Copying a Web Form page within a .NET project can indeed be a bit cumbersome if you're manually following the steps you listed. However, there are some strategies you can use to simplify the process:
### 1. Visual Studio Copy and Paste
You can use Visual Studio's built-in copy and paste functionality to streamline the... | 35,319 | [
{
"from": "human",
"value": "So let's say you wanted to make a copy of a Web Form page within a .Net Project. \nIs there an easier way than:\n\nCopy Source Page\nPage Source Page within project to get new page\nExclude Source Page \nRename code behind class for new page\nAdd Source Page Back\n\nSometimes I... |
Is it better to learn how to code AJAX without the use of an AJAX library? What are the advantages of coding from scratch over using a library such as jQuery?
See also:
What are some of the pros and cons of using jQuery?
| When it comes to learning AJAX, there are advantages and disadvantages to both coding from scratch and using a library like jQuery. Let's explore the benefits of learning AJAX without an AJAX library, as well as the pros and cons of using jQuery.
### Advantages of Learning AJAX from Scratch
1. **Understanding Core Co... | 31,109 | [
{
"from": "human",
"value": "Is it better to learn how to code AJAX without the use of an AJAX library? What are the advantages of coding from scratch over using a library such as jQuery?\nSee also:\nWhat are some of the pros and cons of using jQuery?\n"
},
{
"from": "gpt",
"value": "When it com... |
I'm working with an ASP.net 2.0 GridView control that is bound to the results of a sql query, so it looks something like this:
<asp:GridView ID="MySitesGridView" runat="server" AutoGenerateColumns="False" DataSourceID="InventoryDB" AllowSorting="True" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowCommand="G... | To achieve the requirement of combining values from two different columns into a hyperlink in an ASP.NET GridView control, you can use a `TemplateField` instead of a `BoundField`. The `TemplateField` allows you to create custom content, enabling you to concatenate the values from different columns for your hyperlink.
... | 34,198 | [
{
"from": "human",
"value": "I'm working with an ASP.net 2.0 GridView control that is bound to the results of a sql query, so it looks something like this:\n<asp:GridView ID=\"MySitesGridView\" runat=\"server\" AutoGenerateColumns=\"False\" DataSourceID=\"InventoryDB\" AllowSorting=\"True\" CellPadding=\"4\... |
I'm thinking of forming a Hackers Club at work. My idea is that we would meet monthly and at each meeting one member would present an interesting hack he had created. (The hacks presented wouldn't necessarily have to be software hacks; they could also be the sort of things you read about in MAKE magazine.)
There wou... | Forming a Hackers Club at work sounds like a fantastic idea! It encourages creativity, collaboration, and a sense of community among colleagues. Here are some tips and considerations based on similar initiatives:
### Planning and Structure
1. **Define Objectives:**
- Clearly outline the purpose of the club. Is it ... | 34,870 | [
{
"from": "human",
"value": "I'm thinking of forming a Hackers Club at work. My idea is that we would meet monthly and at each meeting one member would present an interesting hack he had created. (The hacks presented wouldn't necessarily have to be software hacks; they could also be the sort of things you... |
I would like to assign a drive letter to a GMail drive so that I could script some output to it. Are they any hacks to get this to work?
| Yes, you can assign a drive letter to Google Drive using various methods, allowing you to script outputs or manage files more conveniently. Here are a couple of ways to do this:
### Method 1: Use Google Drive for Desktop
Google Drive for Desktop allows you to sync your Google Drive files to your local computer. Once ... | 35,409 | [
{
"from": "human",
"value": "I would like to assign a drive letter to a GMail drive so that I could script some output to it. Are they any hacks to get this to work?\n"
},
{
"from": "gpt",
"value": "Yes, you can assign a drive letter to Google Drive using various methods, allowing you to script... |
I'm experimenting with the NavBar sample project for iPhone. When I tap on one of the rows in the table in the default view a new view slides in (so far so good). I want to remove the UINavigationBar bar at the top of the new view that slides in. How can I do this?
EDIT: I meant "UINavigationBar". Thanks to every... | To remove the `UINavigationBar` from the new view that slides in when you tap on a row in your table view, you can follow these steps:
1. **Use `UIViewController` Directly:** Instead of pushing a new `UIViewController` onto the navigation stack, you could present the new view controller modally without a navigation co... | 35,438 | [
{
"from": "human",
"value": "I'm experimenting with the NavBar sample project for iPhone. When I tap on one of the rows in the table in the default view a new view slides in (so far so good). I want to remove the UINavigationBar bar at the top of the new view that slides in. How can I do this? \nEDIT: I... |
How can I initialize a const / static array of structs as clearly as possible?
class SomeClass
{
struct MyStruct
{
public string label;
public int id;
};
const MyStruct[] MyArray = {
{"a", 1}
{"b", 5}
{"q", 29}
};
};
| To initialize a `const` or `static` array of structs in C#, you can use an array initializer. However, C# does not allow for an array of structs to be declared as `const`. Instead, you can declare the array as `static readonly`, which is a common practice for collections that should not change after initialization.
He... | 36,049 | [
{
"from": "human",
"value": "How can I initialize a const / static array of structs as clearly as possible?\nclass SomeClass\n{\n\n struct MyStruct\n {\n public string label;\n public int id;\n };\n\n const MyStruct[] MyArray = {\n {\"a\", 1}\n {\"b\", 5}\n ... |
I've made some performance improvements to my application's backend, and to show the benefit to the end users of the GUI, we've been using the Trace.axd page to take timings. (The frontend is .Net 1.1 and the backend is Java, connected via Web services.)
However, these timings show no difference between the old and the... | The issue you're encountering is not uncommon, particularly when dealing with distributed systems involving multiple technologies. The Trace.axd in ASP.NET primarily captures the timing metrics from the perspective of the ASP.NET application itself, which means that it may not accurately represent the total time taken ... | 31,833 | [
{
"from": "human",
"value": "I've made some performance improvements to my application's backend, and to show the benefit to the end users of the GUI, we've been using the Trace.axd page to take timings. (The frontend is .Net 1.1 and the backend is Java, connected via Web services.)\nHowever, these timings ... |
I've got a wxGrid that I populate dynamically. I'd like to store some information with each row that shouldn't be displayed to the user. What is the best way to associate data with a row? Should I just create a hidden column or is there a better way?
| Storing additional information associated with each row in a `wxGrid` that should not be displayed to the user can be accomplished in a few ways. Here are a couple of common approaches, along with their pros and cons:
### 1. Use a Hidden Column
**How It Works:**
You can create an additional column in the `wxGrid` th... | 33,086 | [
{
"from": "human",
"value": "I've got a wxGrid that I populate dynamically. I'd like to store some information with each row that shouldn't be displayed to the user. What is the best way to associate data with a row? Should I just create a hidden column or is there a better way?\n"
},
{
"from": "gpt... |
I run (and am presently completely overhauling) a website that deals with theater (njtheater.com if you're interested).
When I query a list of plays from the database, I'd like "The Merchant of Venice" to sort under the "M"s. Of course, when I display the name of the play, I need the "The" in front.
What the best way ... | To achieve your goal of sorting play titles correctly while still displaying them with the leading article ("The", "A", "An") when shown, you can use a couple of techniques. Here's a recommended approach for your database design and query:
### Database Design
1. **Title Column**: Store the full title of the play in a... | 32,905 | [
{
"from": "human",
"value": "I run (and am presently completely overhauling) a website that deals with theater (njtheater.com if you're interested).\nWhen I query a list of plays from the database, I'd like \"The Merchant of Venice\" to sort under the \"M\"s. Of course, when I display the name of the play,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.