instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am developing a CMS where the clients will need to upload files larger than 2mb - up to 10mb at least. I have changed the details in the php.ini file and I cannot see anywhere else that the problem might be. Any help? Cheers
When you're working with file uploads in PHP and you've already made changes to the `php.ini` file, there are several settings you might want to double-check to ensure that file uploads larger than 2MB are allowed. Here are the key configurations you should look at: 1. **Upload Size Settings**: - `upload_max_filesi...
19,997
[ { "from": "human", "value": "I am developing a CMS where the clients will need to upload files larger than 2mb - up to 10mb at least. I have changed the details in the php.ini file and I cannot see anywhere else that the problem might be. Any help?\nCheers\n" }, { "from": "gpt", "value": "When y...
I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to search/sort/filter based on user input. The data binding demo (http://msdn.microsoft.com/en-us/library/ms771319.aspx) u...
When deciding between `ListBox` and `ListView` in a WPF application, it's essential to consider the specific needs of your application. Both controls support data binding and item templates, but they have distinct features that make them suitable for different scenarios. Here are some pros and cons of each: ### ListBo...
23,343
[ { "from": "human", "value": "I'm considering either a ListBox or a ListView for a WPF application. It seems either supports data binding and item templates. My application has a simple list of items that I intend to be able to search/sort/filter based on user input. The data binding demo (http://msdn.mic...
I would like to create data visualizations in desktop apps, using frameworks, languages and libraries that help with this kind of task. Visualizations should be interactive: clickable, draggable, customizable, animated... What I would like to create is something similar to the examples seen here: http://www.visualcompl...
Creating interactive data visualizations can be achieved using a variety of frameworks and libraries across different programming languages and environments. Below, I've compiled a list of options starting from those that are closer to C++/Visual C++ to those that are quite different. I've also included some insights i...
14,897
[ { "from": "human", "value": "I would like to create data visualizations in desktop apps, using frameworks, languages and libraries that help with this kind of task. Visualizations should be interactive: clickable, draggable, customizable, animated...\nWhat I would like to create is something similar to the ...
If I have a source.c file with a struct: struct a { int i; struct b { int j; } }; How can this struct be used in another file (i.e. func.c)? Should I create a new header file, declare the struct there and include that header in func.c? Or should I define the whole struct in a header file and inclu...
To use the struct defined in `source.c` in another file like `func.c`, you should create a header file that contains the definition of the struct. This allows both `source.c` and `func.c` to include this header file and have access to the struct definition. ### Step-by-step Instructions: 1. **Create a Header File (e....
22,557
[ { "from": "human", "value": "If I have a source.c file with a struct:\nstruct a { \n int i;\n struct b {\n int j;\n }\n};\n\nHow can this struct be used in another file (i.e. func.c)?\nShould I create a new header file, declare the struct there and include that header in func.c?\nOr should I...
Hoi! I have a form I wish to submit, but I need to add the PHPSESSID, because some clients allow no cookies. There are several javascript functions on my page which displays a list of users (search, sort, open details), the page is generated by PHP. Now I am looking for an elegant way to have the PHPSESSID included in ...
Hi Basty! If you need to include the `PHPSESSID` in your form submissions for clients that do not allow cookies, there are a couple of approaches you can take. Since you've mentioned that adding it to the action URL or using hidden fields hasn't worked properly, let's explore some elegant solutions that should help yo...
20,907
[ { "from": "human", "value": "Hoi!\nI have a form I wish to submit, but I need to add the PHPSESSID, because some clients allow no cookies.\nThere are several javascript functions on my page which displays a list of users (search, sort, open details), the page is generated by PHP.\nNow I am looking for an el...
In Enterprise Manager you could script all SPs in a database through the right click menu, is there a way to do it in Management Studio?
Yes, in SQL Server Management Studio (SSMS), you can script all stored procedures in a database using the following method: 1. **Connect to your SQL Server instance** using SSMS. 2. **Expand the database** where the stored procedures are located in the Object Explorer. 3. Navigate to the **"Programmability"** folder. ...
24,890
[ { "from": "human", "value": "In Enterprise Manager you could script all SPs in a database through the right click menu, is there a way to do it in Management Studio?\n" }, { "from": "gpt", "value": "Yes, in SQL Server Management Studio (SSMS), you can script all stored procedures in a database u...
I created an ObjectInputSteam and ObjectOutputStream on a blocking SocketChannel and am trying to read and write concurrently. My code is something like this: socketChannel = SocketChannel.open(destNode); objectOutputStream = new ObjectOutputStream(Channels.newOutputStream(socketChannel)); objectInputStream = new Obje...
The issue you are facing is related to how `SocketChannel` works in blocking mode when used with `ObjectInputStream` and `ObjectOutputStream`. When you create `ObjectInputStream` and `ObjectOutputStream`, they handle synchronization using the underlying `SocketChannel`, which leads to the blocking behavior you observe....
19,411
[ { "from": "human", "value": "I created an ObjectInputSteam and ObjectOutputStream on a blocking SocketChannel and am trying to read and write concurrently. My code is something like this:\nsocketChannel = SocketChannel.open(destNode);\nobjectOutputStream = new ObjectOutputStream(Channels.newOutputStream(so...
I have the following function that is pulling data from a database. The ajax call is working correctly. How can I send the tab delimited data in my success function to the user? Setting the contect type to "application/vnd.ms-excel" didn't work. The alert on success shows the correctly formatted data. function...
It looks like you've already found a solution to your requirement of exporting data to Excel without page redirection by using an iframe. This is a common approach to handle such scenarios. Since you mentioned that your initial AJAX call and data retrieval were successful, but you wanted to avoid page redirection, let ...
21,791
[ { "from": "human", "value": "I have the following function that is pulling data from a database. The ajax call is working correctly. How can I send the tab delimited data in my success function to the user? Setting the contect type to \"application/vnd.ms-excel\" didn't work. The alert on success shows ...
I have a WCF service hosted for internal clients - we have control of all the clients. We will therefore be using a data contracts library to negate the need for proxy generation. I would like to use some readonly properties and have some datacontracts without default constructors. Thanks for your help...
Certainly! When creating Data Contracts for WCF services without requiring proxy generation, it's common to use a shared library that defines your data contracts. This allows both the server and client applications to reference the same types. Below are some guidelines and examples that cover your requirements, such as...
16,008
[ { "from": "human", "value": "I have a WCF service hosted for internal clients - we have control of all the clients. We will therefore be using a data contracts library to negate the need for proxy generation. I would like to use some readonly properties and have some datacontracts without default construc...
I am building on C++ dll, by writing code in C#. I get an error, saying LoaderLock was detected Message: Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang. I tried serachi...
The error message you're seeing, regarding "LoaderLock," typically occurs when you try to execute managed code (e.g., C#) from within a special function of a DLL (such as `DllMain`). This is problematic because the Windows loader does not expect managed execution to occur in certain contexts, which can lead to deadlock...
18,788
[ { "from": "human", "value": "I am building on C++ dll, by writing code in C#.\nI get an error, saying \n\nLoaderLock was detected Message:\n Attempting managed execution inside OS\n Loader lock. Do not attempt to run\n managed code inside a DllMain or image\n initialization function since doing so\n ca...
How would I go about adding enctype="multipart/form-data" to a form that is generated by using <% Html.BeginForm(); %>?
To add `enctype="multipart/form-data"` to a form created using the `Html.BeginForm()` helper method in ASP.NET MVC, you need to specify the `htmlAttributes` parameter. The `Html.BeginForm()` method allows you to pass an anonymous object with HTML attributes, where you can include the `enctype` attribute. Here's how yo...
21,714
[ { "from": "human", "value": "How would I go about adding enctype=\"multipart/form-data\" to a form that is generated by using <% Html.BeginForm(); %>?\n" }, { "from": "gpt", "value": "To add `enctype=\"multipart/form-data\"` to a form created using the `Html.BeginForm()` helper method in ASP.NET...
A common solution to building a model of a system which consists of many items of different types is to create a modular system, where each module is responsible for particular type. For example, there will be module for wombats WombatModule:IModule, where IModule interface has methods like GetCount() (to find number o...
You’ve raised a crucial topic in software architecture, particularly concerning the trade-offs between a modular approach and a more object-oriented approach when modeling systems with various item types. Each approach has its pros and cons depending on the specific needs and context of the application. Here are severa...
19,894
[ { "from": "human", "value": "A common solution to building a model of a system which consists of many items of different types is to create a modular system, where each module is responsible for particular type. For example, there will be module for wombats WombatModule:IModule, where IModule interface has ...
We have an Sqlite DB on our Linux/PHP production webserver. What is the best way to manage it remotely? I've found some server wrappers are available and some applications claim to offer remote access methods. Any suggestions?
Managing an SQLite database remotely requires careful consideration of security, ease of use, and the specific tasks you need to perform. Here are several options and tools that can help you manage your SQLite database remotely on a Linux/PHP production web server: ### 1. **Web-Based Administration Tools** These tools...
17,018
[ { "from": "human", "value": "We have an Sqlite DB on our Linux/PHP production webserver. What is the best way to manage it remotely? I've found some server wrappers are available and some applications claim to offer remote access methods. Any suggestions?\n" }, { "from": "gpt", "value": "Managin...
Is there a Visual Studio plugin/tool/snippet for .NET that is similar to commonclipse for the java eclipse platform that automatically generates the ToString(), Equals(), GetHashCode() methods for you?
Yes, there are several tools and extensions available for Visual Studio that can help you generate `ToString()`, `Equals()`, and `GetHashCode()` methods automatically for your .NET classes. Here are a few popular options: 1. **ReSharper**: This is a widely used Visual Studio extension that provides a host of productiv...
20,397
[ { "from": "human", "value": "Is there a Visual Studio plugin/tool/snippet for .NET that is similar to commonclipse for the java eclipse platform that automatically generates the ToString(), Equals(), GetHashCode() methods for you?\n" }, { "from": "gpt", "value": "Yes, there are several tools and...
What is a strong way to protect against sql injection for a classic asp app? FYI I am using it with an access DB. (I didnt write the app)
SQL Injection is a serious security vulnerability that can allow an attacker to interfere with the queries your application makes to the database. To protect a classic ASP application using an Access database against SQL injection, you can implement several strong practices: ### 1. Use Parameterized Queries Parameter...
21,934
[ { "from": "human", "value": "What is a strong way to protect against sql injection for a classic asp app?\nFYI I am using it with an access DB. (I didnt write the app)\n" }, { "from": "gpt", "value": "SQL Injection is a serious security vulnerability that can allow an attacker to interfere with...
I have a ListBox which until recently was displaying a flat list of items. I was able to use myList.ItemContainerGenerator.ConainerFromItem(thing) to retrieve the ListBoxItem hosting "thing" in the list. This week I've modified the ListBox slightly in that the CollectionViewSource that it binds to for its items has gro...
When working with a `ListBox` that has grouping enabled, the structure of the visual tree becomes more complex, and the items in the list may not correspond directly to the indices you're accessing due to the presence of group headers. The issue you're encountering with `ItemContainerGenerator.ContainerFromIndex(1)` re...
20,209
[ { "from": "human", "value": "I have a ListBox which until recently was displaying a flat list of items. I was able to use myList.ItemContainerGenerator.ConainerFromItem(thing) to retrieve the ListBoxItem hosting \"thing\" in the list.\nThis week I've modified the ListBox slightly in that the CollectionViewS...
If my code throws an exception, sometimes - not everytime - the jsf presents a blank page. I´m using facelets for layout. A similar error were reported at this Sun forumn´s post, but without answers. Anyone else with the same problem, or have a solution? ;) Due to some requests. Here follow more datails: web.xml <erro...
The issue you're facing seems to be related to the handling of exceptions in your JSF application, particularly in how the error page is served. Based on the stack trace and the configurations you provided, here are a few things you can check or try to resolve the blank page issue: 1. **Error Page Configuration**: ...
15,535
[ { "from": "human", "value": "If my code throws an exception, sometimes - not everytime - the jsf presents a blank page. I´m using facelets for layout.\nA similar error were reported at this Sun forumn´s post, but without answers.\nAnyone else with the same problem, or have a solution?\n;)\nDue to some reque...
My Subversion repository is on a Linux server and my OnTime 2007 system is on a Windows 2003 server. I have a post-commit hook script that launches two Perl scripts. One sends an email—works great. The other is supposed to write the details from the SVN commit to the Notes section of the OnTime tracking system. I ha...
Hi Nancy, It sounds like you're on the right track with using SOAP to interact with the OnTime tracking system. A response code of `1` could mean anything depending on how the SOAP service is designed; it may indicate success, failure, or something else entirely. To troubleshoot this, here are some steps you can take...
17,614
[ { "from": "human", "value": "My Subversion repository is on a Linux server and my OnTime 2007 system is on a Windows 2003 server. I have a post-commit hook script that launches two Perl scripts. One sends an email—works great. The other is supposed to write the details from the SVN commit to the Notes sect...
I cannot add workflow item to my WPF project. I create a new WPF project and want to add a sequential workflow. When I do "Add new item" there is no item template to select. Any hints?
In order to add a sequential workflow to your WPF project, it’s important to ensure that your project is set up correctly and that the required references and components are available. Here are some steps and tips to help you troubleshoot the issue: 1. **Check Installed Components**: Make sure that the required compon...
21,592
[ { "from": "human", "value": "I cannot add workflow item to my WPF project.\nI create a new WPF project and want to add a sequential workflow. When I do \"Add new item\" there is no item template to select.\nAny hints?\n" }, { "from": "gpt", "value": "In order to add a sequential workflow to your...
This question may sound fairly elementary, but this is a debate I had with another developer I work with. I was taking care to stack allocate things where I could, instead of heap allocating them. He was talking to me and watching over my shoulder and commented that it wasn't necessary because they are the same perform...
Your question touches on important aspects of memory management in programming, specifically the differences between stack and heap allocation. Let's break this down: ### Stack vs Heap Allocation 1. **Stack Allocation**: - **Performance**: Stack allocation is generally faster because it involves simply moving the ...
22,621
[ { "from": "human", "value": "This question may sound fairly elementary, but this is a debate I had with another developer I work with.\nI was taking care to stack allocate things where I could, instead of heap allocating them. He was talking to me and watching over my shoulder and commented that it wasn't n...
I am trying to figure out how to add a custom control to the iPhone MoviePlayer. For an example of what I am trying to do see the following image. I am trying to add something like the controls on the right and left of the basic movie controls. I had done this in the Open SDK by adding a subclass to the playerview, bu...
In iOS, as of the introduction of `MPMoviePlayerController` and later `AVPlayerViewController`, Apple has provided a more standardized way to play videos, but customization options for controls are limited. However, you can overlay your custom controls on top of the standard player controls by using a few techniques. ...
17,574
[ { "from": "human", "value": "I am trying to figure out how to add a custom control to the iPhone MoviePlayer.\nFor an example of what I am trying to do see the following image.\n\nI am trying to add something like the controls on the right and left of the basic movie controls.\nI had done this in the Open S...
Currently, if I want to apply a method to a group of ActiveRecord objects, I have to structure the call like so: messages = Message.find(:all) csv = Message.to_csv(messages) How can I define the method so it's structured like so? messages = Message.find(:all) csv = messages.to_csv This is the current model code: requ...
To enable calling the `to_csv` method directly on a collection of `Message` objects, you'll want to define the `to_csv` method as an instance method in the class. However, since you're actually working with a collection (an array of `Message` objects), you'll need to implement the method in a way that can be called on ...
24,806
[ { "from": "human", "value": "Currently, if I want to apply a method to a group of ActiveRecord objects, I have to structure the call like so:\nmessages = Message.find(:all)\ncsv = Message.to_csv(messages)\n\nHow can I define the method so it's structured like so?\nmessages = Message.find(:all)\ncsv = messag...
Does anyone know of crossbrowser equivalent of explicitOriginalTarget event parameter? This parameter is Mozilla specific and it gives me the element that caused the blur. Let's say i have a text input and a link on my page. Text input has the focus. If I click on the link, text input's blur event gives me the link ele...
To achieve cross-browser compatibility for handling the `blur` event and determining which element caused the blur (similar to Firefox's `explicitOriginalTarget`), you can use the standard `relatedTarget` property of the event object in combination with a fallback for older browsers. ### Overview The `relatedTarget` p...
22,189
[ { "from": "human", "value": "Does anyone know of crossbrowser equivalent of explicitOriginalTarget event parameter? This parameter is Mozilla specific and it gives me the element that caused the blur. Let's say i have a text input and a link on my page. Text input has the focus. If I click on the link, text...
I am using IIS6, I've written an HttpModule, and I get this error? After googling the web I find that this problem is caused by the .NET framework 3.5, so I put this on a machine where I didn't install .NET 3.5, but the problem is still there!
It sounds like you're facing an issue with your HttpModule in an IIS6 environment, and it seems to be related to the .NET Framework. While .NET 3.5 is indeed an older framework and has known issues in certain configurations, there are a few things to consider when diagnosing your problem further. Here are some steps y...
21,029
[ { "from": "human", "value": "I am using IIS6, I've written an HttpModule, and I get this error? After googling the web I find that this problem is caused by the .NET framework 3.5, so I put this on a machine where I didn't install .NET 3.5, but the problem is still there!\n" }, { "from": "gpt", ...
Suppose xmlNode is a XML DOM node, how do you get its XML system independently? For IE, it is xmlNode.xml; For Netscape, it is new XMLSerializer().serializeToString(xmlNode). In jQuery, is there any built-in method I can leverage?
In jQuery, there isn't a built-in method that directly corresponds to `xmlNode.xml` or `new XMLSerializer().serializeToString(xmlNode)`. However, you can achieve the same functionality using the browser's native JavaScript APIs. To convert an XML DOM node to a string in a way that's independent of the browser, you can...
25,526
[ { "from": "human", "value": "Suppose xmlNode is a XML DOM node, how do you get its XML system independently? \nFor IE, it is xmlNode.xml;\nFor Netscape, it is new XMLSerializer().serializeToString(xmlNode). \nIn jQuery, is there any built-in method I can leverage?\n" }, { "from": "gpt", "value":...
I'm rather confused about this. And what's their relationship(e.g., how one can be used in the context of the other)? Much thanks!!
It seems like you have a specific topic or concept in mind that you're confused about, but I need a bit more information to help you effectively. Could you clarify what terms or concepts you're referring to? Once I have that, I can explain their relationship and how they might be used in context. Thank you!
28,271
[ { "from": "human", "value": "I'm rather confused about this. \nAnd what's their relationship(e.g., how one can be used in the context of the other)? Much thanks!!\n" }, { "from": "gpt", "value": "It seems like you have a specific topic or concept in mind that you're confused about, but I need a ...
We're starting a large web project, mostly green field. I like the Tapestry framework for java/web solutions. I have concerns about starting a Tapestry 5 project since T5 is still in beta. However, if I understand the documentation correctly, T4 development will not be supported by T5 and up. My question: Should I begi...
When considering whether to start a large web project with Apache Tapestry 5, there are several factors to weigh, especially given your concerns about using a framework still in beta. ### Pros of Choosing Tapestry 5: 1. **Future-Proofing**: If Tapestry 5 is imminent, starting with it could be beneficial since T4 supp...
15,514
[ { "from": "human", "value": "We're starting a large web project, mostly green field. I like the Tapestry framework for java/web solutions. I have concerns about starting a Tapestry 5 project since T5 is still in beta. However, if I understand the documentation correctly, T4 development will not be supported...
I need to display a variable-length message and allow the text to be selectable. I have made the TextBox ReadOnly which does not allow the text to be edited, but the input caret is still shown. The blinking input caret is confusing. How do I hide it?
If you're using a `TextBox` in a Windows Forms application and want to prevent the blinking cursor (input caret) from showing while keeping the text selectable, you can handle this by changing the `TextBox` to a different control or modifying its behavior. Here are a couple of approaches you can take: ### Option 1: ...
11,260
[ { "from": "human", "value": "I need to display a variable-length message and allow the text to be selectable. I have made the TextBox ReadOnly which does not allow the text to be edited, but the input caret is still shown. \nThe blinking input caret is confusing. How do I hide it?\n" }, { "from": "g...
Sign. My tsql kungfu sucks. I have a fee that is of type small money. When I exported as SQL from MS Access the column that represents the fee was stored as text, for example $3.28 was stored as "00000328". When I imported this into MS SQLServer I changed the data type to smallmoney, but it was stored as 328. How do I ...
To adjust the values in your `smallmoney` column so that the decimal point is correctly placed two digits to the left, you will need to update the existing values in that column accordingly. Since your current values are in the format where the decimal point is missing (for example, "328" instead of "3.28"), you can us...
25,464
[ { "from": "human", "value": "Sign. My tsql kungfu sucks. I have a fee that is of type small money. When I exported as SQL from MS Access the column that represents the fee was stored as text, for example $3.28 was stored as \"00000328\". When I imported this into MS SQLServer I changed the data type to smal...
I want to implement user stories in a new project where can i find a good template or other ones used in agile development?
Implementing user stories in your project is a great way to align development with user needs. Here are some resources and templates you can use for creating user stories in an Agile environment: ### User Story Template A common template for writing user stories is: ``` As a [type of user], I want [some goal] so that...
24,456
[ { "from": "human", "value": "I want to implement user stories in a new project where can i find a good template or other ones used in agile development?\n" }, { "from": "gpt", "value": "Implementing user stories in your project is a great way to align development with user needs. Here are some r...
Using MSBuild, how can I filter out unwanted extensions in my project (and folders potentially)? Extensions like .cs, .resx files etc.
To filter out unwanted file extensions from your MSBuild project, you can modify the project file (e.g., `.csproj`) to exclude specific file types during the build process. This can be done using the `Exclude` attribute in the `ItemGroup` section where you define your source files. Here’s how you can achieve this: ##...
21,339
[ { "from": "human", "value": "Using MSBuild, how can I filter out unwanted extensions in my project (and folders potentially)?\nExtensions like .cs, .resx files etc.\n" }, { "from": "gpt", "value": "To filter out unwanted file extensions from your MSBuild project, you can modify the project file ...
What are you favorite LogParser 2.2 Scripts to run against IIS logs and Event logs? I am putting a list of scripts together to run against our production environment to proactively look for issues and to help when isolating performance problems. Do you have a certain list of LogParser 2.2 scripts that you use?
LogParser 2.2 is a powerful tool for querying various types of logs, including IIS logs and Windows Event logs. Here are some useful LogParser scripts that can help you proactively identify issues and troubleshoot performance problems in your production environment: ### IIS Logs 1. **Top HTTP Status Codes** ```sql...
19,499
[ { "from": "human", "value": "What are you favorite LogParser 2.2 Scripts to run against IIS logs and Event logs?\nI am putting a list of scripts together to run against our production environment to proactively look for issues and to help when isolating performance problems.\nDo you have a certain list of L...
Is it possible to model relationships between entities that are defined in separate NSManagedObjectModels if the entities are always used within an NSManagedObjectModel that is created by merging the relevant models? For example, say model 1 defines an entity Foo with relationship (one-to-one) toBar and that model 2 de...
Yes, it is possible to model relationships between entities defined in separate `NSManagedObjectModel` files when merging them into a single model using `mergedModelFromModels:`. However, there are specific considerations and limitations to keep in mind, as Core Data does not automatically infer relationships across di...
13,425
[ { "from": "human", "value": "Is it possible to model relationships between entities that are defined in separate NSManagedObjectModels if the entities are always used within an NSManagedObjectModel that is created by merging the relevant models?\nFor example, say model 1 defines an entity Foo with relations...
I need to create a simple editor using a RichTextBox control in a windows forms application that includes the ability to create tables. Is it possible to create a table in a RichTextBox control? If so, any pointers on the best way to do this would be appreciated.
Unfortunately, the standard `RichTextBox` control in Windows Forms does not support creating tables natively. The `RichTextBox` is primarily designed for formatted text and does not have built-in functionality to handle complex layouts like tables. However, you can implement a few workarounds or alternatives: ### Wo...
25,576
[ { "from": "human", "value": "I need to create a simple editor using a RichTextBox control in a windows forms application that includes the ability to create tables.\nIs it possible to create a table in a RichTextBox control?\nIf so, any pointers on the best way to do this would be appreciated.\n" }, { ...
Suppose you have a method with some pre and post-conditions. Is it ok to create an exception class for each pre-condition that is not accomplished? For example: Not accomplishing pre1 means throwing a notPre1Exception instance.
Creating a separate exception class for each pre-condition that is not satisfied can be appropriate in some situations, but it also has its pros and cons. Here are some considerations to help you decide whether to go this route: ### Pros 1. **Clarity**: Each exception clearly identifies which specific pre-condition wa...
22,272
[ { "from": "human", "value": "Suppose you have a method with some pre and post-conditions.\nIs it ok to create an exception class for each pre-condition that is not accomplished? \nFor example:\nNot accomplishing pre1 means throwing a notPre1Exception instance.\n" }, { "from": "gpt", "value": "Cr...
My project is building a Java web application on top of the AllegroGraph RDF store. I would like to find a good solution to map between the triples that come out of the store and our domain objects. I have looked into Topaz, an Object/Triple mapping API being developed in the spirit of Hibernate. The trouble is that...
Mapping between RDF triples and domain objects in a Java web application can be a challenge, particularly when dealing with a specific RDF store like AllegroGraph. Here are a few strategies you might consider for implementing object/triple mapping, given the constraints you've mentioned: ### 1. Custom Mapping Layer S...
18,159
[ { "from": "human", "value": "My project is building a Java web application on top of the AllegroGraph RDF store. I would like to find a good solution to map between the triples that come out of the store and our domain objects. I have looked into Topaz, an Object/Triple mapping API being developed in the ...
i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line : [INFO] AuthChallengeProcessor - basic authentication scheme selected Do you know how to disable the integrated loging or how to set a lower d...
To control the logging level of the Apache Commons HttpClient when it logs messages like `[INFO] AuthChallengeProcessor - basic authentication scheme selected`, you can configure the logging settings in your Lotus Notes Java agent environment. Here are a few methods you might consider: ### 1. Adjust Log4j Properties ...
24,729
[ { "from": "human", "value": "i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line :\n[INFO] AuthChallengeProcessor - basic authentication scheme selected\n\nDo you know how to disable t...
I'm using the following code to make sure all certificates pass, even invalid ones, but I would like to know if there is a better way, as this event gets called globally and I only want the certificate to pass for a certain HTTP call and not for any others that are happening asynchronously. // This delegate makes sure ...
To selectively bypass SSL certificate validation for specific HTTP calls in a way that doesn't affect other requests globally, you should avoid setting a global `ServicePointManager.ServerCertificateValidationCallback`. Instead, you can use `HttpClient` along with a custom `HttpClientHandler` that implements your speci...
23,089
[ { "from": "human", "value": "I'm using the following code to make sure all certificates pass, even invalid ones, but I would like to know if there is a better way, as this event gets called globally and I only want the certificate to pass for a certain HTTP call and not for any others that are happening asy...
What are some of the popular techniques you can adopt to add durability to your in-memory data structures (ie) if the process crashes, you can preserve all previously executed operations on that data structure? If my data structure involves just a list of tuples, then I would just store them in a SQL DB and that would...
To achieve durability for in-memory data structures such as graphs or trees, where you want to preserve all previously executed operations even in the event of a crash, there are several techniques you can adopt. Here's a rundown of some popular techniques: ### 1. Write Ahead Logging (WAL) This technique involves writ...
24,028
[ { "from": "human", "value": "What are some of the popular techniques you can adopt to add durability to your in-memory data structures (ie) if the process crashes, you can preserve all previously executed operations on that data structure? \nIf my data structure involves just a list of tuples, then I would ...
We have 2 new GIS programmer/analyst in our department (new to programming and ArcObjects) and I don't feel I'm qualified enough or have the time to teach them. So I'm looking for entry level books/tutorials for them to use as reference. The only books I can find for developing Extensions for ArcMap are written for VB...
It's great that you're looking for resources to help your new GIS programmer/analysts get up to speed with ArcObjects and .NET programming. While the landscape of resources can sometimes be limited, there are still several books, online tutorials, and communities that can be very helpful for beginners. Here are some su...
23,317
[ { "from": "human", "value": "We have 2 new GIS programmer/analyst in our department (new to programming and ArcObjects) and I don't feel I'm qualified enough or have the time to teach them. So I'm looking for entry level books/tutorials for them to use as reference.\nThe only books I can find for developin...
Does anybody know if Hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level cache before going to the database? My code seems to be behaving that way, and I can't seem to find anything in the documentation about this. The Java doc is (as usual) sparse. Thanks!
In Hibernate, the `initialize()` method is used to initialize a proxy object, allowing you to access the data it represents. When it comes to the second-level cache and how it interacts with the `initialize()` method, there are a few key points to consider: 1. **Proxy Initialization**: When you call `Hibernate.initial...
21,177
[ { "from": "human", "value": "Does anybody know if Hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level cache before going to the database? My code seems to be behaving that way, and I can't seem to find anything in the documentation about this. The J...
I like LINQ to SQL, but it seems like the classes it generates are tightly coupled to the database they are stored in, which seems like a Bad Thing. For example, using ye olde Northwind database, if I create the dbml with the Products table, a Product class is generated. I can use this class in any other tier, which i...
You raise a valid concern about the coupling between your data access layer and your business/domain models when using LINQ to SQL. Indeed, having your generated classes tightly bound to the database schema can make it difficult to switch technologies or change your database design without significant refactoring. Her...
21,775
[ { "from": "human", "value": "I like LINQ to SQL, but it seems like the classes it generates are tightly coupled to the database they are stored in, which seems like a Bad Thing. \nFor example, using ye olde Northwind database, if I create the dbml with the Products table, a Product class is generated. I can...
I run a browser based game at www.darknovagames.com. Recently, I've been working on reformatting the site with CSS, trying to get all of its pages to verify according to the HTML standard. I've been toying with this idea of having the navigation menu on the left AJAX the pages in (rather than taking the user to a separ...
It's great that you're considering user experience while also focusing on site performance and standards compliance. Here are some considerations and suggestions based on your situation: ### AJAX Navigation 1. **User Experience**: AJAX can significantly improve the experience by reducing page load times and providing...
23,464
[ { "from": "human", "value": "I run a browser based game at www.darknovagames.com. Recently, I've been working on reformatting the site with CSS, trying to get all of its pages to verify according to the HTML standard.\nI've been toying with this idea of having the navigation menu on the left AJAX the pages ...
Say your company is willing to sponsor the fees for taking programming certification examination. What is the best aproach to implement this? I would say if the programmer passes the exam at the first try, it shoud be fully sponsored. If the programmer doesn't pass the first try, the 2nd exam should be 50% sponsored. ...
Implementing a sponsorship program for programming certification examinations requires careful consideration to balance encouragement with accountability. Here’s a structured approach to design your program effectively: ### 1. Clear Communication of Policy - **Outline Sponsorship Structure**: Clearly communicate th...
21,801
[ { "from": "human", "value": "Say your company is willing to sponsor the fees for taking programming certification examination. What is the best aproach to implement this?\nI would say if the programmer passes the exam at the first try, it shoud be fully sponsored. \nIf the programmer doesn't pass the first ...
i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al. I am researching this for a client and for an article, and i think my google-fu is not strong tonight. Any suggestions? ED...
Glad to hear you resolved the issue! Adding a nested table or another GridView below a selected row in an ASP.NET 2.0 GridView can be accomplished by leveraging the `RowDataBound` event and managing the visibility of the nested rows programmatically. Here's a general approach to do this, along with some tips for improv...
18,651
[ { "from": "human", "value": "i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al.\nI am researching this for a client and for an article, and i think my google-fu ...
I've only started playing with both ASP.Net MVC and the new-to-VS2008 Dynamic Data Website Templates. I note that they both use routing in their URL handling, and I'm given to understand that because of routing, ASP.Net MVC won't work under IIS6. However my DynamicData site works just fine on IIS6. I've had to tempor...
The primary difference between ASP.NET MVC and ASP.NET Dynamic Data regarding their compatibility with IIS6 is primarily rooted in how they handle URL routing and request processing, as well as the underlying architecture of each framework. ### ASP.NET MVC: 1. **Routing Mechanism**: - ASP.NET MVC uses a complex r...
21,528
[ { "from": "human", "value": "I've only started playing with both ASP.Net MVC and the new-to-VS2008 Dynamic Data Website Templates. I note that they both use routing in their URL handling, and I'm given to understand that because of routing, ASP.Net MVC won't work under IIS6. However my DynamicData site wo...
How can I raise an event from a SWF file loaded into a Flex application (using SWFLoader)? I want to be able to detect a) when a button is pressed b) when the animation ends
To raise events from a SWF file loaded into a Flex application using `SWFLoader`, you'll generally need to use ActionScript in your SWF file to dispatch custom events that can be captured by your Flex application. Here's how you can achieve this for both a button press and when an animation ends: ### Steps to Raise Ev...
18,850
[ { "from": "human", "value": "How can I raise an event from a SWF file loaded into a Flex application (using SWFLoader)?\nI want to be able to detect\na) when a button is pressed\nb) when the animation ends\n\n" }, { "from": "gpt", "value": "To raise events from a SWF file loaded into a Flex appl...
This question is related to another: Will having multiple filegroups help speed up my database? The software we're developing is an analytical tool that uses MS SQL Server 2005 to store relational data. Initial analysis can be slow (since we're processing millions or billions of rows of data), but there are performanc...
When dealing with a situation where you might need to manage hundreds of thousands of tables in SQL Server, it’s important to consider both database design and the specific performance impacts of various management strategies. Here are some insights into the options you've mentioned and how they may help with performan...
17,219
[ { "from": "human", "value": "This question is related to another:\nWill having multiple filegroups help speed up my database?\nThe software we're developing is an analytical tool that uses MS SQL Server 2005 to store relational data. Initial analysis can be slow (since we're processing millions or billions...
I am taking a class in C++ programming and the professor told us that there is no need to learn C because C++ contains everything in C plus object-oriented features. However, some others have told me that this is not necessarily true. Can anyone shed some light on this?
Your professor's assertion that "there is no need to learn C because C++ contains everything in C plus object-oriented features" is somewhat simplistic and may not capture the full nuance of the relationship between the two languages. Here's a breakdown of the situation: ### Similarities: 1. **Syntax and Structure**: ...
22,381
[ { "from": "human", "value": "I am taking a class in C++ programming and the professor told us that there is no need to learn C because C++ contains everything in C plus object-oriented features. However, some others have told me that this is not necessarily true. Can anyone shed some light on this?\n" }...
I'm using a Form to show notifications (it appears at the bottom right of the screen), but when I show this form it steals the focus from the main Form. Is there a way to show this "notification" form without stealing focus?
Yes, you can show a notification form without stealing focus from the main form by creating it as a modeless dialog. Here’s how you can achieve this in a typical Windows Forms application in C#: 1. **Set the Form Properties**: Make sure your notification form's properties are set correctly. You want to make sure that ...
22,850
[ { "from": "human", "value": "I'm using a Form to show notifications (it appears at the bottom right of the screen), but when I show this form it steals the focus from the main Form. Is there a way to show this \"notification\" form without stealing focus?\n" }, { "from": "gpt", "value": "Yes, yo...
The people writing the user manual are not necessarily programmers, and they need a visual editor. A major issue is the internal format of the authoring tool; it should be readable text/html, so it's easy to compare versions of individual pages checked into version control.
When creating a user manual with the assistance of non-programmers, it's essential to choose an authoring tool that meets several criteria: visual editing capabilities, a readable and version-control-friendly output format, and ease of use for the writers. Here are some recommendations and considerations for selecting ...
21,685
[ { "from": "human", "value": "The people writing the user manual are not necessarily programmers, and they need a visual editor. A major issue is the internal format of the authoring tool; it should be readable text/html, so it's easy to compare versions of individual pages checked into version control.\n" ...
I'm trying to read a file to produce a DOM Document, but the file has whitespace and newlines and I'm trying to ignore them, but I couldn't: DocumentBuilderFactory docfactory=DocumentBuilderFactory.newInstance(); docfactory.setIgnoringElementContentWhitespace(true); I see in Javadoc that setIgnoringElementContentWhite...
If you want to ignore whitespace and newline characters in an XML document while parsing it with the `DocumentBuilder`, and if setting `setIgnoringElementContentWhitespace(true)` is not working due to not having a DTD or XML Schema, you can indeed manually process the resulting `DOM` to remove the whitespace text nodes...
23,065
[ { "from": "human", "value": "I'm trying to read a file to produce a DOM Document, but the file has whitespace and newlines and I'm trying to ignore them, but I couldn't:\nDocumentBuilderFactory docfactory=DocumentBuilderFactory.newInstance();\ndocfactory.setIgnoringElementContentWhitespace(true);\n\nI see i...
Is there a way to call an EJB that is served through WebSphere (iiop://host:port/ejbName) from a vanilla JRE (like Sun). A lot of people have been telling me that this type of architecture relies in a homogenous environment. Thoughts?
Yes, it is possible to call an Enterprise JavaBeans (EJB) running on WebSphere from a Java application running in a standalone environment (vanilla JRE, such as Sun's JRE). However, there are a few considerations and configurations that you need to make to facilitate this communication. ### Key Points to Consider: 1....
18,977
[ { "from": "human", "value": "Is there a way to call an EJB that is served through WebSphere (iiop://host:port/ejbName) from a vanilla JRE (like Sun). A lot of people have been telling me that this type of architecture relies in a homogenous environment. Thoughts?\n" }, { "from": "gpt", "value": ...
What exactly is the difference between the window.onload event and the onload event of the body tag? when do I use which and how should it be done correctly?
The `window.onload` event and the `onload` event of the `<body>` tag are related but serve slightly different purposes in JavaScript. Here’s a breakdown of the differences and when to use each: ### `window.onload` - **Definition**: The `window.onload` event is a global event that fires when the entire page is fully l...
20,959
[ { "from": "human", "value": "What exactly is the difference between the window.onload event and the onload event of the body tag? when do I use which and how should it be done correctly?\n" }, { "from": "gpt", "value": "The `window.onload` event and the `onload` event of the `<body>` tag are rel...
Is there a "#if DEBUG"-like conditional statement which can be used in VS 2008 for determining if the code is being run from a unit test? (We're using MS's built-in unit testing.) For example: #if !UNITTEST // Do some GUI stuff we don't want to see when unit testing #endif
In Visual Studio 2008, there isn't a predefined conditional compilation symbol for detecting whether code is being run from unit tests. However, you can define your own compilation symbol in your project settings that can serve a similar purpose. Here are the steps to achieve this: 1. **Define a Compilation Symbol**:...
25,587
[ { "from": "human", "value": "Is there a \"#if DEBUG\"-like conditional statement which can be used in VS 2008 for determining if the code is being run from a unit test? (We're using MS's built-in unit testing.)\nFor example: \n#if !UNITTEST\n// Do some GUI stuff we don't want to see when unit testing\n#endi...
I'm wondering why query string is preferred when getting values from user request. Where? 1) Code of System.Web.Mvc.DefaultModelBinder looks like this (only part of it): HttpRequestBase request = controllerContext.HttpContext.Request; if (request != null) { if (request.QueryString != null) { ...
You're correct in your observations regarding the behavior of the `DefaultModelBinder` in ASP.NET MVC and the priority given to query string parameters over form data in certain cases. Let's delve into the reasoning behind this design choice: ### 1. **Separation of Concerns**: - **Query Strings**: Typically used to pa...
17,394
[ { "from": "human", "value": "I'm wondering why query string is preferred when getting values from user request. Where? \n1) Code of System.Web.Mvc.DefaultModelBinder looks like this (only part of it):\nHttpRequestBase request = controllerContext.HttpContext.Request;\n if (request != null)\n {\n ...
I am trying the FDT editor on a project that previously ran successfully in Flash CS3. FDT builds and runs it successfully but the SWF is blank (white). I've tried a few viewers on the output file and it is actually blank. One difference is that now my project doesn't seem to include my entry .fla file. I'm new to Fl...
It's great to hear that you resolved the issue with your FDT setup! It's a common scenario for those transitioning from a traditional IDE like Flash CS3 to a more code-centric environment, especially when dealing solely with ActionScript 3. In ActionScript 3, especially when not using an FLA file, you do need to expl...
23,074
[ { "from": "human", "value": "I am trying the FDT editor on a project that previously ran successfully in Flash CS3.\nFDT builds and runs it successfully but the SWF is blank (white). I've tried a few viewers on the output file and it is actually blank.\nOne difference is that now my project doesn't seem to...
Background: I'm running a full-time job and a part-time job in the weekends, and both my employers have supplied a laptop for me to work on. Of course I also have my powerful workstation at home to work from, and sometimes when I'm at the office at my weekend job (it's in another city) I'm working from yet another wor...
Given your scenario, setting up a Virtual Desktop on your VMware server can indeed streamline your workflow and provide a consistent environment across different machines. Here are some considerations to help you decide between using VMware Workstation with remote access software versus investing in a full VDI (Virtual...
17,704
[ { "from": "human", "value": "Background: \nI'm running a full-time job and a part-time job in the weekends, and both my employers have supplied a laptop for me to work on. Of course I also have my powerful workstation at home to work from, and sometimes when I'm at the office at my weekend job (it's in anot...
I'm trying to get my head around why the following doesn't work. I have a std::vector and I want to call a static member function of it's contained value_type like so: std::vector<Vector> v; unsigned u = v.value_type::Dim(); where Vector is in fact a typedef for a templated type: template <typename T, unsigned U> clas...
The error you're encountering is due to the way you're trying to access the static member function `Dim()` through the `value_type` of the `std::vector`. In C++, `std::vector<T>` is a template class where `T` is the type of elements it contains. The syntax you're using, `v.value_type::Dim()`, is not correct because `va...
19,564
[ { "from": "human", "value": "I'm trying to get my head around why the following doesn't work. I have a std::vector and I want to call a static member function of it's contained value_type like so:\nstd::vector<Vector> v;\nunsigned u = v.value_type::Dim();\n\nwhere Vector is in fact a typedef for a templated...
So far I've found the following components for building ASP.NET MVC views: Yahoo UI (YUI) Ext JS Flexgrid (grid only) What are the other options that are currently available which inlcude a nice grid component?
When building ASP.NET MVC views, there are several libraries and frameworks available that include robust grid components. Here are some popular options beyond the ones you mentioned: 1. **DataTables**: - A highly flexible jQuery plugin that adds advanced interaction controls to HTML tables. It includes features li...
25,430
[ { "from": "human", "value": "So far I've found the following components for building ASP.NET MVC views:\n\nYahoo UI (YUI) \nExt JS\nFlexgrid (grid only)\n\nWhat are the other options that are currently available which inlcude a nice grid component?\n" }, { "from": "gpt", "value": "When building ...
I have a .NET TCP Client that sends high volumes of messages to a (.NET async) TCP server. I need to keep sending messages to the server but I run out of ports on the client due to TIME_WAIT. How can a program continually and reliably send messages without using all of the available ports? Is there a method to keep r...
Running out of available ports due to the `TIME_WAIT` state is a common issue when dealing with high volumes of TCP connections. Here are several approaches you can take to address this problem without switching to UDP or diving into more complex solutions like IOCP in C++: ### 1. Reuse the Same Socket You can keep a...
13,683
[ { "from": "human", "value": "I have a .NET TCP Client that sends high volumes of messages to a (.NET async) TCP server.\nI need to keep sending messages to the server but I run out of ports on the client due to TIME_WAIT. \nHow can a program continually and reliably send messages without using all of the a...
Suppose that I have interface MyInterface and 2 classes A, B which implement MyInterface. I declared 2 objects: MyInterface a = new A() , and MyInterface b = new B(). When I try to pass to a function - function doSomething(A a){} I am getting an error. This is my code: public interface MyInterface {} public class A im...
In Java, method overloading does not work with interfaces directly as you are trying to do in your example. When you declare `MyInterface a = new A();`, the reference `a` is of type `MyInterface`, so when you try to pass it to the method `test(A a)`, it does not match the method signature because `a` is treated as `MyI...
21,125
[ { "from": "human", "value": "Suppose that I have interface MyInterface and 2 classes A, B which implement MyInterface.\nI declared 2 objects: MyInterface a = new A() , and MyInterface b = new B().\nWhen I try to pass to a function - function doSomething(A a){} I am getting an error.\nThis is my code:\npubli...
The title pretty much says it all. I want to create a SqlConnection and then check that connection without opening a database, cause at that point I don't know yet where will I connect to. Is it possible to do that? The SqlConnection class has a 'Open' member which tries to open the database you'd set in the Database ...
In ADO.NET, the `SqlConnection` class requires a connection string that includes a specific database or server to establish a connection to SQL Server. However, if you want to verify whether the connection can be established without specifically targeting a database, you have limited options. Here are a few strategie...
21,830
[ { "from": "human", "value": "The title pretty much says it all. I want to create a SqlConnection and then check that connection without opening a database, cause at that point I don't know yet where will I connect to. Is it possible to do that? \nThe SqlConnection class has a 'Open' member which tries to op...
pre tags are super-useful for code blocks in HTML and for debugging output while writing scripts, but how do I make the text word-wrap instead of printing out one long line?
In HTML, the `<pre>` tag is used for preformatted text, meaning that it maintains spaces and line breaks exactly as they are in the HTML source code. By default, text inside a `<pre>` tag does not wrap; it continues in a single line, leading to horizontal scrolling if the text exceeds the width of its container. To en...
25,271
[ { "from": "human", "value": "pre tags are super-useful for code blocks in HTML and for debugging output while writing scripts, but how do I make the text word-wrap instead of printing out one long line?\n" }, { "from": "gpt", "value": "In HTML, the `<pre>` tag is used for preformatted text, mean...
I have seen member functions programed both inside of the class they belong to and outside of the class with a function prototype inside of the class. I have only ever programmed using the first method, but was wondering if it is better practice to use the other or just personal preference?
The decision to define member functions inside or outside of a class in C++ can indeed come down to personal preference, but there are some considerations regarding best practices, readability, maintainability, and organization. ### Defining Member Functions Inside the Class #### Advantages: 1. **Readability**: When ...
20,655
[ { "from": "human", "value": "I have seen member functions programed both inside of the class they belong to and outside of the class with a function prototype inside of the class. I have only ever programmed using the first method, but was wondering if it is better practice to use the other or just persona...
This Linq to SQL query ... Return (From t In Db.Concessions Where t.Country = "ga" Select t.ConcessionID, t.Title, t.Country) ... is generating this SQL: SELECT [t0].[ConcessionID], [t0].[Title], [t0].[Country] FROM [dbo].[Concessions] AS [t0] WHERE [t0].[Country] = ga ... when what I want is WHERE [t0].[Country]...
The issue you're encountering is that the LINQ query is generating SQL without the necessary quotes around the string value "ga". This is likely due to the fact that the string value is not being recognized correctly in the LINQ query. In LINQ to SQL, when you want to use a string literal in a query, you should ensure...
22,805
[ { "from": "human", "value": "This Linq to SQL query ...\n Return (From t In Db.Concessions Where t.Country = \"ga\" Select t.ConcessionID, t.Title, t.Country)\n\n... is generating this SQL:\nSELECT [t0].[ConcessionID], [t0].[Title], [t0].[Country]\nFROM [dbo].[Concessions] AS [t0]\nWHERE [t0].[Country] =...
I have an array I've created in JavaScript. The end result comes out to element1,element2,,,element5,element6,,,element9.... etc Once passed to ColdFusion, it removes the null elements, I end up with element1,element2,element5,element6,element9 I need to maintain these spaces, any ideas? My problem may begin before t...
To maintain the structure of your array with null or empty elements when passing data from JavaScript to ColdFusion, you can consider a couple of approaches. ### Option 1: Use a String Representation Instead of using an array to hold your form elements, you can create a string representation where you explicitly ind...
23,424
[ { "from": "human", "value": "I have an array I've created in JavaScript. The end result comes out to element1,element2,,,element5,element6,,,element9.... etc\nOnce passed to ColdFusion, it removes the null elements, I end up with element1,element2,element5,element6,element9\nI need to maintain these spaces...
I have a query that I'm executing from a .NET application to a SQL Server database and it seems to take quite a while to complete (5+ Minutes). I created a test app in c# to try to see what was talking so long (the query should return quickly). As I was reconstructing the query by adding in elements to see which por...
The difference in performance you're experiencing with the two queries, even though they are almost identical, could be attributed to a few potential issues related to SQL Server's handling of queries, particularly concerning case sensitivity, indexing, and query optimization. Here are some points to consider that may ...
23,035
[ { "from": "human", "value": "I have a query that I'm executing from a .NET application to a SQL Server database and it seems to take quite a while to complete (5+ Minutes). I created a test app in c# to try to see what was talking so long (the query should return quickly). \nAs I was reconstructing the qu...
I have an embedded webserver that has a total of 2 Megs of space on it. Normally you gzip files for the clients benefit, but this would save us space on the server. I read that you can just gzip the js file and save it on the server. I tested that on IIS and I didn't have any luck at all. What exactly do I need to ...
To serve gzipped files from an embedded web server that does not support dynamic gzip compression, you can indeed pre-compress your JavaScript files and then serve them with the correct headers. Here’s a step-by-step guide to accomplish this: ### Step 1: Gzip the JavaScript File First, you need to gzip the JavaScript ...
20,496
[ { "from": "human", "value": "I have an embedded webserver that has a total of 2 Megs of space on it. Normally you gzip files for the clients benefit, but this would save us space on the server. I read that you can just gzip the js file and save it on the server. I tested that on IIS and I didn't have any...
What's the best way to get an array of all elements in an html document with a specific CSS class using javascript? No javascript frameworks like jQuery allowed here right now, and I could loop all the elements and check them manually myself. I'm hoping for something a little more elegant.
You can efficiently get an array of all elements in an HTML document with a specific CSS class using the `document.getElementsByClassName` method or the `document.querySelectorAll` method. Here's how you can do it using both approaches: ### Using `document.getElementsByClassName` This method returns a live HTMLColle...
22,837
[ { "from": "human", "value": "What's the best way to get an array of all elements in an html document with a specific CSS class using javascript?\nNo javascript frameworks like jQuery allowed here right now, and I could loop all the elements and check them manually myself. I'm hoping for something a little ...
When writing GUIs, I've frequently come over the following problem: Assume you have a model and a controller. The controller has a widget W that is used to show a property X of the model. Because the model might be changed from outside the controller (there might be other controllers using the same model, undo operatio...
The issue you're encountering is a common one in GUI architecture, particularly in the Model-View-Controller (MVC) pattern. The problem arises due to the bidirectional communication between the model and the widget, leading to what is often called "event storming" or redundant updates. Here are some best practices and ...
20,727
[ { "from": "human", "value": "When writing GUIs, I've frequently come over the following problem: Assume you have a model and a controller. The controller has a widget W that is used to show a property X of the model.\nBecause the model might be changed from outside the controller (there might be other contr...
A colleague once told me that the last option when everything has failed to debug on Linux was to use strace. I tried to learn the science behind this strange tool, but I am not a system admin guru and I didn’t really get results. So, What is it exactly and what does it do? How and in which cases should it be used? Ho...
Sure! Let's break down what `strace` is, how it works, when to use it, and how to interpret its output in a simple manner. ### What is `strace`? `strace` is a diagnostic tool in Linux that allows you to monitor the system calls made by a program and the signals received by that program. System calls are the primary m...
20,298
[ { "from": "human", "value": "A colleague once told me that the last option when everything has failed to debug on Linux was to use strace.\nI tried to learn the science behind this strange tool, but I am not a system admin guru and I didn’t really get results.\nSo,\n\nWhat is it exactly and what does it do?...
How inefficient is it to get the stack trace for an exception? I know it's costly, but how costly? Should they definitely not be used in production environment?
Getting a stack trace for an exception is a relatively expensive operation in terms of performance, but the exact cost can vary depending on several factors, including the programming language, the runtime environment, and how the stack trace is implemented. Here are some points to consider: ### Performance Cost 1. **...
22,508
[ { "from": "human", "value": "How inefficient is it to get the stack trace for an exception? I know it's costly, but how costly? Should they definitely not be used in production environment?\n" }, { "from": "gpt", "value": "Getting a stack trace for an exception is a relatively expensive operat...
I am writing a script that powers on a system via network. And then i need to run a few commands on the other host. How do I know whether the system has powered on? My programming language is Perl and the target host is RHEL5. Is there any kernel interrupt or network boot information that indicates the system has powe...
To achieve what you're aiming for, you'll need to focus on a few key aspects: detecting system power-on status, determining when the operating system has fully booted, and managing network connectivity (especially with DHCP). Below, I'll address your questions and provide some recommendations for your Perl script. ###...
18,031
[ { "from": "human", "value": "I am writing a script that powers on a system via network. And then i need to run a few commands on the other host. How do I know whether the system has powered on?\nMy programming language is Perl and the target host is RHEL5.\nIs there any kernel interrupt or network boot inf...
I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain. The database is a Microsoft Access database. The function th...
It looks like you're implementing paging in your ASP.NET application with an Access database. The code you've provided has the right structure, but there are a few areas where you might run into issues that could affect data retrieval, especially when dealing with pagination. Let's walk through the relevant parts and e...
18,682
[ { "from": "human", "value": "I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain.\nThe database is a ...
I have a table that has a processed_timestamp column -- if a record has been processed then that field contains the datetime it was processed, otherwise it is null. I want to write a query that returns two rows: NULL xx -- count of records with null timestamps NOT NULL yy -- count of records with non-null tim...
Yes, you can achieve this in a single query by using conditional aggregation. This method is efficient, especially for large tables, as it scans the table only once. You can use a `CASE` statement to count the records based on whether the `processed_timestamp` is `NULL` or not. Here’s an example SQL query that demonst...
26,372
[ { "from": "human", "value": "I have a table that has a processed_timestamp column -- if a record has been processed then that field contains the datetime it was processed, otherwise it is null.\nI want to write a query that returns two rows:\nNULL xx -- count of records with null timestamps\nNOT NULL...
The ability to use BitKeeper free of charge had been withdrawn by the copyright holder Larry McVoy after he claimed Andrew Tridgell had reverse engineered the BitKeeper protocols in violation of the BitKeeper license. At Linux.Conf.Au 2005, Tridgell demonstrated during his keynote that the reverse engineering process ...
To prevent unintended leaks of sensitive information, such as utility functions or debugging tools, organizations can implement several processes and procedures throughout the software development lifecycle. Here are some effective practices: 1. **Code Reviews**: Implement a strict code review process where all code c...
25,028
[ { "from": "human", "value": "\nThe ability to use BitKeeper free of charge had been withdrawn by the copyright holder Larry McVoy after he claimed Andrew Tridgell had reverse engineered the BitKeeper protocols in violation of the BitKeeper license. At Linux.Conf.Au 2005, Tridgell demonstrated during his key...
Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"? f arg (obj.DoStuff()) f arg <| obj.DoStuff()
In the context of F#, both alternatives you provided are syntactically valid, but they serve slightly different purposes and can convey different meanings based on the context. 1. **`f arg (obj.DoStuff())`**: This is the more traditional and straightforward function application. It clearly shows that `obj.DoStuff()` i...
22,926
[ { "from": "human", "value": "Which of theese two alternatives do you find yourself using most often, and which is more \"idiomatic\"?\n\nf arg (obj.DoStuff())\nf arg <| obj.DoStuff()\n\n" }, { "from": "gpt", "value": "In the context of F#, both alternatives you provided are syntactically valid, ...
I have heard that LINQ2SQL has been written to support multiple database vendor providers however for internal political reasons at MS, only SQL Server has been supported. Is this a fair summary of the situation, and if so has a timetable been released as to when other databases will be supported? I am aware of Matt Wa...
Your summary of the LINQ to SQL situation is somewhat accurate. LINQ to SQL was primarily designed for SQL Server and is tightly integrated with it. While the architecture does allow for the possibility of supporting other database providers, Microsoft has not provided first-party support for LINQ to SQL with other dat...
26,216
[ { "from": "human", "value": "I have heard that LINQ2SQL has been written to support multiple database vendor providers however for internal political reasons at MS, only SQL Server has been supported.\nIs this a fair summary of the situation, and if so has a timetable been released as to when other database...
Problem Language: C# 2.0 or later I would like to register context handlers to create menues when the user right clicks certain files (in my case *.eic). What is the procedure to register, unregister (clean up) and handle events (clicks) from these menues? I have a clue it's something to do with the windows registry, ...
Creating context menus for file types like `*.eic` in Windows through a C# application involves manipulating the Windows Registry. Since you're working with C# 2.0 or later, there are no built-in methods specifically for creating shell extensions (which is what you would need for this functionality), but you can do it ...
20,157
[ { "from": "human", "value": "Problem\nLanguage: C# 2.0 or later\n\nI would like to register context handlers to create menues when the user right clicks certain files (in my case *.eic). What is the procedure to register, unregister (clean up) and handle events (clicks) from these menues?\nI have a clue it'...
How can polymorphism be described in an easy-to-understand way? We can find a lot of information about the subject on the Internet and books, like in Type polymorphism. But let's try to make it as simple as we can.
Sure! Let's break down polymorphism in simple terms. **What is Polymorphism?** Polymorphism is a fancy word that comes from two Greek words: "poly" meaning "many" and "morph" meaning "form." So, it literally means "many forms." **In Programming:** In programming, polymorphism allows objects to be treated as instan...
22,905
[ { "from": "human", "value": "How can polymorphism be described in an easy-to-understand way?\nWe can find a lot of information about the subject on the Internet and books, like in Type polymorphism. But let's try to make it as simple as we can.\n" }, { "from": "gpt", "value": "Sure! Let's break ...
I've working on a WinForms in VB.NET (3.5) application that requires the user to enter domain administrator credentials. To make things easier on the user, they should only have to enter the user name and password once, and then just rely on my app to save these credentials. I'd like to save these credentials with the ...
To handle encryption and decryption of user credentials in a FIPS-compliant manner, you can use the built-in `RijndaelManaged` class (which implements the AES algorithm). However, you need to ensure that you follow the restrictions set by FIPS. The code below demonstrates how to encrypt and decrypt a password using a ...
21,131
[ { "from": "human", "value": "I've working on a WinForms in VB.NET (3.5) application that requires the user to enter domain administrator credentials. To make things easier on the user, they should only have to enter the user name and password once, and then just rely on my app to save these credentials. I'd...
How do I do forward referencing / declaration in C++ to avoid circular header file references? I have the #ifndef guard in the header file, yet memory tells me I need this forward referencing thing - which i've used before >< but can't remember how.
In C++, forward declarations can help you avoid circular dependencies between header files. A forward declaration allows you to declare the existence of a class, function, or variable before you define it. This means you can refer to a type without needing to include the full definition, which is useful when two classe...
19,813
[ { "from": "human", "value": "How do I do forward referencing / declaration in C++ to avoid circular header file references?\nI have the #ifndef guard in the header file, yet memory tells me I need this forward referencing thing - which i've used before >< but can't remember how. \n" }, { "from": "gp...
I saw a code snippet yesterday in one of the responses here on StackOverflow that intrigued me. It was something like this: List<string> myList = new List<string> {"aBc", "HELLO", "GoodBye"}; myList.ForEach(d=>d.ToLower()); I was hoping I could use it to convert all items in myList to lowercase. However, it doesn't...
The issue you encountered is that the `ForEach` method doesn't modify the elements of the list in place. The `ToLower()` method returns a new string with all characters converted to lowercase but does not modify the original strings in the list. To modify the contents of the list, you can use LINQ in combination with ...
24,988
[ { "from": "human", "value": "I saw a code snippet yesterday in one of the responses here on StackOverflow that intrigued me. It was something like this:\n List<string> myList = new List<string> {\"aBc\", \"HELLO\", \"GoodBye\"};\n\n myList.ForEach(d=>d.ToLower());\n\nI was hoping I could use it to convert a...
I've used lex and yacc (more usually bison) in the past for various projects, usually translators (such as a subset of EDIF streamed into an EDA app). Additionally, I've had to support code based on lex/yacc grammars dating back decades. So I know my way around the tools, though I'm no expert. I've seen positive commen...
Both ANTLR (Another Tool for Language Recognition) and Lex/Yacc (or its modern alternatives like Flex/Bison) are powerful tools for creating parsers, but they have different design philosophies, features, and usability aspects. Since you have experience with Lex/Yacc and are considering ANTLR, here are some points of c...
20,815
[ { "from": "human", "value": "I've used lex and yacc (more usually bison) in the past for various projects, usually translators (such as a subset of EDIF streamed into an EDA app). Additionally, I've had to support code based on lex/yacc grammars dating back decades. So I know my way around the tools, though...
I've found plenty of simple, cheap solutions for recording composite video sources to my PC, a laptop. But I'd like to be able to record in HD and use component cables. I was wondering if anyone had a good solution for this. Required: Cheap Desired Portable, external hardware device
If you’re looking for a way to record HD video from a component source to your PC or laptop, there are a few options that can meet your requirements for being relatively affordable, portable, and an external solution. Here are some suggestions: ### 1. **External Capture Cards** - **Elgato HD60 S**: This is a popular c...
24,424
[ { "from": "human", "value": "I've found plenty of simple, cheap solutions for recording composite video sources to my PC, a laptop. But I'd like to be able to record in HD and use component cables.\nI was wondering if anyone had a good solution for this.\nRequired:\nCheap\n\nDesired\nPortable, external hard...
I've switched computers a few times recently, and somewhere along the way I lost my .emacs. I'm trying to build it up again, but while I'm at it, I thought I'd pick up other good configurations that other people use. So, if you use Emacs, what's in your .emacs? Mine is pretty barren right now, containing only: Global...
It's great that you're rebuilding your `.emacs` file! Emacs is incredibly flexible, and there's a lot you can do to enhance your workflow. Here are some commonly used configurations and packages that you might find useful. Feel free to customize them based on your personal preferences. ### Basic Configuration 1. **Ba...
19,942
[ { "from": "human", "value": "I've switched computers a few times recently, and somewhere along the way I lost my .emacs. I'm trying to build it up again, but while I'm at it, I thought I'd pick up other good configurations that other people use.\nSo, if you use Emacs, what's in your .emacs?\nMine is pretty...
SqlDataReader is a faster way to process the stored procedure. What are some of the advantage/disadvantages of using SQLDataReader?
Using `SqlDataReader` in ADO.NET provides a way to read data from a SQL Server database in a forward-only, read-only manner. Here are some advantages and disadvantages of using `SqlDataReader`: ### Advantages: 1. **Performance**: - `SqlDataReader` is faster than other data retrieval methods (like `DataSet` or `Dat...
23,018
[ { "from": "human", "value": "SqlDataReader is a faster way to process the stored procedure. What are some of the advantage/disadvantages of using SQLDataReader?\n" }, { "from": "gpt", "value": "Using `SqlDataReader` in ADO.NET provides a way to read data from a SQL Server database in a forward-o...
So my problem has to do with a Sticky footer that works, but a rounded corner script pushes the footer up a bit in IE7. (example: Games Page) If you load the page in IE7, the footer is in the wrong place, but if you do the following: 1. Open a new tab 2. Go to google.ca in the new tab (or do something) 3. Close the tab...
It sounds like you're encountering a rendering issue specific to Internet Explorer 7, which can be quite tricky. This kind of issue often has to do with how IE7 handles layout and rendering, especially with CSS properties that affect positioning and floating elements. Here are a few approaches you can consider to trou...
21,805
[ { "from": "human", "value": "So my problem has to do with a Sticky footer that works, but a rounded corner script pushes the footer up a bit in IE7. (example: Games Page) If you load the page in IE7, the footer is in the wrong place, but if you do the following:\n1. Open a new tab\n2. Go to google.ca in the...
I am writing an application with a hand-crafted domain model (classes) and a hand-crafted data model (tables/relationships), and letting NHibernate take care of the mapping. Is it best to tell the database to perform cascading updates or deletes or to tell NHibernate to do it (cascade="all-delete-orphan")? Can they bot...
When deciding whether to handle cascading updates and deletes through the database itself or through NHibernate in a .NET application, it's important to consider several factors related to maintainability, performance, and the specific behaviors you want to achieve in your application. Here’s an overview of both approa...
21,362
[ { "from": "human", "value": "I am writing an application with a hand-crafted domain model (classes) and a hand-crafted data model (tables/relationships), and letting NHibernate take care of the mapping.\nIs it best to tell the database to perform cascading updates or deletes or to tell NHibernate to do it (...
Does anyone know if there's an add-in that does autocomplete for queries on SQL Management Studio?
Yes, SQL Server Management Studio (SSMS) has built-in IntelliSense features that provide autocomplete suggestions for SQL queries. However, if you're looking for additional functionality or enhancements, there are some add-ins and extensions you might consider: 1. **SSMSBoost**: This is a popular add-in for SSMS that ...
25,633
[ { "from": "human", "value": "Does anyone know if there's an add-in that does autocomplete for queries on SQL Management Studio?\n" }, { "from": "gpt", "value": "Yes, SQL Server Management Studio (SSMS) has built-in IntelliSense features that provide autocomplete suggestions for SQL queries. Howe...
What are the recommendations for including your compiler, libraries, and other tools in your source control system itself? In the past, I've run into issues where, although we had all the source code, building an old version of the product was an exercise in scurrying around trying to get the exact correct configuratio...
Including compilers, libraries, and other tools in your source control can certainly streamline your build process and help ensure that anyone trying to build the software has the correct environment. Here are several strategies and considerations for managing build tools effectively: ### 1. **Use Package Managers** ...
22,114
[ { "from": "human", "value": "What are the recommendations for including your compiler, libraries, and other tools in your source control system itself?\nIn the past, I've run into issues where, although we had all the source code, building an old version of the product was an exercise in scurrying around tr...
Developing software solutions which already exist and are available for re-use (either commercial or open-source). AKA "re-inventing the wheel". Same as above, but your solution being broken. AKA "re-inventing the square wheel". Developing solutions for problems which do not exist. Again, I'm interested in a more for...
Certainly! TRIZ (Theory of Inventive Problem Solving) is a systematic methodology for solving problems and enhancing creativity. It can be applied to address challenges in software development, including the ones you mentioned. Here’s how you might approach these issues using TRIZ principles: ### 1. **Re-inventing the...
24,475
[ { "from": "human", "value": "\nDeveloping software solutions which already exist and are available for re-use (either commercial or open-source). AKA \"re-inventing the wheel\".\nSame as above, but your solution being broken. AKA \"re-inventing the square wheel\".\nDeveloping solutions for problems which do...
I am currently working with 2 sql 2000 servers one I can query but not add any databases to which lead to the second one having lots of queries that use the first as a linked server. I would like to improve performance while still querying live data. Is it possible to mirror the live data to the second server, that way...
In SQL Server 2000, there are limited options for replicating data or achieving high availability and improved performance, especially given the constraints of the older version. Since you have identified that you primarily have read-heavy operations with low write operations, here are some options to consider: ### 1....
21,294
[ { "from": "human", "value": "I am currently working with 2 sql 2000 servers one I can query but not add any databases to which lead to the second one having lots of queries that use the first as a linked server. I would like to improve performance while still querying live data.\nIs it possible to mirror th...
My implementation of httpclient occasionally throws an exception when calling doGetConnection(). However, I have the following timeout set _moHttpClient.setHttpConnectionFactoryTimeout(30000); it looks almost like my timeout is not being picked up. Is there anywhere else I need to set a timeout to ensure this behaviou...
If you are experiencing issues with your `HttpClient` implementation throwing exceptions when calling `doGetConnection()`, and you have already set the HTTP connection factory timeout, there are a few other places you might need to configure timeouts to ensure comprehensive handling of HTTP requests. Here’s a checklis...
22,061
[ { "from": "human", "value": "My implementation of httpclient occasionally throws an exception when calling doGetConnection(). However, I have the following timeout set\n_moHttpClient.setHttpConnectionFactoryTimeout(30000);\n\nit looks almost like my timeout is not being picked up. Is there anywhere else I n...
I have few different applications among which I'd like to share a C# enum. I can't quite figure out how to share an enum declaration between a regular application and a WCF service. Here's the situation. I have 2 lightweight C# destop apps and a WCF webservice that all need to share enum values. Client 1 has Meth...
Yes, you can definitely share an enum among a WCF service and other applications by using a common library. The approach you're considering, creating a `Common.dll` library, is a good way to encapsulate the enum and make it accessible to all your applications. Here’s how you can accomplish this: ### Step 1: Create a C...
24,488
[ { "from": "human", "value": "I have few different applications among which I'd like to share a C# enum. I can't quite figure out how to share an enum declaration between a regular application and a WCF service. \nHere's the situation. I have 2 lightweight C# destop apps and a WCF webservice that all need to...
I am interested to read and understand the 2D mesh algorithms. A search on Google reveals a lot of papers and sources, however most are too academic and not much on beginner's side. So, would anyone here recommend any reading sources ( suitable for the beginners), or open source implementation that I can learn from th...
Understanding 2D mesh algorithms can be quite involved, especially given the academic nature of many resources. However, there are several beginner-friendly sources and open-source implementations you can explore. Here are some recommendations for learning about quadrilateral and mixed mesh generation: ### Books: 1. *...
21,331
[ { "from": "human", "value": "I am interested to read and understand the 2D mesh algorithms. A search on Google reveals a lot of papers and sources, however most are too academic and not much on beginner's side. \nSo, would anyone here recommend any reading sources ( suitable for the beginners), or open sour...
Often time I need to add a control to a dialog after the dialog has been generated via dialog template and CreateDialogIndirect. In these cases the tab order is set by the dialog template and there is no obvious way to change the tab order by including a newly created control.
When you add a control to a dialog after it has been created (for example, using `CreateDialogIndirect`), the default tab order of the controls does not automatically update to include the new control. This can cause issues with keyboard navigation when users are trying to tab through the controls in the dialog. To pr...
18,773
[ { "from": "human", "value": "Often time I need to add a control to a dialog after the dialog has been generated via dialog template and CreateDialogIndirect. In these cases the tab order is set by the dialog template and there is no obvious way to change the tab order by including a newly created control.\...
Converting a couple stored procedures from MySQL to Microsoft SQL server. Everything is going well, except one procedure used the MySQL SHA1() function. I cannot seem to find an equivalent to this in MS-SQL. Does anyone know a valid equivalent for SHA1() on MS-SQL?
In Microsoft SQL Server, you can use the built-in `HASHBYTES` function to calculate the SHA1 hash of a given input. Here’s how you can use it: ```sql SELECT HASHBYTES('SHA1', 'your input string here'); ``` This will return the SHA1 hash in binary format. If you need the hash in a hexadecimal string format, you can co...
24,805
[ { "from": "human", "value": "Converting a couple stored procedures from MySQL to Microsoft SQL server. Everything is going well, except one procedure used the MySQL SHA1() function. I cannot seem to find an equivalent to this in MS-SQL.\nDoes anyone know a valid equivalent for SHA1() on MS-SQL?\n" }, { ...
I've been beating myself over the head with this app migration for a few days now. What I have is an old MSSQL Server 2000-backed application that is being upgraded to a Windows 2003 Server running SMSQL Server 2005. I know little about SQL Server but obviously not enough. I tried backing up the database on the old ser...
Migrating a database from SQL Server 2000 to SQL Server 2005 can be tricky, especially when dealing with legacy applications. Here are several strategies you might consider to successfully migrate your database: ### 1. **Backup and Restore**: Since you're having issues with the backup file, let's clarify the steps: -...
21,995
[ { "from": "human", "value": "I've been beating myself over the head with this app migration for a few days now. What I have is an old MSSQL Server 2000-backed application that is being upgraded to a Windows 2003 Server running SMSQL Server 2005. I know little about SQL Server but obviously not enough.\nI tr...