instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Can anyone recommend a decent C image library?
I'm after loaders for bmp, gif, jpg, png and tga.
I want to use this for programming my Sony Playstation Portable, so opensource would be very handy.
After some googleing I've found FreeImage and CImg, but both feel rather heavy, and CImg is C++ not C.
| If you're looking for a lightweight C library for handling various image formats (BMP, GIF, JPG, PNG, and TGA) for your Sony Playstation Portable project, here are a few options you might consider:
1. **stb_image**:
- Part of the [stb single-file public domain libraries](https://github.com/nothings/stb).
- Suppo... | 17,873 | [
{
"from": "human",
"value": "Can anyone recommend a decent C image library?\nI'm after loaders for bmp, gif, jpg, png and tga.\nI want to use this for programming my Sony Playstation Portable, so opensource would be very handy.\nAfter some googleing I've found FreeImage and CImg, but both feel rather heavy,... |
What's the difference between TRUNCATE and DELETE in SQL?
If your answer is platform specific, please indicate that.
| In SQL, both `TRUNCATE` and `DELETE` are used to remove records from a table, but they have some important differences in their functionality, performance, and usage. Here are the main differences:
### 1. Purpose
- **DELETE**: Used to remove specific rows from a table based on a condition (WHERE clause). If no conditi... | 13,852 | [
{
"from": "human",
"value": "What's the difference between TRUNCATE and DELETE in SQL?\nIf your answer is platform specific, please indicate that.\n"
},
{
"from": "gpt",
"value": "In SQL, both `TRUNCATE` and `DELETE` are used to remove records from a table, but they have some important differenc... |
I am trying to use Validation in WPF. I created a NotNullOrEmptyValidationRule as shown below:
public class NotNullOrEmptyValidationRule : ValidationRule
{
public override ValidationResult Validate(object value, CultureInfo cultureInfo)
{
if (String.IsNullOrEmpty(value as String))
... | To use your custom `NotNullOrEmptyValidationRule` in WPF XAML, you need to ensure that you have properly declared the namespace where your validation rule is defined. This is commonly done at the top of your XAML file within the `<Window>` or `<UserControl>` tag (or whatever top-level container you are using).
Here's... | 9,540 | [
{
"from": "human",
"value": "I am trying to use Validation in WPF. I created a NotNullOrEmptyValidationRule as shown below: \npublic class NotNullOrEmptyValidationRule : ValidationRule\n {\n public override ValidationResult Validate(object value, CultureInfo cultureInfo)\n {\n if... |
I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object:
public class SafeDictionary<TKey, TValue>: IDictionary<TKey, TValue>
{
private readonly object syncRoot = new object();
private Dictionary<TKey, TValue> d = new Dictionary<TKey, TValue>();... | Yes, there are several ways to implement a thread-safe dictionary in C# that can lead to cleaner and more maintainable code. The approach you took using locking works, but it can lead to more verbose code due to the need for explicit locks in every consumer.
Here are some alternative approaches:
### 1. Using `Concurr... | 13,609 | [
{
"from": "human",
"value": "I was able to implement a thread-safe Dictionary in C# by deriving from IDictionary and defining a private SyncRoot object:\npublic class SafeDictionary<TKey, TValue>: IDictionary<TKey, TValue>\n{\n private readonly object syncRoot = new object();\n private Dictionary<TKey... |
On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say "your download will begin in a moment."
A couple of possible approaches I know about, and browser compatibility (based on a quick ... | To implement a download mechanism that allows you to display additional content while the file is being downloaded, you can use a combination of server-side scripting and client-side scripting. The idea is to create a temporary page that informs the user about the download, then triggers the download after a brief dela... | 13,491 | [
{
"from": "human",
"value": "On a PHP-based web site, I want to send users a download package after they have filled out a short form. The site-initiated download should be similar to sites like download.com, which say \"your download will begin in a moment.\"\nA couple of possible approaches I know about, ... |
I need to host and run managed controls inside of a purely unmanaged C++ app. How to do this?
To run unlicensed controls is typically simple:
if (SUCCEEDED(ClrCreateManagedInstance(type, iid, &obj)))
{
// do something with obj
}
When using a licensed control however, we need to somehow embed a .licx file into the ... | To use licensed managed controls in a purely unmanaged C++ application, you need to follow a series of steps to ensure that the license information is correctly embedded and accessible at runtime. Below are the steps you need to take:
### 1. Create a Licx File
First, create a `.licx` file for your licensed controls. ... | 11,168 | [
{
"from": "human",
"value": "I need to host and run managed controls inside of a purely unmanaged C++ app. How to do this?\nTo run unlicensed controls is typically simple:\nif (SUCCEEDED(ClrCreateManagedInstance(type, iid, &obj)))\n{\n // do something with obj\n}\n\nWhen using a licensed control however,... |
A few years ago, I read a book that described how you could override the default event 'dispatcher' implementation in .NET with your own processor.
class foo {
public event EventHandler myEvent;
...
}
...
myFoo.myEvent += myBar1.EventHandler;
myFoo.myEvent += myBar2.EventHandler;
... | It's great that you identified the book you were thinking of—Jeffrey Richter's *CLR via C#*. This book is well-known for providing deep insights into the .NET framework and the Common Language Runtime (CLR), including topics like event handling, memory management, and performance considerations.
### Why Override the D... | 14,822 | [
{
"from": "human",
"value": "A few years ago, I read a book that described how you could override the default event 'dispatcher' implementation in .NET with your own processor.\n class foo {\n public event EventHandler myEvent;\n ...\n }\n\n ...\n myFoo.myEvent += myBar1.EventHandl... |
I am looking at some code and it has this statement:
~ConnectionManager()
{
Dispose(false);
}
The class implements the IDisposable interface, but I do not know if that is part of that the tilde(~) is used for.
| In C#, the tilde (`~`) before a method name indicates that the method is a destructor (also known as a finalizer). In your code snippet:
```csharp
~ConnectionManager()
{
Dispose(false);
}
```
The `~ConnectionManager()` is the destructor for the `ConnectionManager` class. Destructors are called by the garbage coll... | 17,168 | [
{
"from": "human",
"value": "I am looking at some code and it has this statement: \n~ConnectionManager()\n{\n Dispose(false);\n}\n\nThe class implements the IDisposable interface, but I do not know if that is part of that the tilde(~) is used for.\n"
},
{
"from": "gpt",
"value": "In C#, the ... |
I am very new to the entity framework, so please bear with me...
How can I relate two objects from different contexts together?
The example below throws the following exception:
System.InvalidOperationException: The
relationship between the two objects
cannot be defined because they are
attached to different Obj... | In Entity Framework, each `DbContext` (or `ObjectContext` in earlier versions) is meant to be a separate unit of work that keeps track of its own set of entities. When you try to relate or connect entities from different contexts, EF throws an `InvalidOperationException` because it doesn’t know how to manage the relati... | 14,209 | [
{
"from": "human",
"value": "I am very new to the entity framework, so please bear with me...\nHow can I relate two objects from different contexts together?\nThe example below throws the following exception:\n\nSystem.InvalidOperationException: The\n relationship between the two objects\n cannot be defin... |
Most of the work I do is with what could be considered enterprise Web applications. These projects have large budgets, longer timelines (from 3-12 months), and heavy customizations. Because as developers we have been touting the idea of the Web as the next desktop OS, customers are coming to expect the software running... | Implementing an automatic update mechanism for enterprise web applications can certainly align with user expectations, particularly as businesses increasingly seek software that resembles desktop applications in terms of usability and manageability. However, there are several challenges and considerations that you need... | 14,741 | [
{
"from": "human",
"value": "Most of the work I do is with what could be considered enterprise Web applications. These projects have large budgets, longer timelines (from 3-12 months), and heavy customizations. Because as developers we have been touting the idea of the Web as the next desktop OS, customers ... |
Is there a way to find the maximum and minimum defined values of an enum in c++?
| In C++, enums do not inherently provide a way to find their maximum or minimum values since they are essentially a set of named integer constants. However, you can derive the minimum and maximum values of an enum by defining them explicitly or by using some programming techniques. Here's a general approach to achieve t... | 16,088 | [
{
"from": "human",
"value": "Is there a way to find the maximum and minimum defined values of an enum in c++?\n"
},
{
"from": "gpt",
"value": "In C++, enums do not inherently provide a way to find their maximum or minimum values since they are essentially a set of named integer constants. Howeve... |
I read that you could call JavaScript code from a Java Applet by calling
JApplet.getAppletContext().showDocument( "javascript:alert('Hello World');" );
However, when I do this i get the following error:
java.net.MalformedURLException: unknown protocol: javascript
How do I work around this?
| The error you are experiencing indicates that the Java Applet cannot interpret the `javascript:` protocol correctly. This can occur for a few reasons, including the security model of Java Applets, as well as how applets handle URLs.
While `JApplet.getAppletContext().showDocument()` is used for navigating to URLs or ex... | 15,026 | [
{
"from": "human",
"value": "I read that you could call JavaScript code from a Java Applet by calling\nJApplet.getAppletContext().showDocument( \"javascript:alert('Hello World');\" );\n\nHowever, when I do this i get the following error:\njava.net.MalformedURLException: unknown protocol: javascript\n\nHow d... |
I want to be able to intercept the shutdown event in C# for Windows Vista. Due to the advanced security features with Vista, any applications that are running after the shutdown command is called are halted and displayed in a list, prompting the user to do something with them.
Does anybody know how to overcome this an... | In Windows Vista and later versions, applications can handle shutdown events to perform any necessary clean-up tasks before the system shuts down. However, due to the security measures in place, intercepting these events requires certain considerations. You can handle the shutdown event in a Windows Forms or WPF applic... | 17,064 | [
{
"from": "human",
"value": "I want to be able to intercept the shutdown event in C# for Windows Vista. Due to the advanced security features with Vista, any applications that are running after the shutdown command is called are halted and displayed in a list, prompting the user to do something with them.\... |
First of all: I am not an experienced ClearCase user, but I have lots of experience with other VCS and *nix command-line tools. WIth ClearCase, I use command-line tool ("cleartool") working in a Unix shell.
Problem: I have a small set of sources stored in the ClearCase. Once in a while a fresh .tgz with the same source... | You're not alone in finding ClearCase a bit cumbersome compared to other version control systems, especially for tasks like the one you described. ClearCase has its own workflows and methods that can feel cumbersome if you're used to more straightforward systems like Git or Subversion. However, with a few techniques, y... | 15,789 | [
{
"from": "human",
"value": "First of all: I am not an experienced ClearCase user, but I have lots of experience with other VCS and *nix command-line tools. WIth ClearCase, I use command-line tool (\"cleartool\") working in a Unix shell.\nProblem: I have a small set of sources stored in the ClearCase. Once ... |
I work with a bunch of sets in order to generate constrained random traffic, but I want to be able to call a Specman macro that computes the complement of a set with syntax like:
COMPLEMENT begin
domain=[0..10,24..30],
complementing_set=[2..3,27..30]
end
and have it generate:
[0..1,4..10,24..26]
Every time I ... | You can achieve this in Specman by creating a macro that computes the complement of a given set based on your specified syntax. By using the `int_range_list` object and its capabilities, you can perform set operations more efficiently. Below is a proposed implementation of the `COMPLEMENT` macro that computes the compl... | 17,318 | [
{
"from": "human",
"value": "I work with a bunch of sets in order to generate constrained random traffic, but I want to be able to call a Specman macro that computes the complement of a set with syntax like:\nCOMPLEMENT begin \n domain=[0..10,24..30],\n complementing_set=[2..3,27..30] \nend\n\nand have ... |
The default asp.net membership provider uses a .mdf sql server database file in the app_code database.
How scalable is this in terms of calling a flat file database instead of running it in a standard sql environment?
Is this recommended only for small/medium traffic sites?
| Using a flat file database (like an MDF file with SQL Server Express) in an ASP.NET application can work for small to medium traffic sites, but there are several factors to consider regarding scalability and performance.
### Scalability of Flat File Databases:
1. **Concurrency**:
- Flat file databases like SQL Se... | 12,233 | [
{
"from": "human",
"value": "The default asp.net membership provider uses a .mdf sql server database file in the app_code database.\nHow scalable is this in terms of calling a flat file database instead of running it in a standard sql environment?\nIs this recommended only for small/medium traffic sites? \... |
When I add or é to a text value of a listitem, it display the code of the HTML entity instead of the result (a space or é).
I can add "physical" non-breaking spaces or special chars, but I would like to avoid that if possible. Sometimes the data stored in database is encoded, and I don't want to always pr... | If you are facing an issue where HTML entities such as ` ` or `é` are being displayed as plain text instead of rendering as their respective characters, it sounds like the content is being treated as plain text instead of being interpreted as HTML. Here are a few potential solutions to ensure that the HTML ... | 16,622 | [
{
"from": "human",
"value": "When I add or é to a text value of a listitem, it display the code of the HTML entity instead of the result (a space or é).\nI can add \"physical\" non-breaking spaces or special chars, but I would like to avoid that if possible. Sometimes the data stored in databa... |
Handling multiple merges onto branches in Subversion or CVS is just one of those things that has to be experienced. It is inordinately easier to keep track of branches and merges in Mercurial (and probably any other distributed system) but I don't know why. Does anyone else know?
My question stems from the fact that wi... | The differences in how Mercurial (and other distributed version control systems) and centralized systems like Subversion and CVS handle branches and merges can be attributed to several fundamental design principles and concepts inherent to distributed version control systems (DVCS). Here are some key points that help e... | 10,335 | [
{
"from": "human",
"value": "Handling multiple merges onto branches in Subversion or CVS is just one of those things that has to be experienced. It is inordinately easier to keep track of branches and merges in Mercurial (and probably any other distributed system) but I don't know why. Does anyone else know... |
I've got a page with a normal form with a submit button and some jQuery which binds to the form submit event and overrides it with e.preventDefault() and runs an AJAX command. This works fine when the submit button is clicked but when a link with onclick='document.formName.submit();' is clicked, the event is not caught... | The issue you’re encountering is due to how the form submission is being triggered. When you use `document.formName.submit()`, it triggers the form submission directly, bypassing the jQuery event handler that you have set up for the form’s `submit` event. This means that any `e.preventDefault()` logic you have in your ... | 14,814 | [
{
"from": "human",
"value": "I've got a page with a normal form with a submit button and some jQuery which binds to the form submit event and overrides it with e.preventDefault() and runs an AJAX command. This works fine when the submit button is clicked but when a link with onclick='document.formName.submi... |
I'm building an interface much like the built-in Weather application's flipside view, or the Alarms view of the Clock application in editing mode. The table view is always in editing mode, so the delete icon appears on the left side of each cell.
When the table view is in editing mode, my delegate doesn't receive didSe... | To allow rows in a `UITableView` to be selectable even when the table view is in editing mode, you can override the default behavior of the editing mode in your table view. By default, when a table view enters editing mode, the selection of rows is typically disabled. However, you can achieve your goal by manually hand... | 15,500 | [
{
"from": "human",
"value": "I'm building an interface much like the built-in Weather application's flipside view, or the Alarms view of the Clock application in editing mode. The table view is always in editing mode, so the delete icon appears on the left side of each cell.\nWhen the table view is in editi... |
Running under Server 2008, SQL Server 2005 SP2 has the option to "Add New Administrator" from the SQL Server 2005 Surface Ara Configuration. This launches the SQL Server 2005 User Provisioning Tool for Vista. You are then able to grant privileges such as Server SysAdmin role etc.
When I do this the privileges are copie... | It sounds like you are experiencing issues with SQL Server 2005 User Provisioning Tool not saving the administrative privileges correctly on your Server 2008 environment. This could be due to several factors, including permission issues or the fact that SQL Server 2005 is not fully compatible with Server 2008 in certai... | 16,386 | [
{
"from": "human",
"value": "Running under Server 2008, SQL Server 2005 SP2 has the option to \"Add New Administrator\" from the SQL Server 2005 Surface Ara Configuration. This launches the SQL Server 2005 User Provisioning Tool for Vista. You are then able to grant privileges such as Server SysAdmin role e... |
Is there a way in Ruby to find the version of a file, specifically a .dll file?
| Yes, in Ruby, you can find the version information of a .dll file using the `Win32API` library or by utilizing the `ffi` gem to call the Windows API functions that retrieve version information. Here is an example using the `ffi` gem:
1. First, you'll need to install the `ffi` gem if you don't already have it. You can ... | 9,280 | [
{
"from": "human",
"value": "Is there a way in Ruby to find the version of a file, specifically a .dll file?\n"
},
{
"from": "gpt",
"value": "Yes, in Ruby, you can find the version information of a .dll file using the `Win32API` library or by utilizing the `ffi` gem to call the Windows API funct... |
I've just set up a new build server with the Windows 2008 .NET 3.5 SDK, and for some reason it hasn't installed c:\Program Files\Common Files\Microsoft Shared\TextTemplating so I can't run t4 templates on it. I had a look at the install options in add/remove programs and every single option is checked.
Any ideas why i... | If the `c:\Program Files\Common Files\Microsoft Shared\TextTemplating` folder is missing on your Windows 2008 build server after installing the .NET 3.5 SDK, it may be due to a few potential issues. Here are some steps you can follow to troubleshoot and possibly resolve the issue:
1. **Check the Installation of Visual... | 17,895 | [
{
"from": "human",
"value": "I've just set up a new build server with the Windows 2008 .NET 3.5 SDK, and for some reason it hasn't installed c:\\Program Files\\Common Files\\Microsoft Shared\\TextTemplating so I can't run t4 templates on it. I had a look at the install options in add/remove programs and eve... |
I am dynamically added a bunch of buttons to a toolbar. I want the ability to programatically make it wrap onto a second row if the number of buttons exceeds the horizontal space in the current form. I dont want users to have to click the dropdown button to view more buttons as i need to ensure that all buttons are v... | To programmatically wrap buttons onto a second row in a toolbar based on available horizontal space, you can achieve this using a few different approaches depending on the framework or UI library you're using. Below are general suggestions that can be applied in most scenarios:
### 1. CSS Flexbox (for HTML/CSS)
If you... | 16,126 | [
{
"from": "human",
"value": "I am dynamically added a bunch of buttons to a toolbar. I want the ability to programatically make it wrap onto a second row if the number of buttons exceeds the horizontal space in the current form. I dont want users to have to click the dropdown button to view more buttons a... |
I want to define a CSS class that will provide the same style as HTML's <pre> element.
I tried this:
.mystyle {
display: block;
font-family: monospace;
white-space: pre;
}
which works fine on FF but not on IE (white-spaces are not kept). Does anyone have a clue?
| The `<pre>` element in HTML is specifically designed to display preformatted text, preserving both whitespace and line breaks. Your CSS class is almost there, but there are a couple of adjustments you can make to ensure compatibility across all browsers, including Internet Explorer.
Here’s an improved version of your ... | 18,543 | [
{
"from": "human",
"value": "I want to define a CSS class that will provide the same style as HTML's <pre> element.\nI tried this:\n.mystyle { \n display: block;\n font-family: monospace;\n white-space: pre;\n} \n\nwhich works fine on FF but not on IE (white-spaces are not kept). Does anyone have a cl... |
There are several web applications which allow you to send photos from your mobile phone and post them to web site/application. How do these work and what sort of technologies would one use to implement such a feature? Is it an MMS server or does one need to get into socket programming? For example, some applications... | To implement a feature that allows users to send photos from their mobile phones to a web application, there are several approaches and technologies involved. Here’s an overview of how these systems typically work, along with a discussion of the various technologies you might consider:
### 1. **Email-Based Photo Uploa... | 14,660 | [
{
"from": "human",
"value": "There are several web applications which allow you to send photos from your mobile phone and post them to web site/application. How do these work and what sort of technologies would one use to implement such a feature? Is it an MMS server or does one need to get into socket pro... |
I've got a couple DNN portals I manage and I need a solution to keep them "alive" during slack traffic times. After a given time of inactivity IIS will unload the DNN application from memory which will effect load time for the first client request. DNN has the "KeepAlive.aspx" file that I hit with a wget command from... | Keeping your DNN (DotNetNuke) portals responsive during times of low traffic is a common challenge. The `KeepAlive.aspx` method you’re using is indeed one common approach, but there are several alternatives and improvements you might consider. Here are some options:
1. **Application Pool Settings in IIS**:
- Adjus... | 13,658 | [
{
"from": "human",
"value": "I've got a couple DNN portals I manage and I need a solution to keep them \"alive\" during slack traffic times. After a given time of inactivity IIS will unload the DNN application from memory which will effect load time for the first client request. DNN has the \"KeepAlive.as... |
I am ready to start using SVN, but I have NO (as in the money required for free beer) experience with source control. I have installed subversion on my server (that was easy, 'apt-get install subversion') but now I don't know what to do, how to configure it, or how to use it.What suggestions do you have, and where can... | Great to hear you're getting started with Subversion (SVN)! Below is a step-by-step guide on setting up your SVN server, creating repositories, and using clients like TortoiseSVN, along with recommended resources to deepen your understanding.
### Setting Up Your SVN Server
1. **Install Subversion (if not already done... | 6,543 | [
{
"from": "human",
"value": "I am ready to start using SVN, but I have NO (as in the money required for free beer) experience with source control. I have installed subversion on my server (that was easy, 'apt-get install subversion') but now I don't know what to do, how to configure it, or how to use it.Wh... |
I'm developing a website on an XP virtual machine and have an SMTP virtual server set up in IIS -- it delivers mail just fine. What I would like is to confirm that any emails the site sends are only going to a specific domain.
The XP firewall seems to only involve incoming connections, I can't block outgoing TCP on por... | To filter outgoing email by destination address in your Windows XP environment with an SMTP server in IIS, you have a few options, but keep in mind that Windows XP and IIS SMTP are quite limited in features, especially for advanced configurations. Here are some potential solutions:
### 1. **Use a Local Relay SMTP Serv... | 13,641 | [
{
"from": "human",
"value": "I'm developing a website on an XP virtual machine and have an SMTP virtual server set up in IIS -- it delivers mail just fine. What I would like is to confirm that any emails the site sends are only going to a specific domain.\nThe XP firewall seems to only involve incoming conn... |
This code works (C# 3)
double d;
if(d == (double)(int)d) ...;
Is there a better way to do this?
For extraneous reasons I want to avoid the double cast so; what nice ways exist other than this? (even if they aren't as good)
Note: Several people pointed out the (important) point that == is often problematic regrading ... | If you want to check if a `double` value `d` can be represented as an integer without using a double cast, you have a few alternatives. Here are some options that maintain clarity while avoiding the explicit cast:
### 1. Use `Math.Floor` or `Math.Ceiling`
You can use `Math.Floor` or `Math.Ceiling` to check if the valu... | 17,114 | [
{
"from": "human",
"value": "This code works (C# 3)\ndouble d;\nif(d == (double)(int)d) ...;\n\n\nIs there a better way to do this?\nFor extraneous reasons I want to avoid the double cast so; what nice ways exist other than this? (even if they aren't as good)\n\nNote: Several people pointed out the (importa... |
This seems very noisy to me. Five lines of overhead is just too much.
m_Lock.EnterReadLock()
Try
Return m_List.Count
Finally
m_Lock.ExitReadLock()
End Try
So how would you simply this?
| You can simplify the code by using a `Using` statement, which ensures that the lock is always exited correctly, even if an exception occurs. Here's a cleaner version of your code:
```vb
Using readLock = m_Lock.ReadLock
Return m_List.Count
End Using
```
However, please note that the above code will only work if `R... | 18,963 | [
{
"from": "human",
"value": "This seems very noisy to me. Five lines of overhead is just too much.\nm_Lock.EnterReadLock()\nTry\n Return m_List.Count\nFinally\n m_Lock.ExitReadLock()\nEnd Try\n\nSo how would you simply this?\n"
},
{
"from": "gpt",
"value": "You can simplify the code by usi... |
I need to do a simple mail merge in OpenOffice using C++, VBScript, VB.Net or C# via OLE or native API. Are there any good examples available?
| Certainly! To perform a mail merge in OpenOffice using C++, VBScript, VB.Net, or C# via OLE or the native API, you can interact with OpenOffice's API using the UNO (Universal Network Objects) framework. Below, I'll provide an example using C# to demonstrate a simple mail merge operation.
### Mail Merge in OpenOffice U... | 9 | [
{
"from": "human",
"value": "I need to do a simple mail merge in OpenOffice using C++, VBScript, VB.Net or C# via OLE or native API. Are there any good examples available?\n"
},
{
"from": "gpt",
"value": "Certainly! To perform a mail merge in OpenOffice using C++, VBScript, VB.Net, or C# via OLE... |
Boost is meant to be the standard non-standard C++ library that every C++ user can use. Is it reasonable to assume it's available for an open source C++ project, or is it a large dependency too far?
| Boost is indeed a widely used library in the C++ ecosystem and provides a wealth of functionality, from smart pointers to regular expressions and multi-threading. It has a strong reputation and is often considered a de facto standard for C++ libraries, especially for projects that require functionality not yet availabl... | 10,446 | [
{
"from": "human",
"value": "Boost is meant to be the standard non-standard C++ library that every C++ user can use. Is it reasonable to assume it's available for an open source C++ project, or is it a large dependency too far?\n"
},
{
"from": "gpt",
"value": "Boost is indeed a widely used libr... |
I am trying to use the $addHandler function to add a handler to a text box's click event
var o=$get('myTextBox');
var f = Type.parse('funcWithArgs');
$addHandler(o, 'click', f);
However I need to pass parameters to the called function. How do you do that?
TIA
| In JavaScript, when you want to pass parameters to a function that is used as an event handler (like your `click` event), you can use a closure or an anonymous function to wrap your event handler and pass the desired parameters.
Here's how you can modify your code to achieve this:
```javascript
var o = $get('myTextB... | 17,092 | [
{
"from": "human",
"value": "I am trying to use the $addHandler function to add a handler to a text box's click event \nvar o=$get('myTextBox');\nvar f = Type.parse('funcWithArgs');\n$addHandler(o, 'click', f);\n\nHowever I need to pass parameters to the called function. How do you do that?\nTIA\n"
},
{... |
I have been asked to develop some usercontrols in ASP.NET that will at a later point be pulled into a SharePoint site as web parts. I am new to SharePoint and will not have access to a SharePoint server during the time I need to prototype these parts.
Does anyone know of any reasons that this approach will not work?
I... | Your approach of developing user controls in ASP.NET with the intention of integrating them into SharePoint as web parts does have some potential pitfalls. Here are some reasons why it may not work effectively:
1. **SharePoint Architecture**: SharePoint has its own set of lifecycle events, context, and data management... | 13,567 | [
{
"from": "human",
"value": "I have been asked to develop some usercontrols in ASP.NET that will at a later point be pulled into a SharePoint site as web parts. I am new to SharePoint and will not have access to a SharePoint server during the time I need to prototype these parts.\nDoes anyone know of any re... |
I am trying to dynamicaly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error:
Metadata file 'System.Data.Linq.dll' could not be found
My code looks like:
CompilerParameters compilerParams = new CompilerParameters();
compilerParams.CompilerOptions = "/target:... | The error you are encountering, "Metadata file 'System.Data.Linq.dll' could not be found," suggests that the CodeDom compiler is unable to locate the `System.Data.Linq.dll` assembly. This could be due to a few reasons, and I'll outline steps you can take to resolve this issue:
### Steps to Resolve the Issue
1. **Chec... | 14,785 | [
{
"from": "human",
"value": "I am trying to dynamicaly compile code using CodeDom. I can load other assemblies, but I cannot load System.Data.Linq.dll. I get an error:\nMetadata file 'System.Data.Linq.dll' could not be found\nMy code looks like:\nCompilerParameters compilerParams = new CompilerParameters()... |
Have someone ever done this before???
I am trying to use MinGW to compile a program using the MySQL libraries. I keep getting the message that the function 'rint' is redefined. Ok it's true that the function is in both files config-win.h, from MySQL and math.h from the standard library, but both of them are suppose to ... | It looks like you're encountering a common issue where there are conflicting definitions of the `rint` function between the MySQL headers and the standard C library headers when using MinGW. This can often be attributed to the way that certain functions are defined in different environments or libraries.
Here are som... | 17,105 | [
{
"from": "human",
"value": "Have someone ever done this before???\nI am trying to use MinGW to compile a program using the MySQL libraries. I keep getting the message that the function 'rint' is redefined. Ok it's true that the function is in both files config-win.h, from MySQL and math.h from the standard... |
Does anyone have any tips or gotcha moments to look out for when trying to migrate MySQL tables from the the default case-insenstive swedish or ascii charsets to utf-8? Some of the projects that I'm involved in are striving for better internationalization and the database is going to be a significant part of this chang... | Migrating MySQL tables from case-insensitive Swedish or ASCII character sets to UTF-8 can be a significant undertaking, especially when it comes to ensuring data integrity and application compatibility. Here are some tips and potential "gotchas" to watch out for during this process:
### Tips for Migration
1. **Backup... | 14,383 | [
{
"from": "human",
"value": "Does anyone have any tips or gotcha moments to look out for when trying to migrate MySQL tables from the the default case-insenstive swedish or ascii charsets to utf-8? Some of the projects that I'm involved in are striving for better internationalization and the database is goi... |
Suppose I have a set of values, stored in a std::set:
{1, 2, 6, 8}
and I have a search key, say, 3. I want to put 3 into a function and get the first value greater than or equal to 3, in this case I would want to get 6.
The find() function provided in map/set/multimap/and set will, of course, return the end iterator fo... | Yes, in C++, you can achieve this by using the `std::set`'s member function `lower_bound`. The `lower_bound` function returns an iterator pointing to the first element that is not less than the specified value (i.e., greater than or equal to the specified value).
Here's how you can use `lower_bound` to find the first ... | 18,781 | [
{
"from": "human",
"value": "Suppose I have a set of values, stored in a std::set:\n{1, 2, 6, 8}\nand I have a search key, say, 3. I want to put 3 into a function and get the first value greater than or equal to 3, in this case I would want to get 6.\nThe find() function provided in map/set/multimap/and set... |
I have applied a Formatter to a JFormattedTextField using a FormatterFactory, when a user clicks into the text field I want to select the contents.
A focus listener does not work as expected because the formatter gets called, which eventually causes the value to be reset which ultimately de-selects the fields contents... | Yes, you are right in your analysis of the issue. When you apply a `Formatter` to a `JFormattedTextField`, any changes to the field (including those triggered by focusing the field) may cause the formatter to reset the contents. This can interfere with your attempt to select the text.
To correctly select the contents ... | 16,161 | [
{
"from": "human",
"value": "I have applied a Formatter to a JFormattedTextField using a FormatterFactory, when a user clicks into the text field I want to select the contents. \nA focus listener does not work as expected because the formatter gets called, which eventually causes the value to be reset which... |
I'm working with dRuby and basicly I'm calling a remote method that returns me an object.
In the clientside I have this code:
handle_error(response) if response.is_a?(Error)
where response is the DRbObject. (I've developed this code before using dRuby and I'm returning an Error object if something went wrong). The pro... | In dRuby, when you return an object from a remote method, the object is serialized and sent over the network, which means that it arrives on the client side as a `DRbObject` instead of the original class. When you check the type of `response` with `response.is_a?(Error)`, it returns `false` because `response` is an ins... | 17,753 | [
{
"from": "human",
"value": "I'm working with dRuby and basicly I'm calling a remote method that returns me an object.\nIn the clientside I have this code:\nhandle_error(response) if response.is_a?(Error)\n\nwhere response is the DRbObject. (I've developed this code before using dRuby and I'm returning an E... |
I am using SqlMetal to general my DataContext.dbml class for my ASP.net application using LinqToSql. When I initially created the DataContext.dbml file, Visual Studio used this to create a related DataContext.designer.cs file. This designer file contains the DataContext class in C# that is used throughout the app (and ... | The issue you're experiencing with the .dbml and .designer.cs files not regenerating in Visual Studio when you update your database is a common challenge for developers using Linq to SQL. Unfortunately, Visual Studio does not automatically regenerate the designer.cs file when the dbml is updated, which can lead to the ... | 14,346 | [
{
"from": "human",
"value": "I am using SqlMetal to general my DataContext.dbml class for my ASP.net application using LinqToSql. When I initially created the DataContext.dbml file, Visual Studio used this to create a related DataContext.designer.cs file. This designer file contains the DataContext class in... |
I've recently had to dust off my Perl and shell script skills to help out some colleagues. The colleagues in question have been tasked with providing some reports from an internal application with a large Oracle database backend, and they simply don't have the skills to do this. While some might question whether I have... | Storing database credentials securely is a common challenge, and there are several strategies you can consider, especially since you mentioned that you need to account for shared access and automated processes like cron jobs. Below are some options you can explore:
### 1. Use Oracle Wallet
Oracle provides a feature c... | 12,298 | [
{
"from": "human",
"value": "I've recently had to dust off my Perl and shell script skills to help out some colleagues. The colleagues in question have been tasked with providing some reports from an internal application with a large Oracle database backend, and they simply don't have the skills to do this.... |
I have heard that there is lots of interesting and useful WSGI middleware around. However, I am not sure which ones (apart from the ones that are part of pylons) are useful and stable. What is your favourite WSGI middleware?
| There are indeed many useful and interesting WSGI middleware components available that can enhance the functionality of your web applications. Here are some popular and stable WSGI middleware options that you might find useful:
1. **Gunicorn**: While primarily an application server, it can also be considered middlewar... | 17,185 | [
{
"from": "human",
"value": "I have heard that there is lots of interesting and useful WSGI middleware around. However, I am not sure which ones (apart from the ones that are part of pylons) are useful and stable. What is your favourite WSGI middleware?\n"
},
{
"from": "gpt",
"value": "There ar... |
I've been wondering, is there a performance difference between using named functions and anonymous functions in Javascript?
for (var i = 0; i < 1000; ++i) {
myObjects[i].onMyEvent = function() {
// do something
};
}
vs
function myEventHandler() {
// do something
}
for (var i = 0; i < 1000; ++i) {... | In JavaScript, there is a distinction between named functions and anonymous functions that can impact performance, but the difference in most practical scenarios is often negligible. Let's analyze both approaches you mentioned:
1. **Anonymous Function:**
```javascript
for (var i = 0; i < 1000; ++i) {
myOb... | 12,404 | [
{
"from": "human",
"value": "I've been wondering, is there a performance difference between using named functions and anonymous functions in Javascript? \nfor (var i = 0; i < 1000; ++i) {\n myObjects[i].onMyEvent = function() {\n // do something\n };\n}\n\nvs\nfunction myEventHandler() {\n /... |
I have a LinkedList, where Entry has a member called id. I want to remove the Entry from the list where id matches a search value. What's the best way to do this? I don't want to use Remove(), because Entry.Equals will compare other members, and I only want to match on id. I'm hoping to do something kind of like th... | In a `LinkedList`, you cannot directly use methods like `RemoveAll` that are available in `List<T>`. Instead, you'll need to iterate through the `LinkedList` and remove the entries that match your criteria manually.
Here's how you can achieve this using a simple loop:
```csharp
using System;
using System.Collections.... | 14,213 | [
{
"from": "human",
"value": "I have a LinkedList, where Entry has a member called id. I want to remove the Entry from the list where id matches a search value. What's the best way to do this? I don't want to use Remove(), because Entry.Equals will compare other members, and I only want to match on id. I... |
I'm about to deal with managing and running my first Internet connected Apache webserver and I was wondering if there are any sys admins and developers out there that would like to share some of their knowledge regarding security and optimization tips for running Apache webserver.
Maybe you can share your top five (or ... | Congratulations on your new venture! Running an Apache web server involves several important considerations for security and optimization. Here’s a list of top practices to implement right after you install Apache on a Linux server:
### 1. **Keep Software Up to Date**
- **Regular Updates**: Regularly update your Ap... | 14,702 | [
{
"from": "human",
"value": "I'm about to deal with managing and running my first Internet connected Apache webserver and I was wondering if there are any sys admins and developers out there that would like to share some of their knowledge regarding security and optimization tips for running Apache webserve... |
Let's say I have an existing trivial XML file named 'MyData.xml' that contains the following:
<?xml version="1.0" encoding="utf-8" ?>
<myElement>foo</myElement>
I want to change the text value of 'foo' to 'bar' resulting in the following:
<?xml version="1.0" encoding="utf-8" ?>
<myElement>bar</myElement>
Once I am do... | The easiest way to modify an XML file in Python is to use the `xml.etree.ElementTree` module, which is part of the standard library. Below is a simple script that reads your XML file, changes the text value from "foo" to "bar", and then saves the changes back to the file.
Here is how you can do it:
```python
import x... | 18,746 | [
{
"from": "human",
"value": "Let's say I have an existing trivial XML file named 'MyData.xml' that contains the following:\n<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<myElement>foo</myElement>\n\nI want to change the text value of 'foo' to 'bar' resulting in the following:\n<?xml version=\"1.0\" encoding... |
I have exceptions created for every condition that my application does not expect. UserNameNotValidException, PasswordNotCorrectException etc.
However I was told I should not create exceptions for those conditions. In my UML those ARE exceptions to the main flow, so why should it not be an exception?
Any guidance or b... | Creating exceptions in software development is a common practice for managing unexpected situations or errors that can arise during execution. However, there are best practices regarding when and how to use exceptions. Here are some points to consider:
### 1. **Distinction Between Exceptions and Business Logic Errors*... | 13,533 | [
{
"from": "human",
"value": "I have exceptions created for every condition that my application does not expect. UserNameNotValidException, PasswordNotCorrectException etc.\nHowever I was told I should not create exceptions for those conditions. In my UML those ARE exceptions to the main flow, so why should... |
You can, obviously, put a variable declaration in a for loop:
for (int i = 0; ...
and I've noticed that you can do the same thing in if and switch statements as well:
if ((int i = f()) != 0) ...
switch (int ch = stream.get()) ...
But when I try to do the same thing in a while loop:
while ((int ch = stream.get()) != ... | The behavior you are observing is due to the rules of variable scope in C++ and how the `while` loop works in relation to its condition.
In C++, variable declarations can be used in the initialization sections of `for` loops as well as in the condition of `if` and `switch` statements because they create a new scope f... | 17,793 | [
{
"from": "human",
"value": "You can, obviously, put a variable declaration in a for loop:\nfor (int i = 0; ...\n\nand I've noticed that you can do the same thing in if and switch statements as well:\nif ((int i = f()) != 0) ...\n\nswitch (int ch = stream.get()) ...\n\nBut when I try to do the same thing in... |
I'm using memcache to design a cache for the model layer of a web application, one of my biggest problems is data consistency.
It came to my mind caching data like this:
(key=query, value=list of object ids result of the query)
for each id of the list:
(key=object.id, value=object)
So, every time a query is done:
If t... | Your approach to caching with Memcache can work, but it does have some trade-offs, especially concerning data consistency. Here are some considerations and suggestions to improve your cache strategy:
### Pros of Your Approach:
1. **Efficiency in Query Caching**: Caching the query results by storing a list of object ID... | 9,625 | [
{
"from": "human",
"value": "I'm using memcache to design a cache for the model layer of a web application, one of my biggest problems is data consistency. \nIt came to my mind caching data like this:\n(key=query, value=list of object ids result of the query)\nfor each id of the list:\n(key=object.id, value... |
First of all, I'm fairly sure snapping to grid is fairly easy, however I've run into some odd trouble in this situation and my maths are too weak to work out specifically what is wrong.
Here's the situation
I have an abstract concept of a grid, with Y steps exactly Y_STEP apart (the x steps are working fine so ignore t... | From your description, it seems like you're encountering a common issue in coordinate transformations, especially when dealing with offsets and snapping to a grid. The problem you described—where the tool appears misaligned with the cursor after scrolling—likely stems from an inconsistency in how you are managing offse... | 11,813 | [
{
"from": "human",
"value": "First of all, I'm fairly sure snapping to grid is fairly easy, however I've run into some odd trouble in this situation and my maths are too weak to work out specifically what is wrong.\nHere's the situation\nI have an abstract concept of a grid, with Y steps exactly Y_STEP apar... |
I get the following error message in SQL Server 2005:
User '<username>' does not have permission to run DBCC DBREINDEX for object '<table>'.
Which minimum role do I have to give to user in order to run the command?
| In SQL Server 2005, the `DBCC DBREINDEX` command requires specific permissions that are not typically granted to regular users. To allow a user to run the `DBCC DBREINDEX` command, you need to ensure that the user has one of the following roles:
1. **db_owner role**: Members of the `db_owner` role can perform any acti... | 19,862 | [
{
"from": "human",
"value": "I get the following error message in SQL Server 2005:\nUser '<username>' does not have permission to run DBCC DBREINDEX for object '<table>'.\n\nWhich minimum role do I have to give to user in order to run the command?\n"
},
{
"from": "gpt",
"value": "In SQL Server 2... |
I use the on-demand (hosted) version of FogBugz. I would like to start using Mercurial for source control. I would like to integrate FogBugz and a BitBucket repository.
I gave it a bit of a try but things weren't going very well.
FogBugz requires that you hook up your Mercurial client to a fogbugz.py python script.... | Integrating FogBugz with Mercurial using the on-demand (hosted) version can be a bit tricky, especially if you're using TortoiseHg, which might not include the hgext directory that FogBugz requires. However, you can set this up by following these general steps:
### Step 1: Set Up Your Environment
1. **Install Mercuri... | 10,641 | [
{
"from": "human",
"value": "I use the on-demand (hosted) version of FogBugz. I would like to start using Mercurial for source control. I would like to integrate FogBugz and a BitBucket repository.\nI gave it a bit of a try but things weren't going very well. \nFogBugz requires that you hook up your Merc... |
Hi I am trying to find a way to read the cookie that i generated in .net web application to read that on the php page because i want the users to login once but they should be able to view .net and php pages ,until the cookie expires user should not need to login in again , but both .net and php web applications are on... | To share authentication cookies between a .NET application and a PHP application, you need to ensure that both applications are configured correctly and that they can communicate with each other. This involves several steps, given that they are on different servers. Here’s a general approach to implement this:
### 1. ... | 6,536 | [
{
"from": "human",
"value": "Hi I am trying to find a way to read the cookie that i generated in .net web application to read that on the php page because i want the users to login once but they should be able to view .net and php pages ,until the cookie expires user should not need to login in again , but ... |
How do I use system environment variables in my project post-build events without having to write and execute an external batch file? I thought that it would be as easy as creating a new environment variable named LHDLLDEPLOY and writing the following in my post-build event textbox:
copy $(TargetPath) %LHDLLDEPLOY%\$(... | It looks like you've encountered a common issue when trying to use system environment variables directly in Visual Studio post-build events. In Visual Studio, system environment variables are accessed using a different syntax than what you originally used.
Here's the correct approach to use your environment variable `... | 18,764 | [
{
"from": "human",
"value": "How do I use system environment variables in my project post-build events without having to write and execute an external batch file? I thought that it would be as easy as creating a new environment variable named LHDLLDEPLOY and writing the following in my post-build event tex... |
I need a cross platform method of determining the MAC address of a computer at run time. For windows the 'wmi' module can be used and the only method under Linux I could find was to run ifconfig and run a regex across its output. I don't like using a package that only works on one OS, and parsing the output of anothe... | To obtain the MAC address of a computer in a cross-platform manner (both Windows and Linux), you can use the `psutil` library. This library provides a consistent interface for retrieving system and network information across different operating systems.
Here's how you can use `psutil` to obtain the MAC address:
### S... | 16,641 | [
{
"from": "human",
"value": "I need a cross platform method of determining the MAC address of a computer at run time. For windows the 'wmi' module can be used and the only method under Linux I could find was to run ifconfig and run a regex across its output. I don't like using a package that only works on... |
I'm trying to do a simple update. I've done this kind of thing thousands of times.
update articles
set department = 60
where type = 'Top Story'
Today I get a strange error.
Describe Error: Failed to retrieve
execution plan: Subquery returned more
than 1 value. This is not permitted
when the subquery follows =,... | The error message you’re seeing suggests that there might be a problem with how the SQL Server is interpreting your query, but the message about a subquery returning more than one value is puzzling since your `UPDATE` statement does not include a subquery. Here are a few things to consider:
1. **Database Trigger:** Ch... | 16,477 | [
{
"from": "human",
"value": "I'm trying to do a simple update. I've done this kind of thing thousands of times. \nupdate articles\nset department = 60\nwhere type = 'Top Story'\n\nToday I get a strange error.\n\nDescribe Error: Failed to retrieve\n execution plan: Subquery returned more\n than 1 value. Th... |
In my tests I need to test what happens when an OracleException is thrown (due to a stored procedure failure). I am trying to setup Rhino Mocks to
Expect.Call(....).Throw(new OracleException());
For whatever reason however, OracleException seems to be sealed with no public constructor. What can I do to test this?
E... | Testing exceptions, especially sealed exceptions like `OracleException`, can be challenging due to their access modifiers. However, there are several strategies you can consider to simulate an `OracleException` in your unit tests without needing to directly instantiate it.
### 1. Create a Custom Exception
If you need ... | 16,217 | [
{
"from": "human",
"value": "In my tests I need to test what happens when an OracleException is thrown (due to a stored procedure failure). I am trying to setup Rhino Mocks to \nExpect.Call(....).Throw(new OracleException());\n\nFor whatever reason however, OracleException seems to be sealed with no public... |
Looking for one that is fast enough and still graceful with memory. The image is a 24bpp System.Drawing.Bitmap.
| If you're working with a 24bpp (bits per pixel) `System.Drawing.Bitmap` in a .NET environment and need a method that is both fast and memory-efficient for image manipulation, you have a few options depending on what you're trying to achieve (e.g., resizing, filtering, drawing, etc.). Here are a few considerations and a... | 11,213 | [
{
"from": "human",
"value": "Looking for one that is fast enough and still graceful with memory. The image is a 24bpp System.Drawing.Bitmap.\n"
},
{
"from": "gpt",
"value": "If you're working with a 24bpp (bits per pixel) `System.Drawing.Bitmap` in a .NET environment and need a method that is b... |
Please give me the direction of the best guidance on the Entity Framework.
| Entity Framework (EF) is a powerful Object-Relational Mapping (ORM) framework for .NET applications, and there are numerous resources available for learning and mastering it. Here’s a structured approach to finding the best guidance on Entity Framework:
### Official Documentation
1. **Microsoft Documentation**: The be... | 15,817 | [
{
"from": "human",
"value": "Please give me the direction of the best guidance on the Entity Framework.\n"
},
{
"from": "gpt",
"value": "Entity Framework (EF) is a powerful Object-Relational Mapping (ORM) framework for .NET applications, and there are numerous resources available for learning an... |
According to Wikipedia, on the Comparison of programming languages page, it says that F# uses CLI. Does that mean that F# is designed for the purpose of making command-line applications and not graphical applications, or is there another meaning of CLI?
| In the context of programming languages, "CLI" stands for "Common Language Infrastructure." It is a framework developed by Microsoft that allows different programming languages to be interoperable and run on the .NET platform. The term CLI in this case is not related to "command-line interface" applications.
F# is ind... | 20,684 | [
{
"from": "human",
"value": "According to Wikipedia, on the Comparison of programming languages page, it says that F# uses CLI. Does that mean that F# is designed for the purpose of making command-line applications and not graphical applications, or is there another meaning of CLI?\n"
},
{
"from": "... |
Any ideas how to display a PDF file in a WPF Windows Application?
I am using the following code to run the browser but the Browser.Navigate method does not do anything!
WebBrowser browser = new WebBrowser();
browser.Navigate("http://www.google.com");
this.AddChild(browser); // this is the System.Windows.Window
| To display a PDF file in a WPF application, there are a few different approaches you can take. Using the `WebBrowser` control is one option, but it can be tricky and often requires the appropriate PDF viewer plugin to be installed in Internet Explorer, which may not be reliable.
Here are a couple of alternative method... | 14,399 | [
{
"from": "human",
"value": "Any ideas how to display a PDF file in a WPF Windows Application? \n\nI am using the following code to run the browser but the Browser.Navigate method does not do anything!\nWebBrowser browser = new WebBrowser();\nbrowser.Navigate(\"http://www.google.com\");\nthis.AddChild(brows... |
Using Scala's command line REPL:
def foo(x: Int): Unit = {}
def foo(x: String): Unit = {println(foo(2))}
gives
error: type mismatch;
found: Int(2)
required: String
It seems that you can't define overloaded recursive methods in the REPL. I thought this was a bug in the Scala REPL and filed it, but it was almost instan... | The issue you're encountering in the Scala REPL when trying to define overloaded recursive methods is indeed related to the way the REPL compiles and interprets the code.
### Why It Happens:
1. **Type Resolution**: In Scala, method overloading works based on the static types of arguments at the call site. When you de... | 16,335 | [
{
"from": "human",
"value": "Using Scala's command line REPL:\ndef foo(x: Int): Unit = {}\ndef foo(x: String): Unit = {println(foo(2))}\n\ngives\nerror: type mismatch;\nfound: Int(2)\nrequired: String\n\nIt seems that you can't define overloaded recursive methods in the REPL. I thought this was a bug in the... |
We encountered a problem with using Subversion on Windows. A developer committed a file foo.Data.sql and later another developer committed a file called foo.data.sql. Naturally, this caused a problem on Windows clients (all clients are Windows in our environments) because files are case sensitive in Subversion but not ... | The issue you encountered is a common one when using version control systems like Subversion on case-insensitive file systems, such as those found on Windows. Let's address your questions one by one:
### 1. How is it possible for a developer to do this using a Windows client?
In Subversion, the repository is case-sen... | 13,734 | [
{
"from": "human",
"value": "We encountered a problem with using Subversion on Windows. A developer committed a file foo.Data.sql and later another developer committed a file called foo.data.sql. Naturally, this caused a problem on Windows clients (all clients are Windows in our environments) because files ... |
I have used the XML Parser before, and even though it worked OK, I wasn't happy with it in general, it felt like I was using workarounds for things that should be basic functionality.
I recently saw SimpleXML but I haven't tried it yet. Is it any simpler? What advantages and disadvantages do both have? Any other parser... | When working with XML in PHP, both the XML Parser and SimpleXML are available options, but they serve different use cases and user experiences. Let's compare the two, along with mentioning other alternatives.
### XML Parser
**Advantages:**
- **Flexibility:** The XML Parser allows for a very granular level of control o... | 16,846 | [
{
"from": "human",
"value": "I have used the XML Parser before, and even though it worked OK, I wasn't happy with it in general, it felt like I was using workarounds for things that should be basic functionality.\nI recently saw SimpleXML but I haven't tried it yet. Is it any simpler? What advantages and di... |
I need a framework for generating charts for data visualization. I picked up Processing www.processing.org/ but at the moment i can not run that in the "headless" mode from a web server. Is there any other candidate for this domain? What are the options if you need more chart type than what is supported by out-of-the-b... | If you're looking for alternatives to Processing for generating charts and data visualizations, especially in a headless mode from a web server, there are several options you can consider. Below are some popular frameworks and libraries that you can use for data visualization:
### 1. **D3.js**
- **Overview**: A powerf... | 12,330 | [
{
"from": "human",
"value": "I need a framework for generating charts for data visualization. I picked up Processing www.processing.org/ but at the moment i can not run that in the \"headless\" mode from a web server. Is there any other candidate for this domain? What are the options if you need more chart ... |
While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.
It can help you understand the problem better. Maybe you don't have to solve it the way you thought you did.
It can help you understand the lan... | Implementing quicksort in a Windows batch file is certainly an interesting challenge due to the limitations of batch scripting. However, it is possible to create a basic version of quicksort by leveraging string manipulation and recursion through the use of functions.
Here’s a simple example of how you might implemen... | 12,956 | [
{
"from": "human",
"value": "While normally it's good to always choose the right language for the job, it can sometimes be instructive to try and do something in a language which is wildly inappropriate.\n\nIt can help you understand the problem better. Maybe you don't have to solve it the way you thought ... |
The following code:
template <typename S, typename T>
struct foo {
void bar();
};
template <typename T>
void foo <int, T>::bar() {
}
gives me the error
invalid use of incomplete type 'struct foo<int, T>'
declaration of 'struct foo<int, T>'
(I'm using gcc.) Is my syntax for partial specialization wrong? Note that ... | The error you're encountering arises from the way partial specialization works in C++. In your original code, you're trying to define a member function for a partially specialized version of the `foo` template. However, the syntax you've used is incorrect for partial specialization.
In C++, when you want to partially ... | 18,337 | [
{
"from": "human",
"value": "The following code:\ntemplate <typename S, typename T>\nstruct foo {\n void bar();\n};\n\ntemplate <typename T>\nvoid foo <int, T>::bar() {\n}\n\ngives me the error\ninvalid use of incomplete type 'struct foo<int, T>'\ndeclaration of 'struct foo<int, T>'\n\n(I'm using gcc.) Is... |
I'm using localConnection in AS3 to allow several flash applications to interact with a central application. (Some are AS2, some AS3).
The central application must use a seperate localConnection variable for each receiving connection (otherwise the second app that tries to connect will be rejected).
But what about send... | When designing your localConnection architecture in ActionScript 3 (AS3) for multiple Flash applications to interact with a central application, choosing how to manage your connections can affect both performance and maintainability.
### Sending Messages: Single Connection vs Multiple Connections
1. **Single LocalCon... | 13,841 | [
{
"from": "human",
"value": "I'm using localConnection in AS3 to allow several flash applications to interact with a central application. (Some are AS2, some AS3).\nThe central application must use a seperate localConnection variable for each receiving connection (otherwise the second app that tries to conn... |
So I have something like this:
var xmlStatement:String = "xmlObject.node[3].@thisValue";
What mystery function do I have to use so that I can execute xmlStatement and get thisValue from that xmlObject? Like....
var attribute:String = mysteryFunction(xmlStatement);
P.S. I know eval() works for actionscript2, I need th... | In ActionScript 3, there is no direct equivalent to `eval()` like in some other languages, since it's designed to be more type-safe and secure. However, you can achieve similar functionality by breaking down the expression into its parts and accessing the properties directly.
In your case, if you have an XML object an... | 17,076 | [
{
"from": "human",
"value": "So I have something like this:\nvar xmlStatement:String = \"xmlObject.node[3].@thisValue\";\n\nWhat mystery function do I have to use so that I can execute xmlStatement and get thisValue from that xmlObject? Like....\nvar attribute:String = mysteryFunction(xmlStatement);\n\nP.S.... |
I need to create a really basic Adobe Illustrator file on the clipboard that I can paste in Adobe Illustrator or Expression Design. I'm looking for code samples on how to programmatically generate Adobe Illustrator Files, preferably from C# or some other .NET language (but at the moment any language goes).
I have found... | Creating Adobe Illustrator (AI) files programmatically, especially in the AI3 format, can be a bit tricky since the file format specifications are complex and not widely documented. However, I can provide you with a basic C# example that constructs a simple AI3 file. The AI3 format is binary-based, and you’ll typically... | 14,627 | [
{
"from": "human",
"value": "I need to create a really basic Adobe Illustrator file on the clipboard that I can paste in Adobe Illustrator or Expression Design. I'm looking for code samples on how to programmatically generate Adobe Illustrator Files, preferably from C# or some other .NET language (but at th... |
I have a table that holds information about cities in a game, you can build one building each turn and this is recorded with the value "usedBuilding".
Each turn I will run a script that alters usedBuilding to 0, the question is, which of the following two ways is faster and does it actually matter which way is used?
UP... | To determine which of the two SQL statements you provided is faster and whether it matters which one you use, let's analyze both options.
1. **`UPDATE cities SET usedBuilding = 0;`**:
- This command will update every row in the `cities` table, setting `usedBuilding` to 0, regardless of its current value.
- If y... | 18,009 | [
{
"from": "human",
"value": "I have a table that holds information about cities in a game, you can build one building each turn and this is recorded with the value \"usedBuilding\".\nEach turn I will run a script that alters usedBuilding to 0, the question is, which of the following two ways is faster and d... |
Emacs has a useful transpose-words command which lets one exchange the word before the cursor with the word after the cursor, preserving punctuation.
For example, ‘stack |overflow’ + M-t = ‘overflow stack|’ (‘|’ is the cursor position).
<a>|<p> becomes <p><a|>.
Is it possible to emulate it in Vim? I know I can use dwwP... | It's great to see that you found a solution to emulate Emacs' `transpose-words` feature in Vim! Your approach using a command with the substitute (`:s`) command and `%#` for word boundaries is indeed clever and functional.
For others who might be looking for a similar solution, let’s break down what you did for clari... | 18,139 | [
{
"from": "human",
"value": "Emacs has a useful transpose-words command which lets one exchange the word before the cursor with the word after the cursor, preserving punctuation.\nFor example, ‘stack |overflow’ + M-t = ‘overflow stack|’ (‘|’ is the cursor position).\n<a>|<p> becomes <p><a|>.\nIs it possible... |
I am sending newsletters from a Java server and one of the hyperlinks is arriving missing a period, rendering it useless:
Please print your <a href=3D"http://xxxxxxx.xxx.xx.edu=
au//newsletter2/3/InnovExpoInviteVIP.pdf"> VIP invitation</a> for future re=
ference and check the Innovation Expo website <a href=3D"http://x... | It sounds like you've encountered an issue with line wrapping in emails due to SMTP's handling of lines that begin with a period. Here are some recommendations to avoid or mitigate this issue:
### 1. Upgrade Your Java Version
Since you've discovered that an outdated Java version is causing the problem, the first step ... | 12,467 | [
{
"from": "human",
"value": "I am sending newsletters from a Java server and one of the hyperlinks is arriving missing a period, rendering it useless:\nPlease print your <a href=3D\"http://xxxxxxx.xxx.xx.edu=\nau//newsletter2/3/InnovExpoInviteVIP.pdf\"> VIP invitation</a> for future re=\nference and check t... |
I'm doing some testing on Firefox toolbars for the sake of learning and I can't find out any information on how to store the contents of a "search" drop-down inside the user's profile.
Is there any tutorial on how to sort this out?
| To store contents for a Firefox toolbar's search drop-down within a user's profile, you'll likely need to create a Firefox extension (also known as an add-on) using the WebExtensions API. Below is an overview of how you can approach this task, along with some resources to help you get started.
### Step-by-Step Guide
... | 12,861 | [
{
"from": "human",
"value": "I'm doing some testing on Firefox toolbars for the sake of learning and I can't find out any information on how to store the contents of a \"search\" drop-down inside the user's profile.\nIs there any tutorial on how to sort this out?\n"
},
{
"from": "gpt",
"value": ... |
I have a bunch of Velocity template files in a Visual Studio 2008 project, the problem is that despite the fact that the extension is .vm instead of .xml or similar Visual Studio thinks that the HTML they contains must conform to XML naming standards and generates errors (not just warnings even) on each compilation.
Ho... | To resolve the issue of Visual Studio 2008 treating your `.vm` (Velocity template) files as XML files and generating validation errors, you can adjust the settings to prevent XML validation specifically for those files. Here are a couple of approaches you can take:
### 1. Change the File Extension
One of the simplest ... | 18,704 | [
{
"from": "human",
"value": "I have a bunch of Velocity template files in a Visual Studio 2008 project, the problem is that despite the fact that the extension is .vm instead of .xml or similar Visual Studio thinks that the HTML they contains must conform to XML naming standards and generates errors (not ju... |
I'm looking for an elegant, high performance solution to the following problem.
There are 256 linked lists.
Each list contains the same types of object that among other things holds a whole number that is used to define a sort order.
All numbers across all lists are unique
Each individual list is sorted in ascendin... | Certainly! The problem you’re facing is a classic example of merging multiple sorted lists into a single sorted list. There are several elegant algorithms to accomplish this, with one of the most efficient methods being the use of a min-heap (also known as a priority queue).
Here’s a step-by-step outline of the soluti... | 13,983 | [
{
"from": "human",
"value": "I'm looking for an elegant, high performance solution to the following problem. \nThere are 256 linked lists. \n\nEach list contains the same types of object that among other things holds a whole number that is used to define a sort order.\nAll numbers across all lists are uniq... |
It's common to have a table where for example the the fields are account, value, and time. What's the best design pattern for retrieving the last value for each account? Unfortunately the last keyword in a grouping gives you the last physical record in the database, not the last record by any sorting. Which means IM... | You're right that using `LAST()` in a grouping context doesn't always yield the expected results, especially when dealing with time-ordered data. There are several approaches you can take to efficiently retrieve the last value for each account in a more elegant way. Here are a few methods, along with an explanation of ... | 14,458 | [
{
"from": "human",
"value": "It's common to have a table where for example the the fields are account, value, and time. What's the best design pattern for retrieving the last value for each account? Unfortunately the last keyword in a grouping gives you the last physical record in the database, not the la... |
Implementing Equals() for reference types is harder than it seems. My current canonical implementation goes like this:
public bool Equals( MyClass obj )
{
// If both refer to the same reference they are equal.
if( ReferenceEquals( obj, this ) )
return true;
// If the other object is null they are not equal b... | Your implementation of `Equals()` for a reference type is a solid starting point and covers many of the essential cases for comparing objects. However, there are some improvements and best practices to consider, especially with respect to the `Equals()` method and how it interacts with `GetHashCode()`. Below are some p... | 13,645 | [
{
"from": "human",
"value": "Implementing Equals() for reference types is harder than it seems. My current canonical implementation goes like this:\npublic bool Equals( MyClass obj )\n{\n // If both refer to the same reference they are equal.\n if( ReferenceEquals( obj, this ) )\n return true;\n\n // ... |
I heard that decision tables in relational database have been researched a lot in academia. I also know that business rules engines use decision tables and that many BPMS use them as well.
I was wondering if people today use decision tables within their relational databases?
| Yes, decision tables are still relevant and used within relational databases today, especially in contexts where business rules, conditional logic, and decision-making processes are crucial. Here are some ways they are applied:
1. **Business Rules Implementation**: Decision tables provide a structured way to implement... | 14,885 | [
{
"from": "human",
"value": "I heard that decision tables in relational database have been researched a lot in academia. I also know that business rules engines use decision tables and that many BPMS use them as well. \nI was wondering if people today use decision tables within their relational databases?\n... |
I'm gearing up to do some Ajax style client-side JavaScript code in the near future, and I've heard rave reviews of jQuery when it comes to this realm. What I'm wondering is:
What are all the cross-browser JavaScript libraries out there?
What is the experience using them?
| There are several popular JavaScript libraries that are designed to simplify cross-browser development and provide various utilities for Ajax and DOM manipulation. Here’s a list of some notable cross-browser JavaScript libraries along with insights into their experiences:
### 1. **jQuery**
- **Experience**: jQuery ... | 11,677 | [
{
"from": "human",
"value": "I'm gearing up to do some Ajax style client-side JavaScript code in the near future, and I've heard rave reviews of jQuery when it comes to this realm. What I'm wondering is:\n\nWhat are all the cross-browser JavaScript libraries out there?\n\nWhat is the experience using them?\... |
Is there a secure way of logging into a Gmail account on a web browser, from an external Java program? I know the following works, but is there a safer alternative?
Desktop.getDesktop().browse(new URI(
"https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmail" +
"&service=m... | Using the method you've described for logging into Gmail via a web browser from a Java program is not secure, primarily because it involves hardcoding the user's credentials (email and password) in the URL, which is both insecure and against best practices. Here are a few safer alternatives to consider:
### 1. Open Au... | 17,248 | [
{
"from": "human",
"value": "Is there a secure way of logging into a Gmail account on a web browser, from an external Java program? I know the following works, but is there a safer alternative?\nDesktop.getDesktop().browse(new URI(\n \"https://www.google.com/accounts/ServiceLoginAuth?continue=http://... |
When coding, what in your experience is a better approach?
Break the problem down into small enough pieces and then implement each piece.
Break the problem down, but then implement using a top-down approach.
Any other?
| Both approaches—breaking the problem down into small pieces and implementing each piece, or using a top-down approach—have their merits and can be effective depending on the context and the problem you're working on. Here’s a breakdown of each approach, along with some other considerations:
### 1. **Bottom-Up Approach... | 15,611 | [
{
"from": "human",
"value": "When coding, what in your experience is a better approach? \n\nBreak the problem down into small enough pieces and then implement each piece.\nBreak the problem down, but then implement using a top-down approach.\nAny other?\n\n"
},
{
"from": "gpt",
"value": "Both ap... |
I have experimented with Lisp (actually Scheme) and found it to be a very beautiful language that I am interested in learning more about. However, it appears that Lisp is never used in serious projects, and I haven't seen it listed as a desired skill on any job posting. I am interested in hearing from anyone who has ... | Lisp, and specifically its dialects like Scheme and Common Lisp, has a rich history and a unique set of features that many developers appreciate, including powerful macro systems, first-class functions, and a focus on symbolic computation. While it's true that Lisp may not be as prevalent in mainstream job postings com... | 16,132 | [
{
"from": "human",
"value": "I have experimented with Lisp (actually Scheme) and found it to be a very beautiful language that I am interested in learning more about. However, it appears that Lisp is never used in serious projects, and I haven't seen it listed as a desired skill on any job posting. I am i... |
I want alwaysPositive to be assigned a positive number with all possible values for lareValue1 and largeValue2 (these are at least 1).
The following statement causes a buffer overflow:
int alwaysPositive = (largeValue1 + largeValue2) / 2;
I know I can prevent it by substracting and adding:
int alwaysPositive = largeVa... | In C#, you can achieve the effect of an unsigned right shift (like `>>>` in Java or JavaScript) using a combination of right shifting and a cast to the appropriate type. However, C# doesn't have an unsigned right shift operator, as C# integers are signed. To avoid overflow when calculating the average of two large posi... | 18,508 | [
{
"from": "human",
"value": "I want alwaysPositive to be assigned a positive number with all possible values for lareValue1 and largeValue2 (these are at least 1).\nThe following statement causes a buffer overflow:\nint alwaysPositive = (largeValue1 + largeValue2) / 2;\n\nI know I can prevent it by substrac... |
What tools are available for creating in process COM servers in Java?
| Creating in-process COM servers in Java can be somewhat complex since Java does not natively support COM (Component Object Model). However, there are several tools and libraries that can help you achieve this. Here are some of the most notable ones:
1. **JacORB**: This is an implementation of the Object Management Gro... | 17,339 | [
{
"from": "human",
"value": "What tools are available for creating in process COM servers in Java?\n"
},
{
"from": "gpt",
"value": "Creating in-process COM servers in Java can be somewhat complex since Java does not natively support COM (Component Object Model). However, there are several tools ... |
I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process.
For example, let's say I have three files. Using execfile:
script_1.py calls script_2.py.
In turn, script_2.py calls script_3.py.
How can I get the file name and path of script_3.py, f... | To obtain the file path of the currently running script in Python, regardless of how many scripts are called, you can use the `__file__` attribute in your script. This special attribute holds the path of the script that is currently being executed.
Here's how you can use it in `script_3.py`:
```python
# script_3.py
i... | 20,331 | [
{
"from": "human",
"value": "I have scripts calling other script files but I need to get the filepath of the file that is currently running within the process. \nFor example, let's say I have three files. Using execfile:\n\nscript_1.py calls script_2.py. \nIn turn, script_2.py calls script_3.py. \n\nHow can... |
What are some general tips to make sure I don't leak memory in C++ programs? How do I figure out who should free memory that has been dynamically allocated?
| Memory management in C++ can be challenging, especially when it comes to dynamically allocated memory. Here are some general tips to help you avoid memory leaks in your C++ programs:
### General Tips to Avoid Memory Leaks:
1. **Use Smart Pointers**:
- Prefer smart pointers (like `std::unique_ptr` and `std::shared_... | 11,619 | [
{
"from": "human",
"value": "What are some general tips to make sure I don't leak memory in C++ programs? How do I figure out who should free memory that has been dynamically allocated?\n"
},
{
"from": "gpt",
"value": "Memory management in C++ can be challenging, especially when it comes to dyna... |
I want to use javascript to insert some elements into the current page.
Such as this is the original document:
<p>Hello world!</p>
Now I want to insert an element in to the text so that it will become:
<p>Hello <span id=span1>new</span> world!</p>
I need the span tag because I want to handle it later.Show or hide.
But ... | To insert an element into the existing text while maintaining the same style as the surrounding text, you can use a `span` tag with an inline style that inherits the font styling from its parent. Specifically, you can set the CSS properties of the `span` to match the surrounding text.
Here’s a way to do it using JavaS... | 11,289 | [
{
"from": "human",
"value": "I want to use javascript to insert some elements into the current page.\nSuch as this is the original document:\n<p>Hello world!</p>\nNow I want to insert an element in to the text so that it will become:\n<p>Hello <span id=span1>new</span> world!</p>\nI need the span tag becaus... |
This question intends to be technology-agnostic. Which kind of web framework do you prefer, and when: Pure MVC or event-driven component-oriented?
Just to make the point in "technology-agnosticism", here I name a few MVC vs. component web frameworks, in diverse technologies / languages:
Struts vs. Java Server Faces / ... | The choice between a pure MVC (Model-View-Controller) framework and an event-driven, component-oriented framework largely depends on the specific needs and context of the project. Each approach has its strengths and is suited for different scenarios. Here’s a breakdown of both styles and when one might be preferable ov... | 16,564 | [
{
"from": "human",
"value": "This question intends to be technology-agnostic. Which kind of web framework do you prefer, and when: Pure MVC or event-driven component-oriented?\nJust to make the point in \"technology-agnosticism\", here I name a few MVC vs. component web frameworks, in diverse technologies /... |
8 bits representing the number 7 look like this:
00000111
Three bits are set.
What are the algorithms to determine the number of set bits in a 32-bit integer?
| There are several algorithms to determine the number of set bits (also known as "1-bits" or "Hamming Weight") in a 32-bit integer. Below are a few common methods:
### 1. **Naive Method (Loop and Count)**
This method simply iterates through each bit of the integer and checks if it is set.
```python
def count_set_bits... | 10,378 | [
{
"from": "human",
"value": "8 bits representing the number 7 look like this:\n00000111\n\nThree bits are set.\nWhat are the algorithms to determine the number of set bits in a 32-bit integer?\n"
},
{
"from": "gpt",
"value": "There are several algorithms to determine the number of set bits (also... |
As a temporary quick fix to mitigate the major risk while working on the permanent fix for XSS Vulnerability in a very large code base, I'm looking for a pre-existing XSS prevention blacklist that does a reasonable job of protecting against XSS.
Preferably a set of Regular Expressions. I'm aware of plenty of cheat shee... | Using regular expressions to mitigate XSS vulnerabilities can be quite tricky, as regex can be overly simplistic and may not account for all edge cases. However, if you're looking for a temporary fix, you can consider implementing a blacklist of patterns that are commonly associated with XSS attacks.
That said, here’s... | 12,863 | [
{
"from": "human",
"value": "As a temporary quick fix to mitigate the major risk while working on the permanent fix for XSS Vulnerability in a very large code base, I'm looking for a pre-existing XSS prevention blacklist that does a reasonable job of protecting against XSS.\nPreferably a set of Regular Expr... |
I've got the following JavaScript on my web page...
64 var description = new Array();
65 description[0] = "..."
66 description[1] = "..."
...
78 function init() {
79 document.getElementById('somedivid').innerHTML = description[0];
80 }
81
82 window.onload = init();
In Microsoft Internet Explor... | The issue you're encountering stems from the way you're assigning the `init` function to `window.onload`. In your current code, you're executing the `init` function immediately and assigning the result (which is `undefined` since `init` doesn't return anything) to `window.onload`. This means that the `init` function do... | 18,110 | [
{
"from": "human",
"value": "I've got the following JavaScript on my web page...\n64 var description = new Array();\n65 description[0] = \"...\"\n66 description[1] = \"...\"\n...\n78 function init() {\n79 document.getElementById('somedivid').innerHTML = description[0];\n80 }\n81\n82 ... |
Is it possible to dynamically create and modify images on a per pixel level in JavaScript (on client side)? Or has this to be done with server based languaged, such as PHP?
My use case is as follows:
The user opens webpage and loads locally stored image
A preview of the image is displayed
The user can modify the imag... | Yes, it is absolutely possible to dynamically create and modify images on a per-pixel level in JavaScript on the client side. You can achieve this using the HTML5 `<canvas>` element, which provides a powerful way to draw and manipulate images in a 2D rendering context.
Here's a general outline of how you can implement... | 12,593 | [
{
"from": "human",
"value": "Is it possible to dynamically create and modify images on a per pixel level in JavaScript (on client side)? Or has this to be done with server based languaged, such as PHP? \nMy use case is as follows:\n\nThe user opens webpage and loads locally stored image\nA preview of the im... |
Please could you help me in sending a data from Mobile appication to Web Server in WBXML format ? I have got a bit to convert xml to wbxml but not getting how to send that to web server in efficient way ?
| Certainly! To send data from a mobile application to a web server in WBXML format, you typically follow these general steps:
### 1. Convert XML to WBXML
Assuming you already have the functionality to convert your XML to WBXML, let’s outline how to perform the conversion. You'll typically use a library for this conver... | 14,690 | [
{
"from": "human",
"value": "Please could you help me in sending a data from Mobile appication to Web Server in WBXML format ? I have got a bit to convert xml to wbxml but not getting how to send that to web server in efficient way ?\n"
},
{
"from": "gpt",
"value": "Certainly! To send data from ... |
Is it possible to read and write Word (2003 and 2007) files in PHP without using a COM object?
I know that I can:
$file = fopen('c:\file.doc', 'w+');
fwrite($file, $text);
fclose();
but Word will read it as an HTML file not a native .doc file.
| Yes, it is possible to read and write Word (2003 and 2007) files in PHP without using a COM object. The typical way to handle Word documents in PHP involves using libraries that can manipulate the underlying file format of Word documents directly, rather than trying to write raw binary or text data. Here are a couple o... | 16,909 | [
{
"from": "human",
"value": "Is it possible to read and write Word (2003 and 2007) files in PHP without using a COM object?\nI know that I can:\n$file = fopen('c:\\file.doc', 'w+');\nfwrite($file, $text);\nfclose();\n\nbut Word will read it as an HTML file not a native .doc file.\n"
},
{
"from": "gp... |
This will hopefully be an easy one. I have an F# project (latest F# CTP) with two files (Program.fs, Stack.fs). In Stack.fs I have a simple namespace and type definition
Stack.fs
namespace Col
type Stack=
...
Now I try to include the namespace in Program.fs by declaring
open Col
This doesn't work and gives me th... | When working with multiple files in an F# project, there are a few important considerations to ensure that your namespaces and types are recognized properly. Here are a few steps you should take to resolve the issue you are facing:
1. **File Order**: Ensure that `Stack.fs` is compiled before `Program.fs`. In F#, the o... | 16,197 | [
{
"from": "human",
"value": "This will hopefully be an easy one. I have an F# project (latest F# CTP) with two files (Program.fs, Stack.fs). In Stack.fs I have a simple namespace and type definition\nStack.fs\nnamespace Col\n\ntype Stack= \n ...\n\nNow I try to include the namespace in Program.fs by decla... |
I wish to implement my software on a shareware basis, so that the user is
given a maximum trial period of (say) 30 days with which to try out the software. On purchase I intend the user to be given a randomly-generated key, which when entered
enables the software again.
I've never been down this route before, so any ad... | Implementing shareware software involves a combination of user experience design, technical development, and legal considerations. Here's a structured approach to help you get started:
### 1. Trial Period Implementation
#### a. Determine the Trial Logic
- Set a maximum trial period (e.g., 30 days).
- Store the trial ... | 15,315 | [
{
"from": "human",
"value": "I wish to implement my software on a shareware basis, so that the user is\ngiven a maximum trial period of (say) 30 days with which to try out the software. On purchase I intend the user to be given a randomly-generated key, which when entered\nenables the software again.\nI've ... |
I have a few problems with my mod_rewrite rules. There a three different url pattern I want to handle.
http://example.com/%module%/%view%-%args%.html
http://example.com/%module%/%view%.html
http://example.com/%module%
The following mod_rewrite rules don't really work. Also I've the problem that the query (example: us... | Your mod_rewrite rules appear to have the right idea, but they need some adjustments to properly handle the URL patterns you specified. Here's an updated version of your rules that should cover all three URL patterns you mentioned:
```apache
<IfModule mod_rewrite.c>
RewriteEngine On
# Handle: http://example.c... | 17,159 | [
{
"from": "human",
"value": "I have a few problems with my mod_rewrite rules. There a three different url pattern I want to handle.\n\nhttp://example.com/%module%/%view%-%args%.html\nhttp://example.com/%module%/%view%.html\nhttp://example.com/%module%\n\nThe following mod_rewrite rules don't really work. Al... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.