instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I know there is no such thing as a dumb question but this is: Can you serve contextual based ads via adsense or others on a site that is entirely behind https?
| There's no such thing as a dumb question! To answer your query, yes, you can serve contextually based ads via services like Google AdSense on a site that is entirely behind HTTPS. In fact, Google recommends using HTTPS for websites because it enhances security and trustworthiness, which can also positively impact ad pe... | 37,592 | [
{
"from": "human",
"value": "I know there is no such thing as a dumb question but this is: Can you serve contextual based ads via adsense or others on a site that is entirely behind https?\n"
},
{
"from": "gpt",
"value": "There's no such thing as a dumb question! To answer your query, yes, you c... |
I'm trying to avoid code like this when reusing the same ViewUserControl in ASP.NET MVC. Any suggestions?
<% if (ViewContext.ViewData["editMode"].ToString() == "edit"){ %>
<%= Html.SubmitButton("submit", "Update Brand")%><span class="or">Or</span><a href="#" class="cancel">Cancel</a>
<% } else { %>
<%= Html.Sub... | To avoid using inline code blocks with `<% ... %>` in your ASP.NET MVC views, you can take advantage of the `HtmlHelper` extension methods and Razor syntax, which is cleaner and more maintainable. Here’s how you can refactor your code using Razor:
1. **Use ViewData or ViewBag**: You can pass the mode (edit or create) ... | 34,970 | [
{
"from": "human",
"value": "I'm trying to avoid code like this when reusing the same ViewUserControl in ASP.NET MVC. Any suggestions?\n<% if (ViewContext.ViewData[\"editMode\"].ToString() == \"edit\"){ %>\n <%= Html.SubmitButton(\"submit\", \"Update Brand\")%><span class=\"or\">Or</span><a href=\"#\" cl... |
I am running both maven inside the m2eclipse plugin, windows command line and my cygwin command line.
cygwin's bash shell dumps artifacts into the cygwin /home/me/.m2 directory
but m2eclipse & windows shell (on vista) uses /Users/me/Documents/.m2
Is it possible to tell the mvn command to use one central .m2 directory ?... | Yes, it is possible to configure Maven to use a single `.m2` directory regardless of the environment (Cygwin, Windows command line, or Eclipse with the m2e plugin). You can achieve this by setting the `MAVEN_HOME` or `M2_HOME` environment variable and specifying a different location for the `settings.xml` file, or by u... | 32,557 | [
{
"from": "human",
"value": "I am running both maven inside the m2eclipse plugin, windows command line and my cygwin command line.\ncygwin's bash shell dumps artifacts into the cygwin /home/me/.m2 directory\nbut m2eclipse & windows shell (on vista) uses /Users/me/Documents/.m2\nIs it possible to tell the mv... |
I am working on a silverlight app that you need to enter information into a textbox and then just hit enter. Well there is no onclick event, that I could find, so what I did was use the onkeypressup event and check if it was the enter key that was pressed if so do "blah".
It just feels like there is a better way to do... | In Silverlight, handling the `KeyUp` event is a common way to detect when the Enter key is pressed in a TextBox. However, there is indeed a more direct way to respond to user input specifically for actions like submitting a form or executing an action after text input.
While the `KeyUp` event is a valid choice, you mi... | 35,842 | [
{
"from": "human",
"value": "I am working on a silverlight app that you need to enter information into a textbox and then just hit enter. Well there is no onclick event, that I could find, so what I did was use the onkeypressup event and check if it was the enter key that was pressed if so do \"blah\".\nIt... |
When you use the POISSON function in Excel (or in OpenOffice Calc), it takes two arguments:
an integer
an 'average' number
and returns a float.
In Python (I tried RandomArray and NumPy) it returns an array of random poisson numbers.
What I really want is the percentage that this event will occur (it is a constant num... | It seems like there's a bit of confusion about the POISSON distribution in Python compared to what you're expecting from Excel or OpenOffice Calc.
### Understanding the POISSON function
In Excel/OpenOffice Calc, the `POISSON` function gives you the probability of a given number of events happening in a fixed interval... | 34,451 | [
{
"from": "human",
"value": "When you use the POISSON function in Excel (or in OpenOffice Calc), it takes two arguments:\n\nan integer\nan 'average' number\n\nand returns a float.\nIn Python (I tried RandomArray and NumPy) it returns an array of random poisson numbers.\nWhat I really want is the percentage ... |
I have a 'framework' in Flex which loads and destroys child 'sections', which are instances of module classes. These have a lot of webservice and animation in them and are part of a public facing site.
Before I remove a section from the screen I call a 'hideSection()' interface method on the instance. In this method I ... | The situation you're describing is a common challenge in application development, particularly in environments with asynchronous operations like web service calls and animations. You're on the right track with your proposed solution of implementing a `_disposed` property and an `IDisposable` interface to manage the lif... | 34,546 | [
{
"from": "human",
"value": "I have a 'framework' in Flex which loads and destroys child 'sections', which are instances of module classes. These have a lot of webservice and animation in them and are part of a public facing site.\nBefore I remove a section from the screen I call a 'hideSection()' interface... |
Does the HTML "select" element have an on select event? what exactly is the name of the event?
| The HTML `<select>` element does not have an "on select" event. Instead, it has the "change" event, which is triggered when the user selects a different option from the dropdown.
You can listen for this event using JavaScript like this:
```html
<select id="mySelect">
<option value="option1">Option 1</option>
<opt... | 38,146 | [
{
"from": "human",
"value": "Does the HTML \"select\" element have an on select event? what exactly is the name of the event?\n"
},
{
"from": "gpt",
"value": "The HTML `<select>` element does not have an \"on select\" event. Instead, it has the \"change\" event, which is triggered when the user ... |
I have a piece of code looking like this :
TAxis *axis = 0;
if (dynamic_cast<MonitorObjectH1C*>(obj))
axis = (dynamic_cast<MonitorObjectH1C*>(obj))->GetXaxis();
Sometimes it crashes :
Thread 1 (Thread -1208658240 (LWP 11400)):
#0 0x0019e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x048c67fb in __wait... | The crash you're experiencing is most likely related to a few potential issues that could occur with the `dynamic_cast` in C++. Let's break down the possible reasons:
1. **Type Safety and RTTI**: The `dynamic_cast` operation relies on Run-Time Type Information (RTTI). If the type you are trying to cast (`MonitorObject... | 30,602 | [
{
"from": "human",
"value": "I have a piece of code looking like this : \nTAxis *axis = 0;\nif (dynamic_cast<MonitorObjectH1C*>(obj))\n axis = (dynamic_cast<MonitorObjectH1C*>(obj))->GetXaxis();\n\nSometimes it crashes : \nThread 1 (Thread -1208658240 (LWP 11400)):\n#0 0x0019e7a2 in _dl_sysinfo_int80 () ... |
As the title says really.
I've had a look at inheriting from TextBox, but the only sensible override was "OnKeyDown", but that just gives me a key from the Key enum (with no way to use Char.IsNumeric()).
| To create a custom TextBox control that only allows numeric input, you can indeed inherit from the `TextBox` class and override the `OnKeyPress` method. The `OnKeyPress` method allows you to handle key input and filter it based on your requirements.
Here’s a simple implementation of a `NumericTextBox` that only accept... | 33,594 | [
{
"from": "human",
"value": "As the title says really.\nI've had a look at inheriting from TextBox, but the only sensible override was \"OnKeyDown\", but that just gives me a key from the Key enum (with no way to use Char.IsNumeric()).\n"
},
{
"from": "gpt",
"value": "To create a custom TextBox ... |
When I generate a default scaffold, the display tags on show.html.erb have
<%=h @broker.name %>
I know the difference between <% and <%=. What's the "h" do?
| In Ruby on Rails, the `h` method is a helper method used to escape HTML. It stands for "HTML escape." When you use `<%= h @broker.name %>`, it ensures that any special characters in `@broker.name` are converted to HTML entities. This is crucial for preventing Cross-Site Scripting (XSS) attacks, where an attacker could ... | 36,489 | [
{
"from": "human",
"value": "When I generate a default scaffold, the display tags on show.html.erb have\n<%=h @broker.name %>\n\nI know the difference between <% and <%=. What's the \"h\" do?\n"
},
{
"from": "gpt",
"value": "In Ruby on Rails, the `h` method is a helper method used to escape HTM... |
I'm hacking on a simple Cocoa app to make blocks move around the screen like a video game. I need to detect key presses, but I'm not going to have text entry fields like a dialog box would have.
How do I get key presses without text controls? In particular, I need to get arrow keys.
| To detect key presses, including arrow keys, in a Cocoa application without text fields, you can implement key event handling in your view or window. Here's how you can do this:
1. **Subclass NSView**: Create a custom view class that will handle the key events.
2. **Override `acceptsFirstResponder`**: Return `YES` in... | 33,581 | [
{
"from": "human",
"value": "I'm hacking on a simple Cocoa app to make blocks move around the screen like a video game. I need to detect key presses, but I'm not going to have text entry fields like a dialog box would have.\nHow do I get key presses without text controls? In particular, I need to get arro... |
Recently I wrote an extremely basic Java Swing program with a couple of text fields and buttons. The program works fine for me on Ubuntu with Java 1.5. But when I try to run it on OSX (10.4), the main window is displayed correctly but the program seems unresponsive. Nothing seems to happen, no matter which button I cli... | It sounds like you might be encountering an issue related to the Event Dispatch Thread (EDT) in Java Swing. In Swing, all updates to the GUI (Graphical User Interface) should be done on the EDT to ensure thread safety. If you are performing long-running tasks or blocking operations on the EDT, it can cause the GUI to b... | 31,368 | [
{
"from": "human",
"value": "Recently I wrote an extremely basic Java Swing program with a couple of text fields and buttons. The program works fine for me on Ubuntu with Java 1.5. But when I try to run it on OSX (10.4), the main window is displayed correctly but the program seems unresponsive. Nothing seem... |
Is there an outlining setting to disable 'collapsing to definition' of comments in Visual Studio 2005?
| In Visual Studio 2005, there is no specific setting to disable the collapsing of comments in the outlining feature. The outlining feature, which allows code folding, treats comments as part of the code structure, and thus it can collapse them along with other blocks of code.
However, if you want to avoid comments from... | 36,961 | [
{
"from": "human",
"value": "Is there an outlining setting to disable 'collapsing to definition' of comments in Visual Studio 2005?\n"
},
{
"from": "gpt",
"value": "In Visual Studio 2005, there is no specific setting to disable the collapsing of comments in the outlining feature. The outlining f... |
Does anyone have sample code to copy open (in-use and locked by another program) files using Volume Shadow Copy Service (VSS) API?
There was an article about this in The Delphi Magazine (September 2005). But that code is no longer available and even if it was, it's not current.
I am looking for sample code that works w... | Using the Volume Shadow Copy Service (VSS) API in Delphi to copy open and locked files can be quite involved, but I can guide you through a sample implementation. Here's a simplified example that demonstrates how to use VSS in Delphi.
### Step-by-Step Guide
1. **Ensure you have the necessary libraries**: VSS is part ... | 35,178 | [
{
"from": "human",
"value": "Does anyone have sample code to copy open (in-use and locked by another program) files using Volume Shadow Copy Service (VSS) API?\nThere was an article about this in The Delphi Magazine (September 2005). But that code is no longer available and even if it was, it's not current.... |
I'm looking for a way to configure the color used for line numbering (as in: :set nu) in Vim. The default on most platforms seems to be yellow (which is also used for some highlighted tokens). I would like to color the line numbers a dim gray; somewhere in the vicinity of #555. I'm not picky though, any subdued colo... | To configure the color of line numbers in Vim, you can set up custom highlighting for the line number and relative line number settings. Here’s how you can set the line numbers to a dim gray color like `#555`.
1. Open your Vim configuration file, typically located at `~/.vimrc`.
2. Add the following lines to set the ... | 35,518 | [
{
"from": "human",
"value": "I'm looking for a way to configure the color used for line numbering (as in: :set nu) in Vim. The default on most platforms seems to be yellow (which is also used for some highlighted tokens). I would like to color the line numbers a dim gray; somewhere in the vicinity of #555... |
A Java version of this question was just answered, and, well, I don't know how to do this in .net.
So how do you calculate the display width of a string in C# / .net?
| To calculate the display width of a string in C# / .NET, you can use the `Graphics` class to measure the string dimensions. This is particularly useful in Windows Forms applications where you have access to the drawing context. Below is an example of how to do this in a Windows Forms application:
### Example Code:
1.... | 32,485 | [
{
"from": "human",
"value": "A Java version of this question was just answered, and, well, I don't know how to do this in .net. \nSo how do you calculate the display width of a string in C# / .net?\n"
},
{
"from": "gpt",
"value": "To calculate the display width of a string in C# / .NET, you can ... |
PostgreSQL allows the creation of 'Partial Indexes' which are basically indexes with conditional predicates. http://www.postgresql.org/docs/8.2/static/indexes-partial.html
While testing, I found that they are performing very well for a case where the query is accessing only certain 12 rows in a table with 120k rows.
... | Partial indexes in PostgreSQL can indeed provide significant performance benefits for queries that only access a subset of rows, as they allow for a more efficient indexing strategy. However, there are some potential disadvantages and caveats to consider before deploying them:
1. **Maintenance Overhead**: Like any ind... | 34,810 | [
{
"from": "human",
"value": "PostgreSQL allows the creation of 'Partial Indexes' which are basically indexes with conditional predicates. http://www.postgresql.org/docs/8.2/static/indexes-partial.html \nWhile testing, I found that they are performing very well for a case where the query is accessing only ce... |
I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:
You can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.
We check these in to SVN. The developers can pass... | To run a `.launch` file outside of the IDE in a way that integrates with your build server while preserving the ability to use integrated debugging, you can consider the following approaches:
### 1. Use Eclipse Headless Mode
Eclipse provides a headless mode that allows you to run certain tasks without launching the fu... | 31,723 | [
{
"from": "human",
"value": "I'm finding it difficult to phrase this question well, as there are quite a few generic terms (run, configuration, launch, etc.). Here goes:\nYou can save run configurations in a .launch file. (in the Run Configuration Dialog, under the Common tab, Save as a shared file.\nWe che... |
The jQuery documentation says the library has built-in support for the following events: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and error.
I need to handle cut, copy, and pa... | To handle cut, copy, and paste events in jQuery, you can use the `cut`, `copy`, and `paste` events directly. These events are supported in modern browsers, including those based on WebKit.
Here’s a simple example of how you can set up event handlers for these events using jQuery:
```html
<!DOCTYPE html>
<html lang="e... | 35,496 | [
{
"from": "human",
"value": "The jQuery documentation says the library has built-in support for the following events: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, and ... |
every time i create a FileInfo object and access it's lastaccesstime property, it's always a few minutes off. the file property window remains constant, however the application shows that it is usually a few minutes after the property window time.
Also, i noticed that if i drag the file to the cmd window to pass the fi... | The behavior you are observing regarding the `LastAccessTime` property in the `FileInfo` object can be attributed to several factors:
### 1. **File System Caching and Delay in Updates**
- The filesystem may cache the last access time for performance reasons. This means that when you access the `LastAccessTime` prop... | 30,383 | [
{
"from": "human",
"value": "every time i create a FileInfo object and access it's lastaccesstime property, it's always a few minutes off. the file property window remains constant, however the application shows that it is usually a few minutes after the property window time.\nAlso, i noticed that if i drag... |
I had a VBA project in outlook with a few email macros - but after a PC crash they are all gone and all I see is a fresh 'Project1' when I hit Alt+F11
I'm not a VBA programmer, but had a collection of handy macros for email sorting etc. I would not like to have to code them again. Anyone know where the code files shoul... | I'm sorry to hear about your PC crash. VBA macros in Outlook are stored within the Outlook application itself and not as separate files on the filesystem. Unfortunately, if the Outlook profile or application data was lost during the crash and not backed up, there is a high likelihood that the macros have been lost as w... | 31,908 | [
{
"from": "human",
"value": "I had a VBA project in outlook with a few email macros - but after a PC crash they are all gone and all I see is a fresh 'Project1' when I hit Alt+F11\nI'm not a VBA programmer, but had a collection of handy macros for email sorting etc. I would not like to have to code them aga... |
I am kinda repeating this question bit the 1st time it was asked incorrectly.
I have this:
<xsd:complexType name="A">
<xsd:sequence>
<xsd:element name="options" type="options"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="B">
<xsd:complexContent>
<xsd:element... | The issue you're encountering is related to the way XML Schema (XSD) handles element names and types, especially in the context of inheritance and extension. When you define the element `options` in both complex types `A` and `B`, the XML Schema treats these as separate and distinct elements, even if `B` is supposed to... | 33,739 | [
{
"from": "human",
"value": "I am kinda repeating this question bit the 1st time it was asked incorrectly.\nI have this:\n<xsd:complexType name=\"A\">\n <xsd:sequence>\n <xsd:element name=\"options\" type=\"options\"/>\n </xsd:sequence>\n</xsd:complexType>\n\n<xsd:complexType name=\... |
We have SQL Server database setup. We are setting up a replication scenarios where we have one publisher and on subscriber. The subscriber will be used as a reporting platform so that we can run all the BI queries that we need and have to hit the server that is reciving all the data from our clients. The subscriber i... | Hi Paul,
Setting up a SQL Server replication scenario like the one you described is indeed possible and can be effective for your reporting needs. Let's address your questions one by one:
### a) Will SQL Server allow this scenario, noting that no changes on the subscriber are pushed back to the publisher?
Yes, SQL Se... | 35,031 | [
{
"from": "human",
"value": "We have SQL Server database setup. We are setting up a replication scenarios where we have one publisher and on subscriber. The subscriber will be used as a reporting platform so that we can run all the BI queries that we need and have to hit the server that is reciving all th... |
I want to add items in a LaTeX-document. Say for example, that I want add hints to the document. I create a command, so I can call something similar to this:
\hint{foocareful}{Be careful with foo!}{foo is a very precious item and can easily be broken. Be careful, especially don't throw foo.}
This will be formatted in ... | To automate the creation of a hint system in LaTeX, you can define a new command that will not only format your hints but also register them for later referencing in an appendix. To do this, we will use the `\newcommand` feature to create a custom command for hints, and we will store the hint information in a list that... | 32,656 | [
{
"from": "human",
"value": "I want to add items in a LaTeX-document. Say for example, that I want add hints to the document. I create a command, so I can call something similar to this:\n\\hint{foocareful}{Be careful with foo!}{foo is a very precious item and can easily be broken. Be careful, especially do... |
ASP.Net 3.5 running under IIS 7 doesn't seem to allow this out of the box.
if (!EventLog.SourceExists("MyAppLog"))
EventLog.CreateEventSource("MyAppLog", "Application");
EventLog myLog = new EventLog();
myLog.Source = "MyAppLog";
myLog.WriteEntry("Message");
| When running an ASP.NET application under IIS, there are a few considerations regarding the use of event logs, particularly when creating an event source. The issue you're facing may arise from insufficient permissions for the application pool user that IIS is using.
### Key Points to Consider:
1. **Permissions**: Th... | 33,569 | [
{
"from": "human",
"value": "ASP.Net 3.5 running under IIS 7 doesn't seem to allow this out of the box.\n if (!EventLog.SourceExists(\"MyAppLog\"))\n EventLog.CreateEventSource(\"MyAppLog\", \"Application\");\n\n EventLog myLog = new EventLog();\n myLog.Source = \"MyAppLog\";... |
I'm trying to log users out when the user's session timeout happens. Logging users out - in my case - requires modifying the user's "online" status in a database.
I was thinking that I might be able to use the observer pattern to make something that would monitor the state of the user session and trigger a callback wh... | To handle user session timeouts and update their "online" status appropriately, using a combination of session management and some kind of polling mechanism is a solid approach. Here are a few strategies you can consider:
### 1. **Session Management with Database Updates**
Using PHP sessions, you typically don't have... | 30,271 | [
{
"from": "human",
"value": "I'm trying to log users out when the user's session timeout happens. Logging users out - in my case - requires modifying the user's \"online\" status in a database.\nI was thinking that I might be able to use the observer pattern to make something that would monitor the state o... |
I have an AIR app with an <mx:HTML> component, which renders a page that includes an HTML/Javascript based WYSIWYG/rich-text editor. Various keyboard shortcuts are assigned for formatting and what have you, but if I type a shortcut which isn't assigned (eg cmd or [ctrl on Windows] + M), the character is entered as if n... | To handle the scenario where you want to intercept certain keyboard shortcuts in an Adobe AIR application with an `<mx:HTML>` component, you'll need to manage keyboard events in such a way that you can determine when a modifier key is pressed, but the corresponding action is not assigned. This way, you can prevent the ... | 31,386 | [
{
"from": "human",
"value": "I have an AIR app with an <mx:HTML> component, which renders a page that includes an HTML/Javascript based WYSIWYG/rich-text editor. Various keyboard shortcuts are assigned for formatting and what have you, but if I type a shortcut which isn't assigned (eg cmd or [ctrl on Window... |
On a particular Debian server, iostat (and similar) report an unexpectedly high volume (in bytes) of disk writes going on. I am having trouble working out which process is doing these writes.
Two interesting points:
Tried turning off system services one at a time to no avail. Disk activity remains fairly constant an... | When dealing with unexpectedly high disk write activity on a Debian server, especially when you've ruled out user-space processes, there are several steps you can take to investigate further. Here are some approaches to help you identify the source of the disk writes:
### 1. **Use `iotop` to Monitor Disk I/O by Proces... | 29,853 | [
{
"from": "human",
"value": "On a particular Debian server, iostat (and similar) report an unexpectedly high volume (in bytes) of disk writes going on. I am having trouble working out which process is doing these writes.\nTwo interesting points:\n\nTried turning off system services one at a time to no avai... |
I've got the equivalent of an AST that a user has built using a rule engine. But when displaying a list of the rules, I'd like to be able to "pretty print" each rule into something that looks nice**. Internally when represented as a string they look like s-expressions so imagine something like:
(and (contains "foo" "... | There are several approaches to pretty-printing expressions like the one you provided, especially in the context of rule engines and ASTs. While specific implementations will depend on your programming language and environment, here are some ideas and libraries that have successfully tackled this problem.
### 1. **Us... | 35,250 | [
{
"from": "human",
"value": "I've got the equivalent of an AST that a user has built using a rule engine. But when displaying a list of the rules, I'd like to be able to \"pretty print\" each rule into something that looks nice**. Internally when represented as a string they look like s-expressions so ima... |
I need to be able to receive a fax in a java application. I was wondering what are some ways of doing this. Efax? Use a fax to email provider?
| Receiving a fax in a Java application can be achieved through several methods, especially with the prevalence of digital solutions such as e-fax services and fax-to-email providers. Here are some approaches you can consider:
### 1. **Using eFax Services**
eFax services allow you to send and receive faxes electronicall... | 28,410 | [
{
"from": "human",
"value": "I need to be able to receive a fax in a java application. I was wondering what are some ways of doing this. Efax? Use a fax to email provider?\n"
},
{
"from": "gpt",
"value": "Receiving a fax in a Java application can be achieved through several methods, especiall... |
I am creating a Control Template for the Button control in Silverlight 2. I started with an empty template and added the visual elements I wanted. The main visual element is just a path (shape) filled with a color. The button control already has a Color property associated with it and I was wondering if it was possi... | In Silverlight 2, you can indeed bind the properties of elements in your ControlTemplate to properties of the control itself. To link the `Color` property of your `Button` control with the `Fill` property of a `Path` element in your ControlTemplate, you can use data binding in XAML.
Here is how you can achieve that by... | 35,233 | [
{
"from": "human",
"value": "I am creating a Control Template for the Button control in Silverlight 2. I started with an empty template and added the visual elements I wanted. The main visual element is just a path (shape) filled with a color. The button control already has a Color property associated wi... |
I'm hoping that someone has found a way of doing this already or that there is a library already in existence. It's one of those things that would be nice but is in no way necessary for the time being.
The functionality I'm looking for is something like datejs in reverse.
Thanks,
Simon.
Thanks, using something like th... | Hi Simon,
It sounds like you're looking for a way to format or display timestamped versions of a document in a user-friendly manner, especially when they are clustered closely together. While there are many libraries for date formatting, the reverse functionality—converting timestamp data into a more human-readable fo... | 34,289 | [
{
"from": "human",
"value": "I'm hoping that someone has found a way of doing this already or that there is a library already in existence. It's one of those things that would be nice but is in no way necessary for the time being.\nThe functionality I'm looking for is something like datejs in reverse.\nThan... |
I would like to do something like the following but can't seem to get the syntax for the Do method quite right.
var sqr = new _mocks.CreateRenderer<ShapeRenderer>();
Expect.Call(sqr.CanRender(null)).IgnoreArguments().Do(x =>x.GetType() == typeof(Square)).Repeat.Any();
So basically, I would like to set up the sqr.CanRe... | It looks like you're using a mocking framework (possibly Rhino Mocks or a similar one) to set up expectations for your `ShapeRenderer`. In the context you've provided, it seems like you want to define a behavior for the `CanRender` method based on the type of the input argument.
The approach you're trying to use with ... | 35,879 | [
{
"from": "human",
"value": "I would like to do something like the following but can't seem to get the syntax for the Do method quite right.\nvar sqr = new _mocks.CreateRenderer<ShapeRenderer>();\nExpect.Call(sqr.CanRender(null)).IgnoreArguments().Do(x =>x.GetType() == typeof(Square)).Repeat.Any();\n\nSo ba... |
I have a SQL database (SQL Server 2008) which contains the following design
ITEM
ID (Int, Identity)
Name (NVarChar(50))
Description (NVarChar(200))
META
ID (Int, Identity)
Name (NVarChar(50))
There exists a N-N relationship between these two, i.e an Item can contain zero or more meta references and a meta can be as... | Yes, it is possible to achieve the filtering you want using LINQ to SQL. Your requirements involve matching items that have all specified meta tags associated with them while allowing for additional meta tags. Here's how you can structure your LINQ query to meet these requirements:
### Steps:
1. **Create a list of th... | 33,629 | [
{
"from": "human",
"value": "I have a SQL database (SQL Server 2008) which contains the following design\nITEM\n\nID (Int, Identity)\nName (NVarChar(50))\nDescription (NVarChar(200))\n\nMETA\n\nID (Int, Identity)\nName (NVarChar(50))\n\nThere exists a N-N relationship between these two, i.e an Item can cont... |
When installing one of JRuby's frequent upgrades, I need to re-install my gems, as they normally reside in the jruby install directory.
I know it doesn't have to be this way. Could someone post some instructions or point to a web page on how to avoid this?
Keep in mind, I'm not wanting to share gems with a C-Ruby inst... | To avoid having to reinstall your gems every time you upgrade JRuby, you can configure JRuby to use a shared gem directory. This way, you can maintain a common location for gems that multiple JRuby installations can access. Here’s how to do it:
### Steps to Share Gems Between JRuby Installations
1. **Choose a Shared ... | 34,550 | [
{
"from": "human",
"value": "When installing one of JRuby's frequent upgrades, I need to re-install my gems, as they normally reside in the jruby install directory.\nI know it doesn't have to be this way. Could someone post some instructions or point to a web page on how to avoid this?\nKeep in mind, I'm n... |
I'm trying to hide the "Title" field in a list.
This doesn't seem to work:
SPList myList;
...
SPField titleField = myList.Fields.GetField("Title");
//titleField.PushChangesToLists = true; <-- doesn't seem to make a difference
titleField.ShowInEditForm = false;
titleField.ShowInDisplayForm = false;
titleField.ShowInNewF... | To hide the "Title" field in a SharePoint list, you should ensure you are making the right modifications to the field properties and have the correct permissions to perform those actions. However, it's essential to know that in some cases, merely hiding the field from forms does not remove it from the list entirely, es... | 34,655 | [
{
"from": "human",
"value": "I'm trying to hide the \"Title\" field in a list.\nThis doesn't seem to work:\nSPList myList;\n...\nSPField titleField = myList.Fields.GetField(\"Title\");\n//titleField.PushChangesToLists = true; <-- doesn't seem to make a difference\ntitleField.ShowInEditForm = false;\ntitleFi... |
I know that it is possible to check how much physical RAM is installed using GetPhysicallyInstalledSystemMemory or how much ram the operating system can see using GlobalMemoryStatusEx. However, I am wondering if there is any way to check how much ram a user has installed by slot. That is, to be able to programmatical... | To check the amount of RAM installed in each memory slot on a Windows system without using .NET, you can use the Windows Management Instrumentation (WMI) through native API calls or command-line tools. Below are a couple of methods to achieve this.
### Method 1: Using WMIC
The Windows Management Instrumentation Comma... | 24,063 | [
{
"from": "human",
"value": "I know that it is possible to check how much physical RAM is installed using GetPhysicallyInstalledSystemMemory or how much ram the operating system can see using GlobalMemoryStatusEx. However, I am wondering if there is any way to check how much ram a user has installed by slo... |
I have two models, Article and Post that both inherit from a base model called ContentBase.
You can leave comments on both Articles and Posts, so I am using a Polymorphic Association between Comments and Article or Post.
However, since both Article and Post inherit from ContentBase, the commentable_type field ends up b... | To resolve the issue you're facing with polymorphic associations and STI (Single Table Inheritance), you can explicitly set the `commentable_type` when defining your associations in the `Article` and `Post` models. Here's how to do that:
### Adjusting the Article and Post Models
You can override the `commentable_type... | 28,059 | [
{
"from": "human",
"value": "I have two models, Article and Post that both inherit from a base model called ContentBase.\nYou can leave comments on both Articles and Posts, so I am using a Polymorphic Association between Comments and Article or Post.\nHowever, since both Article and Post inherit from Conten... |
I am trying to create a search page with MySQL fulltext.
I have a search page with a textbox:
< FORM NAME ="form1" METHOD ="POST" ACTION ="catalog.php?action=<?php echo $title; ?>">
I pass the user's input to another webpage (catalog.php) which runs the query:
"SELECT * FROM books WHERE MATCH (title) AGAINST (???)"
W... | To utilize the MySQL full-text search with the `MATCH ... AGAINST` syntax, you need to pass the user input safely to avoid SQL injection and ensure that the search works as expected. Here’s a step-by-step guide on how to implement this in your `catalog.php` file.
### 1. User Input Handling
First, ensure that you're re... | 32,843 | [
{
"from": "human",
"value": "I am trying to create a search page with MySQL fulltext.\nI have a search page with a textbox:\n< FORM NAME =\"form1\" METHOD =\"POST\" ACTION =\"catalog.php?action=<?php echo $title; ?>\">\n\nI pass the user's input to another webpage (catalog.php) which runs the query:\n\"SELE... |
I am using the jQuery validation plugin. Great stuff! I want to migrate my existing ASP.NET solution to use jQuery instead of the ASP.NET validators. I am missing a replacement for the regular expression validator. I want to be able to do something like this:
$("Textbox").rules("add", { regularExpression: "^[a-zA-Z'.\s... | To add a custom validation rule in jQuery Validation plugin, you can extend the validator with a new method. In your case, you want to create a custom rule for validating a regular expression. Here’s how you can do that:
1. Define the custom rule using `$.validator.addMethod()`.
2. Add the rule to the element using `.... | 34,292 | [
{
"from": "human",
"value": "I am using the jQuery validation plugin. Great stuff! I want to migrate my existing ASP.NET solution to use jQuery instead of the ASP.NET validators. I am missing a replacement for the regular expression validator. I want to be able to do something like this:\n$(\"Textbox\").rul... |
From a Java program, I need to launch the default browser on a local HTML file, pointed to an anchor inside the file. In Java SE 6, the java.awt.Desktop.browse method will open the file, but will not honor the anchor, so something like the following opens the file at the top, but does not page the browser to the ancho... | If you're restricted to Java SE 6 and you want to open a local HTML file in the default browser and navigate to a specific anchor, one workaround is to use a temporary HTTP server to serve the file instead of accessing it directly from the file system. This way, you can use a `http` URL to access the file, which should... | 34,454 | [
{
"from": "human",
"value": "From a Java program, I need to launch the default browser on a local HTML file, pointed to an anchor inside the file. In Java SE 6, the java.awt.Desktop.browse method will open the file, but will not honor the anchor, so something like the following opens the file at the top, b... |
In particular, would it be possible to have code similar to this c++ code executed at compile time in c#?
template <int N>
struct Factorial
{
enum { value = N * Factorial<N - 1>::value };
};
template <>
struct Factorial<0>
{
enum { value = 1 };
};
// Factorial<4>::value == 24
// Factorial<0>::value == 1
voi... | In C#, you don't have templates in the same way C++ does, but you can achieve similar functionality using static classes, generics, and compile-time constants. While you cannot perform metaprogramming to the same extent as in C++, you can calculate factorials at compile time in C# using static members. Here’s a way to ... | 35,537 | [
{
"from": "human",
"value": "In particular, would it be possible to have code similar to this c++ code executed at compile time in c#?\ntemplate <int N>\nstruct Factorial \n{\n enum { value = N * Factorial<N - 1>::value };\n};\n\ntemplate <>\nstruct Factorial<0> \n{\n enum { value = 1 };\n};\n\n// Fac... |
I’m trying to implement a dictionary for use with WCF. My requirements are:
actual (private variable or base
class) type equivalent to
Dictionary
Comparer
= System.StringComparer.InvariantCultureIgnoreCase
Custom (override/new) Add(key,
value) method (to include
validations).
Override ToString()
Use of the same t... | Implementing a custom dictionary that meets the requirements for use with WCF involves some challenges due to how WCF handles serialization and deserialization of types, especially when using generic collections like `Dictionary<TKey, TValue>`. Here are a few steps you can follow to ensure your custom dictionary works ... | 29,551 | [
{
"from": "human",
"value": "I’m trying to implement a dictionary for use with WCF. My requirements are:\n\nactual (private variable or base\nclass) type equivalent to\nDictionary \nComparer\n= System.StringComparer.InvariantCultureIgnoreCase\nCustom (override/new) Add(key,\nvalue) method (to include\nval... |
Is there way in next piece of code to only get the first record?
Dal.TreeHtmlExportsCollection treeHtmlExportsCollection =
new Dal.TreeHtmlExportsCollection().Where(Dal.TreeHtmlExports.Columns.TreeId, treeId).
OrderByDesc(Dal.TreeHtmlExports.Columns.DateCreated).Load();
| Yes, you can modify your code to retrieve only the first record from the `TreeHtmlExportsCollection`. Assuming the collection supports limiting the results, you can use a method to take just the first record after loading the collection. If your data access library supports LINQ, you could use `FirstOrDefault()` to ach... | 36,361 | [
{
"from": "human",
"value": "Is there way in next piece of code to only get the first record?\nDal.TreeHtmlExportsCollection treeHtmlExportsCollection =\n new Dal.TreeHtmlExportsCollection().Where(Dal.TreeHtmlExports.Columns.TreeId, treeId).\n OrderByDesc(Dal.TreeHtmlExports.Columns.DateCreated).Load();\n... |
I am working on an automated testing app, and am currently in the process of writing a function that compares values between two XML files that should be identical, but may not be. Here is a sample of the XML I'm trying to process:
<?xml version="1.0" encoding="utf-8"?>
<report xmlns="http://www.**.com/**">
<subrepo... | It looks like you're on the right track but facing an issue with the XPath expression. Since your XML contains a namespace (`xmlns="http://www.**.com/**"`), this namespace needs to be considered when writing your XPath queries. XPath expressions are sensitive to namespaces, and unless you account for the namespace, the... | 33,056 | [
{
"from": "human",
"value": "I am working on an automated testing app, and am currently in the process of writing a function that compares values between two XML files that should be identical, but may not be. Here is a sample of the XML I'm trying to process:\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<... |
Need to an expression that returns only things with an "I" followed by either a "J" or a "V" (No Quotes) and then a minimum of 1 number up to 3 numbers.
I J###
I V###
I J##
I V##
I J#
I v#
| To create an expression that matches the specified patterns, you can use the following regular expression (regex):
```
I [JjVv]\d{1,3}
```
Here's a breakdown of the regex:
- `I` - Matches the literal character "I".
- `[JjVv]` - Matches either "J" or "V", case insensitive (it matches "J", "j", "V", or "v").
- `\d{1,3... | 36,379 | [
{
"from": "human",
"value": "Need to an expression that returns only things with an \"I\" followed by either a \"J\" or a \"V\" (No Quotes) and then a minimum of 1 number up to 3 numbers.\nI J### \nI V### \nI J## \nI V## \nI J# \nI v# \n"
},
{
"from": "gpt",
"value": "To create an expression tha... |
I'm experimenting with WCF Services, and have come across a problem with passing Interfaces.
This works:
[ServiceContract]
public interface IHomeService
{
[OperationContract]
string GetString();
}
but this doesn't:
[ServiceContract]
public interface IHomeService
{
[OperationContract]
IDevice GetInterfa... | The issue you're encountering relates to how WCF (Windows Communication Foundation) handles data contracts and types. When you expose a service interface that returns an interface (like `IDevice`), WCF doesn't know how to serialize or deserialize that interface across the service boundary because it needs a concrete ty... | 36,567 | [
{
"from": "human",
"value": "I'm experimenting with WCF Services, and have come across a problem with passing Interfaces.\nThis works:\n[ServiceContract]\npublic interface IHomeService\n{\n [OperationContract]\n string GetString();\n}\n\nbut this doesn't:\n[ServiceContract]\npublic interface IHomeServ... |
I'm not the best at PHP and would be extremely grateful if somebody could help. Basically I need to parse each line of a datafeed and just get each bit of information between each "|" - then I can add it to a database. I think I can handle getting the information from between the "|"'s by using explode but I need a bit... | Sure! To parse a multiline string and extract each piece of information between the pipe (`|`) characters, you can indeed use `explode()`. Here's a simple example of how to do this in PHP. This code assumes you're submitting data through a form using a `textarea`.
### Step-by-Step Solution
1. **Create a Form with a T... | 33,079 | [
{
"from": "human",
"value": "I'm not the best at PHP and would be extremely grateful if somebody could help. Basically I need to parse each line of a datafeed and just get each bit of information between each \"|\" - then I can add it to a database. I think I can handle getting the information from between ... |
In my current 32-bit application, I check (very occasionally) for overflow by doing operations on 64-bit integers.
However, on 64-bit systems there does not seem to be a standard 128-bit integer. Is there a simple way of checking for overflow, or a way of getting 128-bit integers, which works on all OSes and compilers?... | If you're looking for a way to perform arithmetic operations that could potentially overflow a 64-bit integer without the overhead of libraries like GMP, there are a few strategies you can employ to effectively manage larger values. While C/C++ does not have a built-in 128-bit integer type in the standard, you can emul... | 32,308 | [
{
"from": "human",
"value": "In my current 32-bit application, I check (very occasionally) for overflow by doing operations on 64-bit integers.\nHowever, on 64-bit systems there does not seem to be a standard 128-bit integer. Is there a simple way of checking for overflow, or a way of getting 128-bit intege... |
I'm trying to install RSpec as a gem after having it installed as a plugin. I've gone ahead and followed the directions found here http://github.com/dchelimsky/rspec-rails/wikis for the section titled rspec and rspec-rails gems. When I run ruby script/generate rspec, I get the error Couldn't find 'rspec' generator. ... | It looks like you're trying to use the RSpec gem with an older version of Rails (2.1.2), and you're encountering an issue with the generator not being found. Here are a few troubleshooting steps and tips to help you resolve this issue:
1. **Ensure Gems Are Installed Properly**: Double-check that you have both `rspec` ... | 34,667 | [
{
"from": "human",
"value": "I'm trying to install RSpec as a gem after having it installed as a plugin. I've gone ahead and followed the directions found here http://github.com/dchelimsky/rspec-rails/wikis for the section titled rspec and rspec-rails gems. When I run ruby script/generate rspec, I get the... |
Hello I've just upgraded icefaces 1.7.1 to 1.7.2 and started to get javax.faces.application.ViewExpiredException exceptions after clicking twice on the same link.
I'm using JBoss Seam 2.0.2 and I suppose that it is some stupid mistake I've made during upgrade but I can't figure out what. I've just replaced three jars w... | When you upgrade libraries like ICEfaces, especially in a complex environment like JBoss Seam, there are a few considerations and steps that you should take into account to address issues like the `javax.faces.application.ViewExpiredException`. Here are some potential areas to investigate and steps to troubleshoot the ... | 33,652 | [
{
"from": "human",
"value": "Hello I've just upgraded icefaces 1.7.1 to 1.7.2 and started to get javax.faces.application.ViewExpiredException exceptions after clicking twice on the same link.\nI'm using JBoss Seam 2.0.2 and I suppose that it is some stupid mistake I've made during upgrade but I can't figure... |
I write a singleton c++ in the follow way:
class A {
private:
static A* m_pA;
A();
virtual ~A();
public:
static A* GetInstance();
static void FreeInstance();
void WORK1();
void WORK2();
void WORK3();
}
}
A* A::GetInstance() {
if (m_pA ==... | Your initial implementation of the singleton pattern in C++ has several issues, particularly with resource management and thread safety. Below, I will outline some of the problems with your first implementation and then suggest an improved version of the singleton pattern.
### Issues with Initial Implementation
1. **... | 31,551 | [
{
"from": "human",
"value": "I write a singleton c++ in the follow way:\nclass A {\n private:\n static A* m_pA;\n A();\n virtual ~A();\n\n public:\n static A* GetInstance();\n static void FreeInstance();\n\n void WORK1();\n void WORK2();\n void W... |
I'm just wondering if the same thread is used for each session, or if its dangerous to count on a particular thread between requests. What I'm getting at, is can I use thread static storage?
| In web applications, especially in environments like web servers or frameworks that handle multiple requests (such as a typical HTTP server), the threading model can vary based on the server and the architecture being used.
### Thread Safety and Static Storage:
1. **Thread Pooling**: Most web servers use a pool of th... | 33,414 | [
{
"from": "human",
"value": "I'm just wondering if the same thread is used for each session, or if its dangerous to count on a particular thread between requests. What I'm getting at, is can I use thread static storage?\n"
},
{
"from": "gpt",
"value": "In web applications, especially in environm... |
I'm currently running into some issues resizing images using GD.
Everything works fine until i want to resize an animated gif, which delivers the first frame on a black background.
I've tried using getimagesize but that only gives me dimensions and nothing to distinguish between just any gif and an animated one.
Actual... | Hi Kris,
If you want to skip animated GIFs while resizing images using the GD library in PHP, you can check if a GIF is animated by inspecting its binary content. Animated GIFs typically have multiple frames, which you can detect by looking for the "NETSCAPE" extension that is added to animated GIFs.
Here's a simple ... | 33,659 | [
{
"from": "human",
"value": "I'm currently running into some issues resizing images using GD.\nEverything works fine until i want to resize an animated gif, which delivers the first frame on a black background.\nI've tried using getimagesize but that only gives me dimensions and nothing to distinguish betwe... |
Is there really that much of a difference between the performance of Vector and ArrayList? Is it good practice to use ArrayLists at all times when thread safety isn't an issue?
| Yes, there are significant differences between `Vector` and `ArrayList` in Java, particularly in terms of performance and design. Here are some of the key differences:
1. **Synchronization**:
- `Vector` is synchronized, meaning it is thread-safe and can be used in concurrent applications without additional synchro... | 34,457 | [
{
"from": "human",
"value": "Is there really that much of a difference between the performance of Vector and ArrayList? Is it good practice to use ArrayLists at all times when thread safety isn't an issue?\n"
},
{
"from": "gpt",
"value": "Yes, there are significant differences between `Vector` ... |
What's the best way to get a nice clean URL structure like stack overflow has?
Do I need to use IIS for this? Or is there a way I can do it with some sort of mapping file in asp .net?
The site I want this for has hundreds of pages, and is already deployed.
I would like a method that requires the least amount of change... | To achieve clean URLs in IIS 6.0 for your ASP.NET application without modifying existing code significantly, you can use URL rewriting. In IIS 6, there isn't built-in support for URL rewriting as you have in later versions (like with URL Rewrite module in IIS 7 and above), but you can still manage it through custom cod... | 32,844 | [
{
"from": "human",
"value": "What's the best way to get a nice clean URL structure like stack overflow has? \nDo I need to use IIS for this? Or is there a way I can do it with some sort of mapping file in asp .net?\nThe site I want this for has hundreds of pages, and is already deployed.\nI would like a met... |
Can someone explain in simple terms the "signals and slots" pattern?
| Certainly! The "signals and slots" pattern is a way to communicate between different parts of a program, particularly in user interface (UI) frameworks. It helps objects (like buttons, windows, etc.) to send messages to each other without needing to know anything about each other.
Here's a simple breakdown:
1. **Sign... | 35,823 | [
{
"from": "human",
"value": "Can someone explain in simple terms the \"signals and slots\" pattern?\n"
},
{
"from": "gpt",
"value": "Certainly! The \"signals and slots\" pattern is a way to communicate between different parts of a program, particularly in user interface (UI) frameworks. It helps... |
I have a list of about 600 jobs that I can't delete from the command line because they are attached to changelists. The only way I know how to detach them is via the GUI, but that would take forever. Does anyone know a better (i.e., faster) way?
| If you're dealing with a large number of jobs attached to changelists that you want to detach, doing it through the GUI can indeed be time-consuming. Fortunately, if you're using a version control system like Perforce (as implied by the terms you've used), you can detach jobs from changelists using command-line command... | 32,655 | [
{
"from": "human",
"value": "I have a list of about 600 jobs that I can't delete from the command line because they are attached to changelists. The only way I know how to detach them is via the GUI, but that would take forever. Does anyone know a better (i.e., faster) way?\n"
},
{
"from": "gpt",
... |
Currently i have this method:
static boolean checkDecimalPlaces(double d, int decimalPlaces){
if (d==0) return true;
double multiplier = Math.pow(10, decimalPlaces);
double check = d * multiplier;
check = Math.round(check);
check = check/multiplier;
return (d==check);
}
But thi... | Your implementation for checking the number of decimal places in a `double` value has evolved well through iterations. Given the limitations of floating-point arithmetic and the inherent issues with the representation of decimal values in binary format, the approach using `BigDecimal` is indeed a sound choice. Here’s a... | 32,978 | [
{
"from": "human",
"value": "Currently i have this method:\nstatic boolean checkDecimalPlaces(double d, int decimalPlaces){\n if (d==0) return true;\n\n double multiplier = Math.pow(10, decimalPlaces); \n double check = d * multiplier;\n check = Math.round(check); \n check = check/mult... |
I've got a strange problem with SQL Server 2000, and I just can't think of a reason for this to happen.
There are two tables, both having a combined primary key with a clustered index on it, both keys have the same structure:
(VARCHAR(11), INT, DATETIME) /* can't change this, so don't suggest I should */
So, joining... | This is indeed a fascinating scenario you're facing with SQL Server 2000, and your observations bring up several important points about how SQL Server handles data types, joins, and execution plans.
### 1. Understanding the "NO JOIN PREDICATE" Warning
The "NO JOIN PREDICATE" warning indicates that the query optimizer... | 35,180 | [
{
"from": "human",
"value": "I've got a strange problem with SQL Server 2000, and I just can't think of a reason for this to happen.\nThere are two tables, both having a combined primary key with a clustered index on it, both keys have the same structure:\n(VARCHAR(11), INT, DATETIME) /* can't change this... |
I'm currently looking for a possibility in Java to identify a font as symbolic like OpenOffice does.
Characters with the font Windings or Webdings and so on should be rendered with the correct "pictures".
Anyone an idea how to distinguish between normal fonts and fonts with symbols?
| To distinguish between normal fonts and symbolic fonts in Java, you can use the `Font` class to analyze the characters supported by a font. Fonts such as Wingdings and Webdings primarily map certain characters to symbols rather than typical alphanumeric characters. Here's a simple approach you can take:
1. **Check the... | 33,926 | [
{
"from": "human",
"value": "I'm currently looking for a possibility in Java to identify a font as symbolic like OpenOffice does.\nCharacters with the font Windings or Webdings and so on should be rendered with the correct \"pictures\".\nAnyone an idea how to distinguish between normal fonts and fonts with ... |
I have a multidimensional array. I need to search it for a specific range of values, edit those values and return the edited data.
Example array:
array(3) {
["first"]=>
array(1) {
[0]=>
string(4) "baz1"
}
["second"]=>
array(1) {
[0]=>
string(4) "foo1"
}
["third"]=>
array(1) {
[0]=>
... | To accomplish the task of searching for values that match a certain pattern in a multidimensional array and modifying them, you can use regular expressions (regex) in PHP. Given that "foo" could be any substring, you can use a pattern to find those matching strings and then append "-bar" to them.
Here's an example fun... | 33,041 | [
{
"from": "human",
"value": "I have a multidimensional array. I need to search it for a specific range of values, edit those values and return the edited data.\nExample array:\narray(3) {\n [\"first\"]=>\n array(1) {\n [0]=>\n string(4) \"baz1\"\n }\n [\"second\"]=>\n array(1) {\n [0]=>\n s... |
Does anyone know how I can get a list of products belonging to a specific category from within a view file in Magento?
| In Magento, if you want to retrieve a list of products belonging to a specific category within a view file (e.g., a `.phtml` file), you can do so by utilizing the Magento framework. Here’s a general outline of how you can achieve that.
### Steps to Retrieve Products from a Specific Category
1. **Load the Category**: ... | 33,561 | [
{
"from": "human",
"value": "Does anyone know how I can get a list of products belonging to a specific category from within a view file in Magento?\n"
},
{
"from": "gpt",
"value": "In Magento, if you want to retrieve a list of products belonging to a specific category within a view file (e.g., a... |
A while ago I had a query that I ran quite a lot for one of my users. It was still being evolved and tweaked but eventually it stablised and ran quite quickly, so we created a stored procedure from it.
So far, so normal.
The stored procedure, though, was dog slow. No material difference between the query and the proc... | Certainly! The issue you're encountering is indeed related to a well-known phenomenon in SQL Server called **parameter sniffing**. It occurs when SQL Server uses the parameter values passed to a stored procedure to create a query execution plan. If the parameter values lead to a suboptimal plan, it can lead to performa... | 31,170 | [
{
"from": "human",
"value": "A while ago I had a query that I ran quite a lot for one of my users. It was still being evolved and tweaked but eventually it stablised and ran quite quickly, so we created a stored procedure from it. \nSo far, so normal. \nThe stored procedure, though, was dog slow. No materia... |
I have an asp.net image button and I want to cancel the click event incase he fails the client side validation... how do I do that?
| To cancel the click event of an ASP.NET ImageButton based on client-side validation, you can use JavaScript to handle the button's click event. If the validation fails, you can prevent the form submission or the button's action. Here's how you can do that:
### Example ASP.NET Code
1. **Define your ASP.NET ImageButton... | 32,955 | [
{
"from": "human",
"value": "I have an asp.net image button and I want to cancel the click event incase he fails the client side validation... how do I do that?\n"
},
{
"from": "gpt",
"value": "To cancel the click event of an ASP.NET ImageButton based on client-side validation, you can use JavaS... |
I need to change a static property on an object in our web application. The property has a default value that is hard-coded into the object. If I change the static property in my Application_Start does that change stick:
A) Forever (well, until the app is recycled)
B) Until the object is GC'd then re-inialised by the... | When you change a static property on an object in your web application during the `Application_Start` method, the behavior is as follows:
### A) Forever (well, until the app is recycled)
This option is the most accurate in your context. Once the static property is modified in `Application_Start`, that value will rema... | 37,379 | [
{
"from": "human",
"value": "I need to change a static property on an object in our web application. The property has a default value that is hard-coded into the object. If I change the static property in my Application_Start does that change stick:\nA) Forever (well, until the app is recycled)\nB) Until ... |
I have a problem with Lucene.NET. During an index, I receive the error 'Access to the path segments is denied'. Or sometimes 'Access to the path deletable is denied'. I eventually gave 'Everyone' full security rights to the index directory, but the problem still existed.
I then found out that during the index run, luce... | The "Access to the path segments is denied" and similar errors you're experiencing with Lucene.NET typically indicate a permissions issue or a file locking issue. Here are a few steps you can take to diagnose and hopefully resolve the issue:
### 1. **File Locking Issues**
- **Antivirus Software**: Sometimes, antivi... | 33,408 | [
{
"from": "human",
"value": "I have a problem with Lucene.NET. During an index, I receive the error 'Access to the path segments is denied'. Or sometimes 'Access to the path deletable is denied'. I eventually gave 'Everyone' full security rights to the index directory, but the problem still existed.\nI then... |
Need to calculate a stock market portfolio based on trades in a database. The calculation I'm looking to do via SQL are average price, rate of return, portfolio value, etc.
Sample data:
Stock Shares Price Value
A 100 50 5000
A -20 60 -1200
A 50 40 2000
I haven't been... | To calculate average price, rate of return, portfolio value, etc., from your trades using SQL, you can follow a series of steps. Below, I'll outline how you can achieve this with SQL queries using your sample data.
Assuming your data is stored in a table called `trades`, here’s a way to derive the desired metrics.
##... | 30,820 | [
{
"from": "human",
"value": "Need to calculate a stock market portfolio based on trades in a database. The calculation I'm looking to do via SQL are average price, rate of return, portfolio value, etc.\nSample data:\n\nStock Shares Price Value\nA 100 50 5000\nA -20 60 -120... |
I noticed the specificaition for Collections.sort:
public static <T> void sort(List<T> list, Comparator<? super T> c)
Why is the "? super" necessary here? If ClassB extends ClassA, then wouldn't we have a guarantee that a Comparator<ClassA> would be able to compare two ClassB objects anyway, without the "? super" par... | The use of `? super T` in the `Comparator<? super T>` declaration in the method signature for `Collections.sort()` is necessary because of how generics work in Java, particularly in the context of inheritance and type compatibility.
Let’s break down what’s happening here:
1. **Generics and Inheritance**: When you hav... | 31,894 | [
{
"from": "human",
"value": "I noticed the specificaition for Collections.sort:\npublic static <T> void sort(List<T> list, Comparator<? super T> c)\n\nWhy is the \"? super\" necessary here? If ClassB extends ClassA, then wouldn't we have a guarantee that a Comparator<ClassA> would be able to compare two Cl... |
How can I open a synchronous dialog in Flex? I need to call a function from an External Interface (JavaScript) that will open a simple dialog in the Flex application and returns an value according to the button the user has clicked (OK/Cancel).
So it should by a synchronous call to a dialog, i.e. the call waits until t... | Creating a synchronous dialog in a Flex application that can be called from JavaScript through an `ExternalInterface` is a bit tricky, especially because Flex and JavaScript operate asynchronously by default. However, you can implement a mechanism that simulates synchronous behavior by using a polling approach. Here's ... | 27,814 | [
{
"from": "human",
"value": "How can I open a synchronous dialog in Flex? I need to call a function from an External Interface (JavaScript) that will open a simple dialog in the Flex application and returns an value according to the button the user has clicked (OK/Cancel).\nSo it should by a synchronous cal... |
I'm trying to simply use some of the examples and instructions regarding the YUI-Uploader, and I'm being frustrated by a number of issues.
The "YUI Library: Uploader" cheat sheet's simple use case doesn't work for me because all the listed methods except addListener() do not exist on the myUploader object.
The example... | It sounds like you encountered a number of challenges with the YUI Uploader, especially with the differences between versions 2.5.1 and 2.6.0. The YUI library has gone through many iterations, and with those updates, some methods and properties have changed. Here are some suggestions to help you and others who might fa... | 33,532 | [
{
"from": "human",
"value": "I'm trying to simply use some of the examples and instructions regarding the YUI-Uploader, and I'm being frustrated by a number of issues.\n\nThe \"YUI Library: Uploader\" cheat sheet's simple use case doesn't work for me because all the listed methods except addListener() do no... |
I have a SQL Server 2005 sp2 box where tempdb has either 8 data files or 5 data files dependingo n where you look. DBCC showfilestates and sys.database_files (both queried in tempdb) show 8 data files (tempdev - tempdev8), however when I query sys.master_files (in master db, which is also what the GUI uses), I only se... | This situation sounds quite unusual, but it can occur due to a variety of reasons, such as a failed operation when adding files to `tempdb`, or a corruption of the system catalogs. Below are answers to your questions:
### 1. How can this happen?
The discrepancy between the number of files you see in `tempdb` can be ca... | 31,878 | [
{
"from": "human",
"value": "I have a SQL Server 2005 sp2 box where tempdb has either 8 data files or 5 data files dependingo n where you look. DBCC showfilestates and sys.database_files (both queried in tempdb) show 8 data files (tempdev - tempdev8), however when I query sys.master_files (in master db, wh... |
I want to call some RESTful web services from a J2ME client running on a MIDP enabled mobile device. I read the MIDP api for HTTPConnections and thought this is just crying out for a simple wrapper to hide all those unpleasant byte arrays and such like. Before I write my own I wondered whether there was a good open sou... | For J2ME applications, especially when you're dealing with RESTful web services, the limitations of the MIDP API can indeed make handling HTTP connections cumbersome. Fortunately, there are a few libraries that can help simplify this process.
Here are a couple of options you might consider:
1. **KSOAP**: Although pri... | 36,114 | [
{
"from": "human",
"value": "I want to call some RESTful web services from a J2ME client running on a MIDP enabled mobile device. I read the MIDP api for HTTPConnections and thought this is just crying out for a simple wrapper to hide all those unpleasant byte arrays and such like. Before I write my own I w... |
I receive some arguments into a stored procedure. These arguments are NVARCHAR's.
I have a problem, when I need to cast some of these values to FLOATS, because they are being received as e.g.
@VALUE1 NVARCHAR(100)
DECLARE @ChangedValue
SET @ChangedValue = CAST(@Value1 AS FLOAT)
E.g. @Value1 = "0,001"
Gives me a problem... | Yes, you can replace commas with periods in your NVARCHAR input before casting it to FLOAT in your SQL Server stored procedure. You can use the `REPLACE` function to achieve this.
Here's how you can modify your code:
```sql
DECLARE @Value1 NVARCHAR(100);
DECLARE @ChangedValue FLOAT;
-- Sample input for demonstration... | 36,217 | [
{
"from": "human",
"value": "I receive some arguments into a stored procedure. These arguments are NVARCHAR's.\nI have a problem, when I need to cast some of these values to FLOATS, because they are being received as e.g.\n@VALUE1 NVARCHAR(100)\nDECLARE @ChangedValue\nSET @ChangedValue = CAST(@Value1 AS FLO... |
I have an ASP.net website ( http://www.erate.co.za ) version 2.0.
When someone opens my website in Firefox everything looks different.
Why is that and how can I make it compatible?
Please help!
Etienne
| When a website looks different in different browsers like Firefox compared to others (like Internet Explorer), it often boils down to various factors related to HTML/CSS rendering differences, JavaScript execution, or unsupported features in one browser versus another. Here are steps you can take to identify and resolv... | 32,613 | [
{
"from": "human",
"value": "I have an ASP.net website ( http://www.erate.co.za ) version 2.0.\nWhen someone opens my website in Firefox everything looks different.\nWhy is that and how can I make it compatible?\nPlease help!\nEtienne\n"
},
{
"from": "gpt",
"value": "When a website looks differe... |
I have a few GridItem components that gets filled with dynamic data. Sometimes this data longer than the GridItem's fixed width, causing the GridItem to get a horizontal scrollbar. How can I disable this (I'm assuming you can...)
Is there a general style that handles this for other Flex components as well?
Thanks.
| To prevent your `GridItem` components from showing a horizontal scrollbar when the content exceeds their fixed width, you can use CSS to manage the overflow. The most common approach is to set the `overflow` property to `hidden`, `scroll`, or `auto` depending on your needs. Here’s how you can achieve this:
### CSS Met... | 32,951 | [
{
"from": "human",
"value": "I have a few GridItem components that gets filled with dynamic data. Sometimes this data longer than the GridItem's fixed width, causing the GridItem to get a horizontal scrollbar. How can I disable this (I'm assuming you can...)\nIs there a general style that handles this for o... |
If you (or your organization) aspires to thoroughly unit test your code, how do you measure the success or quality of your efforts?
Do you use code coverage, what percentage do you aim for?
Do you find that philosophies like TDD have a better impact than metrics?
| Measuring the success or quality of unit testing efforts can be approached from various angles. Here are some common methods and considerations:
### 1. Code Coverage
- **Code Coverage Tools**: Tools like JaCoCo (Java), Istanbul (JavaScript), Coverage.py (Python), and others can be used to measure code coverage.
- **P... | 34,746 | [
{
"from": "human",
"value": "If you (or your organization) aspires to thoroughly unit test your code, how do you measure the success or quality of your efforts? \n\nDo you use code coverage, what percentage do you aim for? \nDo you find that philosophies like TDD have a better impact than metrics?\n\n"
}... |
I am using sphinx to do full text search on a mysql database through thinking sphinx.
I would like to highlight the matched terms in the results I show to the user.
Shpinx is smart enough that searching for 'botulism' will match "i like to inject botulinum into my eyes"
How can I get it to tell me that 'botulinum' matc... | To highlight matched terms in your results using Sphinx and Thinking Sphinx, you can leverage the features provided by Sphinx to extract matching snippets that show how the search term relates to the results.
Here are steps you can take to achieve this:
### 1. Use the `highlight` Method
When you perform a search usin... | 34,468 | [
{
"from": "human",
"value": "I am using sphinx to do full text search on a mysql database through thinking sphinx.\nI would like to highlight the matched terms in the results I show to the user.\nShpinx is smart enough that searching for 'botulism' will match \"i like to inject botulinum into my eyes\"\nHow... |
I'm trying to build a shared library (DLL) on Windows, using MSVC 6 (retro!) and I have a peculiar link issue I need to resolve. My shared library must access some global state, controlled by the loading application.
Broadly, what I have is this:
application.c:
static int g_private_value;
int use_private_value() {
... | To achieve the goal of having your shared library (`shared_library.dll`) access the `g_private_value` variable from the application while also exporting the `shared_library_method`, you'll need to consider the following:
1. **Linking the Shared Library Correctly**: In order for your shared library to link against the ... | 30,532 | [
{
"from": "human",
"value": "I'm trying to build a shared library (DLL) on Windows, using MSVC 6 (retro!) and I have a peculiar link issue I need to resolve. My shared library must access some global state, controlled by the loading application.\nBroadly, what I have is this:\napplication.c:\nstatic int g_... |
My question is a lot like this one. However I'm on MySQL and I'm looking for the "lowest tech" solution that I can find.
The situation is that I have 2 databases that should have the same data in them but they are updated primarily when they are not able to contact each other. I suspect that there is some sort of clus... | If you're looking for a "lowest tech" solution to sync data between two MySQL databases without the complexity of clustering or replication, your Federated table approach is a reasonable option, but there are indeed simpler methods you can consider.
### Suggested Solutions
1. **Scheduled Sync Script:**
- Create a ... | 33,724 | [
{
"from": "human",
"value": "My question is a lot like this one. However I'm on MySQL and I'm looking for the \"lowest tech\" solution that I can find. \nThe situation is that I have 2 databases that should have the same data in them but they are updated primarily when they are not able to contact each othe... |
How can I format data coming from a DataBinder.Eval statement in an ASPX page?
For example, I want to display the published date of the news items in a particular format in the homepage. I'm using the ASP.NET 2.0 Repeater control to show the list of news items.
The code for this goes like this:
<asp:Repeater ID="Repeat... | Yes, you can definitely format the published date using a custom method in ASP.NET Web Forms. Here's how you can do it step by step:
### 1. Define Your Formatting Method
You should define your custom method in the code-behind of your ASPX page (the `.aspx.cs` file). The method will accept the date and return it in the... | 34,956 | [
{
"from": "human",
"value": "How can I format data coming from a DataBinder.Eval statement in an ASPX page?\nFor example, I want to display the published date of the news items in a particular format in the homepage. I'm using the ASP.NET 2.0 Repeater control to show the list of news items.\nThe code for th... |
For debugging purposes, I need to recursively search a directory for all files which start with a UTF-8 byte order mark (BOM). My current solution is a simple shell script:
find -type f |
while read file
do
if [ "`head -c 3 -- "$file"`" == $'\xef\xbb\xbf' ]
then
echo "found BOM in: $file"
fi
done
Or... | Your shell script approach is a good starting point for detecting files with a UTF-8 Byte Order Mark (BOM). However, there are indeed more elegant and efficient ways to achieve the same result. Here are a few alternatives you can consider:
### Using `find` with `grep`
You can use `find` in combination with `grep` to ... | 33,174 | [
{
"from": "human",
"value": "For debugging purposes, I need to recursively search a directory for all files which start with a UTF-8 byte order mark (BOM). My current solution is a simple shell script:\nfind -type f |\nwhile read file\ndo\n if [ \"`head -c 3 -- \"$file\"`\" == $'\\xef\\xbb\\xbf' ]\n t... |
I've been working on a project called Axial that converts MSIL (compiled C# or VB.NET) to JavaScript. There are a few samples of working code, but some common situations don't work properly. (The current release doesn't work in production mode and the SVN code doesn't work in debug mode but is much cleaner.) I've heard... | Your project Axial sounds intriguing, especially given the potential to bridge the gap between C# or VB.NET and JavaScript. If the product performs well, it could indeed find a niche among developers who prefer working in .NET languages but are required to target the JavaScript environment, especially in web developmen... | 34,272 | [
{
"from": "human",
"value": "I've been working on a project called Axial that converts MSIL (compiled C# or VB.NET) to JavaScript. There are a few samples of working code, but some common situations don't work properly. (The current release doesn't work in production mode and the SVN code doesn't work in de... |
With the following code:
Dim x As System.Xml.Linq.XElement = _
<div>
<%= message.ToString() %>
</div>
Dim m = x.ToString()
...if message is HTML, then the < and > characters get converted to < and &rt;.
How can I force it to skip this encoding?
| In VB.NET, when using the `<%= %>` syntax in an ASP.NET context, it automatically encodes any HTML content to prevent XSS (Cross-Site Scripting) attacks. If you want to preserve the HTML tags (i.e., you don't want them to be encoded to `<` and `>`), you can use `XElement.Parse` and `XNode.Parse` methods to bypass... | 37,224 | [
{
"from": "human",
"value": "With the following code:\nDim x As System.Xml.Linq.XElement = _\n<div>\n<%= message.ToString() %>\n</div>\nDim m = x.ToString()\n\n...if message is HTML, then the < and > characters get converted to < and &rt;. \nHow can I force it to skip this encoding?\n"
},
{
"fro... |
Let's say I have the following code:
@sites = Site.find(session[:sites]) # will be an array of Site ids
@languages = Language.for_sites(@sites)
for_sites is a named_scope in the Language model that returns the languages associated with those sites, and languages are associated with sites using has_many through. The go... | In Rails 2.1, you can achieve the behavior you want by defining a custom method within the `Site` model that returns the associated languages. Since you're using a `has_many :through` association, you can leverage that to retrieve the associated languages directly from the `Site` instances.
Here's how you can do it:
... | 33,770 | [
{
"from": "human",
"value": "Let's say I have the following code:\n@sites = Site.find(session[:sites]) # will be an array of Site ids\n@languages = Language.for_sites(@sites)\n\nfor_sites is a named_scope in the Language model that returns the languages associated with those sites, and languages are associa... |
We have a typical business application with an Outlook-looking Winforms client talking to asmx webservices. We’d like to make a portion of the features available over our intranet, but the new users we need to reach - all of them - are in developing countries with dial up-type bandwidth and a lot of latency. And they... | Your approach of developing a thick client that minimizes round trips and data transfer is sensible given the constraints of your user base. Here are some recommendations for your implementation:
### General Approach:
1. **Single Page Application (SPA):** Building a single-page application (SPA) will allow you to load... | 34,116 | [
{
"from": "human",
"value": "We have a typical business application with an Outlook-looking Winforms client talking to asmx webservices. We’d like to make a portion of the features available over our intranet, but the new users we need to reach - all of them - are in developing countries with dial up-type ... |
With the Ajax Control Toolkit, one can easily drag and drop all types of great extender onto controls, but they register a boatload of JavaScript to do it.
How do I control this?
If the ScriptManager is in the MasterPage, is there anyway to control the loading of a script on one page that isn't in another?
For exa... | In ASP.NET Web Forms, when using the Ajax Control Toolkit, the `ScriptManager` is responsible for managing JavaScript files and resources. By default, when you include a control (like a CalendarExtender) on a page that uses a `ScriptManager`, the scripts for that control are loaded on all pages that use the same `Scrip... | 34,364 | [
{
"from": "human",
"value": "With the Ajax Control Toolkit, one can easily drag and drop all types of great extender onto controls, but they register a boatload of JavaScript to do it. \n\nHow do I control this? \nIf the ScriptManager is in the MasterPage, is there anyway to control the loading of a script... |
I have an abstract base class which acts as an interface.
I have two "sets" of derived classes, which implement half of the abstract class. ( one "set" defines the abstract virtual methods related to initialization, the other "set" defines those related to the actual "work". )
I then have derived classes which use mult... | Yes, you are correct in your observations and analysis of the situation. Let's clarify some of your concerns and discuss the appropriate solution.
### Issues with Your Current Design
1. **Multiple Inheritance and Ambiguity**:
Your `NotAbsTotal` class inherits from both `AbsInit` and `AbsWork`, both of which have i... | 31,189 | [
{
"from": "human",
"value": "I have an abstract base class which acts as an interface.\nI have two \"sets\" of derived classes, which implement half of the abstract class. ( one \"set\" defines the abstract virtual methods related to initialization, the other \"set\" defines those related to the actual \"wo... |
My Visual Studio (2008) Editor has stopped to underline Errors (this nifty wavy red lines). I can't really tell when, but it can be related to the installation of .Net Framework 3.5 SP 1 or the MVC Beta (which I guess is unlikely). Furthermore have I installed and uninstalled both CodeRush and Resharper for evaluation ... | The issue you're experiencing with Visual Studio 2008 not underlining errors with wavy red lines could be related to several factors, especially considering the installation and uninstallation of various components. Here are some steps you can take to troubleshoot and potentially restore this functionality:
### 1. Res... | 32,048 | [
{
"from": "human",
"value": "My Visual Studio (2008) Editor has stopped to underline Errors (this nifty wavy red lines). I can't really tell when, but it can be related to the installation of .Net Framework 3.5 SP 1 or the MVC Beta (which I guess is unlikely). Furthermore have I installed and uninstalled bo... |
Anyone know of a JS library that will allow me to syntax highlight a code block, then highlight line-level diffs? For example, in a subversion diff, I'd like to highlight the characters on the line that have changed (as well as highlighting the fact that there are change(s) on the line).
Edit: I'm after something that... | For your requirements of syntax highlighting code blocks while also highlighting line-level diffs and changed characters, you might consider combining a few JavaScript libraries:
1. **Prism.js** or **Highlight.js**: Both of these libraries are excellent for syntax highlighting in various programming languages. You can... | 30,406 | [
{
"from": "human",
"value": "Anyone know of a JS library that will allow me to syntax highlight a code block, then highlight line-level diffs? For example, in a subversion diff, I'd like to highlight the characters on the line that have changed (as well as highlighting the fact that there are change(s) on ... |
I recently wrote a webservice to be used with Silverlight which uses the ASP.net membership and roles.
To validate the client in the service I look at the HTTPContext.Current.User (Which works when the service is called from Silverlight)
However, I've been trying to call the same service from an asp.net postback. But w... | When working with ASP.NET Membership and roles in a web service, particularly when using both a Silverlight client and a traditional ASP.NET postback client, you may encounter issues with user authentication if the correct authentication context is not maintained between requests.
Here are some steps you can take to a... | 34,018 | [
{
"from": "human",
"value": "I recently wrote a webservice to be used with Silverlight which uses the ASP.net membership and roles.\nTo validate the client in the service I look at the HTTPContext.Current.User (Which works when the service is called from Silverlight)\nHowever, I've been trying to call the s... |
I have this simple regex,
[\d]{1,5}
that matches any integer between 0 and 99999.
How would I modify it so that it didn't match 0, but matches 01 and 10, etc?
I know there is a way to do an OR like so...
[\d]{1,5}|[^0]{1}
(doesn't make much sense)
There a way to do an AND?
| To create a regex that matches integers between 1 and 99999 (including numbers like `01`, `10`, etc.), but not `0`, you can modify your regex as follows:
```
(?:[1-9]\d{0,4}|0\d{1,4})
```
### Explanation:
1. `(?: ... )` - This denotes a non-capturing group. It groups the patterns together without capturing the match... | 36,178 | [
{
"from": "human",
"value": "I have this simple regex,\n[\\d]{1,5}\n\nthat matches any integer between 0 and 99999.\nHow would I modify it so that it didn't match 0, but matches 01 and 10, etc?\nI know there is a way to do an OR like so...\n[\\d]{1,5}|[^0]{1}\n\n(doesn't make much sense)\nThere a way to do ... |
My company has an existing established WinForm application which in running on WinXP. The application does alot of sound processing using DirectSound.
My company would like to evaluate Mono, as an alternative on a per workstation cost to Vista/Win Server 2008.
I've heard that different estimates, ranging from 'it will... | Migrating a WinForms application to Mono can be a complex task, and the ease of doing so often depends on several factors, including the complexity of the application and the specific libraries it uses.
### Real-World Experience
1. **Compatibility**: In general, WinForms applications can run on Mono, but the compatib... | 31,794 | [
{
"from": "human",
"value": "My company has an existing established WinForm application which in running on WinXP. The application does alot of sound processing using DirectSound.\nMy company would like to evaluate Mono, as an alternative on a per workstation cost to Vista/Win Server 2008.\nI've heard that... |
The deceptively simple foundation of dynamic code generation within a C/C++ framework has already been covered in another question. Are there any gentle introductions into topic with code examples?
My eyes are starting to bleed staring at highly intricate open source JIT compilers when my needs are much more modest.
... | Dynamic code generation and Just-In-Time (JIT) compilation can indeed be intricate topics, but there are resources and approaches that present these concepts in a more accessible manner. Below are some gentle introductions, code examples, and considerations that should help you understand dynamic code generation withou... | 31,543 | [
{
"from": "human",
"value": "The deceptively simple foundation of dynamic code generation within a C/C++ framework has already been covered in another question. Are there any gentle introductions into topic with code examples? \nMy eyes are starting to bleed staring at highly intricate open source JIT comp... |
I want to have the context menu of links provide me an option to open in different browsers, rather than open in my default browser. For instance,
Open in -->
IE
Firefox
Opera
Chrome
Safari
etc.
| To create a context menu option that allows you to open links in different browsers, you'll typically need to use a browser extension or tool, as standard browser functionality only provides the option to open in the default browser. Here’s a general guide for how you can set this up:
### Option 1: Using a Browser Ext... | 32,188 | [
{
"from": "human",
"value": "I want to have the context menu of links provide me an option to open in different browsers, rather than open in my default browser. For instance,\nOpen in --> \n\nIE\nFirefox\nOpera\nChrome\nSafari\netc.\n\n"
},
{
"from": "gpt",
"value": "To create a context menu o... |
Where do you draw the line to stop making abstractions and to start writing sane code? There are tons of examples of 'enterprise code' such as the dozen-file "FizzBuzz" program... even something simple such as an RTS game can have something like:
class Player {} ;/// contains Weapons
class Weapons{} ;/// contains Bulle... | The balance between abstraction and readability in code can be quite challenging to navigate, especially when striving for both maintainability and clarity. Here are some principles and practices to help you draw that line:
### 1. **KISS Principle (Keep It Simple, Stupid)**
- Avoid unnecessary complexity. If a solu... | 33,553 | [
{
"from": "human",
"value": "Where do you draw the line to stop making abstractions and to start writing sane code? There are tons of examples of 'enterprise code' such as the dozen-file \"FizzBuzz\" program... even something simple such as an RTS game can have something like:\nclass Player {} ;/// contains... |
I have a checkbox list control on my asp.net web form that I am dynamically populating from an arraylist. In javascript I want to be able to iterate through the values in the list and if a particular value has been selected to display other controls on the page.
My issue is that all the values in the checkbox list are... | The issue you are experiencing with the checkbox values being shown as `'on'` is indeed due to the lack of a `value` attribute being set for each checkbox in the ASP.NET CheckBoxList control. By default, if a checkbox does not have a value attribute specified, the browser will send `'on'` as the value when the checkbox... | 31,882 | [
{
"from": "human",
"value": "I have a checkbox list control on my asp.net web form that I am dynamically populating from an arraylist. In javascript I want to be able to iterate through the values in the list and if a particular value has been selected to display other controls on the page. \nMy issue is th... |
In my project environment I have 2 projects.
MyApp & MyModule
MyApp loads MyModule. When it loads it attempts to get a class of type DisplayObject and add it to a container of itself.
The problem comes when I try to use a check box / radio button / progress bar.
The check box and radio button appear exactly like normal... | The issue you're experiencing with using components like CheckBox, RadioButton, and ProgressBar in your modular Flex application is likely related to the way the module is packaged and the classes are loaded. Here are some steps to help you troubleshoot and potentially resolve the issue:
### 1. Ensure Proper Module Co... | 34,607 | [
{
"from": "human",
"value": "In my project environment I have 2 projects.\nMyApp & MyModule\nMyApp loads MyModule. When it loads it attempts to get a class of type DisplayObject and add it to a container of itself.\nThe problem comes when I try to use a check box / radio button / progress bar.\nThe check bo... |
I want to work with versioned ActiveRecord associations. E.g., I want to find the object that another object belongs_to as of a certain past date, or the one that it belonged to before that. Does there already exist a library subclassing Rails' ActiveRecord to provide versioned relations? Or some other Ruby library whi... | As of my last knowledge update in October 2023, there isn't a widely adopted, specific library that directly subclasses ActiveRecord to provide versioned associations. However, there are several approaches and libraries you can consider for implementing versioned ActiveRecord associations:
1. **PaperTrail**: This is o... | 29,295 | [
{
"from": "human",
"value": "I want to work with versioned ActiveRecord associations. E.g., I want to find the object that another object belongs_to as of a certain past date, or the one that it belonged to before that. Does there already exist a library subclassing Rails' ActiveRecord to provide versioned ... |
What's the coolest mashup you've built? What APIs did you use? How was the mashup better than the sum of its parts?
| As an AI language model, I don't build projects myself, but I can certainly describe a cool mashup concept that combines various APIs effectively. Here's an example:
### Concept: Travel Buddy Application
#### Overview:
The Travel Buddy Application is a mashup designed to help users plan their trips by combining trave... | 36,028 | [
{
"from": "human",
"value": "What's the coolest mashup you've built? What APIs did you use? How was the mashup better than the sum of its parts?\n"
},
{
"from": "gpt",
"value": "As an AI language model, I don't build projects myself, but I can certainly describe a cool mashup concept that comb... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.