instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
There seems to be lots of different ways to register assemblies with the GAC, as in, they 'work'. However, what's the "proper" way of doing it?
In response to Lou Franco (and gacutil):
I'm using Gacutil for development, but it seems to me to be not the proper way to install it, since gacutil isn't included in the basi... | You're correct in your understanding that the most appropriate way to register assemblies in the Global Assembly Cache (GAC) is to use Windows Installer technology, which is indeed what WiX (Windows Installer XML) utilizes. Here's a detailed explanation:
### The "Proper" Way to Register Assemblies in the GAC
1. **Win... | 36,010 | [
{
"from": "human",
"value": "There seems to be lots of different ways to register assemblies with the GAC, as in, they 'work'. However, what's the \"proper\" way of doing it?\nIn response to Lou Franco (and gacutil):\nI'm using Gacutil for development, but it seems to me to be not the proper way to install... |
I have a main canvas 'blackboard' in a panel,
this canvas has itself several children, like a toolbar (tiles), a label and some skinning.
The problem is that when I move to the rectangle tool and I start drawing rectangles if I want to change the tool when I click on an other tool such as 'circle' or 'select' the butt... | The issue you're encountering is quite common in applications where UI elements overlap, particularly in graphics applications where drawing is involved. The main challenge here is to ensure that the buttons in your toolbar can respond to clicks, even if the mouse is down on the canvas.
Here are a few potential solut... | 37,463 | [
{
"from": "human",
"value": "I have a main canvas 'blackboard' in a panel,\nthis canvas has itself several children, like a toolbar (tiles), a label and some skinning.\nThe problem is that when I move to the rectangle tool and I start drawing rectangles if I want to change the tool when I click on an other ... |
Where can I find pascal-style railroad diagrams to describe C++ syntax?
(As an alternative to EBNF)
| Railroad diagrams are a visual way to represent grammars and syntax similar to how EBNF (Extended Backus-Naur Form) works. If you're looking for C++ syntax described in railroad diagrams, there are a few resources you might consider:
1. **Online Railroad Diagram Generators**: There are various tools available online w... | 36,255 | [
{
"from": "human",
"value": "Where can I find pascal-style railroad diagrams to describe C++ syntax?\n(As an alternative to EBNF)\n"
},
{
"from": "gpt",
"value": "Railroad diagrams are a visual way to represent grammars and syntax similar to how EBNF (Extended Backus-Naur Form) works. If you're ... |
I have been banging my head against a brick wall trying to deploy my MVC app on IIS6 (linked question)
I have scrapped wildcard mapping for the time being and am trying to get the .mvc extension working. Everything is configured correctly in IIS and the .mvc extension is pointing to the .NET dll for all verb types (unc... | Deploying an ASP.NET MVC application on IIS6 can be tricky, especially when it comes to routing and configuration. Here are some steps and considerations that might help you troubleshoot the issue you're experiencing with the `.mvc` extension not being handled correctly:
### 1. Ensure Correct Handler Mapping
Double-ch... | 34,820 | [
{
"from": "human",
"value": "I have been banging my head against a brick wall trying to deploy my MVC app on IIS6 (linked question)\nI have scrapped wildcard mapping for the time being and am trying to get the .mvc extension working. Everything is configured correctly in IIS and the .mvc extension is pointi... |
I have seen that there is a NVL function for PL/SQL that substitutes a value when null is encountered.
But what if I want to set a field to NULL, e.g.
EXEC SQL UPDATE mytable SET myfield=NULL WHERE otherValue=1;
When I run this with C++ on HPUX, 0L is used for null while on Linux the statement fails with illegal valu... | In Oracle PL/SQL, `NULL` is a special marker used to indicate that a data value does not exist in the database. When you are writing a query to set a field to `NULL`, you should not use `0L` or any other language-specific representation of a null value. Instead, you should directly use `NULL` in your SQL statement as p... | 37,100 | [
{
"from": "human",
"value": "I have seen that there is a NVL function for PL/SQL that substitutes a value when null is encountered.\nBut what if I want to set a field to NULL, e.g. \nEXEC SQL UPDATE mytable SET myfield=NULL WHERE otherValue=1;\n\nWhen I run this with C++ on HPUX, 0L is used for null while o... |
I'm looking for an example of how to load an image from file and print it on a page using WPF. I'm having a hard time finding good information about WPF printing.
| Certainly! To print an image from a file in a WPF application, you need to load the image into a visual element and then use the `PrintDialog` class to send it to the printer. Here's a step-by-step guide on how to do this.
### 1. Create a WPF Project
First, create a new WPF Application project in Visual Studio.
### ... | 33,940 | [
{
"from": "human",
"value": "I'm looking for an example of how to load an image from file and print it on a page using WPF. I'm having a hard time finding good information about WPF printing.\n"
},
{
"from": "gpt",
"value": "Certainly! To print an image from a file in a WPF application, you nee... |
Is there a good Silverlight Design Architecture?
| Yes, there are several design architectures that can be effectively used for Silverlight applications. When developing a Silverlight application, it's important to keep in mind the constraints and capabilities of the platform. Below are some commonly used architectural patterns that can help in building maintainable an... | 35,856 | [
{
"from": "human",
"value": "Is there a good Silverlight Design Architecture? \n"
},
{
"from": "gpt",
"value": "Yes, there are several design architectures that can be effectively used for Silverlight applications. When developing a Silverlight application, it's important to keep in mind the con... |
A k-ary necklace of length n is an ordered list of length n whose items are drawn from an alphabet of length k, which is the lexicographically first list in a sort of all lists sharing an ordering under rotation.
Example:
(1 2 3) and (1 3 2) are the necklaces of length 3 from the alphabet {1 2 3}.
More info:
http://en... | Generating k-ary necklaces directly without generating all combinations first can be done efficiently using a recursive backtracking approach. The idea is to build the necklace by exploring each possibility and ensuring that we only keep the lexicographically first necklace representative for each rotation.
Below is a... | 34,968 | [
{
"from": "human",
"value": "A k-ary necklace of length n is an ordered list of length n whose items are drawn from an alphabet of length k, which is the lexicographically first list in a sort of all lists sharing an ordering under rotation.\nExample:\n(1 2 3) and (1 3 2) are the necklaces of length 3 from ... |
This is the exception that I'm getting when I'm trying to bind to a System.Type.Name.
Here is what I'm doing:
this.propertyTypeBindingSource.DataSource = typeof(System.Type);
/* snip */
this.nameTextBox1.DataBindings.Add(
new System.Windows.Forms.Binding(
"Text",
this.propertyTypeBindingSource,
... | Binding to a `System.Type` object can be a bit tricky, especially when trying to bind to a property like `Name` directly. The issue arises because `System.Type` does not implement `INotifyPropertyChanged` and thus the binding doesn't get updated properly when the `Type` changes.
Here are a couple of workarounds:
###... | 34,918 | [
{
"from": "human",
"value": "This is the exception that I'm getting when I'm trying to bind to a System.Type.Name.\nHere is what I'm doing:\nthis.propertyTypeBindingSource.DataSource = typeof(System.Type);\n\n/* snip */\n\nthis.nameTextBox1.DataBindings.Add(\n new System.Windows.Forms.Binding(\n \... |
i want to import in my iphone application, but i know this framework is not available in iphone sdk,but i need to use NSfileWrapper class in this framework, is this class also available in UIKit or others framework available in iphone sdk, thanks
| Yes, the `NSFileWrapper` class is available in the iOS SDK. It is part of the Foundation framework, which is included in the iOS SDK. You can use `NSFileWrapper` for managing file system data in a way that preserves the structure of files and directories.
To use `NSFileWrapper` in your iPhone application, make sure yo... | 39,212 | [
{
"from": "human",
"value": "i want to import in my iphone application, but i know this framework is not available in iphone sdk,but i need to use NSfileWrapper class in this framework, is this class also available in UIKit or others framework available in iphone sdk, thanks\n"
},
{
"from": "gpt",
... |
Comparable to cacti or mrtg.
| It seems like you're looking for tools or software that are comparable to Cacti and MRTG for network monitoring and performance graphing. Both Cacti and MRTG are popular for monitoring network traffic, with Cacti providing more features and flexibility due to its use of a database and a web interface.
Here are some a... | 37,245 | [
{
"from": "human",
"value": "Comparable to cacti or mrtg.\n"
},
{
"from": "gpt",
"value": "It seems like you're looking for tools or software that are comparable to Cacti and MRTG for network monitoring and performance graphing. Both Cacti and MRTG are popular for monitoring network traffic, wit... |
How do I execute a command every time after ssh'ing from one machine to another?
e.g
ssh mymachine
stty erase ^H
I'd rather just have "stty erase ^H" execute every time after my ssh connection completes.
This command can't simply go into my .zshrc file. i.e. for local sessions, I can't run the command (it screws up m... | To execute a command automatically every time you SSH into a remote machine, you can place that command in the appropriate shell initialization file on the remote machine. Since you specifically want it to run only when you SSH into that machine, you can modify the `.bashrc`, `.bash_profile`, or `.zshrc` file on the re... | 38,282 | [
{
"from": "human",
"value": "How do I execute a command every time after ssh'ing from one machine to another?\ne.g\nssh mymachine\nstty erase ^H\n\nI'd rather just have \"stty erase ^H\" execute every time after my ssh connection completes.\nThis command can't simply go into my .zshrc file. i.e. for local ... |
My code:
string input1;
input1 = Console.ReadLine();
Console.WriteLine("byte output");
byte[] bInput1 = Encoding.Unicode.GetBytes(input1);
for (int x = 0; x < bInput1.Length; x++)
Console.WriteLine("{0} = {1}", x, bInput1[x]);
outputs:
104
0
101
0
108
0
108
0
1... | The output you're seeing is due to the way that the string "hello" is encoded using the Unicode encoding (specifically UTF-16 LE, which is a little-endian format). In this encoding, each character is represented by two bytes.
### Breakdown of Your Input
For the input "hello":
- The character 'h' has a Unicode code po... | 36,669 | [
{
"from": "human",
"value": "My code:\n string input1;\n\n input1 = Console.ReadLine();\n\n Console.WriteLine(\"byte output\");\n\n byte[] bInput1 = Encoding.Unicode.GetBytes(input1);\n\n\n for (int x = 0; x < bInput1.Length; x++)\n Console.WriteLine(\"{0} = {1}... |
I'm running Xorg and my (Qt) program daemonises itself. Now I log out and restart the X server. When I log in again my process is still running fine, but I can't see it.
Is there a way of attatching the new incarnation of the X server to the old process?
If I don't restart the whole server, but log out and in again, is... | When you daemonize a process, it usually disconnects from the terminal and runs in the background, which can make it challenging to interact with it directly after you log out or restart the X server. Here are some considerations and potential solutions for your scenario:
### 1. **Reattaching to the Existing Process A... | 37,291 | [
{
"from": "human",
"value": "I'm running Xorg and my (Qt) program daemonises itself. Now I log out and restart the X server. When I log in again my process is still running fine, but I can't see it.\nIs there a way of attatching the new incarnation of the X server to the old process?\nIf I don't restart the... |
What is the simplest way to read a full line in a C console program
The text entered might have a variable length and we can't make any assumption about its content.
| In C, if you want to read a full line of input from the console, the simplest way is to use the `fgets` function. This function allows you to read a line of input into a buffer until a newline character is encountered or until a specified number of characters is read, which helps handle variable-length inputs without a... | 36,926 | [
{
"from": "human",
"value": "What is the simplest way to read a full line in a C console program\nThe text entered might have a variable length and we can't make any assumption about its content.\n"
},
{
"from": "gpt",
"value": "In C, if you want to read a full line of input from the console, th... |
My application caches some data on disk. Because the cache may be large, it should not be stored on a network drive. It should persist between invocations of the application. I have a mechanism for the user to choose a location, but would like the default to be sensible and "the right thing" for the platform.
What i... | When choosing a default location for caching data on disk, it is indeed important to follow platform conventions. For different operating systems, the recommended locations can vary. Here are common default paths based on the operating system:
1. **Windows**: Use `%LOCALAPPDATA%`, which typically points to a path like... | 37,732 | [
{
"from": "human",
"value": "My application caches some data on disk. Because the cache may be large, it should not be stored on a network drive. It should persist between invocations of the application. I have a mechanism for the user to choose a location, but would like the default to be sensible and \... |
Which is better in general in terms of the ordering? Do you put the fault condition at the top or bottom?
if (noProblems == true) {
// do stuff
} else {
// deal with problem
}
OR
if (noProblems == false) {
// deal with problem
} else {
// do stuff
}
| When it comes to ordering conditions in an `if` statement, the choice between putting the fault condition at the top or the bottom often depends on readability and clarity for someone reviewing the code.
### Common Practices
1. **Happy Path First**: It is generally recommended to put the "happy path" (or the no-probl... | 39,844 | [
{
"from": "human",
"value": "Which is better in general in terms of the ordering? Do you put the fault condition at the top or bottom?\nif (noProblems == true) {\n // do stuff\n} else {\n // deal with problem\n}\n\nOR\nif (noProblems == false) {\n // deal with problem\n} else {\n // do stuff\n}... |
Some of us still "live" in a programming environment where unit testing has not yet been embraced. To get started, the obvious first step would be to try to implement a decent framework for unit testing, and I guess xUnit is the "standard".
So what is a good starting point for implementing xUnit in a new programming la... | Implementing an xUnit-style unit testing framework in a new programming language like Visual DataFlex can be a rewarding endeavor. Below are some steps and considerations to help you get started on building a basic xUnit framework:
### 1. **Understand xUnit Structure**
xUnit frameworks generally have the following co... | 33,816 | [
{
"from": "human",
"value": "Some of us still \"live\" in a programming environment where unit testing has not yet been embraced. To get started, the obvious first step would be to try to implement a decent framework for unit testing, and I guess xUnit is the \"standard\".\nSo what is a good starting point ... |
How does the JVM handle a primitive "long", which is 64bits, on a 32bit processor?
Can it utilise mulitple cores in parallel when on a Multi-Core 32bit machine?
How much slower are 64bit operations on a 32bit machine?
| The Java Virtual Machine (JVM) handles primitive types, including `long` (which is 64 bits), in a specific manner when running on a 32-bit architecture.
### Handling of `long` on a 32-bit Processor
1. **Storage**:
- On a 32-bit architecture, the JVM will typically handle a `long` as two separate 32-bit integers. ... | 35,528 | [
{
"from": "human",
"value": "How does the JVM handle a primitive \"long\", which is 64bits, on a 32bit processor?\n\nCan it utilise mulitple cores in parallel when on a Multi-Core 32bit machine?\nHow much slower are 64bit operations on a 32bit machine?\n"
},
{
"from": "gpt",
"value": "The Java V... |
I have a list of email address which I want to distribute evenly by domain.
For example:
let the list be,
a@a.com
b@a.com
c@a.com
a@b.com
b@b.com
c@c.com
The output should be
a@a.com
a@b.com
c@c.com
b@a.com
b@b.com
c@a.com
The source list is not sorted by domain as in example, but can be sorted by domain, if that c... | You can achieve this distribution of email addresses by employing a two-pass algorithm. The basic idea is to group the emails by domain and then interleave them to ensure an even distribution. Here’s how you can do it step by step:
### Step 1: Group Emails by Domain
1. Create a dictionary (or hash map) to group emails... | 34,620 | [
{
"from": "human",
"value": "I have a list of email address which I want to distribute evenly by domain.\nFor example:\nlet the list be, \na@a.com\nb@a.com\nc@a.com\na@b.com\nb@b.com\nc@c.com\n\nThe output should be \na@a.com\na@b.com\nc@c.com\nb@a.com\nb@b.com\nc@a.com\n\nThe source list is not sorted by d... |
For some reason I can't find a way to get the equivalents of sqlite's interactive shell commands:
.tables
.dump
using the Python sqlite3 API.
Is there anything like that?
| Yes, you can achieve the equivalent of SQLite's interactive shell commands `.tables` and `.dump` using the `sqlite3` module in Python. Here’s how to do both:
### 1. Getting Table Names (Equivalent to `.tables`)
You can retrieve the names of all tables in a database by querying the `sqlite_master` table:
```python
im... | 37,117 | [
{
"from": "human",
"value": "For some reason I can't find a way to get the equivalents of sqlite's interactive shell commands:\n.tables\n.dump\n\nusing the Python sqlite3 API. \nIs there anything like that?\n"
},
{
"from": "gpt",
"value": "Yes, you can achieve the equivalent of SQLite's interact... |
My spring-context file is shown below.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:jms="http://www.springframework.org/sc... | The error message you're encountering suggests that there's an issue with the XML schema definitions or that the Spring context configuration file cannot be properly parsed.
Here are a few potential issues and resolutions:
1. **Check XML Declaration**: Ensure that your Spring configuration XML file (`cfa-spring-conte... | 32,042 | [
{
"from": "human",
"value": "My spring-context file is shown below.\n<beans xmlns=\"http://www.springframework.org/schema/beans\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xmlns:aop=\"http://www.springframework.org/schema/aop\"\n xmlns:jee=\"http://www.springframework.org/schema/j... |
What is the C# equivalent of Delphi's FillChar?
| In Delphi, the `FillChar` procedure is used to fill a block of memory with a specific value. In C#, you can achieve a similar effect by using methods like `Array.Fill`, `Buffer.BlockCopy`, or by manipulating a byte array directly.
Here’s a straightforward way to fill an array in C#:
### Using `Array.Fill`
If you're w... | 38,427 | [
{
"from": "human",
"value": "What is the C# equivalent of Delphi's FillChar?\n"
},
{
"from": "gpt",
"value": "In Delphi, the `FillChar` procedure is used to fill a block of memory with a specific value. In C#, you can achieve a similar effect by using methods like `Array.Fill`, `Buffer.BlockCopy... |
What, if any, is the performance difference between the following two loops?
for (Object o: objectArrayList) {
o.DoSomething();
}
and
for (int i=0; i<objectArrayList.size(); i++) {
objectArrayList.get(i).DoSomething();
}
| The two loops you've provided iterate through a list of objects in slightly different ways. Here's a breakdown of their performance differences:
1. **Enhanced For Loop (For-Each Loop)**:
```java
for (Object o : objectArrayList) {
o.DoSomething();
}
```
- **Performance**: The enhanced for loop (al... | 38,332 | [
{
"from": "human",
"value": "What, if any, is the performance difference between the following two loops?\nfor (Object o: objectArrayList) {\n o.DoSomething();\n}\n\nand \nfor (int i=0; i<objectArrayList.size(); i++) {\n objectArrayList.get(i).DoSomething();\n}\n\n"
},
{
"from": "gpt",
"va... |
Under normal circumstances, a VB.NET application of mine can check the ClientName environmental variable to get the name of the workstation the user is connecting from.
So when WorkstationX RDPs into ServerA:
ComputerName=ServerA
ClientName=WorkstationX
That works fine.
If I right-click on the application and choose ... | When you run a VB.NET application with "Run as Administrator," it runs in a different security context that may not have access to certain environment variables, including `ClientName`, which can result in the variable being unavailable.
To get the client's workstation name in an RDP session (even when running as an a... | 36,347 | [
{
"from": "human",
"value": "Under normal circumstances, a VB.NET application of mine can check the ClientName environmental variable to get the name of the workstation the user is connecting from.\nSo when WorkstationX RDPs into ServerA:\n\nComputerName=ServerA\nClientName=WorkstationX\n\nThat works fine.\... |
What is the most recommended/best way to stop multiple instances of a setTimeout function from being created (in javascript)?
An example (psuedo code):
function mouseClick()
{
moveDiv("div_0001", mouseX, mouseY);
}
function moveDiv(objID, destX, destY)
{
//some code that moves the div closer to destination
..... | Using a flag to prevent multiple instances of a `setTimeout` function is one approach, but a more robust and cleaner way is to use a single instance of the `setTimeout` and manage its execution within the `moveDiv` function. Here are a few common strategies to prevent multiple simultaneous calls to the same function:
... | 37,616 | [
{
"from": "human",
"value": "What is the most recommended/best way to stop multiple instances of a setTimeout function from being created (in javascript)?\nAn example (psuedo code):\nfunction mouseClick()\n{\n moveDiv(\"div_0001\", mouseX, mouseY);\n}\n\nfunction moveDiv(objID, destX, destY)\n{\n //some... |
I have this piece of code in my PHP code:
while ($row = mysqli_fetch_assoc($result))
{
extract($row);
echo "<tr>";
echo "<td bgcolor='#FFFFFF'><input id='bookArray[]' name='bookArray[]' type='checkbox' value='$book_id' />$book_id</td>";
echo "<td bgcolor='#FFFFFF'>$threat_name</td>";
echo "</tr>";
}... | It looks like you're trying to serialize the form data using jQuery but might have a small issue in your selector. In jQuery, you should use the `#` symbol to select an element by its ID. If your form is not being selected correctly, the `serialize()` method will return an empty string.
Here’s how you can modify your ... | 35,234 | [
{
"from": "human",
"value": "I have this piece of code in my PHP code:\nwhile ($row = mysqli_fetch_assoc($result))\n{\n extract($row);\n echo \"<tr>\";\n echo \"<td bgcolor='#FFFFFF'><input id='bookArray[]' name='bookArray[]' type='checkbox' value='$book_id' />$book_id</td>\";\n echo \"<td bgcol... |
Anyone know how to detect if a television is currently connected to a PC in c#?
Cheers
| To detect if a television (or any external display) is currently connected to a PC using C#, you can use the `System.Windows.Forms` namespace, specifically the `Screen` class, which provides properties to work with displays connected to the system.
Here's a basic approach to determine if an external display (like a TV... | 33,175 | [
{
"from": "human",
"value": "Anyone know how to detect if a television is currently connected to a PC in c#?\nCheers\n"
},
{
"from": "gpt",
"value": "To detect if a television (or any external display) is currently connected to a PC using C#, you can use the `System.Windows.Forms` namespace, spe... |
I'm using an UpdatePanel and want to put a CompareValidator on two text boxes, to verify that the user-entered password and confirmation are the same.
This is working fine (I have VS2008 and am using .NET 3.5) out of the box, with one minor problem:
The validation is firing as soon as the user clicks out of the first t... | To ensure that your `CompareValidator` only fires after the user has entered text in both the password and confirmation fields, you can make use of a few properties of the `CompareValidator` control in combination with JavaScript to conditionally validate the inputs.
Here's how you can modify your code:
1. **Add a Cu... | 35,359 | [
{
"from": "human",
"value": "I'm using an UpdatePanel and want to put a CompareValidator on two text boxes, to verify that the user-entered password and confirmation are the same.\nThis is working fine (I have VS2008 and am using .NET 3.5) out of the box, with one minor problem:\nThe validation is firing as... |
I am pulling data out of an old-school ActiveX in the form of arrays of doubles. I don't initially know the final number of samples I will actually retrieve.
What is the most efficient way to concatenate these arrays together in C# as I pull them out of the system?
| When working with an unknown number of arrays of doubles and needing to concatenate them in C#, it is generally inefficient to concatenate arrays directly because each concatenation can require creating a new array and copying elements over. Instead, you can use a more efficient approach by leveraging a `List<double>` ... | 36,220 | [
{
"from": "human",
"value": "I am pulling data out of an old-school ActiveX in the form of arrays of doubles. I don't initially know the final number of samples I will actually retrieve.\nWhat is the most efficient way to concatenate these arrays together in C# as I pull them out of the system?\n"
},
{... |
How can I verify a given xpath string is valid in C#/.NET?
I'm not sure just running the XPath and catching exceptions is a valid solution (putting aside the bile in my throat for a moment) - what if tomorrow I run into some other input I haven't tested against?
| To verify if a given XPath string is valid in C#/.NET without executing the XPath query against an XML document, you can use the `XPathExpression.Compile` method. This method allows you to check the validity of the XPath expression by attempting to compile it. If the expression is invalid, it will throw an `XPathExcept... | 35,730 | [
{
"from": "human",
"value": "How can I verify a given xpath string is valid in C#/.NET?\nI'm not sure just running the XPath and catching exceptions is a valid solution (putting aside the bile in my throat for a moment) - what if tomorrow I run into some other input I haven't tested against?\n"
},
{
... |
So, I've been doing Java for a number of years now, but now I'm starting a C++ project. I'm trying to determine best practices for setting up said project.
Within the project, how do you generally structure their code? Do you do it Java style with namespace folders and break up your source that way? Do you keep your pu... | When structuring a C++ project, especially for larger projects, there are several best practices you can follow. The structure of a C++ project can differ from a Java project mainly due to the differences in how these languages handle modules and dependencies. Here are some guidelines to consider:
### Project Structur... | 29,876 | [
{
"from": "human",
"value": "So, I've been doing Java for a number of years now, but now I'm starting a C++ project. I'm trying to determine best practices for setting up said project.\nWithin the project, how do you generally structure their code? Do you do it Java style with namespace folders and break up... |
Sometimes, my UIWebView will have a grey box over part or all of the content. I can't make heads or tails of why it's happening. It happens regularly for certain content.
Thanks!
--Update--
It seems to occur when the webview is not immediately viewable on the screen -- ie i've got a scrollview, and the webview is belo... | It sounds like you're experiencing a common issue with `UIWebView` rendering, particularly when the web view is off-screen or has certain size constraints. Here are several suggestions and troubleshooting steps you can take to potentially resolve the grey box issue:
1. **Use `setNeedsDisplay`**: Call `setNeedsDisplay`... | 36,317 | [
{
"from": "human",
"value": "Sometimes, my UIWebView will have a grey box over part or all of the content. I can't make heads or tails of why it's happening. It happens regularly for certain content.\nThanks!\n--Update--\nIt seems to occur when the webview is not immediately viewable on the screen -- ie i'... |
Perhaps naively, I created a class (AdminDatabase) to handle connection to different MS-Access database files (see code at bottom). The purpose of the class was to allow retrieval of data from a MS-Access database and to manipulate the data. This works well. I can feed an instance of the AdminDatabase class an SQL st... | Your approach to managing the connection to an MS Access database using the `AdminDatabase` class is a good start, and you have a solid understanding of how to handle connections and data retrieval. Let's address your questions and suggest some best practices for integrating your `AdminDatabase` class with the data set... | 32,713 | [
{
"from": "human",
"value": "Perhaps naively, I created a class (AdminDatabase) to handle connection to different MS-Access database files (see code at bottom). The purpose of the class was to allow retrieval of data from a MS-Access database and to manipulate the data. This works well. I can feed an inst... |
I have a problem trying to model a many-to-one relationship in NHibernate, where the object on the 'one' side has a unique constraint on a column. The problem is as follows:
I have two tables, 'Person' and 'Country'. Each Person has one and only one Country associated with it. A Country can have many Persons (really! :... | In NHibernate, when you define a many-to-one relationship, the framework expects that you will manage the association correctly, particularly when it comes to ensuring that the entity on the "one" side (in this case, `Country`) exists before you associate it with an entity on the "many" side (i.e., `Person`).
Your un... | 34,634 | [
{
"from": "human",
"value": "I have a problem trying to model a many-to-one relationship in NHibernate, where the object on the 'one' side has a unique constraint on a column. The problem is as follows:\nI have two tables, 'Person' and 'Country'. Each Person has one and only one Country associated with it. ... |
In Team Build 2008, the Drop Location for a build is no longer specified in the .proj file, and instead is stored in the database and maintained in the GUI tool.
The GUI tool only accepts a network path as a drop location (i.e. \\server\share) and will not accept a local path.
Our build server also hosts the dropped fi... | In Team Build 2008, you're correct that the drop location is usually configured through the GUI and stored in the database. Unfortunately, there isn't a straightforward way to specify a local directory for the drop location through the standard configuration options, since it enforces a network path.
However, there ar... | 36,996 | [
{
"from": "human",
"value": "In Team Build 2008, the Drop Location for a build is no longer specified in the .proj file, and instead is stored in the database and maintained in the GUI tool.\nThe GUI tool only accepts a network path as a drop location (i.e. \\\\server\\share) and will not accept a local pat... |
I want to show a table of fixed width at the center of browser window. Now I use
<table width="200" align="center">
But Visual Studio 2008 gives warning on this line:
Attribute 'align' is considered outdated. A newer construct is recommended.
What CSS style should I apply to the table to obtain the same layout?
| To center a table in the browser window using CSS instead of the outdated `align` attribute, you can use the following approach:
1. Set the table's width using CSS.
2. Use margin properties to center the table.
Here’s an example of how you can achieve this:
```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta c... | 37,848 | [
{
"from": "human",
"value": "I want to show a table of fixed width at the center of browser window. Now I use\n<table width=\"200\" align=\"center\"> \n\nBut Visual Studio 2008 gives warning on this line:\nAttribute 'align' is considered outdated. A newer construct is recommended.\nWhat CSS style should I a... |
Could you write a function that takes one argument (a positive integer) and
divides it by two if it's even, or
multiplies it by three and adds one if it's odd
and then returns the resulting number.
And then a separate function that takes one argument (a positive integer) and repeatedly passes it to the previous funct... | Certainly! Below is a Scheme implementation of the functions that you described related to the Collatz problem. Each function builds on the previous one as you outlined.
```scheme
;; Function to apply the Collatz operation to a number
(define (collatz-step n)
(if (even? n)
(/ n 2)
(+ (* 3 n) 1)))
;; Fun... | 34,208 | [
{
"from": "human",
"value": "Could you write a function that takes one argument (a positive integer) and\n\ndivides it by two if it's even, or\nmultiplies it by three and adds one if it's odd\n\nand then returns the resulting number.\nAnd then a separate function that takes one argument (a positive integer)... |
Do developers have to put certain/extra elements in the feed's XML file or attributes in the hyperlink for the browser to recognize that it's a feed that can be subscribed to? Or do browsers do that automatically as long as the XML validates?
(showing users that "Subscribe to this feed using..." interface in Firefox or... | For browsers to recognize an XML feed (such as RSS or Atom) and display the appropriate subscription interface, developers do need to include specific elements in the feed as well as add certain attributes to the hyperlink that links to the feed. Here’s a breakdown of what is typically required:
### 1. Feed XML Struct... | 38,686 | [
{
"from": "human",
"value": "Do developers have to put certain/extra elements in the feed's XML file or attributes in the hyperlink for the browser to recognize that it's a feed that can be subscribed to? Or do browsers do that automatically as long as the XML validates?\n(showing users that \"Subscribe to ... |
What is the proper way to split up SQL statements to send to an Oracle ADO.NET client? For instance, lets say you have the following code in a text file and want to execute these statements:
CREATE TABLE foo (bar VARCHAR2(100));
INSERT INTO foo (bar) VALUES('one');
INSERT INTO foo (bar) VALUES('two');
I believe tryin... | When dealing with multiple SQL statements in Oracle ADO.NET, it’s important to manage how these statements are sent to the database. In Oracle, semicolons (`;`) are used to terminate SQL statements in tools like SQL*Plus, but they are not part of the actual SQL syntax when sending commands through ADO.NET. Therefore, a... | 35,748 | [
{
"from": "human",
"value": "What is the proper way to split up SQL statements to send to an Oracle ADO.NET client? For instance, lets say you have the following code in a text file and want to execute these statements:\nCREATE TABLE foo (bar VARCHAR2(100));\nINSERT INTO foo (bar) VALUES('one');\nINSERT IN... |
I find it curious that the most obvious way to create Date objects in Java has been deprecated and appears to have been "substituted" with a not so obvious to use lenient calendar.
How do you check that a date, given as a combination of day, month, and year, is a valid date?
For instance, 2008-02-31 (as in yyyy-mm-dd) ... | In Java, you can check if a given combination of day, month, and year forms a valid date by using the `java.time` package introduced in Java 8. The `LocalDate` class is particularly useful for this purpose, as it validates the date upon creation. If the date is invalid (like February 31, 2008), it will throw a `DateTim... | 39,652 | [
{
"from": "human",
"value": "I find it curious that the most obvious way to create Date objects in Java has been deprecated and appears to have been \"substituted\" with a not so obvious to use lenient calendar.\nHow do you check that a date, given as a combination of day, month, and year, is a valid date?\... |
I'm converting some Windows batch files to Unix scripts using sh. I have problems because some behavior is dependent on the %~dp0 macro available in batch files.
Is there any sh equivalent to this? Any way to obtain the directory where the executing script lives?
| In Unix-like systems, there is no direct equivalent to the `%~dp0` macro from Windows batch files. However, you can achieve similar functionality in a shell script by using the `readlink` and `dirname` commands.
The typical way to get the directory where the executing script lives is as follows:
```sh
#!/bin/sh
# G... | 37,963 | [
{
"from": "human",
"value": "I'm converting some Windows batch files to Unix scripts using sh. I have problems because some behavior is dependent on the %~dp0 macro available in batch files.\nIs there any sh equivalent to this? Any way to obtain the directory where the executing script lives?\n"
},
{
... |
I have an input String say Please go to http://stackoverflow.com. The url part of the String is detected and an anchor <a href=""></a> is automatically added by many browser/IDE/applications. So it becomes Please go to <a href='http://stackoverflow.com'>http://stackoverflow.com</a>.
I need to do the same using Java.
| You can achieve this in Java by using regular expressions to detect URLs within a given input string and then replace them with the appropriate anchor tag format. Below is a sample implementation that demonstrates how to do this:
```java
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Url... | 38,019 | [
{
"from": "human",
"value": "I have an input String say Please go to http://stackoverflow.com. The url part of the String is detected and an anchor <a href=\"\"></a> is automatically added by many browser/IDE/applications. So it becomes Please go to <a href='http://stackoverflow.com'>http://stackoverflow.co... |
Is it possible to create a toggle button in C# WinForms? I know that you can use a CheckBox control and set it's Appearance property to "Button", but it doesn't look right. I want it to appear sunken, not flat, when pressed. Any thoughts?
| Yes, it is definitely possible to create a toggle button in C# WinForms that looks sunken when pressed. While using a CheckBox with the Appearance property set to "Button" is one approach, it might not provide the desired visual feedback.
To create a toggle button that has a sunken appearance when pressed, you can use... | 33,353 | [
{
"from": "human",
"value": "Is it possible to create a toggle button in C# WinForms? I know that you can use a CheckBox control and set it's Appearance property to \"Button\", but it doesn't look right. I want it to appear sunken, not flat, when pressed. Any thoughts?\n"
},
{
"from": "gpt",
"va... |
I want to have a map that has a homogeneous key type but heterogeneous data types.
I want to be able to do something like (pseudo-code):
boost::map<std::string, magic_goes_here> m;
m.add<int>("a", 2);
m.add<std::string>("b", "black sheep");
int i = m.get<int>("a");
int j = m.get<int>("b"); // error!
I could have a po... | To achieve a map where you can have a homogeneous key type (e.g., `std::string`) but heterogeneous value types, you can use `boost::variant` or `std::variant` if you're using C++17 or later. This allows you to store different types in the same container while still providing type safety.
Here's how you could implement... | 32,483 | [
{
"from": "human",
"value": "I want to have a map that has a homogeneous key type but heterogeneous data types.\nI want to be able to do something like (pseudo-code):\nboost::map<std::string, magic_goes_here> m;\nm.add<int>(\"a\", 2);\nm.add<std::string>(\"b\", \"black sheep\");\n\nint i = m.get<int>(\"a\")... |
What is the concept of erasure in generics in Java?
| In Java, "erasure" refers to the process by which the Java compiler removes all generic type information after ensuring type safety, effectively converting generic types into their raw types or bounds during compilation. This is a key feature of Java's implementation of generics, which is based on a method called "type... | 36,264 | [
{
"from": "human",
"value": "What is the concept of erasure in generics in Java?\n"
},
{
"from": "gpt",
"value": "In Java, \"erasure\" refers to the process by which the Java compiler removes all generic type information after ensuring type safety, effectively converting generic types into their... |
I'd like to study up on the latest technologies for writing Windows desktop apps. My last experience was with VC++ 6 using MFC. The landscape seems more complex these days, I'm not sure if I should learn .NET, don't really know what Windows forms, WPF are etc. All I want to do is be able to write some simple Windows... | It's great that you're looking to update your skills for writing Windows desktop applications! The landscape has indeed evolved significantly since the days of VC++ 6 and MFC. Here’s a breakdown of the current technologies, along with recommendations for resources to help you learn.
### Current Technologies for Window... | 33,187 | [
{
"from": "human",
"value": "I'd like to study up on the latest technologies for writing Windows desktop apps. My last experience was with VC++ 6 using MFC. The landscape seems more complex these days, I'm not sure if I should learn .NET, don't really know what Windows forms, WPF are etc. All I want to d... |
I am looking for a drop down list which can present the user with a series of images to choose from. Each image will be about 50x50 pixels and a small text description will be under the image. A jQuery and compatable ASP.NET solution would be preferred.
| Creating a dropdown list that displays images with text descriptions involves some custom HTML, CSS, and JavaScript (jQuery). Unfortunately, traditional HTML dropdowns (`<select>` elements) do not support images, so we will have to implement a custom dropdown. Below is a simplified example of how to achieve this using ... | 34,833 | [
{
"from": "human",
"value": "I am looking for a drop down list which can present the user with a series of images to choose from. Each image will be about 50x50 pixels and a small text description will be under the image. A jQuery and compatable ASP.NET solution would be preferred. \n"
},
{
"from": ... |
I'm trying to use the @Searchable annotations from the Compass search engine in my Java program, but I receive a compile-time error: "type mismatch: cannot convert Searchable to Annotation".
I have included all of the jar files that I can think of, and scoured the web for working examples to no avail.
Does anyone have ... | The `@Searchable` annotation you mentioned is part of the Compass framework used for indexing and searching in Java applications. The compile-time error you're encountering suggests that there may be an issue with the import statements or the dependencies in your project.
Here's a step-by-step guide to help you correc... | 34,785 | [
{
"from": "human",
"value": "I'm trying to use the @Searchable annotations from the Compass search engine in my Java program, but I receive a compile-time error: \"type mismatch: cannot convert Searchable to Annotation\".\nI have included all of the jar files that I can think of, and scoured the web for wor... |
I am currently starting my Java VM with the com.sun.management.jmxremote.* properties so that I can connect to it via JConsole for management and monitoring. Unfortunately, it listens on all interfaces (IP addresses) on the machine.
In our environment, there are often cases where there is more than one Java VM running... | Yes, you can configure the Java Management Extensions (JMX) to bind to a specific IP address rather than listening on all interfaces. This can be accomplished by using the `com.sun.management.jmxremote.host` property along with the `com.sun.management.jmxremote.port` property when starting your Java Virtual Machine (JV... | 38,809 | [
{
"from": "human",
"value": "I am currently starting my Java VM with the com.sun.management.jmxremote.* properties so that I can connect to it via JConsole for management and monitoring. Unfortunately, it listens on all interfaces (IP addresses) on the machine.\nIn our environment, there are often cases wh... |
I have a C library with numerous math routines for dealing with vectors, matrices, quaternions and so on. It needs to remain in C because I often use it for embedded work and as a Lua extension. In addition, I have C++ class wrappers to allow for more convenient object management and operator overloading for math opera... | When considering whether to wrap your C library in a C++ interface or port the functionality directly into your C++ classes, there are several factors to weigh, particularly in time-critical applications where performance is paramount. Here's a breakdown of the relevant considerations:
### Performance Considerations
... | 33,754 | [
{
"from": "human",
"value": "I have a C library with numerous math routines for dealing with vectors, matrices, quaternions and so on. It needs to remain in C because I often use it for embedded work and as a Lua extension. In addition, I have C++ class wrappers to allow for more convenient object managemen... |
In HTML in the td of a table you can break text by using <BR> between the words. This also works in the HeaderText of a TemplateItem but not the HeaderText of a BoundField. How do I break up the Header text of a BoundField.
| In ASP.NET Web Forms, when you're using a `GridView` and want to display the header text of a `BoundField` with line breaks, you typically run into a limitation because the `HeaderText` property of a `BoundField` does not process HTML tags such as `<br />`.
However, there are a couple of workarounds you can use:
### ... | 36,547 | [
{
"from": "human",
"value": "In HTML in the td of a table you can break text by using <BR> between the words. This also works in the HeaderText of a TemplateItem but not the HeaderText of a BoundField. How do I break up the Header text of a BoundField.\n"
},
{
"from": "gpt",
"value": "In ASP.NE... |
I am looking for a way to display a modal window in WPF the same way as a window in Cocoa can be displayed as a sheet, i.e. it slides down from the titlebar in front of the main parent window.
My guess is that this would be accomplished by having the modal window as a user control which is loaded into a panel when disp... | To achieve a "sheet"-like modal window behavior in WPF, similar to what Cocoa offers with `NSWindow/sheet`, you can create a user control that acts as your modal "sheet" and animate it to slide down from the title bar of the main window.
Here's a step-by-step approach to implement this:
### Step 1: Create the UserCon... | 30,049 | [
{
"from": "human",
"value": "I am looking for a way to display a modal window in WPF the same way as a window in Cocoa can be displayed as a sheet, i.e. it slides down from the titlebar in front of the main parent window.\nMy guess is that this would be accomplished by having the modal window as a user cont... |
After a repository is imported from VSS to SVN, there are some files which I guess might be VSS specific - .vsssc and .vssscc files for the solution and .vspscc for projects. They seem to be related to VSS project binding. Are they needed (or useful) for SVN as well?
| The files you mentioned—`.vsssc`, `.vssscc`, and `.vspscc`—are specific to Microsoft Visual SourceSafe (VSS) and are used for managing bindings between Visual Studio solutions and projects with the VSS repository. Here's a brief overview of their roles:
- **.vsssc**: This file is associated with a Visual Studio soluti... | 36,455 | [
{
"from": "human",
"value": "After a repository is imported from VSS to SVN, there are some files which I guess might be VSS specific - .vsssc and .vssscc files for the solution and .vspscc for projects. They seem to be related to VSS project binding. Are they needed (or useful) for SVN as well?\n"
},
{... |
Let's say I have an html form. Each input/select/textarea will have a corresponding <label> with the for attribute set to the id of it's companion. In this case, I know that each input will only have a single label.
Given an input element in javascript — via an onkeyup event, for example — what's the best way to find ... | To find the associated `<label>` for an input element in JavaScript, you can use the `for` attribute of the label, which should match the `id` of the input element. When the `onkeyup` event occurs, you can retrieve the input's `id` and then search for the label with that `for` attribute.
Here's an example of how you c... | 37,222 | [
{
"from": "human",
"value": "Let's say I have an html form. Each input/select/textarea will have a corresponding <label> with the for attribute set to the id of it's companion. In this case, I know that each input will only have a single label.\nGiven an input element in javascript — via an onkeyup event, ... |
The problem that I'm having is one that I'm fearing is a design problem, not a coding problem, but I'll ask the question anyway.
I have an ASP.NET 2.0 web application that loads two different user controls dynamically based on a value from a database. Inside each of these user controls is basically a FormView control ... | The issue you're experiencing with the FormView control in ASP.NET is likely due to the lifecycle of the page and the controls within it. When you change the selected value in the dropdown and cause a postback, the dynamically loaded user controls are recreated, but the state of their child controls (like the FormView)... | 35,096 | [
{
"from": "human",
"value": "The problem that I'm having is one that I'm fearing is a design problem, not a coding problem, but I'll ask the question anyway.\nI have an ASP.NET 2.0 web application that loads two different user controls dynamically based on a value from a database. Inside each of these user... |
Using .Net how do I use the Sort method to sort an Array in reverse i.e. Z to A?
| In .NET, you can sort an array in reverse order (from Z to A) using the `Array.Sort` method along with a custom comparer. Below are two common approaches to achieve this using C#.
### Method 1: Using `Array.Sort` with a custom comparer
You can use a custom comparer that defines the reverse order:
```csharp
using Sys... | 37,810 | [
{
"from": "human",
"value": "Using .Net how do I use the Sort method to sort an Array in reverse i.e. Z to A?\n"
},
{
"from": "gpt",
"value": "In .NET, you can sort an array in reverse order (from Z to A) using the `Array.Sort` method along with a custom comparer. Below are two common approaches... |
I have a simple interface:
public interface IVisitorsLogController
{
List<VisitorsLog> GetVisitorsLog();
int GetUniqueSubscribersCount();
int GetVisitorsCount();
string GetVisitorsSummary();
}
the class VisitorsLogController implements this interface.
From a console application or a TestFixture - no ... | It sounds like you're running into a common issue that arises due to how ASP.NET Web Site Projects (as opposed to Web Application Projects) manage code and references.
Here are several things you can try or check to troubleshoot the problem:
1. **Rebuild the Solution**: Sometimes, changes to interfaces or classes mig... | 37,543 | [
{
"from": "human",
"value": "I have a simple interface:\npublic interface IVisitorsLogController \n{\n List<VisitorsLog> GetVisitorsLog();\n int GetUniqueSubscribersCount();\n int GetVisitorsCount();\n string GetVisitorsSummary();\n}\n\nthe class VisitorsLogController implements this interface.... |
I'm auditing a project that uses what is called a Rules Engine. In short, it's a way to externalize business logic from application code.
This concept is entirely new to me and I'm pretty skeptical about it. After hearing people talk about Anemic Domain Models for the past few years, I'm questioning the Rules Engine A... | Your skepticism about the use of a Rules Engine is entirely valid, especially when considering the broader implications on domain modeling, maintainability, and consistency across various application frontends. Let's explore the pros and cons of using a Rules Engine in a software architecture context, particularly with... | 34,390 | [
{
"from": "human",
"value": "I'm auditing a project that uses what is called a Rules Engine. In short, it's a way to externalize business logic from application code. \nThis concept is entirely new to me and I'm pretty skeptical about it. After hearing people talk about Anemic Domain Models for the past few... |
...if there is such a thing. Here's an image of two approachs for structuring DLLs/references in a .NET application: http://www.experts-exchange.com/images/t80668/compArch.png. The app can be a website (it is in this case) or a winform. Each box represents a DLL. For the winform app, just replace "webcontrols" wit... | When structuring DLLs and references in a .NET application, both approaches you referenced in the images have their advantages and disadvantages. Let's break down the two aspects you're considering: the control structure and the organization of common functionality.
### Control Structure
1. **First Image (Direct Use ... | 35,706 | [
{
"from": "human",
"value": "...if there is such a thing. Here's an image of two approachs for structuring DLLs/references in a .NET application: http://www.experts-exchange.com/images/t80668/compArch.png. The app can be a website (it is in this case) or a winform. Each box represents a DLL. For the wi... |
I have a little c# console program that outputs some text using Console.WriteLine. I then pipe this output into a textfile like:
c:myprogram > textfile.txt
However, the file is always an ansi text file, even when I start cmd with the /u switch.
cmd /? says about the /u switch:
/U Causes the output of internal
co... | The issue you're experiencing is due to how the output of your C# console application is being encoded. By default, a C# console application outputs text in the ANSI encoding (which is often the system's default code page) unless you explicitly set it to use a different encoding.
To ensure your C# console application... | 37,187 | [
{
"from": "human",
"value": "I have a little c# console program that outputs some text using Console.WriteLine. I then pipe this output into a textfile like:\nc:myprogram > textfile.txt\nHowever, the file is always an ansi text file, even when I start cmd with the /u switch. \ncmd /? says about the /u switc... |
I would like to execute ls in a Perl program as part of a CGI script. For this I used exec(ls), but this does not return from the exec call.
Is there a better way to get a listing of a directory in Perl?
| Yes, using `exec` in Perl will replace the current process with the executed command, which is why you're not seeing any return from that call. Instead, you can use `qx//` or backticks to capture the output of the `ls` command. However, using Perl's built-in functions to get a directory listing is generally more effici... | 35,786 | [
{
"from": "human",
"value": "I would like to execute ls in a Perl program as part of a CGI script. For this I used exec(ls), but this does not return from the exec call.\nIs there a better way to get a listing of a directory in Perl?\n"
},
{
"from": "gpt",
"value": "Yes, using `exec` in Perl wil... |
I would like to be able to add a hook to my setup.py that will be run post-install (either when easy_install'ing or when doing python setup.py install).
In my project, PySmell, I have some support files for Vim and Emacs. When a user installs PySmell the usual way, these files get copied in the actual egg, and the user... | To add a hook in your `setup.py` that runs post-installation, you can subclass the `install` command from `setuptools`. You've already started down this path, and the next step would be to ensure that you handle both `python setup.py install` and `easy_install`.
Here's how you can achieve that:
1. **Subclassing the ... | 33,680 | [
{
"from": "human",
"value": "I would like to be able to add a hook to my setup.py that will be run post-install (either when easy_install'ing or when doing python setup.py install).\nIn my project, PySmell, I have some support files for Vim and Emacs. When a user installs PySmell the usual way, these files ... |
I'm going to running thousands of queries into SQL and I need to prevent the duplication of field 'domain'. Never had to do this before and any help would be appreciated.
| To prevent duplicate values in the `domain` field of your SQL database, you can use a combination of database constraints and query practices. Below are several approaches to ensure that the `domain` field remains unique:
### 1. Use a Unique Constraint
The simplest way to prevent duplicates in a specific column is by... | 37,288 | [
{
"from": "human",
"value": "I'm going to running thousands of queries into SQL and I need to prevent the duplication of field 'domain'. Never had to do this before and any help would be appreciated.\n"
},
{
"from": "gpt",
"value": "To prevent duplicate values in the `domain` field of your SQL d... |
Is there any c library to get a video from the webcam on linux?
| Yes, there are several C libraries that can be used to capture video from a webcam on Linux. Here are a few popular options:
1. **Video4Linux (V4L2)**: This is the standard API for capturing video in Linux. It provides a way to interact with video devices, including webcams. You can use the V4L2 library to capture vid... | 29,924 | [
{
"from": "human",
"value": "Is there any c library to get a video from the webcam on linux?\n"
},
{
"from": "gpt",
"value": "Yes, there are several C libraries that can be used to capture video from a webcam on Linux. Here are a few popular options:\n\n1. **Video4Linux (V4L2)**: This is the sta... |
How do I remove empty elements from an array in JavaScript?
Is there a straightforward way, or do I need to loop through it and remove them manually?
| In JavaScript, you can remove empty elements from an array without needing to loop through the array manually, thanks to the `filter` method. The `filter` method creates a new array with all elements that pass the test implemented by the provided function. You can use it to filter out any "falsy" values, which includes... | 37,319 | [
{
"from": "human",
"value": "How do I remove empty elements from an array in JavaScript? \nIs there a straightforward way, or do I need to loop through it and remove them manually?\n"
},
{
"from": "gpt",
"value": "In JavaScript, you can remove empty elements from an array without needing to loop... |
Sometimes I need to access some servers running Linux (or maybe another Unix-like SO), but I don't know how to verify which distribution is in use on the server (there are times that even the "responsible" person for the server doesn't know).
Is there an easy and reliable way to discover that, one that is uniform and ... | Yes, there are several reliable methods you can use to identify the Linux distribution (or Unix-like OS) running on a server. Here are some of the most common and consistent approaches:
### 1. Check the `/etc/os-release` file
Most modern Linux distributions provide an `/etc/os-release` file that contains details about... | 38,664 | [
{
"from": "human",
"value": "Sometimes I need to access some servers running Linux (or maybe another Unix-like SO), but I don't know how to verify which distribution is in use on the server (there are times that even the \"responsible\" person for the server doesn't know). \nIs there an easy and reliable wa... |
Is there a difference in passing parameters to .load
$("#myDiv").load("myScript.php?var=x&var2=y&var3=z")
vs
$("#myDiv").load("myScript.php", {var1:x, var2:y, var3:z})
Also, is there a size limit to how much .load can handle? Can
myScript.php return a couple hundred rows of data without issue?
| Yes, there are key differences between the two methods of passing parameters to the `.load()` function in jQuery that you mentioned:
1. **Method of Passing Parameters**:
- **URL Query String**:
```javascript
$("#myDiv").load("myScript.php?var=x&var2=y&var3=z");
```
In this case, you are appendi... | 36,208 | [
{
"from": "human",
"value": "Is there a difference in passing parameters to .load\n$(\"#myDiv\").load(\"myScript.php?var=x&var2=y&var3=z\")\n\nvs\n$(\"#myDiv\").load(\"myScript.php\", {var1:x, var2:y, var3:z})\n\nAlso, is there a size limit to how much .load can handle? Can\nmyScript.php return a couple hun... |
I have a problem.
I am coding using VS2008.
I am calling webservices from my JavaScript Page.
An example
Services.ChangeDropDownLists.GetNowPlayingMoviesByLocationSVC(
blah,
OnSuccessMoviesByRegion,
OnError,
OnTimeOut
);
after execution, it goes to the function OnSuccessMoviesByRegion.
But if I put ... | In JavaScript, when you're making asynchronous calls (like web service calls) within a loop, the behavior you're observing may occur due to the closure mechanism and how the loop variable is handled. Specifically, if you directly reference `i` inside the `OnSuccessMoviesByRegion` function, by the time the asynchronous ... | 36,340 | [
{
"from": "human",
"value": "I have a problem.\nI am coding using VS2008.\nI am calling webservices from my JavaScript Page.\nAn example\nServices.ChangeDropDownLists.GetNowPlayingMoviesByLocationSVC(\n blah, \n OnSuccessMoviesByRegion, \n OnError, \n OnTimeOut\n);\n\nafter execution, it goes to... |
Writing something like this using the loki library,
typedef Functor<void> BitButtonPushHandler;
throws a compiler error, but this works
typedef Functor<void,TYPELIST_1(Matrix3D*)> Perspective;
Functor.h:530: error: '((Loki::FunctorHandler, int>*)this)->Loki::FunctorHandler, int>::f_' cannot be used as a function
F... | The error you’re encountering indicates that the `Functor` template in the Loki library requires a specific type of argument or signature for its instantiation. The first line attempts to instantiate `Functor<void>`, while the second line works with `Functor<void, TYPELIST_1(Matrix3D*)>`.
### Differences in Template ... | 39,190 | [
{
"from": "human",
"value": "Writing something like this using the loki library,\ntypedef Functor<void> BitButtonPushHandler;\n\nthrows a compiler error, but this works\ntypedef Functor<void,TYPELIST_1(Matrix3D*)> Perspective;\n\n\nFunctor.h:530: error: '((Loki::FunctorHandler, int>*)this)->Loki::FunctorHan... |
In a previous question I asked how to make "Computed properties" in a linq to sql object. The answer supplied there was sufficient for that specific case but now I've hit a similar snag in another case.
I have a database with Items that have to pass through a number of Steps. I want to have a function in my database th... | In LINQ to SQL, the issue you're encountering arises because LINQ to SQL needs to translate your LINQ queries into SQL. When you use custom extension methods like `CurrentStep`, LINQ to SQL cannot translate those methods into SQL since it does not understand what they are doing.
To achieve the desired functionality wh... | 36,786 | [
{
"from": "human",
"value": "In a previous question I asked how to make \"Computed properties\" in a linq to sql object. The answer supplied there was sufficient for that specific case but now I've hit a similar snag in another case.\nI have a database with Items that have to pass through a number of Steps.... |
I'm working with a WinForm app in C#, after I type something in a textbox I want to hit the Enter key but the textbox still has focus (flashing cursor is still in textbox), how can I achieve this?
| In a WinForms application, to ensure that after pressing the Enter key, the focus is moved away from the TextBox (i.e., the cursor does not remain in the TextBox), you can handle the `KeyPress` or `KeyDown` event of the TextBox. In the event handler, you can check if the Enter key was pressed, and if so, set the focus ... | 38,540 | [
{
"from": "human",
"value": "I'm working with a WinForm app in C#, after I type something in a textbox I want to hit the Enter key but the textbox still has focus (flashing cursor is still in textbox), how can I achieve this?\n"
},
{
"from": "gpt",
"value": "In a WinForms application, to ensure ... |
Is it possible to catch an error when using JSONP with jQuery? I've tried both the $.getJSON and $.ajax methods but neither will catch the 404 error I'm testing. Here is what I've tried (keep in mind that these all work successfully, but I want to handle the case when it fails):
jQuery.ajax({
type: "GET",
url: ... | When using JSONP (JSON with Padding) with jQuery, handling errors can be tricky because JSONP works by dynamically adding a `<script>` tag to the document, which means it doesn't utilize the standard XMLHttpRequest flow. This limitation prevents jQuery from catching network errors (like 404) as it would with a regular ... | 36,385 | [
{
"from": "human",
"value": "Is it possible to catch an error when using JSONP with jQuery? I've tried both the $.getJSON and $.ajax methods but neither will catch the 404 error I'm testing. Here is what I've tried (keep in mind that these all work successfully, but I want to handle the case when it fails):... |
We are seeing this error in a Winform application. Can anyone help on why you would see this error, and more importantly how to fix it or avoid it from happening.
System.ComponentModel.Win32Exception: Error creating window handle.
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Wind... | The error message you're encountering, `System.ComponentModel.Win32Exception: Error creating window handle`, typically indicates that the application has hit a system limit on the number of window handles that can be created, or it may indicate an issue with the application's resource management. This can happen for se... | 36,469 | [
{
"from": "human",
"value": "We are seeing this error in a Winform application. Can anyone help on why you would see this error, and more importantly how to fix it or avoid it from happening.\n\nSystem.ComponentModel.Win32Exception: Error creating window handle.\n at System.Windows.Forms.NativeWindow.Cre... |
I have a form in VB6 with two combo boxes (cboCustomer and cboItemNumber). When someone selects a value from cboCustomer, I want to populate cboItemNumber with a list of item numbers relevent to the customer selected. What event does VB6 offer that I can use? I've tried _Change and _LostFocus and neither are doing what... | In VB6, when you want to respond to a change in the selection of a combo box, the most appropriate event to use is the `_Click` event or the `_SelectionChangeCommitted` event. However, since VB6 does not have a `_SelectionChangeCommitted` event, you can use the `_Click` event for the `cboCustomer` combo box.
Here's ho... | 35,777 | [
{
"from": "human",
"value": "I have a form in VB6 with two combo boxes (cboCustomer and cboItemNumber). When someone selects a value from cboCustomer, I want to populate cboItemNumber with a list of item numbers relevent to the customer selected. What event does VB6 offer that I can use? I've tried _Change ... |
Is there a way to know the main/calling request in an httpmodule? I only want my module code to run for the main aspx page, not the images and scripts. I could check the path for ".aspx" but it seems like there should be a better way.
| In an ASP.NET application, if you want to ensure that your HttpModule only processes requests for the main ASPX page and ignores requests for resources like images, scripts, or other content types, there are a few strategies you can employ.
While checking the path for `.aspx` might seem straightforward, there are mor... | 35,240 | [
{
"from": "human",
"value": "Is there a way to know the main/calling request in an httpmodule? I only want my module code to run for the main aspx page, not the images and scripts. I could check the path for \".aspx\" but it seems like there should be a better way.\n"
},
{
"from": "gpt",
"valu... |
i know that i can get stacktrace by using Thread.getAllStackTraces()(it returns Map, but clear does not work). When I run recursion method i can get exception because of stacktrace being too big, is there any way to clear it?
| In Java, when you encounter a `StackOverflowError` due to excessive recursion, the stack trace generated by the JVM can be quite large, and there isn't a direct way to "clear" or manage the stack trace of a thread from the outside.
The `Thread.getAllStackTraces()` method indeed returns a map of all threads to their st... | 32,212 | [
{
"from": "human",
"value": "i know that i can get stacktrace by using Thread.getAllStackTraces()(it returns Map, but clear does not work). When I run recursion method i can get exception because of stacktrace being too big, is there any way to clear it?\n"
},
{
"from": "gpt",
"value": "In Java,... |
I'm trying to test a method I have in my application, but I don't know how to unit test a method that is being protected from forgery, take a look at this:
def index
@alumnos = Alumno.paginate :per_page => 20,
:page => params[:page], :order => :nombre
respond_to do |format|
format.html # index... | When you're unit testing a controller action that involves CSRF protection, you need to ensure that your test includes the authenticity token. In Rails, functional tests automatically include a session and authenticity token, but if you encounter issues, you can manually set the token or use helper methods provided by ... | 37,340 | [
{
"from": "human",
"value": "I'm trying to test a method I have in my application, but I don't know how to unit test a method that is being protected from forgery, take a look at this:\n def index\n @alumnos = Alumno.paginate :per_page => 20, \n :page => params[:page], :order => :nombre\n\n re... |
I have a MySQL table containing domain names:
+----+---------------+
| id | domain |
+----+---------------+
| 1 | amazon.com |
| 2 | google.com |
| 3 | microsoft.com |
| | ... |
+----+---------------+
I'd like to be able to search through this table for a full hostname (i.e. 'www.google.co... | You're correct that your current approach might not be the most efficient way to tackle this problem. Instead, you can break down the hostname directly in the SQL query to check against the domains more elegantly.
One approach would be to use SQL string functions to extract the domain from the hostname directly withi... | 40,104 | [
{
"from": "human",
"value": "I have a MySQL table containing domain names:\n+----+---------------+\n| id | domain |\n+----+---------------+\n| 1 | amazon.com |\n| 2 | google.com |\n| 3 | microsoft.com |\n| | ... |\n+----+---------------+\n\nI'd like to be able to search through ... |
I have the following route defined
routes.MapRoute(
"ItemName",
"{controller}/{action}/{projectName}/{name}",
new { controller = "Home", action = "Index", name = "", projectName = "" }
);
This route actually works, so if I type in the browser
/Milestone/Edit/... | The issue you're encountering is related to the way the ASP.NET MVC routing system processes the parameters in your `Url.Action()` call. When you use `Url.Action()`, it generates a URL based on the parameter names you provide. If the parameters do not match the route definition, it will resort to the default query stri... | 38,310 | [
{
"from": "human",
"value": "I have the following route defined\n routes.MapRoute(\n \"ItemName\",\n \"{controller}/{action}/{projectName}/{name}\",\n new { controller = \"Home\", action = \"Index\", name = \"\", projectName = \"\" }\n );\n\nThis route ... |
I have seen some very weird for loops when reading other people's code. I have been trying to search for a full syntax explanation for the for loop in C but it is very hard because the word "for" appears in unrelated sentences making the search almost impossible to Google effectively.
This question came to my mind afte... | The `for` loop in C has a specific syntax that consists of three main parts: initialization, condition, and increment. The basic structure looks like this:
```c
for (initialization; condition; increment) {
// loop body
}
```
### Breaking Down the For Loop Components
1. **Initialization**: This part is executed o... | 36,527 | [
{
"from": "human",
"value": "I have seen some very weird for loops when reading other people's code. I have been trying to search for a full syntax explanation for the for loop in C but it is very hard because the word \"for\" appears in unrelated sentences making the search almost impossible to Google effe... |
What libraries are available for writing xml-rpc clients in native C++ or C?
| There are several libraries available for writing XML-RPC clients in native C++ or C. Here are some notable ones:
### C++ Libraries
1. **xmlrpcpp**:
- A C++ library that implements the XML-RPC protocol. It is lightweight and easy to use, and it supports both client and server functionality.
- GitHub Repository:... | 36,534 | [
{
"from": "human",
"value": "What libraries are available for writing xml-rpc clients in native C++ or C?\n"
},
{
"from": "gpt",
"value": "There are several libraries available for writing XML-RPC clients in native C++ or C. Here are some notable ones:\n\n### C++ Libraries\n\n1. **xmlrpcpp**:\n ... |
Right now I'm working on a web application that receives a significant amount of data from a database that has a potential to return null results. When going through the cyclomatic complexity for the application a number of functions are weighing in between 10 - 30. For the most part the majority of the functions with ... | Reducing cyclomatic complexity is an important aspect of improving code maintainability and readability. Cyclomatic complexity increases when you have many conditional statements or branching logic in a function. To bring down the complexity of your functions, you can use several techniques:
### 1. **Refactoring with ... | 33,143 | [
{
"from": "human",
"value": "Right now I'm working on a web application that receives a significant amount of data from a database that has a potential to return null results. When going through the cyclomatic complexity for the application a number of functions are weighing in between 10 - 30. For the most... |
void (int a[]) {
a[5] = 3; // this is wrong?
}
Can I do this so that the array that is passed in is modified?
Sorry for deleting, a bit new here...
I have another question which might answer my question:
If I have
void Test(int a) {
}
void Best(int &a) {
}
are these two statements equivalent?
Test(a);
Best(&a... | Let's address your questions one by one.
1. **Modifying an Array in a Function**:
The line of code you've provided has a couple of issues. Here’s the modified function prototype:
```cpp
void modifyArray(int a[]) {
a[5] = 3; // This is correct as long as a has at least 6 elements.
}
```
In C++, when you pass an ... | 37,888 | [
{
"from": "human",
"value": "void (int a[]) {\n a[5] = 3; // this is wrong?\n }\nCan I do this so that the array that is passed in is modified?\nSorry for deleting, a bit new here...\nI have another question which might answer my question:\nIf I have\nvoid Test(int a) {\n}\n\nvoid Best(int &a) {\n}\n\... |
My question is similar to Engram's here, but my question goes a bit further. The way i intend it to work is I have a textbox asking how many entries a user is going to make. After they input the number, I need to create that many more textboxes to allow for entries (and then repeat the same process with those textbox... | It looks like you're on the right track for dynamically creating textboxes based on user input in an ASP.NET MVC application. Your code is well structured, but there are a few improvements and clarifications that can help you get it working properly.
### Overview
The process you're trying to implement involves these ... | 36,859 | [
{
"from": "human",
"value": "My question is similar to Engram's here, but my question goes a bit further. The way i intend it to work is I have a textbox asking how many entries a user is going to make. After they input the number, I need to create that many more textboxes to allow for entries (and then r... |
I work on a project that was just told we had to incorporate Parasoft C++ unit testing tool into any code changes going forward. The problem I face is that we have methods with very small changes and now it seems we are forced to unit test the whole method. Many of these methods are hundreds or thousands of lines of co... | Parasoft C++ Test is primarily designed to support unit testing, static code analysis, and various aspects of quality assurance in C++ code. When it comes to unit testing with any framework, including Parasoft, there are several considerations to keep in mind:
1. **Testing Granularity**: Unit testing typically involve... | 36,136 | [
{
"from": "human",
"value": "I work on a project that was just told we had to incorporate Parasoft C++ unit testing tool into any code changes going forward. The problem I face is that we have methods with very small changes and now it seems we are forced to unit test the whole method. Many of these methods... |
I am in the process of writing a text editor. After looking at other text editors I have noticed that a number of them refer to a "soft" versus "hard" wrap. What is the difference? I can't seem to find the answer by searching.
| The terms "soft wrap" and "hard wrap" refer to two different ways of handling line breaks in text editors.
### Soft Wrap:
- **Definition**: Soft wrapping means that the text editor visually breaks lines to fit the width of the window or the text area without actually inserting line breaks into the text. The text flows... | 38,109 | [
{
"from": "human",
"value": "I am in the process of writing a text editor. After looking at other text editors I have noticed that a number of them refer to a \"soft\" versus \"hard\" wrap. What is the difference? I can't seem to find the answer by searching.\n"
},
{
"from": "gpt",
"value": "... |
I've got a web form with Password and Confirm Password text boxes. I've got a RegularExpressionValidator attached to the first one and CompareValidator to the second one.
Now the problem is when i have something in the Password field and nothing in Confirm Password field it does not display an error that fields don't m... | In your case, the issue with the `CompareValidator` not displaying an error message until you have entered something in the Confirm Password field is due to the behavior of the `CompareValidator`. It only validates when both fields have some content to compare. If the Confirm Password field is empty, the validator will... | 32,148 | [
{
"from": "human",
"value": "I've got a web form with Password and Confirm Password text boxes. I've got a RegularExpressionValidator attached to the first one and CompareValidator to the second one.\nNow the problem is when i have something in the Password field and nothing in Confirm Password field it doe... |
We're using interfaces to represent entity classes in our domain model. We have concrete implementations of these by virtue of using LinqToSql. We have added a factory method to each LinqToSql class which our service layer uses to instantiate a new entity (note; as opposed to the controller's DataBind attribute doing... | It sounds like you’re dealing with a classic issue of separation of concerns and the challenges that arise when using interfaces in a data-binding scenario with MonoRail and LINQ to SQL. Since MonoRail's default data binder doesn't handle interface properties well, there are a few approaches you can take to resolve thi... | 36,818 | [
{
"from": "human",
"value": "We're using interfaces to represent entity classes in our domain model. We have concrete implementations of these by virtue of using LinqToSql. We have added a factory method to each LinqToSql class which our service layer uses to instantiate a new entity (note; as opposed to ... |
I'm writing a MUD engine and I've just started on the game object model, which needs to be extensible.
I need help mainly because what I've done feels messy, but I can't think of a another solution that works better.
I have a class called MudObject, and another class called Container, A container can contain multiple M... | It sounds like you're diving into a classic problem of object-oriented design, particularly in the context of a game engine. The requirements you've described indicate that you want a flexible and extensible object model where you can have containers and items that can contain other items. Let's unpack your situation a... | 34,332 | [
{
"from": "human",
"value": "I'm writing a MUD engine and I've just started on the game object model, which needs to be extensible.\nI need help mainly because what I've done feels messy, but I can't think of a another solution that works better.\nI have a class called MudObject, and another class called Co... |
Does Ruby have any tools along the lines of pylint for analyzing source code for errors and simple coding standards?
It would be nice if it could be integrated with cruisecontrolrb for continuous integration.
Or does everyone write such good tests that they don't need source code checkers!
| Yes, Ruby has several tools that can help analyze source code for errors and enforce coding standards, similar to what pylint does for Python. Here are some popular options:
1. **RuboCop**: This is the most widely used static code analyzer for Ruby. It enforces many community-driven style guidelines and helps identify... | 39,735 | [
{
"from": "human",
"value": "Does Ruby have any tools along the lines of pylint for analyzing source code for errors and simple coding standards?\nIt would be nice if it could be integrated with cruisecontrolrb for continuous integration.\nOr does everyone write such good tests that they don't need source c... |
I have a table which has a field sort_id. In this field there are numbers from 1 to n, that define the order of the data sets.
Now I want to delete some elements and afterwards I want to reorder the table. Therefore I need a query that "finds" the gaps and changes the sort_id field according to the modifications.
Sure,... | You can achieve the reordering of the `sort_id` field in a single SQL statement by utilizing a common table expression (CTE) or a subquery, depending on the SQL dialect you are using. Below is an example of how you can do this in a single statement using a CTE.
Assuming you want to delete an entry by its `id`, and you... | 34,898 | [
{
"from": "human",
"value": "I have a table which has a field sort_id. In this field there are numbers from 1 to n, that define the order of the data sets.\nNow I want to delete some elements and afterwards I want to reorder the table. Therefore I need a query that \"finds\" the gaps and changes the sort_id... |
I'm using a Flash TextField control to display some HTML content inside a Flash presentation to be shown on a large touch-screen kiosk. Unfortunately, if any image tag in the displayed HTML content points to a non-existent image, a dialogue is shown with the error message
Error #2044: Unhandled IOErrorEvent:. text=Err... | It looks like you're using Flash's `TextField` with HTML content and you want to suppress the error dialog that appears when an image fails to load. As you've discovered, the default behavior of Flash is to show an error dialog when an image cannot be found, which can be disruptive for a kiosk application. Your approac... | 36,213 | [
{
"from": "human",
"value": "I'm using a Flash TextField control to display some HTML content inside a Flash presentation to be shown on a large touch-screen kiosk. Unfortunately, if any image tag in the displayed HTML content points to a non-existent image, a dialogue is shown with the error message \nErro... |
Within an article-oriented page (such as a blog post), the <h1> element (level 1 heading) is commonly used to markup either:
the blog title (i.e. the often-large site title at the top of the page, not to the <title> element), or
the article title
What is the best choice and why?
To the site owner, who may want to sho... | You raise an important question about the appropriate use of the `<h1>` element in web semantics, especially in the context of blog posts or articles. Here's a comprehensive breakdown of your considerations, along with some additional insights on usability and accessibility:
### **The Role of the `<h1>` Element:**
1.... | 34,305 | [
{
"from": "human",
"value": "Within an article-oriented page (such as a blog post), the <h1> element (level 1 heading) is commonly used to markup either:\n\nthe blog title (i.e. the often-large site title at the top of the page, not to the <title> element), or\nthe article title\n\nWhat is the best choice a... |
A Java web application that I'm working on requires that I restart the server fairly often in order to see the effects of my code changes. I have a local version of WAS 6.0 on my machine that I use to run the app. The server takes about 5-10 minutes to restart. My machine is pretty decent with a dual core proc and 3 ... | Optimizing the startup time of a WebSphere Application Server (WAS) can significantly enhance your development experience, especially when you're frequently restarting the server. Here are some tips and tricks you might find helpful to reduce the startup time of WAS 6.0:
### General Tips
1. **Use Development Mode**: M... | 36,122 | [
{
"from": "human",
"value": "A Java web application that I'm working on requires that I restart the server fairly often in order to see the effects of my code changes. I have a local version of WAS 6.0 on my machine that I use to run the app. The server takes about 5-10 minutes to restart. My machine is p... |
I filled up a combobox with the values from an Enum.
Now a combobox is text right? So I'm using a getter and a setter. I'm having problems reading the text.
Here's the code:
public BookType type
{
get
{
return (BookType)Enum.Parse(typeof(BookType), this.typeComboBox.Text);
}
set
{
t... | It looks like you've identified that the issue was related to timing in your code execution. If you are trying to read the `typeComboBox.Text` immediately after changing the selection, you may be hitting a race condition where the UI has not yet updated the text value properly.
However, for clarity and to provide a be... | 37,834 | [
{
"from": "human",
"value": "I filled up a combobox with the values from an Enum.\nNow a combobox is text right? So I'm using a getter and a setter. I'm having problems reading the text.\nHere's the code:\npublic BookType type\n{\n get\n {\n return (BookType)Enum.Parse(typeof(BookType), this.t... |
I'm using grails j2d which in turns uses GraphicsBuilder to make a simple service to scale an image. My problem is specifically accessing the downloaded image height and width attributes in order to pass the correct parameters to the scale method. How do I access these attributes inside the transformations closure?
Co... | In the Grails J2D library, when you want to manipulate images using the `GraphicsBuilder`, you can access the properties of the image after loading it inside the `image` closure. To get the width and height of the image, you need to utilize the `Image` object that is created when you load the image.
Here's how you ca... | 35,737 | [
{
"from": "human",
"value": "I'm using grails j2d which in turns uses GraphicsBuilder to make a simple service to scale an image. My problem is specifically accessing the downloaded image height and width attributes in order to pass the correct parameters to the scale method. How do I access these attribute... |
I'm using an in-memory dataset to represent an array of objects. I've got most of the code figured out to fill the dataset at runtime, but part of my object contains a dynamic array of TPoint records, and I have no idea how to set up the dataset and the loading code to make that work. I know a TPoint can be represent... | To represent an array of `TPoint` records in a dataset, you can use an Array Data Type (ADT) field. Here's how you can set it up in your in-memory dataset, populate it, and access the values at runtime.
### Step 1: Define Your Data Structure
Assuming you have a simple `TPoint` record:
```pascal
type
TPoint = recor... | 34,227 | [
{
"from": "human",
"value": "I'm using an in-memory dataset to represent an array of objects. I've got most of the code figured out to fill the dataset at runtime, but part of my object contains a dynamic array of TPoint records, and I have no idea how to set up the dataset and the loading code to make tha... |
In an interview for a SQL DBA position a while back, I mentioned I prefer the SQL 2005 Management Studio app vs. the old 2000 versions of Enterprise Manager / Query Analyzer. The DBA who was interviewing me said that they had experienced some sort of database corruption in their 2000 databases when making changes from ... | What you're describing is a known issue that some database administrators encountered when using SQL Server Management Studio (SSMS) 2005 to connect to SQL Server 2000 databases. The primary concern related to compatibility and the way SSMS 2005 handles certain properties or operations that may not be fully compatible ... | 38,728 | [
{
"from": "human",
"value": "In an interview for a SQL DBA position a while back, I mentioned I prefer the SQL 2005 Management Studio app vs. the old 2000 versions of Enterprise Manager / Query Analyzer. The DBA who was interviewing me said that they had experienced some sort of database corruption in their... |
I was wondering if anybody could point me towards a free ftps module for python.
I am a complete newbie to python, but this is something I need for a work project. I need an ftps client to connect to a 3rd party ftps server.
thanks,
David.
| Hi David,
Welcome to Python! For working with FTPS (FTP over SSL), a popular library is `pyftpdlib`, but it primarily focuses on creating FTP servers rather than clients. Instead, you can use the `ftplib` library that comes with Python's standard library, along with `ssl` for the secure connection.
However, for easie... | 37,673 | [
{
"from": "human",
"value": "I was wondering if anybody could point me towards a free ftps module for python.\nI am a complete newbie to python, but this is something I need for a work project. I need an ftps client to connect to a 3rd party ftps server.\nthanks,\nDavid.\n"
},
{
"from": "gpt",
"... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.