instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Long story short, I need to put some text in my Flex application and I don't want users to be able to copy. I was going to use a label, but apparently labels do not support text wrapping. Can I make it so that users cannot select text in a Flex Text control?
Thanks.
| In a Flex application, if you want to display text that users cannot copy, you have a couple of options. While it's true that the `Label` control does not support text wrapping, you can use a `Text` control and adjust its properties to prevent text selection.
Here's how you can achieve that:
1. **Use a Text Control*... | 21,990 | [
{
"from": "human",
"value": "Long story short, I need to put some text in my Flex application and I don't want users to be able to copy. I was going to use a label, but apparently labels do not support text wrapping. Can I make it so that users cannot select text in a Flex Text control?\nThanks.\n"
},
{... |
I'm developing an iPhone app that uses the built-in SQLite database. I'm trying to view and open the database via the sqlite3 command line tool so I can execute arbitrary SQL against it.
When I run my app in the simulator, the .sqlite file it creates is located at ~/Library/Application Support/iPhone Simulator/User/App... | When you develop an iPhone app that uses an SQLite database, accessing the database file on a physical device is a bit different from doing so in the simulator. The SQLite database for your app on a physical iPhone is stored in a location that is not directly accessible due to iOS's security and sandboxing measures. Ho... | 20,284 | [
{
"from": "human",
"value": "I'm developing an iPhone app that uses the built-in SQLite database. I'm trying to view and open the database via the sqlite3 command line tool so I can execute arbitrary SQL against it.\nWhen I run my app in the simulator, the .sqlite file it creates is located at ~/Library/App... |
Does anyone know how in ASP.Net's TreeView control, to have a custom style applied to an Expanded node? I have many root nodes and want the Expanded nodes to have a different background.
| In ASP.NET, the TreeView control doesn't provide direct properties to style expanded nodes differently from collapsed nodes out of the box. However, you can achieve this with some custom code and CSS. Here's a general approach to apply a custom style to expanded nodes:
### Step-by-Step Approach
1. **Use Client-Side S... | 17,868 | [
{
"from": "human",
"value": "Does anyone know how in ASP.Net's TreeView control, to have a custom style applied to an Expanded node? I have many root nodes and want the Expanded nodes to have a different background.\n"
},
{
"from": "gpt",
"value": "In ASP.NET, the TreeView control doesn't provid... |
We have a distributed system with components (including the ActiveMQ broker) running on jdk 1.6.
A potential customer would like to integrate a component that was built on jdk 1.4 with our system. While this customer is willing to write code to integrate with our system, they are not comfortable moving from jdk 1.4.
Wo... | Integrating components built on different versions of the Java Development Kit (JDK) can lead to several potential issues, especially when one component is running on an older version, such as JDK 1.4, while the rest of the system is using JDK 1.6. Here are some key considerations and potential problems you may encount... | 20,590 | [
{
"from": "human",
"value": "We have a distributed system with components (including the ActiveMQ broker) running on jdk 1.6.\nA potential customer would like to integrate a component that was built on jdk 1.4 with our system. While this customer is willing to write code to integrate with our system, they a... |
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the switch? I'm primarily interested in web based applications, but would like to know the challenges that accompany such a move in any environment.
| Refactoring from an ActiveRecord pattern to a DataMapper pattern can be driven by various conditions, especially in the context of web-based applications. Here are some common motivations and challenges associated with such a transition:
### Reasons for Switching from ActiveRecord to DataMapper
1. **Separation of Con... | 19,139 | [
{
"from": "human",
"value": "Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the switch? I'm primarily interested in web based applications, but would like to know the challenges that accompany such a move in any environment.\n"
},
{
"from": "gpt",
"val... |
When dropping the use of rspec and rspec-rails plugins and switching to the gem versions instead, is there anything extra I have to change in spec_helper.rb or something to make the specs in my app see the change?
I can no longer get my specs to run successfully anymore after deleting the plugins and installing the ge... | When transitioning from the RSpec and RSpec-Rails plugins to the gem versions, there are a few steps you need to ensure that everything works correctly. Here’s what you can do to troubleshoot and resolve the issues you are experiencing:
### 1. Update your `spec_helper.rb`
Make sure your `spec_helper.rb` file is updat... | 18,259 | [
{
"from": "human",
"value": "When dropping the use of rspec and rspec-rails plugins and switching to the gem versions instead, is there anything extra I have to change in spec_helper.rb or something to make the specs in my app see the change? \nI can no longer get my specs to run successfully anymore after ... |
There's another post on SO relating to .NET -- not us. Pure PHP. Trying to find the best way/process to deploy stable version of our PHP app. I've seen an article on Capistrano, but am curious what else is out there. Aside from the obvious reasons, I'm also looking to add some scripting so that the SVN rev number g... | Deploying a stable version of your PHP application can involve several strategies and tools. Here are some common methods and tools that can help you with deploying your application, along with some ideas on how to incorporate version control information like SVN revision numbers:
### 1. **Capistrano**
Capistrano is ... | 18,261 | [
{
"from": "human",
"value": "There's another post on SO relating to .NET -- not us. Pure PHP. Trying to find the best way/process to deploy stable version of our PHP app. I've seen an article on Capistrano, but am curious what else is out there. Aside from the obvious reasons, I'm also looking to add so... |
Problem
Our web host provider is changing the IP address of one of the servers we are on. We have been given a time frame for when the switch will take place, but no exact details. Therefore, our current poor man's check requires a periodic page refresh on a browser to see if our website is still there.
Question
We are... | Absolutely! You can definitely create a PowerShell script to periodically check if your website is accessible and print a message or log the results to a file based on the response. Below is a simple example of how you can accomplish this.
### PowerShell Script Example
This script will check the specified URL at regu... | 17,731 | [
{
"from": "human",
"value": "Problem\nOur web host provider is changing the IP address of one of the servers we are on. We have been given a time frame for when the switch will take place, but no exact details. Therefore, our current poor man's check requires a periodic page refresh on a browser to see if o... |
I've always been interested in developing a web search engine. What's a good place to start? I've heard of Lucene, but I'm not a big Java guy. Any other good resources or open source projects?
I understand it's a huge under-taking, but that's part of the appeal. I'm not looking to create the next Google, just somet... | Developing a web search engine is an ambitious and exciting project! While Lucene is a powerful option for indexing and searching text, there are many other technologies and frameworks you can use that might align better with your preferred programming language and requirements. Here are some suggestions to help you ge... | 18,441 | [
{
"from": "human",
"value": "I've always been interested in developing a web search engine. What's a good place to start? I've heard of Lucene, but I'm not a big Java guy. Any other good resources or open source projects?\nI understand it's a huge under-taking, but that's part of the appeal. I'm not loo... |
I've seen second one in another's code and I suppose this length comparison have been done to increase code productivity. It was used in a parser for a script language with a specific dictionary: words are 4 to 24 letters long with the average of 7-8 lettets, alphabet includes 26 latin letters plus "@","$" and "_".
Le... | The phenomenon you're observing relates to how string comparison works at a low level and the optimizations that compilers perform, as well as how these optimizations interact with the specifics of your test conditions.
### Why Length Comparison Might Speed Up Comparisons:
1. **Early Exit**: When comparing two string... | 20,849 | [
{
"from": "human",
"value": "I've seen second one in another's code and I suppose this length comparison have been done to increase code productivity. It was used in a parser for a script language with a specific dictionary: words are 4 to 24 letters long with the average of 7-8 lettets, alphabet includes 2... |
I'm trying to get the charset attribute in any HTML meta tag.
(ie.< meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" >)
Is there any way to do that in C++ under linux. I was using HTML tidy as a parser but I can't get that attribute to return me anything different from us-ascii (even if the encodi... | To extract the `charset` attribute from an HTML `<meta>` tag in C++ under Linux, you can use a more specialized HTML parser or a regular expression approach, since HTML Tidy might not always give you the result you expect.
Here are two methods to achieve your goal:
### Method 1: Using Regular Expressions
Using regu... | 14,588 | [
{
"from": "human",
"value": "I'm trying to get the charset attribute in any HTML meta tag.\n(ie.< meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\" >)\nIs there any way to do that in C++ under linux. I was using HTML tidy as a parser but I can't get that attribute to return me anyth... |
I've read that Silverlight 2.0 imposes by design an asynchronous model when communicating with the web server. I haven't had a chance to experiment with Silverlight, but I assume that it uses a thread-pool to manage threads like in the .NET Framework.
Now, since some browsers, most notably Internet Explorer, have an ha... | Silverlight 2.0 does utilize an asynchronous model for communication with web servers, and it does indeed manage this using a thread pool, similar to the .NET Framework. However, when it comes to HTTP connections, Silverlight operates within the constraints of the web browser's limits on concurrent connections.
In bro... | 22,785 | [
{
"from": "human",
"value": "I've read that Silverlight 2.0 imposes by design an asynchronous model when communicating with the web server. I haven't had a chance to experiment with Silverlight, but I assume that it uses a thread-pool to manage threads like in the .NET Framework.\nNow, since some browsers, ... |
Is there a control or method to accept formatted input in VB.NET?
i.e. It accepts input in a given format ##/##/## or similar?
| Yes, in VB.NET, you can create a control or use existing controls to accept formatted input. For a specific input format like `##/##/##`, you can use a `MaskedTextBox` control which is designed for formatted input. Below are steps to set this up in a Windows Forms application.
### Using MaskedTextBox
1. **Add a Maske... | 19,504 | [
{
"from": "human",
"value": "Is there a control or method to accept formatted input in VB.NET?\ni.e. It accepts input in a given format ##/##/## or similar?\n"
},
{
"from": "gpt",
"value": "Yes, in VB.NET, you can create a control or use existing controls to accept formatted input. For a specifi... |
Mobile Safari is a very capable browser, and it can handle my website as it is perfectly. However, there are a few elements on my page that could be optimized for browsing using this device; such as serving specific thumbnails that are smaller than the desktop counterparts to help fit more content into the screen.
I wo... | Detecting Mobile Safari specifically can be a bit tricky since it's based on the same rendering engine as other browsers on iOS. However, you can make use of the `User-Agent` string that browsers send with their requests to identify if the browser is Mobile Safari.
Here is a simple way to detect Mobile Safari using PH... | 19,122 | [
{
"from": "human",
"value": "Mobile Safari is a very capable browser, and it can handle my website as it is perfectly. However, there are a few elements on my page that could be optimized for browsing using this device; such as serving specific thumbnails that are smaller than the desktop counterparts to he... |
I'm benchmarking a WPF application on various platforms and I need an easy way to determine if WPF is using hardware or software rendering.
I seem to recall a call to determine this, but can't lay my hands on it right now.
Also, is there an easy, code based way to force one rendering pipeline over the other?
| In WPF, you can determine whether hardware or software rendering is being used by checking the `RenderCapability.Tier` property from the `System.Windows.Media` namespace. This property provides information about the rendering capabilities of the system's graphics hardware.
### Check Rendering Mode
You can check if W... | 21,487 | [
{
"from": "human",
"value": "I'm benchmarking a WPF application on various platforms and I need an easy way to determine if WPF is using hardware or software rendering. \nI seem to recall a call to determine this, but can't lay my hands on it right now.\nAlso, is there an easy, code based way to force one ... |
int main()
{
HandPhone A,B;
A>>B;//overloading operator>> to simulate sending sms to another handphone(object)
return 0;
}
How should I declare the istream operator to simulate sending sms to another handphone(object)?
| To overload the `>>` operator for your `HandPhone` class in a way that simulates sending an SMS from one `HandPhone` object to another, you will typically need to define a friend function or a member function within the `HandPhone` class. The `>>` operator can be overloaded using the input stream (`std::istream`) to re... | 19,935 | [
{
"from": "human",
"value": "int main()\n{\n HandPhone A,B;\n A>>B;//overloading operator>> to simulate sending sms to another handphone(object)\n return 0;\n}\n\nHow should I declare the istream operator to simulate sending sms to another handphone(object)?\n"
},
{
"from": "gpt",
"valu... |
I am trying to learn some of the basic and advanced features of visual studio, Anyone find sites that have this type of information ?
I see this:
https://stackoverflow.com/questions/86355/best-way-to-learn-visual-studio-power-features
But it seems more related to tips and advanced features.
All three versions ( 2003, 2... | Learning Visual Studio, whether it's an older version like 2003, 2005, or 2008, or a more recent one, can be quite beneficial for your development skills. Here are some resources that you might find helpful for both basic and advanced features:
### Official Microsoft Resources
1. **Visual Studio Documentation**: The o... | 18,426 | [
{
"from": "human",
"value": "I am trying to learn some of the basic and advanced features of visual studio, Anyone find sites that have this type of information ?\nI see this:\nhttps://stackoverflow.com/questions/86355/best-way-to-learn-visual-studio-power-features\nBut it seems more related to tips and adv... |
Is there a course that can help non OO programmers how to develop in .NET in a good way?
I don't mean just the syntax and how to design a class and the relationship between class but how organize a solution into projects (naming, what to put on each one) what method is more suitable to access data (dataobjects, remotin... | It's great to see your eagerness to improve your .NET development skills, especially in the areas of solution architecture, maintainability, and good design principles. Here are some resources and approaches that can help you gain a more structured understanding of developing mid-size applications in .NET:
### Online ... | 19,142 | [
{
"from": "human",
"value": "Is there a course that can help non OO programmers how to develop in .NET in a good way?\nI don't mean just the syntax and how to design a class and the relationship between class but how organize a solution into projects (naming, what to put on each one) what method is more sui... |
I have some code that creates a fairly large xml DOM and writes it off to a file (up to 50-100MB) . It basically creates the DOM and then calls a toString on it and writes it out with ofstream. Is there a way to get streaming output of the generated dom so that it doesn't create the whole structure in memory all at onc... | To avoid building the entire XML DOM in memory and then writing it out as a single string, you can use a streaming approach. Many XML libraries provide a way to serialize XML incrementally, allowing you to write each part of the XML document directly to an output stream without keeping everything in memory at once.
He... | 19,038 | [
{
"from": "human",
"value": "I have some code that creates a fairly large xml DOM and writes it off to a file (up to 50-100MB) . It basically creates the DOM and then calls a toString on it and writes it out with ofstream. Is there a way to get streaming output of the generated dom so that it doesn't create... |
Here's my issue, I'd like to mock a class that creates a thread at initialization and closes it at destruction. There's no reason for my mock class to actually create and close threads. But, to mock a class, I have inherit from it. When I create a new instance of my mock class, the base classes constructor is called... | Mocking a Resource Acquisition Is Initialization (RAII) class can indeed be tricky, particularly when the class manages resources like threads. The best approach to handle this situation is to use a mocking framework or design your classes to be more testable by employing dependency injection or using interfaces.
Here... | 20,628 | [
{
"from": "human",
"value": "Here's my issue, I'd like to mock a class that creates a thread at initialization and closes it at destruction. There's no reason for my mock class to actually create and close threads. But, to mock a class, I have inherit from it. When I create a new instance of my mock clas... |
I'm working profesionally on a php web application which contains contacts, among other data. I was wondering how hard it would be to make this data available to external programs using the LDAP protocol.
Are there specific tools out there for this? I couldn't really find anything, but I can't imagine I'm the first to ... | Integrating LDAP (Lightweight Directory Access Protocol) functionality into your PHP web application to serve contact data is a feasible task, and there are indeed solutions that can help you achieve this without bloating your application. Here's an overview of how you can go about it and the tools you can use:
### St... | 20,635 | [
{
"from": "human",
"value": "I'm working profesionally on a php web application which contains contacts, among other data. I was wondering how hard it would be to make this data available to external programs using the LDAP protocol.\nAre there specific tools out there for this? I couldn't really find anyth... |
So C# now allows you to use default(Foo) to get a recognized "not filled in yet"/empty instance of a class -- I'm not sure if it is exactly the same as new Foo() or not. Many library classes also implement a Foo.Empty property, which returns a similar instance. And of course any reference type can point to null. So ... | In C#, how you represent an uninitialized or "not filled in yet" instance of a class can vary based on your design choices and the specific use case. Let's explore the options you've mentioned, along with their differences, usage scenarios, and best practices.
### Options for Representing Uninitialized Instances
1. *... | 17,337 | [
{
"from": "human",
"value": "So C# now allows you to use default(Foo) to get a recognized \"not filled in yet\"/empty instance of a class -- I'm not sure if it is exactly the same as new Foo() or not. Many library classes also implement a Foo.Empty property, which returns a similar instance. And of course... |
How can I prevent this exception when making a soap call to a server that is using a self signed certificate?
require "rubygems"
gem "httpclient", "2.1.2"
require 'http-access2'
require 'soap/rpc/driver'
client = SOAP::RPC::Driver.new( url, 'http://removed' )
client.options[ 'protocol.http.ssl_config.verify_mode' ] = O... | When making SOAP calls to a server that uses a self-signed certificate, you may encounter exceptions related to SSL verification. In your case, the exception indicates that the self-signed certificate is not being accepted. You already have a line that sets the SSL verification mode to `VERIFY_NONE`, but it seems it mi... | 18,968 | [
{
"from": "human",
"value": "How can I prevent this exception when making a soap call to a server that is using a self signed certificate?\nrequire \"rubygems\"\ngem \"httpclient\", \"2.1.2\"\nrequire 'http-access2'\nrequire 'soap/rpc/driver'\nclient = SOAP::RPC::Driver.new( url, 'http://removed' )\nclient.... |
I am thinking about using Microsoft Unity for my Dependency Injection tool in our User Interface.
Our Middle Tier already uses Castle Windsor, but I am thinking I should stick with Microsoft.
Does anyone have any thoughts about what the best Dependency Injection tool is?
Autofac
Castle MicroKernel/Windsor
PicoContain... | Choosing the right Dependency Injection (DI) tool can significantly impact the maintainability, testability, and overall design of your application. Here’s a breakdown of some considerations and a comparison of popular DI containers you mentioned:
### Key Considerations
1. **Compatibility and Consistency**: If your m... | 17,395 | [
{
"from": "human",
"value": "I am thinking about using Microsoft Unity for my Dependency Injection tool in our User Interface.\nOur Middle Tier already uses Castle Windsor, but I am thinking I should stick with Microsoft.\nDoes anyone have any thoughts about what the best Dependency Injection tool is? \n\nA... |
When the .net 2.0 framework first came out, the provider model was all the rage. 2.0 even shipped with a bunch of default providers (Membership, sitemap, role). Since the release of 2.0, the hype has died down, and whilst I still use providers day to day, it seems to get far less press.
I was wondering if this is becau... | The decline in the hype around the provider model in .NET since the release of .NET 2.0 can be attributed to several factors:
1. **Rise of Alternatives**: The software development landscape has evolved, with a significant increase in the popularity of other architectural patterns and frameworks. In particular, Depende... | 21,630 | [
{
"from": "human",
"value": "When the .net 2.0 framework first came out, the provider model was all the rage. 2.0 even shipped with a bunch of default providers (Membership, sitemap, role). Since the release of 2.0, the hype has died down, and whilst I still use providers day to day, it seems to get far les... |
Is it possible to do a cast within a LINQ query (for the compiler's sake)?
The following code isn't terrible, but it would be nice to make it into one query:
Content content = dataStore.RootControl as Controls.Content;
List<TabSection> tabList = (from t in content.ChildControls
select t).Of... | Yes, you can achieve this in LINQ by using the `OfType<T>()` method directly in the query expressions, which effectively filters the elements of a sequence based on their type while also allowing you to work with the strongly typed results in subsequent parts of the query.
Here's how you can refactor your code to use... | 14,017 | [
{
"from": "human",
"value": "Is it possible to do a cast within a LINQ query (for the compiler's sake)?\nThe following code isn't terrible, but it would be nice to make it into one query:\nContent content = dataStore.RootControl as Controls.Content;\n\nList<TabSection> tabList = (from t in content.ChildCont... |
What is MySQL equivalent of the Nz Function in Microsoft Access? Is Nz a SQL standard?
In Access, the Nz function lets you return a value when a variant is null. Source
The syntax for the Nz function is:
Nz ( variant, [ value_if_null ] )
| The `Nz` function in Microsoft Access is specifically designed to handle null values by returning a specified alternative value if the given variant is null. The syntax is as follows:
```sql
Nz(variant, [value_if_null])
```
In MySQL, there is no direct equivalent to the `Nz` function, but you can achieve similar func... | 22,483 | [
{
"from": "human",
"value": "What is MySQL equivalent of the Nz Function in Microsoft Access? Is Nz a SQL standard?\nIn Access, the Nz function lets you return a value when a variant is null. Source\nThe syntax for the Nz function is:\nNz ( variant, [ value_if_null ] )\n\n"
},
{
"from": "gpt",
"... |
While designing a table my colleague here says that I should avoid identity column as it is specific to SQL Server and MS Access, But I differ with his views as it makes my coding simpler.
Should I use identity column or not? If not what is best way to create the identity columns from application code?
| Using identity columns in a database can be a good approach, especially when you need a unique identifier for each row in a table. Here are some considerations regarding your colleague's concerns about identity columns:
### Advantages of Using Identity Columns
1. **Simplicity**: Identity columns automatically generat... | 20,435 | [
{
"from": "human",
"value": "While designing a table my colleague here says that I should avoid identity column as it is specific to SQL Server and MS Access, But I differ with his views as it makes my coding simpler. \nShould I use identity column or not? If not what is best way to create the identity colu... |
Is there a way to place a watch on variable and only have Visual Studio break when that value changes?
It would make it so much easier to find tricky state issues.
Can this be done?
Breakpoint conditions still need a breakpoint set, and I'd rather set a watch and let Visual Studio set the breakpoints at state changes.
| Yes, Visual Studio has a feature that allows you to break execution when the value of a variable changes. This is done through the use of **data breakpoints**. However, data breakpoints can only be used with variables that are stored in memory (such as fields of an object) and typically only in a debug configuration.
... | 21,475 | [
{
"from": "human",
"value": "Is there a way to place a watch on variable and only have Visual Studio break when that value changes?\nIt would make it so much easier to find tricky state issues.\nCan this be done?\nBreakpoint conditions still need a breakpoint set, and I'd rather set a watch and let Visual S... |
Say I have the classic 4-byte signed integer, and I want something like
print hex(-1)
to give me something like
0xffffffff
In reality, the above gives me -0x1. I'm dawdling about in some lower level language, and python commandline is quick n easy.
So.. is there a way to do it?
| In Python, when you want to print a negative integer in hexadecimal format as a signed 32-bit integer (like `-1` represented as `0xffffffff`), you can use the following approach. You'll need to mask the number to ensure it fits into 32 bits.
Here’s how you can do it:
```python
num = -1
# Masking to get the last 32 bi... | 22,584 | [
{
"from": "human",
"value": "Say I have the classic 4-byte signed integer, and I want something like\nprint hex(-1)\n\nto give me something like\n\n0xffffffff\n\nIn reality, the above gives me -0x1. I'm dawdling about in some lower level language, and python commandline is quick n easy.\nSo.. is there a way... |
There is the button control in silverlight application . Can I send a mouse click event to it programmatically?
| In Silverlight, you cannot directly simulate a mouse click event on a button control programmatically as you would in some other frameworks. However, you can trigger the click event handler associated with the button by invoking it directly in your code.
Here's how you can do it:
1. **Directly Call the Event Handler:... | 21,077 | [
{
"from": "human",
"value": "There is the button control in silverlight application . Can I send a mouse click event to it programmatically?\n"
},
{
"from": "gpt",
"value": "In Silverlight, you cannot directly simulate a mouse click event on a button control programmatically as you would in some... |
Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable text label. Clicking the text label replaces it with a Hippo CanvasEntry widget which contains the text of the label.
import pygtk
pygtk.require('2.0')
import gtk, hippo
def textClicked(text, event, row):
input = hippo.CanvasEnt... | To automatically focus the `Hippo.CanvasEntry` widget when it is created, you can call the `grab_focus()` method on the entry widget right after you add it to the canvas. This method requests keyboard input focus for the `CanvasEntry`, allowing the user to start typing immediately without needing to click on it again.
... | 21,651 | [
{
"from": "human",
"value": "Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable text label. Clicking the text label replaces it with a Hippo CanvasEntry widget which contains the text of the label.\nimport pygtk\npygtk.require('2.0')\nimport gtk, hippo\n\ndef textClicked(... |
Has anyone had luck with removing large amount of issues from a jira database instead of using the frontend? Deleting 60000 issues with the bulktools is not really feasible.
Last time I tried it, the jira went nuts because of its own way of doing indexes.
| Yes, there are ways to remove a large number of issues from a Jira database more efficiently than using the frontend. Here are a few approaches that you can consider:
### 1. **Jira REST API**
You can use the Jira REST API to script the deletion of issues in bulk. This method allows you to programmatically delete issue... | 20,188 | [
{
"from": "human",
"value": "Has anyone had luck with removing large amount of issues from a jira database instead of using the frontend? Deleting 60000 issues with the bulktools is not really feasible.\nLast time I tried it, the jira went nuts because of its own way of doing indexes.\n"
},
{
"from"... |
Suppose I have the following C code.
unsigned int u = 1234;
int i = -5678;
unsigned int result = u + i;
What implicit conversions are going on here, and is this code safe for all values of u and i? (Safe, in the sense that even though result in this example will overflow to some huge positive number, I could cast it ... | In the code you provided, there are several implicit conversions and considerations regarding safety due to how the C language handles type conversions and arithmetic operations.
### Implicit Conversions:
1. **Mixed Type Arithmetic**: The variables `u` (of type `unsigned int`) and `i` (of type `int`) are being added ... | 20,857 | [
{
"from": "human",
"value": "Suppose I have the following C code.\nunsigned int u = 1234;\nint i = -5678;\n\nunsigned int result = u + i;\n\nWhat implicit conversions are going on here, and is this code safe for all values of u and i? (Safe, in the sense that even though result in this example will overflow... |
Sometimes I break long conditions in ifs onto several lines. The most obvious way to do this is:
if (cond1 == 'val1' and cond2 == 'val2' and
cond3 == 'val3' and cond4 == 'val4'):
do_something
Isn't very very appealing visually, because the action blends with the conditions. However, it is the natural way... | Certainly! There are several ways to improve the readability of long conditions in Python. Here are a few alternatives you can consider:
### 1. Use Parentheses
You can use parentheses around the conditions to improve readability and also align the actions separately from the conditions:
```python
if (
cond1 == '... | 19,750 | [
{
"from": "human",
"value": "Sometimes I break long conditions in ifs onto several lines. The most obvious way to do this is:\n if (cond1 == 'val1' and cond2 == 'val2' and\n cond3 == 'val3' and cond4 == 'val4'):\n do_something\n\nIsn't very very appealing visually, because the action blends with ... |
When you're passing variables through your site using GET requests, do you validate (regular expressions, filters, etc.) them before you use them?
Say you have the URL http://www.example.com/i=45&p=custform. You know that "i" will always be an integer and "p" will always contain only letters and/or numbers. Is it worth... | Yes, it is definitely worth the time to validate variables received through GET requests. Even if you expect specific types of data (like an integer for "i" and alphanumeric characters for "p"), validating these inputs is an important security practice. Here are a few reasons why you should validate your GET parameters... | 17,565 | [
{
"from": "human",
"value": "When you're passing variables through your site using GET requests, do you validate (regular expressions, filters, etc.) them before you use them?\nSay you have the URL http://www.example.com/i=45&p=custform. You know that \"i\" will always be an integer and \"p\" will always co... |
I have a trivial console application in .NET. It's just a test part of a larger application. I'd like to specify the "exit code" of my console application. How do I do this?
| In a .NET console application, you can specify the exit code by using the `Environment.Exit` method or by returning an integer value from the `Main` method. Here's how you can do both:
### Method 1: Using `Environment.Exit`
You can call `Environment.Exit(int exitCode)` to specify the exit code explicitly. Here’s an e... | 21,537 | [
{
"from": "human",
"value": "I have a trivial console application in .NET. It's just a test part of a larger application. I'd like to specify the \"exit code\" of my console application. How do I do this?\n"
},
{
"from": "gpt",
"value": "In a .NET console application, you can specify the exit co... |
Several months ago my work deployed an in-house function that wraps the standard, php, mysql_query() function with additional options and abilities. A sample feature would be some handy debugging tools we can turn on/off.
I was wondering how popular query handlers are and what features people like to build into them.
| Query handlers, or wrappers around standard database functions, are quite popular in web development. They offer flexibility, improved maintainability, and various features that enhance the usability of database interactions. Here are some common features that developers often include in their custom query handlers:
1... | 20,578 | [
{
"from": "human",
"value": "Several months ago my work deployed an in-house function that wraps the standard, php, mysql_query() function with additional options and abilities. A sample feature would be some handy debugging tools we can turn on/off. \nI was wondering how popular query handlers are and what... |
When running a Jasper report in which the SQL is embedded in the report file (.jrxml), is it possible to see the SQL that is executed? Ideally, I'd also like to see the values that are substituted for each of the $P{} placeholders.
Cheers,
Don
| Yes, it is possible to see the SQL that is executed when running a Jasper report with embedded SQL in the .jrxml file, along with the values substituted for the `$P{}` parameters. Here’s how you can do this:
1. **Enable SQL Logging**: JasperReports provides a built-in way to log the SQL queries that are generated and ... | 21,334 | [
{
"from": "human",
"value": "When running a Jasper report in which the SQL is embedded in the report file (.jrxml), is it possible to see the SQL that is executed? Ideally, I'd also like to see the values that are substituted for each of the $P{} placeholders.\nCheers,\nDon\n"
},
{
"from": "gpt",
... |
I have tried this...
Dim myMatches As String() =
System.Text.RegularExpressions.Regex.Split(postRow.Item("Post"), "\b\#\b")
But it is splitting all words, I want an array of words that start with#
Thanks!
| To achieve your goal of splitting a string into an array of words that specifically start with the `#` character (also known as hashtags), you can use a regular expression that matches those words.
Here's how you can modify your code:
```vb.net
Dim myMatches As String() = System.Text.RegularExpressions.Regex.Matches(... | 23,358 | [
{
"from": "human",
"value": "I have tried this...\nDim myMatches As String() = \nSystem.Text.RegularExpressions.Regex.Split(postRow.Item(\"Post\"), \"\\b\\#\\b\")\n\nBut it is splitting all words, I want an array of words that start with#\nThanks!\n"
},
{
"from": "gpt",
"value": "To achieve your... |
In certain areas in my application I need data from several tables in the database (I have an application, the application has many attributes, each attribute has several definitions, and each definition has a value). I need the data from all these tables for an application. Should I use a view (one that would be rath... | When deciding between using a view or subqueries for retrieving data from multiple tables in your application, there are several factors to consider, including performance, maintainability, readability, and caching.
### Using a View
1. **Performance**:
- Views can encapsulate complex SQL queries, making your main... | 20,826 | [
{
"from": "human",
"value": "In certain areas in my application I need data from several tables in the database (I have an application, the application has many attributes, each attribute has several definitions, and each definition has a value). I need the data from all these tables for an application. Sh... |
I'm encountering a strange memory read/write error while calling a compiled DLL from C#. I use DllImport to get a handle to the function we need, which writes a return value to a parametric pointer to an int (i.e., int* out). This function is called multiple times within a thread, and runs successfully over the executi... | AccessViolationException typically indicates an attempt to access memory that the process does not have permission to access, or that has been freed or otherwise invalidated. Given your situation where the calls work fine in one thread but fail in another, it suggests that there may be an issue with how memory is manag... | 20,158 | [
{
"from": "human",
"value": "I'm encountering a strange memory read/write error while calling a compiled DLL from C#. I use DllImport to get a handle to the function we need, which writes a return value to a parametric pointer to an int (i.e., int* out). This function is called multiple times within a threa... |
ToolStrip with MenuStrip or RibbonBar?
It combines both of the controls. It also have a TabPages navigation, contextual tabs, etc. However the RibbonBar is a very complex control and when you open a new document in for example Word2007 the half of the screen you see a Ribbon Bar. It is not cool. When you have toolStr... | The choice between using a `ToolStrip` with `MenuStrip` or a `RibbonBar` in your application often depends on various factors including the complexity of the interface you want to create, user experience considerations, and the specific needs of your application. Below are some insights into both approaches to help you... | 20,170 | [
{
"from": "human",
"value": "ToolStrip with MenuStrip or RibbonBar? \n\nIt combines both of the controls. It also have a TabPages navigation, contextual tabs, etc. However the RibbonBar is a very complex control and when you open a new document in for example Word2007 the half of the screen you see a Ribbon... |
Will there be a functional language which does for the Java community what F# does for the .NET community?
What functional programming languages are available, or in development, for the JVM?
| As of my last knowledge update in October 2023, there are several functional programming languages and libraries available for the Java Virtual Machine (JVM) that aim to integrate functional programming paradigms with the Java ecosystem. While there's no single language that directly mirrors F#'s role for the .NET comm... | 17,997 | [
{
"from": "human",
"value": "Will there be a functional language which does for the Java community what F# does for the .NET community?\nWhat functional programming languages are available, or in development, for the JVM?\n"
},
{
"from": "gpt",
"value": "As of my last knowledge update in October... |
I have an array of 1000 or so entries, with examples below:
wickedweather
liquidweather
driveourtrucks
gocompact
slimprojector
I would like to be able to split these into their respective words, as:
wicked weather
liquid weather
drive our trucks
go compact
slim projector
I was hoping a regular expression my do the tr... | Splitting concatenated words into their respective components can indeed be a challenging task, especially when there are no delimiters or capitalization cues. While regular expressions alone might not suffice due to the nature of your input, you can employ a dictionary-based approach along with some string processing ... | 18,735 | [
{
"from": "human",
"value": "I have an array of 1000 or so entries, with examples below:\nwickedweather\nliquidweather\ndriveourtrucks\ngocompact\nslimprojector\n\nI would like to be able to split these into their respective words, as:\nwicked weather\nliquid weather\ndrive our trucks\ngo compact\nslim proj... |
A while a go I had to developed a music site that allowed audio files to be uploaded to a site and then converted in to various formats using ffmpeg, people would then download the uploaded audio files after purchasing them and a tmp file would be created and placed at the download location and was only valid for each ... | When it comes to storing files (audio, pictures, video) in a web application, both options you mentioned have their pros and cons, especially in terms of security, performance, and manageability. Here’s a breakdown of each option:
### Option 1: Storing Files in a Folder and Referencing Them in the Database
**Pros:**
... | 18,997 | [
{
"from": "human",
"value": "A while a go I had to developed a music site that allowed audio files to be uploaded to a site and then converted in to various formats using ffmpeg, people would then download the uploaded audio files after purchasing them and a tmp file would be created and placed at the downl... |
I have been trying to use the Perl utility/module "prove" as a test harness for some unit tests. The unit tests are a little more "system" than "unit" as I need to fork off some background processes as part of the test, Using the following...
sub SpinupMonitor{
my $base_dir = shift;
my $config = shift;
my $pi... | It looks like you're experiencing issues with process management in Perl, specifically related to forking and the handling of child processes when using the `prove` test harness. This can happen if child processes are not properly managed, leading to them becoming defunct or zombie processes. Here are a few suggestions... | 16,652 | [
{
"from": "human",
"value": "I have been trying to use the Perl utility/module \"prove\" as a test harness for some unit tests. The unit tests are a little more \"system\" than \"unit\" as I need to fork off some background processes as part of the test, Using the following...\nsub SpinupMonitor{\n my $ba... |
I posted an answer to this question, including a very short rant at the end about how String.Split() should accept IEnumerable<string> rather than string[].
That got me thinking. What if the base Object class from which everything else inherits provided a default implementation for IEnumerable such that everything no... | Your idea of providing a default implementation for `IEnumerable` in the base `Object` class is intriguing and would have a number of potential consequences, both positive and negative. Here are some considerations regarding this approach:
### Advantages:
1. **Simplified Interfaces**: Many APIs could be simplified. M... | 16,545 | [
{
"from": "human",
"value": "I posted an answer to this question, including a very short rant at the end about how String.Split() should accept IEnumerable<string> rather than string[]. \nThat got me thinking. What if the base Object class from which everything else inherits provided a default implementati... |
What is an efficient way to shrink a two dimensional array to a smaller size in C#?
For example:
var bigArray = new object[100, 100];
var smallArray = new object[10, 10];
bigArray[0, 0] = 1;
bigArray[0, 1] = 2;
...
bigArray[99, 99] = 100000;
startRowIndex = 0;
startColumnIndex = 0;
endRowIndex = 9;
endColumnIndex = ... | In C#, when you need to create a smaller two-dimensional array from a larger one, the typical approach is to use nested loops to copy the specified section of the larger array into the smaller one. While this does involve iteration, it's generally the most straightforward and clear method to achieve this for a fixed-si... | 16,512 | [
{
"from": "human",
"value": "What is an efficient way to shrink a two dimensional array to a smaller size in C#?\nFor example:\nvar bigArray = new object[100, 100];\nvar smallArray = new object[10, 10];\n\nbigArray[0, 0] = 1;\nbigArray[0, 1] = 2;\n...\nbigArray[99, 99] = 100000;\n\n\nstartRowIndex = 0;\nsta... |
I'm writing some JavaScript code to parse user-entered functions (for spreadsheet-like functionality). Having parsed the formula I could convert it into JavaScript and run eval() on it to yield the result.
However, I've always shied away from using eval() if I can avoid it because it's evil (and, rightly or wrongly, I'... | Using `eval()` in JavaScript can be risky, especially when dealing with user-generated input. It opens your code to a range of potential security vulnerabilities, such as code injection attacks, where malicious users can execute arbitrary JavaScript code. Here are some points to consider:
### When is `eval()` consider... | 20,652 | [
{
"from": "human",
"value": "I'm writing some JavaScript code to parse user-entered functions (for spreadsheet-like functionality). Having parsed the formula I could convert it into JavaScript and run eval() on it to yield the result.\nHowever, I've always shied away from using eval() if I can avoid it beca... |
A lambda expression which takes a function (of one argument) and a number, and applies the function to twice the number.
| You can create a lambda expression that takes a function and a number, and then applies that function to twice the number. Here's how you can do it in Python:
```python
apply_function = lambda func, num: func(2 * num)
```
In this lambda expression:
- `func` is the function that takes one argument.
- `num` is the numb... | 22,310 | [
{
"from": "human",
"value": "A lambda expression which takes a function (of one argument) and a number, and applies the function to twice the number.\n"
},
{
"from": "gpt",
"value": "You can create a lambda expression that takes a function and a number, and then applies that function to twice th... |
I've been writing some providers in c# that inherit from the providerbase class. I've found that it's hard to write tests that use the providers as most mocking frameworks will only allow you to mock an interface.
Is there any way to mock a call to a provider that inherits from providerbase?
If not, is there a pattern... | Mocking classes that inherit from a base class can be a challenge, especially if you are using a mocking framework that primarily works with interfaces. However, you have several options to work around this limitation and make your provider classes more testable.
### 1. Use Interfaces
One of the most common patterns ... | 18,223 | [
{
"from": "human",
"value": "I've been writing some providers in c# that inherit from the providerbase class. I've found that it's hard to write tests that use the providers as most mocking frameworks will only allow you to mock an interface. \nIs there any way to mock a call to a provider that inherits fro... |
I am getting the following error:
Open
OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server
[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.
HRESULT error code:0×80020009
Exception occurred.
I have tried following the directions here with no luck.
Any ideas?
FIXED
My sp... | It sounds like you encountered a common issue when dealing with multiple installations of SQL Server and related components, which can lead to conflicts and connection problems. Here are some general troubleshooting steps that can help avoid similar issues in the future or assist others who might experience the same pr... | 19,387 | [
{
"from": "human",
"value": "I am getting the following error:\nOpen\nOLE error code:80004005 in Microsoft OLE DB Provider for SQL Server\n[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.\nHRESULT error code:0×80020009\nException occurred.\n\nI have tried following the dire... |
I have Windows 2003 Standard, IIS 6, PHP, MySQL and amy trying to get mcrypt working so I can use phpMyAdmin.
I have uncommended php_mcrypt.dll in php.ini and this file is in my extensions folder (c:\php).
I have downloaded libmcrypt.dll to c:\php, c:\php\ext, c:\windows, c:\windows\system32. I have also found a second... | Getting the `mcrypt` extension to work on PHP with IIS 6 can be a bit tricky, especially on older systems like Windows Server 2003. Here are a few troubleshooting steps and tips to help you resolve the issue:
### 1. **Check PHP Version and Compatibility**
Make sure that the version of `php_mcrypt.dll` you are using is... | 19,436 | [
{
"from": "human",
"value": "I have Windows 2003 Standard, IIS 6, PHP, MySQL and amy trying to get mcrypt working so I can use phpMyAdmin.\nI have uncommended php_mcrypt.dll in php.ini and this file is in my extensions folder (c:\\php).\nI have downloaded libmcrypt.dll to c:\\php, c:\\php\\ext, c:\\windows,... |
Some of the requirements (restrictions) for such a ui framework/toolkit are:
No single vendor lock down
Ability for real time data visualization
Good initial widgets
Good dash boarding capabilities
cross platform
Good development/debug environment
No flash
| Based on your requirements for a UI framework/toolkit, here are several options that may fit your needs:
### 1. **React**
- **No single vendor lock down**: React is open source and maintained by a community.
- **Real-time data visualization**: Libraries like Recharts, D3.js, and Chart.js can be integrated for real-tim... | 18,834 | [
{
"from": "human",
"value": "Some of the requirements (restrictions) for such a ui framework/toolkit are:\n\nNo single vendor lock down\nAbility for real time data visualization\nGood initial widgets\nGood dash boarding capabilities\ncross platform\nGood development/debug environment\nNo flash\n\n"
},
{... |
I have a program 'foo' running different threads, fooT1, fooT2, .. fooTn.
Now if I want write another program 'bar', which could kill the thread fooTr, is that possible?
Reason: One of the thread fooTr tracks product license. If this thread is killed; one may run this product indefinitely. And killing 'foo' itself is t... | Killing a specific thread of a running process in a Linux environment, especially a Java application running on the JVM, can be challenging. There are some potential approaches to accomplish this, but it's important to be cautious, as manipulating threads can lead to unpredictable behavior in the application.
### Poss... | 19,837 | [
{
"from": "human",
"value": "I have a program 'foo' running different threads, fooT1, fooT2, .. fooTn.\nNow if I want write another program 'bar', which could kill the thread fooTr, is that possible?\nReason: One of the thread fooTr tracks product license. If this thread is killed; one may run this product ... |
We are changing some of the text for our old, badly written error messages. What are some resources for best practices on writing good error messages (specifically for Windows XP/Vista).
| When writing error messages for Windows XP/Vista or any application, it’s essential to follow best practices to ensure that users understand the issue and how to resolve it. Here are some resources and general best practices for writing effective error messages:
### Best Practices for Writing Error Messages
1. **Be C... | 15,293 | [
{
"from": "human",
"value": "We are changing some of the text for our old, badly written error messages. What are some resources for best practices on writing good error messages (specifically for Windows XP/Vista).\n"
},
{
"from": "gpt",
"value": "When writing error messages for Windows XP/Vis... |
I know this is probably the dumbest question ever, however I am a total beginner when it comes to CSS; how do you hyperlink an image on a webpage using an image which is sourced from CSS? I am trying to set the title image on my website linkable to the frontpage. Thanks!
Edit: Just to make it clear, I'm sourcing my ima... | It's not a dumb question at all! If you want to make a `div` that has a background image hyperlinked to your homepage without changing the `div` to an anchor (`<a>`), you can wrap the `div` in an anchor tag.
Here's how you can do it:
1. Wrap your `div` inside an `<a>` tag in your HTML.
2. Use CSS to ensure that the e... | 20,217 | [
{
"from": "human",
"value": "I know this is probably the dumbest question ever, however I am a total beginner when it comes to CSS; how do you hyperlink an image on a webpage using an image which is sourced from CSS? I am trying to set the title image on my website linkable to the frontpage. Thanks!\nEdit: ... |
I need to add a xml:lang attribute on the root xml node in the outbound document from BizTalk.
This is a fixed value, so it may be set in the schema or something.
This is what I want to get out:
<Catalog xml:lang="NB-NO">
...
</Catalog>
I've tried to define the attribute "xml:lang", but it doesn't allow me to use ":" ... | In BizTalk 2006, you cannot directly use the `:` character in XML attribute names within schemas. However, you can achieve your goal of adding the `xml:lang` attribute to your root node in a couple of different ways.
### Option 1: Use a Custom XSLT
One common approach is to use an XSLT transformation to add the `xml:... | 20,455 | [
{
"from": "human",
"value": "I need to add a xml:lang attribute on the root xml node in the outbound document from BizTalk.\nThis is a fixed value, so it may be set in the schema or something.\nThis is what I want to get out:\n<Catalog xml:lang=\"NB-NO\">\n...\n</Catalog>\n\nI've tried to define the attribu... |
Calling Validate() on an XmlDocument requires passing in a ValidationEventHandler delegate. That event function gets a ValidationEventArgs parameter which in turn has an Exception property of the type XmlSchemaException. Whew!
My current code looks like this:
ValidationEventHandler onValidationError = delegate(object... | To simplify your XML document validation and throw an `XmlSchemaException` directly upon validation errors while ignoring warnings, you can modify your `ValidationEventHandler` to filter out warnings. Unfortunately, the built-in .NET `XmlDocument.Validate` method does not provide a built-in way to handle this directly,... | 21,884 | [
{
"from": "human",
"value": "Calling Validate() on an XmlDocument requires passing in a ValidationEventHandler delegate. That event function gets a ValidationEventArgs parameter which in turn has an Exception property of the type XmlSchemaException. Whew!\nMy current code looks like this:\nValidationEvent... |
Can I safely download and install .Net framework 3.5 SP1 without requiring my customers to upgrade their .Net Framework distributable?
EDIT: And without changing my build script
EDIT: I'm currently running 3.5
| Yes, you can safely download and install .NET Framework 3.5 SP1 without requiring your customers to upgrade their .NET Framework distributable, provided that they already have .NET Framework 3.5 installed on their machines.
Here's a bit more detail to clarify:
1. **.NET Framework 3.5 SP1** is a service pack for the ... | 21,048 | [
{
"from": "human",
"value": "Can I safely download and install .Net framework 3.5 SP1 without requiring my customers to upgrade their .Net Framework distributable?\nEDIT: And without changing my build script\nEDIT: I'm currently running 3.5\n"
},
{
"from": "gpt",
"value": "Yes, you can safely do... |
How do I get the ASCII value of a character as an int in Python?
| In Python, you can obtain the ASCII value of a character using the built-in `ord()` function. This function takes a single character (a string of length 1) as an argument and returns its corresponding ASCII value as an integer.
Here’s an example:
```python
# Example character
char = 'A'
# Get ASCII value
ascii_value... | 23,922 | [
{
"from": "human",
"value": "How do I get the ASCII value of a character as an int in Python?\n"
},
{
"from": "gpt",
"value": "In Python, you can obtain the ASCII value of a character using the built-in `ord()` function. This function takes a single character (a string of length 1) as an argumen... |
I have a simple query like this:
select * from mytable where id > 8
I want to make the 8 a variable. There's some syntax like
declare @myvar int
myvar = 8
but I don't know the exact syntax.
What is it?
Thanks!
| To use a variable in your SQL query, the exact syntax can vary depending on the database system you are using (e.g., SQL Server, MySQL, etc.). Below are examples for both SQL Server and MySQL.
### For SQL Server:
You can declare and set a variable using the following syntax:
```sql
DECLARE @myvar INT; -- Declare the... | 22,435 | [
{
"from": "human",
"value": "I have a simple query like this:\nselect * from mytable where id > 8\n\nI want to make the 8 a variable. There's some syntax like \ndeclare @myvar int\nmyvar = 8\n\nbut I don't know the exact syntax.\nWhat is it?\nThanks!\n"
},
{
"from": "gpt",
"value": "To use a va... |
I've noticed RAII has been getting lots of attention on Stackoverflow, but in my circles (mostly C++) RAII is so obvious its like asking what's a class or a destructor.
So I'm really curious if that's because I'm surrounded daily, by hard-core C++ programmers, and RAII just isn't that well known in general (including C... | Your observation about the attention RAII (Resource Acquisition Is Initialization) is getting on Stack Overflow is quite insightful, and it reflects broader trends in programming language adoption and paradigms.
1. **C++ as a Special Case**: RAII is indeed a cornerstone of resource management in C++. It leverages the ... | 21,710 | [
{
"from": "human",
"value": "I've noticed RAII has been getting lots of attention on Stackoverflow, but in my circles (mostly C++) RAII is so obvious its like asking what's a class or a destructor.\nSo I'm really curious if that's because I'm surrounded daily, by hard-core C++ programmers, and RAII just isn... |
I'm told that the template system in C++ is Turing-complete at compile time. This is mentioned in this post and also on wikipedia.
Can you provide a nontrivial example of a computation that exploits this property?
Is this fact useful in practice?
| Yes, C++ templates can indeed exhibit Turing-completeness at compile time, allowing for complex computations and metaprogramming tasks. This means you can perform computations and generate code based on compile-time logic.
Here's a classic example of using C++ template metaprogramming to compute the Fibonacci sequence... | 17,581 | [
{
"from": "human",
"value": "I'm told that the template system in C++ is Turing-complete at compile time. This is mentioned in this post and also on wikipedia.\nCan you provide a nontrivial example of a computation that exploits this property?\nIs this fact useful in practice?\n"
},
{
"from": "gpt",... |
I've got a string like
foo (123) bar
I want to retrieve all numbers surrounded with the delimiters ( and ).
If I use varname.match(/\([0-9]+\)/), my delimiters are included in the response, and I get "(123)" when what I really want is "123".
How can I retrieve only a portion of the matched string without following i... | To retrieve only the number surrounded by parentheses without including the parentheses in the response, you can use capturing groups in your regular expression. You can modify your regex to capture just the numbers inside the parentheses.
Here's how you can do it:
```javascript
const varname = "foo (123) bar";
const... | 23,959 | [
{
"from": "human",
"value": "I've got a string like\nfoo (123) bar\n\nI want to retrieve all numbers surrounded with the delimiters ( and ). \nIf I use varname.match(/\\([0-9]+\\)/), my delimiters are included in the response, and I get \"(123)\" when what I really want is \"123\". \nHow can I retrieve only... |
I tried but I guess Message Box only works with win forms. What is the best alternative to use in web forms?
| In web forms, you don't have a traditional MessageBox like you do in Windows Forms. However, there are several alternatives you can use to display messages to users in a web application. Here are some common options:
### 1. **JavaScript Alert Box**
You can use the built-in `alert()` function to display a simple messag... | 19,639 | [
{
"from": "human",
"value": "I tried but I guess Message Box only works with win forms. What is the best alternative to use in web forms?\n"
},
{
"from": "gpt",
"value": "In web forms, you don't have a traditional MessageBox like you do in Windows Forms. However, there are several alternatives y... |
Are there any good webservices out there that provide good lookup information for Countries and States/Provinces?
If so what ones do you use?
| Yes, there are several web services that provide lookup information for countries and states/provinces. Here are some popular options:
1. **REST Countries**:
- **URL**: [restcountries.com](https://restcountries.com/)
- **Features**: Provides detailed information about countries, including names, codes, populatio... | 18,630 | [
{
"from": "human",
"value": "Are there any good webservices out there that provide good lookup information for Countries and States/Provinces?\nIf so what ones do you use?\n"
},
{
"from": "gpt",
"value": "Yes, there are several web services that provide lookup information for countries and state... |
iMacros is a very nice tool which allows to authomatically fill HTML forms and extract content, includes cycles and many other features. The problem is that it is quite tricky to make it extracting content properly. For example, I have failed to extract all London-to-Tokio flight prices for all the dates between 1/10/0... | If you're looking for alternatives to iMacros for web scraping and automated form filling, there are several tools and libraries that might meet your needs more effectively:
1. **Selenium**: This is a popular web automation tool that allows you to interact with web pages just like a human would. It's great for filling... | 21,020 | [
{
"from": "human",
"value": "iMacros is a very nice tool which allows to authomatically fill HTML forms and extract content, includes cycles and many other features. The problem is that it is quite tricky to make it extracting content properly. For example, I have failed to extract all London-to-Tokio fligh... |
I've tried restarting apache and the cached pages still appear, so there must be a folder someplace. I don't have a 'public/cache', so what other places should I look? Is there a URL flag that could trigger this effect as well?
| If you're experiencing cached pages in an Apache web server and you've already restarted Apache without resolving the issue, there are several places to check for cached content, as well as URL flags to consider.
### 1. Check Browser Cache
First, ensure that the issue isn't related to your browser's cache. Clear your ... | 18,937 | [
{
"from": "human",
"value": "I've tried restarting apache and the cached pages still appear, so there must be a folder someplace. I don't have a 'public/cache', so what other places should I look? Is there a URL flag that could trigger this effect as well?\n"
},
{
"from": "gpt",
"value": "If you... |
Doxygen is a bit slow - it takes about a couple of minutes to process my whole project, so for small incremental changes this is longer than actually building the rest of my code. There are thousands of files without any documentation so I guess it is spending most of its time processing them. Is there any way to get i... | Doxygen can indeed take a considerable amount of time to process large projects, especially when there are many files without documentation. Here are a few strategies you can use to improve the performance and reduce the processing time:
### 1. Skip Files Without Documentation
Doxygen does not have a built-in option ... | 19,611 | [
{
"from": "human",
"value": "Doxygen is a bit slow - it takes about a couple of minutes to process my whole project, so for small incremental changes this is longer than actually building the rest of my code. There are thousands of files without any documentation so I guess it is spending most of its time p... |
I'm interested in using API spying/hijacking to implement some core features of a project I'm working on. It's been mentioned in this question as well, but that wasn't really on topic so I figured it'd be better with a question of its own for this.,
I'd like to gather as much information as possible on this, different ... | API spying and hijacking is a complex and often sensitive topic, primarily because it can be associated with both legitimate software development practices and malicious intent. However, there are legitimate use cases such as application monitoring, debugging, and extending the functionality of existing software. Below... | 13,523 | [
{
"from": "human",
"value": "I'm interested in using API spying/hijacking to implement some core features of a project I'm working on. It's been mentioned in this question as well, but that wasn't really on topic so I figured it'd be better with a question of its own for this.,\nI'd like to gather as much i... |
I have a command line executable that alters some bits in a file that i want to use from my program.
Is it possible to create my own executable that uses this tool and distribute only one executable?
[edit] Clarification:
The command line tool takes an offset and some bits and changes the bits at this offset in a given... | Yes, it is possible to create your own executable that wraps around the command line tool you want to use. By doing this, you can take control of the parameters you pass to the original tool, effectively creating a custom patcher. Below are the general steps to achieve this using C or C++ on Windows:
### Steps to Crea... | 14,341 | [
{
"from": "human",
"value": "I have a command line executable that alters some bits in a file that i want to use from my program.\nIs it possible to create my own executable that uses this tool and distribute only one executable?\n[edit] Clarification:\nThe command line tool takes an offset and some bits an... |
I'm looking for something that will monitor Windows directories for size and file count over time. I'm talking about a handful of servers and a few thousand folders (millions of files).
Requirements:
Notification on X increase in size over Y time
Notification on X increase in file count over Y time
Historical graphing... | Monitoring Windows directories for size and file count can be accomplished through a combination of existing tools or by developing your own solution. Below are some options, both free and paid, and a brief outline of how you could write your own script using PowerShell.
### Existing Solutions
1. **Free Tools:**
-... | 16,432 | [
{
"from": "human",
"value": "I'm looking for something that will monitor Windows directories for size and file count over time. I'm talking about a handful of servers and a few thousand folders (millions of files).\nRequirements:\n\nNotification on X increase in size over Y time\nNotification on X increase ... |
I have the following C# singleton pattern, is there any way of improving it?
public class Singleton<T> where T : class, new()
{
private static object _syncobj = new object();
private static volatile T _instance = null;
public static T Instance
{
get
{
... | Your implementation of the singleton pattern in C# is a classic example of the double-check locking pattern, which is a valid approach for thread-safe singleton creation. However, there are a few improvements and alternatives you can consider for better clarity, simplicity, and performance.
### Improvements:
1. **Rem... | 16,838 | [
{
"from": "human",
"value": "I have the following C# singleton pattern, is there any way of improving it? \n public class Singleton<T> where T : class, new()\n {\n\n private static object _syncobj = new object();\n private static volatile T _instance = null;\n public static T Inst... |
I have been googling for a good time on how to move a file with c# using the TFS API. The idea is to have a folder on which the developers drop database upgrade scripts and the build process get's to the folder creates a build script and moves all the files on the folder to a new folder with the database build version ... | To manipulate files in TFS (Team Foundation Server) programmatically using C#, you can leverage the `Microsoft.TeamFoundation.Client` and `Microsoft.TeamFoundation.VersionControl.Client` namespaces. Here’s a general approach to moving files using the TFS API in C#.
### Prerequisites
1. **TFS Client Libraries**: Make ... | 17,293 | [
{
"from": "human",
"value": "I have been googling for a good time on how to move a file with c# using the TFS API. The idea is to have a folder on which the developers drop database upgrade scripts and the build process get's to the folder creates a build script and moves all the files on the folder to a ne... |
I have been trying to follow the guidelines in this Microsoft article to authenticate
against Apache with Kerberos and AD. I have successfully tested the communication between the apache server and the AD server with kinit. However when I attempt to access a restricted page on the server with IE I get an Internal serv... | It looks like you're running into a common issue related to Kerberos authentication with Apache, specifically involving the keytab file and the service principal name (SPN). The error message "gss_acquire_cred() failed: Miscellaneous failure (see text) (Key table entry not found)" indicates that Apache cannot find the ... | 10,228 | [
{
"from": "human",
"value": "I have been trying to follow the guidelines in this Microsoft article to authenticate \nagainst Apache with Kerberos and AD. I have successfully tested the communication between the apache server and the AD server with kinit. However when I attempt to access a restricted page on... |
I am using pseudo-code here, but this is in JavaScript. With the most efficient algorithm possible I am trying to find the high and low given an array of positive whole numbers. This is what I came up with, but I don't think it is probably best, and was just wondering if anyone has any other suggestions.
var low = 1;
v... | Your current approach to finding the high and low values in an array of positive whole numbers is mostly on the right track, but it can be optimized and clarified a bit. Here’s a more efficient and clearer version of your algorithm:
1. You only need one pass through the array, which you've done.
2. You should initiali... | 22,245 | [
{
"from": "human",
"value": "I am using pseudo-code here, but this is in JavaScript. With the most efficient algorithm possible I am trying to find the high and low given an array of positive whole numbers. This is what I came up with, but I don't think it is probably best, and was just wondering if anyone ... |
I am writing a dhtml application that creates an interactive simulation of a system. The data for the simulation is generated from another tool, and there is already a very large amount of legacy data.
Some steps in the simulation require that we play "voice-over" clips of audio. I've been unable to find an easy way t... | If you're looking for a cross-browser solution that can handle both MP3 and WAV files, you might want to consider the following libraries and approaches:
1. **Howler.js**:
- Howler.js is a powerful and flexible JavaScript audio library that supports multiple audio formats, including MP3, WAV, and OGG. It provides a... | 21,497 | [
{
"from": "human",
"value": "I am writing a dhtml application that creates an interactive simulation of a system. The data for the simulation is generated from another tool, and there is already a very large amount of legacy data.\nSome steps in the simulation require that we play \"voice-over\" clips of a... |
For decades, in the field of computing (except disk manufacturers), a KB (kilobyte) was understood to mean 1024 bytes. In the past few years, there has been a movement to use KiB ("kibibyte") to mean 1024 bytes, and change the meaning of kilobyte to be 1000 bytes, dooming us to many more years of confusion. On the othe... | The distinction between KB (kilobyte) and KiB (kibibyte) has indeed been a topic of discussion in computing for some time. Traditionally, in many operating systems and applications, a kilobyte has been interpreted as 1024 bytes due to the binary nature of computing. However, to resolve confusion, particularly as storag... | 22,641 | [
{
"from": "human",
"value": "For decades, in the field of computing (except disk manufacturers), a KB (kilobyte) was understood to mean 1024 bytes. In the past few years, there has been a movement to use KiB (\"kibibyte\") to mean 1024 bytes, and change the meaning of kilobyte to be 1000 bytes, dooming us t... |
I have a Button inside an UpdatePanel. The button is being used as the OK button for a ModalPopupExtender. For some reason, the button click event is not firing. Any ideas? Am I missing something?
<asp:updatepanel id="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:ModalPopupExtender ID="ModalDialo... | If the button click event inside an `UpdatePanel` is not firing, there are a few common issues to check that could be affecting the functionality of the `ModalPopupExtender` and the button event. Here are some troubleshooting steps and potential solutions:
1. **Check the Event Wiring**: Ensure that the `ModalOKButton_... | 20,213 | [
{
"from": "human",
"value": "I have a Button inside an UpdatePanel. The button is being used as the OK button for a ModalPopupExtender. For some reason, the button click event is not firing. Any ideas? Am I missing something?\n<asp:updatepanel id=\"UpdatePanel1\" runat=\"server\">\n <ContentTemplate>... |
I've got a really odd error message that only occurs when I add the following line to my project:
std::list<CRect> myVar;
It's worth noting that it doesn't have to be a std::list, it can be std::vector or any other STL container I assume.
Here is the error message:
Error 1 error LNK2005: "public:
__thiscall std::li... | The linker error you're encountering (`LNK2005`) indicates that the definition of the `std::list<CRect>` constructor (and possibly other functions related to it) is being found in multiple translation units, which results in a conflict. This often occurs in C++ due to mismatches in how the types are compiled across dif... | 15,948 | [
{
"from": "human",
"value": "I've got a really odd error message that only occurs when I add the following line to my project:\nstd::list<CRect> myVar;\n\nIt's worth noting that it doesn't have to be a std::list, it can be std::vector or any other STL container I assume.\nHere is the error message:\n\nError... |
I understand that server-side validation is an absolute must to prevent malicious users (or simply users who choose to disable javascript) from bypassing client-side validation. But that's mainly to protect your application, not to provide value for those who are running browsers with javascript disabled. Is it reaso... | Yes, it is generally reasonable to assume that most users have JavaScript enabled, as modern web applications heavily rely on JavaScript for interactivity and functionality. The vast majority of web browsers today support JavaScript, and users typically do not disable it. In fact, according to various studies, only a s... | 21,538 | [
{
"from": "human",
"value": "I understand that server-side validation is an absolute must to prevent malicious users (or simply users who choose to disable javascript) from bypassing client-side validation. But that's mainly to protect your application, not to provide value for those who are running browse... |
How to insert a total column in a crosstab (matrix) report in Report Designer in VS 2008?
It seems that i can only insert a subcolumn in a crosstab report.
| In Visual Studio 2008, when working with a crosstab (or matrix) report in the Report Designer, you can insert a total column by following these steps. While you're correct that you typically insert subcolumns for categories, there is a way to show totals directly in your matrix report.
Here's how you can add a total c... | 18,825 | [
{
"from": "human",
"value": "How to insert a total column in a crosstab (matrix) report in Report Designer in VS 2008?\nIt seems that i can only insert a subcolumn in a crosstab report.\n"
},
{
"from": "gpt",
"value": "In Visual Studio 2008, when working with a crosstab (or matrix) report in the... |
Possible Duplicate:
Reference: Comparing PHP's print and echo
Is there any major and fundamental difference between these two functions in PHP?
| In PHP, `print` and `echo` are both used to output data to the screen, but there are some differences between the two:
1. **Return Value**:
- `echo` does not return a value. It simply outputs the string provided to it.
- `print` returns `1`, so it can be used in expressions.
2. **Syntax**:
- `echo` can take ... | 23,513 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nReference: Comparing PHP's print and echo \n\nIs there any major and fundamental difference between these two functions in PHP?\n"
},
{
"from": "gpt",
"value": "In PHP, `print` and `echo` are both used to output data to the screen, but there ar... |
<div>
<h1>Title</h1>
<table>
...
</table>
</div>
Now, the
<h1>
has a margin: 0;
so it is at the top of the div. The height of the div is 300px.
However I'd like the table to be placed at the bottom of the div, eg. valign="bottom" but for the whole table.
| To position the table at the bottom of a `<div>`, you can use CSS to achieve this effect. You can set the `<div>` to use `flexbox` and apply the necessary properties to align the content. Here’s how you can do it:
```html
<div class="container">
<h1>Title</h1>
<table>
<!-- Table content goes here -->
... | 22,880 | [
{
"from": "human",
"value": "<div>\n<h1>Title</h1>\n<table>\n...\n</table>\n</div>\n\nNow, the\n<h1>\n\nhas a margin: 0;\nso it is at the top of the div. The height of the div is 300px.\nHowever I'd like the table to be placed at the bottom of the div, eg. valign=\"bottom\" but for the whole table.\n"
},
... |
I'm looking to write a config file that allows for RESTful services in WCF, but I still want the ability to 'tap into' the membership provider for username/password authentication.
The below is part of my current config using basicHttp binding or wsHttp w/out WS Security, how will this change w/ REST based services?
... | To configure a WCF service for RESTful services while still utilizing a membership provider for username/password authentication, you will need to make use of the `webHttpBinding` along with appropriate behaviors for RESTful operations. Below is an example of how to adjust your existing configuration for this purpose.
... | 19,189 | [
{
"from": "human",
"value": "I'm looking to write a config file that allows for RESTful services in WCF, but I still want the ability to 'tap into' the membership provider for username/password authentication.\nThe below is part of my current config using basicHttp binding or wsHttp w/out WS Security, how w... |
I have a flash project that I'm trying to export as a single SWF. There's a main SWF file that loads about 6 other SWFs, and both the main and the child SWFs reference other external assets (images, sounds, etc). I'd like to package everything as a single .swf file so I don't have to tote the other assets around with... | Packing a Flash project into a single SWF file can be a bit tricky, especially if your assets are not imported into the Flash Authoring environment. Here are a few approaches you might consider:
### 1. **Preloading Assets:**
Unfortunately, there's no built-in option in the Flash Authoring environment that allows you t... | 19,209 | [
{
"from": "human",
"value": "I have a flash project that I'm trying to export as a single SWF. There's a main SWF file that loads about 6 other SWFs, and both the main and the child SWFs reference other external assets (images, sounds, etc). I'd like to package everything as a single .swf file so I don't ... |
I just fell in love with NHibernate and the fluent interface. The latter enables very nice mappings with refactoring support (no more need for xml files).
But nobody is perfect, so I am missing the many-to-any mapping in fluent. Does anybody know if it is already there? If so, a simple line of code would be nice.
But t... | It's great to hear that you're enjoying NHibernate and the fluent interface! However, as of my last knowledge update in October 2023, NHibernate's Fluent NHibernate doesn't natively support many-to-any mappings out of the box. But there are workarounds and ways to achieve this by falling back on the traditional XML map... | 14,720 | [
{
"from": "human",
"value": "I just fell in love with NHibernate and the fluent interface. The latter enables very nice mappings with refactoring support (no more need for xml files).\nBut nobody is perfect, so I am missing the many-to-any mapping in fluent. Does anybody know if it is already there? If so, ... |
Anybody knows what is mobile capability for render Meta Tags for each adapter?
I am using Marg.Wurfl to detect mobile device, and it maps wurfl capabilities to mobile capabilities, but it does not render meta tags.I have found requiresXhtmlCssSuppression capability in ASP.NET Mobile Controls XHTML Adapter Source, but i... | When working with mobile capabilities in ASP.NET, rendering different meta tags for various devices can be challenging, especially when using a library like Marg.Wurfl for device detection. Here are some steps and considerations to help you with rendering different meta tags based on device capabilities:
### 1. **Unde... | 17,255 | [
{
"from": "human",
"value": "Anybody knows what is mobile capability for render Meta Tags for each adapter?\nI am using Marg.Wurfl to detect mobile device, and it maps wurfl capabilities to mobile capabilities, but it does not render meta tags.I have found requiresXhtmlCssSuppression capability in ASP.NET M... |
How do I change the system-wide short date format in Ubuntu? For example, Thunderbird is showing dates in the DD/MM/YY format, and I would like to change it to MM/DD/YY or YYYY-MM-DD.
The best information I can find so far is in this thread:
http://ubuntuforums.org/showthread.php?t=193916
Edit: I want to change the sy... | To change the system-wide short date format in Ubuntu, you typically need to adjust the locale settings, as many applications rely on these settings to determine how to format dates, numbers, and other locale-sensitive data. Here’s how to do this:
### Method 1: Change Locale Settings
1. **Open the terminal**.
2. **C... | 20,390 | [
{
"from": "human",
"value": "How do I change the system-wide short date format in Ubuntu? For example, Thunderbird is showing dates in the DD/MM/YY format, and I would like to change it to MM/DD/YY or YYYY-MM-DD.\nThe best information I can find so far is in this thread:\nhttp://ubuntuforums.org/showthread... |
I get to dust off my VBScript hat and write some classic ASP to query a SQL Server 2000 database.
Here's the scenario:
I have two datetime fields called fieldA and fieldB.
fieldB will never have a year value that's greater than the year of fieldA
It is possible the that two fields will have the same year.
What I want... | To achieve your goal of comparing the `fieldA` and `fieldB` datetime fields while ignoring the year component in SQL Server 2000, you can extract the month and day parts of each date and compare them.
In SQL Server, you can use the `MONTH()` and `DAY()` functions to extract the month and day from the datetime values. ... | 22,691 | [
{
"from": "human",
"value": "I get to dust off my VBScript hat and write some classic ASP to query a SQL Server 2000 database.\nHere's the scenario:\n\nI have two datetime fields called fieldA and fieldB.\nfieldB will never have a year value that's greater than the year of fieldA\nIt is possible the that tw... |
I know there are several plugins that do asynchronous processing. Which one is the best one and why?
The ones I know about are:
BackgrounDRb
| There are several plugins and frameworks for asynchronous processing in Ruby and Ruby on Rails applications, and the "best" one can depend on your specific use case, requirements, and the complexity of your application. Here are a few popular options along with their strengths:
1. **Sidekiq**:
- **Strengths**: Side... | 18,242 | [
{
"from": "human",
"value": "I know there are several plugins that do asynchronous processing. Which one is the best one and why?\nThe ones I know about are:\n\nBackgrounDRb\n\n"
},
{
"from": "gpt",
"value": "There are several plugins and frameworks for asynchronous processing in Ruby and Ruby ... |
By default it seems that objects are drawn front to back. I am drawing a 2-D UI object and would like to create it back to front. For example I could create a white square first then create a slightly smaller black square on top of it thus creating a black pane with a white border. This post had some discussion on it... | When rendering objects in OpenGL, the order of drawing can affect how your scene looks, particularly for opaque objects. The behavior you are experiencing—where you want to draw objects from back to front, rather than the default front to back—is not directly dependent on transformations like `glOrtho()`. Rather, it re... | 17,501 | [
{
"from": "human",
"value": "By default it seems that objects are drawn front to back. I am drawing a 2-D UI object and would like to create it back to front. For example I could create a white square first then create a slightly smaller black square on top of it thus creating a black pane with a white bor... |
In Flash, there seem to be two sets of mouse click events:
onMouseUp, onMouseDown
onPress, onRelease
Is there any actual difference between these events? I can't tell from the documentation, and I haven't noticed anything in actual usage, but it seems odd to have two different sets of names for the same basic events... | In ActionScript 2, while it may seem that `onMouseUp`, `onMouseDown`, `onPress`, and `onRelease` serve similar purposes, there are important distinctions between them.
### Mouse Events
- **onMouseDown**: This event triggers when the mouse button is pressed down over the target object. It is generally used to start an ... | 20,908 | [
{
"from": "human",
"value": "In Flash, there seem to be two sets of mouse click events:\n\nonMouseUp, onMouseDown\nonPress, onRelease\n\nIs there any actual difference between these events? I can't tell from the documentation, and I haven't noticed anything in actual usage, but it seems odd to have two dif... |
I'm calling a webservice using the NuSoap PHP library. The webservice appears to use .NET; every time I call it I get an error about using an invalid SoapAction header. The header being sent is an empty string. How can I find the SoapAction that the server is expecting?
| When you encounter an issue with an invalid SoapAction header while using the NuSoap PHP library, it’s essential to ensure that the correct SoapAction is being sent with your request. The SoapAction is a SOAP header that indicates the intent of the request, and .NET web services are particularly sensitive to this heade... | 16,704 | [
{
"from": "human",
"value": "I'm calling a webservice using the NuSoap PHP library. The webservice appears to use .NET; every time I call it I get an error about using an invalid SoapAction header. The header being sent is an empty string. How can I find the SoapAction that the server is expecting?\n"
},
... |
Why isn't this project maintained anymore? I love this app, however not updating it seems like a crime against all .Net developers. There are several items that I would love to add to it given the chance of a future release.
Can anyone share something I don't know?
| It's not uncommon for open-source projects or even commercial applications to become unmaintained for a variety of reasons. Here are some possible explanations for why a project might not be actively maintained:
1. **Lack of Time or Resources**: The original developers may have moved on to other projects, responsibili... | 22,132 | [
{
"from": "human",
"value": "Why isn't this project maintained anymore? I love this app, however not updating it seems like a crime against all .Net developers. There are several items that I would love to add to it given the chance of a future release. \nCan anyone share something I don't know?\n"
},
... |
We @ medicware.com.br are thinking about making our web application offline-capable with Gears. Our main goal is to keep basic functionality running when the internet connection goes down.
So, I'd like to hear success stories, tips and resources about yours real experiences in that field (related to Gears or not).
| It’s great to hear that you’re exploring offline capabilities for your web application. However, it’s worth noting that Google Gears is no longer actively supported or recommended for building offline-capable applications. Instead, modern web technologies like Service Workers and the Cache API provide robust and well-s... | 17,994 | [
{
"from": "human",
"value": "We @ medicware.com.br are thinking about making our web application offline-capable with Gears. Our main goal is to keep basic functionality running when the internet connection goes down.\nSo, I'd like to hear success stories, tips and resources about yours real experiences in ... |
I need to make sure that user can run only one instance of my program at a time.
Which means, that I have to check programatically, whether the same program is already running, and quit in such case.
The first thing that came to my mind was to create a file somewhere, when the program starts. Then, each other instance ... | To ensure that your program can only run one instance at a time in a portable and clean way, you can utilize platform-specific mechanisms rather than relying on PID files which can become stale or prone to errors. Here's how you can implement this on both Linux/Unix and Windows.
### Linux/Unix: Using a Lock File with ... | 14,692 | [
{
"from": "human",
"value": "I need to make sure that user can run only one instance of my program at a time.\nWhich means, that I have to check programatically, whether the same program is already running, and quit in such case.\nThe first thing that came to my mind was to create a file somewhere, when the... |
I'm currently adding some new extended classes to this code:
foreach (BaseType b in CollectionOfExtendedTypes) {
if (b is ExtendedType1) {
((ExtendedType1) b).foo = this;
}
else if (b is ExtendedType2) {
((ExtenedType2) b).foo = this;
}
else {
b.foo = this;
}
}
and was curious if there is a... | Yes, in C# 7.0 and later, you can use pattern matching with the `switch` statement to achieve similar functionality as your `if`-`else` statements. This allows you to perform type checking and casting in a more concise and readable way.
Here's how you can refactor your code using a `switch` statement with pattern matc... | 23,315 | [
{
"from": "human",
"value": "I'm currently adding some new extended classes to this code:\nforeach (BaseType b in CollectionOfExtendedTypes) {\n if (b is ExtendedType1) {\n ((ExtendedType1) b).foo = this;\n\n }\n else if (b is ExtendedType2) {\n ((ExtenedType2) b).foo = this;\n\n } \n else {\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.