instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
How to create instance of AxHost abstract class
| `AxHost` is an abstract base class in the .NET Framework that is used to create ActiveX controls in Windows Forms applications. Because it's an abstract class, you cannot instantiate it directly. Instead, you need to create a derived class that implements the abstract members of `AxHost`.
Here's a basic outline of how... | 25,411 | [
{
"from": "human",
"value": "How to create instance of AxHost abstract class\n"
},
{
"from": "gpt",
"value": "`AxHost` is an abstract base class in the .NET Framework that is used to create ActiveX controls in Windows Forms applications. Because it's an abstract class, you cannot instantiate it ... |
Here are my current options.
.Net : Using WPF, Visual C#, SQLServer
Java : Using Spring, Hibernate, Enterprise DB, web-based
Can you suggest which one is better?, especially with regards to building complex forms.
| Choosing between .NET (WPF) and Java (Spring with Hibernate) for building complex forms largely depends on several factors, including your team's expertise, project requirements, and the development environment. Here's a comparison to help you decide:
### .NET (WPF, Visual C#, SQL Server)
#### Pros:
1. **Rich UI Capa... | 24,263 | [
{
"from": "human",
"value": "Here are my current options. \n\n.Net : Using WPF, Visual C#, SQLServer\nJava : Using Spring, Hibernate, Enterprise DB, web-based\n\nCan you suggest which one is better?, especially with regards to building complex forms.\n"
},
{
"from": "gpt",
"value": "Choosing bet... |
I'm programming in C for RAM limited embedded microcontroller with RTOS.
I regularly break my code to short functions, but every function calling require to more stack memory.
Every task needs his stack, and this is one of the significant memory consumers in the project.
Is there an alternative to keep the code well or... | Managing stack memory in an embedded system with an RTOS can be challenging, especially when you want to maintain code organization and readability. Here are some strategies to help you reduce stack usage while keeping your code structured:
### 1. **Inline Functions**
If your functions are small and called frequently,... | 25,406 | [
{
"from": "human",
"value": "I'm programming in C for RAM limited embedded microcontroller with RTOS.\nI regularly break my code to short functions, but every function calling require to more stack memory.\nEvery task needs his stack, and this is one of the significant memory consumers in the project.\nIs t... |
I've been given some code with commenting unlike anything I've come across before:
//{{{ Imports
import imports;
//}}}
It is the same for each method block,
//{{{ above the code block
//}}} below the code block
Also see: http://en.wikipedia.org/wiki/Folding_editor
| The commenting style you're encountering is known as "folding comments" or "code folding markers." These markers are specifically designed to help developers manage large codebases by allowing them to collapse (or "fold") sections of code in their editor, making it easier to navigate and focus on specific parts of the ... | 27,643 | [
{
"from": "human",
"value": "I've been given some code with commenting unlike anything I've come across before:\n//{{{ Imports\nimport imports;\n//}}}\n\nIt is the same for each method block, \n//{{{ above the code block \n//}}} below the code block\n\nAlso see: http://en.wikipedia.org/wiki/Folding_editor... |
In an asp.net application, I would like to combine the use of the Webclient Software Factory (WCSF), and its associated Model View Presenter pattern (MVP), with Page Method, that is static methods on the .aspx Views marked with the [WebMethod] attribute.
However, static methods on the aspx page would seem to break the... | Combining the Web Client Software Factory (WCSF) with the Model-View-Presenter (MVP) pattern while also utilizing ASP.NET Web Methods (static methods decorated with the `[WebMethod]` attribute) presents a unique challenge since MVP typically relies on instance methods for communication between the view and presenter. H... | 16,352 | [
{
"from": "human",
"value": "In an asp.net application, I would like to combine the use of the Webclient Software Factory (WCSF), and its associated Model View Presenter pattern (MVP), with Page Method, that is static methods on the .aspx Views marked with the [WebMethod] attribute. \nHowever, static method... |
Is there a way to find all the class dependencies of a java main class?
I have been manually sifting through the imports of the main class and it's imports but then realized that, because one does not have to import classes that are in the same package, I was putting together an incomplete list.
I need something that w... | Yes, you can find all class dependencies of a Java main class recursively using several methods. Here are a few approaches that might help you achieve this:
### 1. **Using Reflection (at Runtime)**
You can use Java Reflection to get some of the dependencies at runtime. However, this approach won't cover all possible ... | 27,293 | [
{
"from": "human",
"value": "Is there a way to find all the class dependencies of a java main class?\nI have been manually sifting through the imports of the main class and it's imports but then realized that, because one does not have to import classes that are in the same package, I was putting together a... |
My company requires me to use Outlook for my E-mail. Outlook does virtually nothing the way I want to do it and it frustrates me greatly. (I'm not trying to start a flame war here, it must do exactly what thousands of CEO's want it to do, but I'm not a CEO.)
I would like to be able to automatically extract the thousa... | You can certainly extract emails and attachments from Outlook using various methods, including C# programming and open-source tools. Below are some approaches to help you achieve this.
### 1. **Using Outlook Interop in C#**
You can use the Outlook Interop library in C# to programmatically access your emails and attac... | 22,879 | [
{
"from": "human",
"value": "My company requires me to use Outlook for my E-mail. Outlook does virtually nothing the way I want to do it and it frustrates me greatly. (I'm not trying to start a flame war here, it must do exactly what thousands of CEO's want it to do, but I'm not a CEO.)\nI would like to b... |
I have a Rails app that sets a cookie and does a redirect to another server once the user is logged in. However, the cookie that the Rails app sets isn't seen by the server for some reason. I've tried setting http_only to false but I still can't even see the cookie unless the domain is the same as my Rails app. Here's ... | The issue you're encountering is related to how cookies are handled across different domains. When setting a cookie in a Rails app (or any web application), there are some important aspects to consider:
1. **Domain Attribute**: The `domain` attribute of the cookie specifies which domains can access the cookie. By defa... | 25,647 | [
{
"from": "human",
"value": "I have a Rails app that sets a cookie and does a redirect to another server once the user is logged in. However, the cookie that the Rails app sets isn't seen by the server for some reason. I've tried setting http_only to false but I still can't even see the cookie unless the do... |
When printing in Windows forms, or doing a print preview, a dialog is displayed with text like
Page [P] of [DOC]
where [P] is page number and [DOC] is the name of the document. The dialog also contains a button to allow the user to cancel the print job.
How can I change the text displayed? What I would prefer is text ... | In a Windows Forms application, customizing the default print dialog or print preview dialog is somewhat limited. The built-in dialog displays static messages like "Page [P] of [DOC]" and does not provide direct options to change this text. However, you can achieve a similar effect by creating your own custom print pre... | 23,649 | [
{
"from": "human",
"value": "When printing in Windows forms, or doing a print preview, a dialog is displayed with text like \nPage [P] of [DOC]\nwhere [P] is page number and [DOC] is the name of the document. The dialog also contains a button to allow the user to cancel the print job.\nHow can I change the ... |
Excuse me if I'm off on my terminology, I only have around 2.4 years of programming experience, mostly in .NET.
Currently I'm one of two .NET developers in a mainframe shop, the other developer set the standards and is a great coder with a lot more experience plus a CS degree(I am 100% self taught).
We use custom coll... | It's great to see your enthusiasm and critical thinking around performance and coding practices! Your experience in a .NET environment, especially using generics and working with collections, is valuable.
### When to Use Custom Collections
Custom collections can be beneficial in various scenarios, particularly when y... | 26,405 | [
{
"from": "human",
"value": "Excuse me if I'm off on my terminology, I only have around 2.4 years of programming experience, mostly in .NET.\nCurrently I'm one of two .NET developers in a mainframe shop, the other developer set the standards and is a great coder with a lot more experience plus a CS degree(I... |
We need a mailing list package similar to Python Mailman. I'd use Mailman except for one thing: we want to link the subscriber list to a table in our MySQL database. We want people to be able to opt in/out and control delivery options directly from our site in addition to via the email interface. I don't think Mailman ... | If you're looking for a mailing list package that can easily integrate with a MySQL database and allow subscribers to manage their preferences directly on your site, there are several options you can consider:
1. **PHPlist**:
- PHPlist is a well-known open-source mailing list manager that stores subscribers in a d... | 27,046 | [
{
"from": "human",
"value": "We need a mailing list package similar to Python Mailman. I'd use Mailman except for one thing: we want to link the subscriber list to a table in our MySQL database. We want people to be able to opt in/out and control delivery options directly from our site in addition to via th... |
I'm trying to write a tennis reservation system and I got stucked with this problem.
Let's say you have players with their prefs regarding court number, day and hour.
Also every player is ranked so if there is day/hour slot and there are several players
with preferences for this slot the one with top priority should be... | Designing a tennis reservation system with player preferences and rankings can be a complex task, but with the right approach, you can create an efficient and effective solution. Here are some steps and algorithms you can consider:
### Problem Breakdown
1. **Inputs**:
- A list of players, each with:
- A uniqu... | 24,573 | [
{
"from": "human",
"value": "I'm trying to write a tennis reservation system and I got stucked with this problem.\nLet's say you have players with their prefs regarding court number, day and hour.\nAlso every player is ranked so if there is day/hour slot and there are several players\nwith preferences for t... |
We have a need to take dozens of different protocols from systems such as security systems, fire alarms, camera systems etc.. and integrate them into a single common protocol.
I would like this to be a messaging server that many systems could subscribe to and or communicate through.
polling and non-polling "drivers" (... | Integrating various protocols from different systems into a single common messaging architecture is a complex task, and you have a few options to consider. Here are some thoughts on the tools and technologies you mentioned:
### 1. BizTalk Server
BizTalk is a robust integration platform from Microsoft that can handle d... | 23,114 | [
{
"from": "human",
"value": "We have a need to take dozens of different protocols from systems such as security systems, fire alarms, camera systems etc.. and integrate them into a single common protocol.\nI would like this to be a messaging server that many systems could subscribe to and or communicate thr... |
I read somewhere that NTP is based on UDP and there's no security built with NTP communication so it is easy to spoof NTP responses. Is it true? Wouldn't that be a major security issue since most of the servers out there depend on NTP to sync their clock?
| Yes, you are correct that the Network Time Protocol (NTP) primarily operates over the User Datagram Protocol (UDP), which does not provide inherent security features. This can lead to vulnerabilities, including the potential for spoofing NTP responses. Because NTP operates over UDP, it does not establish a connection o... | 26,449 | [
{
"from": "human",
"value": "I read somewhere that NTP is based on UDP and there's no security built with NTP communication so it is easy to spoof NTP responses. Is it true? Wouldn't that be a major security issue since most of the servers out there depend on NTP to sync their clock?\n"
},
{
"from":... |
I am invoking an external process by using System.Diagonistics.Process and passing two filenames as parameters. Now some time this process terminates due to exceptions and it seems that files handle are not being released by the process. How can i release the resources occupied by the process.
| When invoking an external process using `System.Diagnostics.Process`, it's important to handle the process correctly to ensure that resources such as file handles are released properly, even if the process terminates unexpectedly. Below are some best practices to help you manage external processes and handle resources ... | 23,028 | [
{
"from": "human",
"value": "I am invoking an external process by using System.Diagonistics.Process and passing two filenames as parameters. Now some time this process terminates due to exceptions and it seems that files handle are not being released by the process. How can i release the resources occupied ... |
We have developed a website that uses MVC, C#, and jQuery. In one of my controller classes we are validating inputs from the user and if it fails we throw an exception that the Ajax error parameter(aka option) handles. (We use Block UI to display the error message. BlockUI is a jQuery plugIn that blocks the screen and... | The difference in behavior between your local environment and the server regarding exception handling in an ASP.NET MVC application can be attributed to a few potential factors. Here are some things to investigate and try in order to identify and resolve the issue:
### 1. **Custom Error Handling in Web.config**
Check ... | 23,565 | [
{
"from": "human",
"value": "We have developed a website that uses MVC, C#, and jQuery. In one of my controller classes we are validating inputs from the user and if it fails we throw an exception that the Ajax error parameter(aka option) handles. (We use Block UI to display the error message. BlockUI is a... |
In a previous question, I learned how to keep a footer div at the bottom of the page. (see other question)
Now I'm trying to vertically center content between the header and footer divs.
so what I've got is:
#divHeader
{
height: 50px;
}
#divContent
{
position:absolute;
}
#divFooter
{
height: 50px;
pos... | To vertically center the content between a header and footer while keeping the footer at the bottom of the page, you'll want to make a few adjustments to your CSS. Instead of using `position: absolute`, which can complicate layout flow, you can use a flexbox approach for better alignment.
Here's how you can modify you... | 28,281 | [
{
"from": "human",
"value": "In a previous question, I learned how to keep a footer div at the bottom of the page. (see other question)\nNow I'm trying to vertically center content between the header and footer divs.\nso what I've got is:\n#divHeader\n{\n height: 50px;\n}\n\n#divContent\n{\n position:... |
I'm developing a shareware desktop application. I'm to the point where I need to implement the trial-use/activation code. How do you approach something like this? I have my own ideas, but I want to see what the stackoverflow community thinks.
I'm developing with C++/Qt. The intended platform is Windows/Mac/Linux.
Thank... | Implementing a trial-use and activation system for a shareware desktop application requires careful consideration of both user experience and security. Here are some common approaches and best practices for implementing a trial and activation system in C++/Qt for cross-platform applications:
### 1. **Trial Period Logi... | 20,975 | [
{
"from": "human",
"value": "I'm developing a shareware desktop application. I'm to the point where I need to implement the trial-use/activation code. How do you approach something like this? I have my own ideas, but I want to see what the stackoverflow community thinks.\nI'm developing with C++/Qt. The int... |
I'm trying to resize an embedded object. The issue is that when the mouse hovers over the object, it takes "control" of the mouse, swallowing up movement events. The result being that you can expand the div containing the object, but when you try to shrink it, if the mouse enters the area of the object the resize hal... | To achieve the desired functionality of resizing an embedded PDF while preventing it from capturing mouse events, you can use a transparent overlay div that sits above the iframe during the resize operation. This overlay will allow mouse events to pass through to the resizable div without being interrupted by the ifram... | 25,141 | [
{
"from": "human",
"value": "I'm trying to resize an embedded object. The issue is that when the mouse hovers over the object, it takes \"control\" of the mouse, swallowing up movement events. The result being that you can expand the div containing the object, but when you try to shrink it, if the mouse e... |
The XML I'm trying to validate is as follows:
<root>
<element attribute="foo">
<bar/>
</element>
<element attribute="hello">
<world/>
</element>
</root>
How can this be validated using a Schema?
Note:
element can only contain bar when attribute="foo".
element can only contain world when... | To validate your XML structure with the specified rules using XML Schema (XSD), you can create an XSD file that defines the constraints on the `<element>` based on its `attribute`.
Here's an example of an XSD schema that accomplishes this:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www... | 26,164 | [
{
"from": "human",
"value": "The XML I'm trying to validate is as follows:\n<root>\n <element attribute=\"foo\">\n <bar/>\n </element>\n <element attribute=\"hello\">\n <world/>\n </element>\n</root>\n\nHow can this be validated using a Schema?\nNote:\nelement can only contain bar ... |
I'm not very experienced at using ASP.NET, but I've used built in membership providers for simple WebForms application, and I found them PITA when trying to extend the way they work (add/remove few fields and redo controls accordingly).
Now I'm preparing for MVC (ASP.NET MVC or Monorail based) project, and I'm thinking... | When developing an ASP.NET MVC application, you have several options for handling user authentication and authorization. While the built-in ASP.NET membership provider can work, it often becomes cumbersome when you need to extend functionality or customize user data. Here are some alternatives and best practices for ha... | 24,162 | [
{
"from": "human",
"value": "I'm not very experienced at using ASP.NET, but I've used built in membership providers for simple WebForms application, and I found them PITA when trying to extend the way they work (add/remove few fields and redo controls accordingly).\nNow I'm preparing for MVC (ASP.NET MVC or... |
Given the following:
#light
//any function returning bool * 'a
let foo =
let x = ref 10
fun () ->
x := !x - 1
if !x <> 0 then
(true, x)
else
(false, x)
while let (c,x) = foo() in c do print_any x;//can't access x, but would be convinent.
//this is how I want it ... | In F#, the way you are trying to access `x` in the `while` loop leads to some scoping issues because `x` is a reference, and you cannot directly use `x` after the `while` condition. You already have a good idea with the `loop` function which abstracts away the recursive calling.
If you want to continue with your `foo`... | 25,023 | [
{
"from": "human",
"value": "Given the following:\n#light\n//any function returning bool * 'a\nlet foo =\n let x = ref 10\n fun () ->\n x := !x - 1\n if !x <> 0 then\n (true, x)\n else\n (false, x)\n\nwhile let (c,x) = foo() in c do print_any x;//can't access... |
I have a rich-text editor on my site that I'm trying to protect against XSS attacks. I think I have pretty much everything handled, but I'm still unsure about what to do with images. Right now I'm using the following regex to validate image URLs, which I'm assuming will block inline javascript XSS attacks:
"https?://... | You're correct to be cautious about XSS vulnerabilities when allowing users to input URLs for images in a rich-text editor. While your regex is a start, relying solely on regex for validation can be misleading and potentially insecure. Here are some key considerations and recommendations regarding image URLs and XSS pr... | 26,055 | [
{
"from": "human",
"value": "I have a rich-text editor on my site that I'm trying to protect against XSS attacks. I think I have pretty much everything handled, but I'm still unsure about what to do with images. Right now I'm using the following regex to validate image URLs, which I'm assuming will block in... |
I've noticed that the wmd editor can either output HTML or markdown. Does it make more sense to store the user input (in a database) as markdown or HTML? If as markdown, what is the best way to display it on a webpage later on (any examples would be greatly appreciated).
Given that the recommendation is store it as mar... | When deciding whether to store user input as Markdown or HTML in a database, it generally makes more sense to store it as Markdown. Here are some reasons why:
### Reasons to Store as Markdown
1. **Simplicity and Safety**: Markdown is simpler and less prone to security risks such as XSS (Cross-Site Scripting) attacks,... | 26,872 | [
{
"from": "human",
"value": "I've noticed that the wmd editor can either output HTML or markdown. Does it make more sense to store the user input (in a database) as markdown or HTML? If as markdown, what is the best way to display it on a webpage later on (any examples would be greatly appreciated).\nGiven ... |
My application connects to an FTP server with a username and password. I can create an encryption routine to encrypt and decrypt the password, but anybody with access to the source code and the encrypted password can decrypt the password.
Is there an easy way to prevent every human being from knowing the entire passwo... | To address the challenge of protecting sensitive credentials like passwords in your application, consider the following strategies that can help mitigate the risk of human access to the entire password:
### 1. **Secret Management Tools**
Use a dedicated secret management solution. Tools like HashiCorp Vault, AWS Secre... | 16,997 | [
{
"from": "human",
"value": "My application connects to an FTP server with a username and password. I can create an encryption routine to encrypt and decrypt the password, but anybody with access to the source code and the encrypted password can decrypt the password.\nIs there an easy way to prevent every ... |
I have a database for a web application that is home to some personal information about my users.
What should I do to make sure the data is secure?
Encrypting the data makes sense, of course... but what about stopping somebody from getting on the machine to begin with?
What do I do about the developers that need access... | Securing a database that contains personal information is crucial for protecting user data and maintaining trust. Here are some best practices for securing your database and the environment it operates in:
### 1. **Database Security**
- **Encryption**:
- Use encryption for data at rest and in transit. For data at r... | 23,242 | [
{
"from": "human",
"value": "I have a database for a web application that is home to some personal information about my users.\nWhat should I do to make sure the data is secure?\nEncrypting the data makes sense, of course... but what about stopping somebody from getting on the machine to begin with?\nWhat d... |
EDIT: See my working code in the answers below.
In brief: I have a JSP file which calls a method in a Java Bean. This method creates a PDF file and in theory, returns it to the JSP so that the user can download it. However, upon loading the PDF, Adobe Reader gives the error: File does not begin with '%PDF-'.
In detail... | The issue you're facing stems from the way you're handling the output of the PDF file in your JSP. While your method is correctly creating the PDF file on the file system, you're not sending the content of the PDF file back to the client correctly through the JSP.
To address this, you need to modify your JSP to direc... | 26,642 | [
{
"from": "human",
"value": "EDIT: See my working code in the answers below.\n\nIn brief: I have a JSP file which calls a method in a Java Bean. This method creates a PDF file and in theory, returns it to the JSP so that the user can download it. However, upon loading the PDF, Adobe Reader gives the error: ... |
I need to compare the integer part of two doubles for inequality and I'm currently doing this:
int iA = (int)dA;
int iB = (int)dB;
if( iA != iB )
{
...
}
but I wonder if there's a better approach than this.
Thanks.
If I used Math.Truncate() instead of a cast to int, would it still be accurate to compare the two r... | Your current approach of casting the `double` values to `int` to compare their integer parts is straightforward and works correctly as long as the range of the values falls within the limits of the `int` type. However, it's important to note that casting from `double` to `int` simply truncates the fractional part witho... | 28,260 | [
{
"from": "human",
"value": "I need to compare the integer part of two doubles for inequality and I'm currently doing this:\nint iA = (int)dA;\nint iB = (int)dB;\n\nif( iA != iB )\n{\n ...\n}\n\nbut I wonder if there's a better approach than this.\nThanks.\nIf I used Math.Truncate() instead of a cast to ... |
after hours of searching on the net I'm quite desperate to find solution for this. I've up & running OGG Theora decoder in DirectShow which ouputs YV12 and YUY2 color models.
Now, I want to make a RGB pixel manipulation filter for this output and to process it into video renderer.
According to this and
this, it shoul... | It sounds like you're encountering issues with the DirectShow filter graph when working with YV12 output from your OGG Theora decoder. Here are some suggestions and considerations that may help you resolve this:
1. **Check the Supported Media Types**: Ensure that your RGB pixel manipulation filter is correctly set up ... | 27,111 | [
{
"from": "human",
"value": "after hours of searching on the net I'm quite desperate to find solution for this. I've up & running OGG Theora decoder in DirectShow which ouputs YV12 and YUY2 color models. \nNow, I want to make a RGB pixel manipulation filter for this output and to process it into video rende... |
I have a large xml document that needs to be processed 100 records at a time
It is being done within a Windows Service written in c#.
The structure is as follows :
<docket xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="docket.xsd">
<order>
<Date>2008-10-13</Date>
... | Yes, you can process a large XML document in chunks of 100 orders, while maintaining the original structure and namespace. Below is an example of how you could implement this in C# using `System.Xml.Linq` to read the XML and create new XML documents for each chunk.
First, you'll need to load the XML document, then gro... | 26,360 | [
{
"from": "human",
"value": "I have a large xml document that needs to be processed 100 records at a time\nIt is being done within a Windows Service written in c#. \nThe structure is as follows :\n<docket xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"docket.xsd\">\n... |
I'm just writing some code that enables the SeDebug privilege in Windows, using AdjustTokenPrivileges. The token came from OpenProcessToken; OpenThreadToken only returns a token if impersonating.
A couple of things occur to me:
What's the scope of the token? Is it per-process, or per-thread? If I enable a privilege, i... | In Windows, the scope of a security token is generally per process. When you obtain a token using `OpenProcessToken`, you get a handle to a process token that is associated with the entire process. When you enable or disable a privilege using `AdjustTokenPrivileges`, the changes you make to the token will affect the pr... | 26,376 | [
{
"from": "human",
"value": "I'm just writing some code that enables the SeDebug privilege in Windows, using AdjustTokenPrivileges. The token came from OpenProcessToken; OpenThreadToken only returns a token if impersonating.\nA couple of things occur to me:\n\nWhat's the scope of the token? Is it per-proces... |
I have a query:
UPDATE choices SET votes = votes + 1 WHERE choice_id = '$user_choice'
But when I execute it in my script, the votes field is updated twice, so the votes will go from 4 to 6 instead to 5. It doesn't seem that it is getting called twice because I echo out stuff to test this and only get one echo. Is there... | The issue you're experiencing, where the `votes` field is being updated more than once with each page refresh, could be caused by several factors, including:
1. **Form Resubmission:** If you have a form that submits the vote, refreshing the page might be causing the form to be submitted multiple times. This could happ... | 26,283 | [
{
"from": "human",
"value": "I have a query:\nUPDATE choices SET votes = votes + 1 WHERE choice_id = '$user_choice'\nBut when I execute it in my script, the votes field is updated twice, so the votes will go from 4 to 6 instead to 5. It doesn't seem that it is getting called twice because I echo out stuff t... |
I have the following problem using template instantiation [*].
file foo.h
class Foo
{
public:
template <typename F>
void func(F f)
private:
int member_;
};
file foo.cc
template <typename F>
Foo::func(F f)
{
f(member_);
}
file caller.cc
Foo::func(boost::bind(&Bar::bar_func, bar_instance, _1));
Whil... | The issue you are encountering is due to the way C++ handles template instantiation. When you define a templated member function in a source file (like `foo.cc`), the compiler does not automatically instantiate the function unless it has been explicitly called with a specific template parameter. This is why you are get... | 25,826 | [
{
"from": "human",
"value": "I have the following problem using template instantiation [*]. \nfile foo.h\nclass Foo\n{\npublic:\n template <typename F>\n void func(F f)\n\nprivate:\n int member_;\n};\n\nfile foo.cc\ntemplate <typename F>\nFoo::func(F f)\n{\n f(member_);\n}\n\nfile caller.cc\nFo... |
I'm currently logging via the simplest of methods within my servlet using Tomcat. I use the ServletConfig.getServletContext().log to record activity. This writes to the localhost.YYYY-MM-DD.log in $TOMCAT_HOME/logs.
I don't want to get away from the simplicity of this logging mechanism unless absolutely necessary. B... | The `ServletContext.log()` method does write to the default Tomcat logs using the configured logging system, and as you noted, it writes to files named after the hostname (usually `localhost`).
If you want to change the name of the log file without adopting a complete logging framework, you have a couple of options. B... | 27,280 | [
{
"from": "human",
"value": "I'm currently logging via the simplest of methods within my servlet using Tomcat. I use the ServletConfig.getServletContext().log to record activity. This writes to the localhost.YYYY-MM-DD.log in $TOMCAT_HOME/logs.\nI don't want to get away from the simplicity of this logging... |
Is it possible to reload a page that was loaded thru link_to_remote? I'm doing this in my controller:
def create
if captchas_verified
do_something
else
render :action=>'new'
end
But when the captchas is wrong, it do not render a form that is inside of the new template. By the way, in the webserver log, it shows... | It sounds like you're working with Rails and trying to handle some AJAX functionality with `link_to_remote`. When dealing with AJAX requests, rendering the full page (like you would normally do in a regular request) doesn't automatically update the client-side view, as the request is handled asynchronously.
From your ... | 24,770 | [
{
"from": "human",
"value": "Is it possible to reload a page that was loaded thru link_to_remote? I'm doing this in my controller: \ndef create\n if captchas_verified\n do_something\n else\n render :action=>'new'\nend\n\nBut when the captchas is wrong, it do not render a form that is inside of the new tem... |
I have the following HTML node structure:
<div id="foo">
<div id="bar"></div>
<div id="baz">
<div id="biz"></div>
</div>
<span></span>
</div>
How do I count the number of immediate children of foo, that are of type div? In the example above, the result should be two (bar and baz).
| To count the number of immediate children of the `<div id="foo">` that are of type `<div>`, you can use JavaScript. Here's how you can do it:
```javascript
// Get the element with id 'foo'
const foo = document.getElementById('foo');
// Get all immediate children of 'foo'
const children = foo.children;
// Initialize ... | 26,579 | [
{
"from": "human",
"value": "I have the following HTML node structure:\n<div id=\"foo\">\n <div id=\"bar\"></div>\n <div id=\"baz\">\n <div id=\"biz\"></div>\n </div>\n <span></span>\n</div>\n\nHow do I count the number of immediate children of foo, that are of type div? In the example above, the res... |
Is there any way to define what the "Open Resource" dialog in Eclipse should show?
If you work with svn you don't want the *.svn files to show up. (I know there is a fix out for this one but does there exist a more general one?)
| In Eclipse, the "Open Resource" dialog can indeed be customized to filter out certain file types and resources, including `.svn` files. Here’s how you can define what the dialog should show:
### 1. Excluding Specific File Types
You can configure file filters within Eclipse to exclude certain types of files, including... | 29,135 | [
{
"from": "human",
"value": "Is there any way to define what the \"Open Resource\" dialog in Eclipse should show?\nIf you work with svn you don't want the *.svn files to show up. (I know there is a fix out for this one but does there exist a more general one?)\n"
},
{
"from": "gpt",
"value": "In... |
Is there an easy way to generate a PDF report from an RDL that's been uploaded to Report Manager and put that file somewhere on the server's disk? I already have a location on disk to put the file, I just need to know how to programmatically generate the PDF. This is for SQL Server 2005 Reporting Services. Code in eith... | To generate a PDF report from an RDL file uploaded to SQL Server 2005 Reporting Services (SSRS) and save it to a specific location on your server, you can use the ReportExecutionService web service provided by SSRS. Here's a step-by-step guide and example code in C# to accomplish this.
### Steps
1. **Add a Reference ... | 23,186 | [
{
"from": "human",
"value": "Is there an easy way to generate a PDF report from an RDL that's been uploaded to Report Manager and put that file somewhere on the server's disk? I already have a location on disk to put the file, I just need to know how to programmatically generate the PDF. This is for SQL Ser... |
On the MSVC++ compiler, one can use the __int8, __int16, __int32 and similar types for integers with specific sizes. This is extremely useful for applications which need to work with low-level data structures like custom file formats, hardware control data structures and the like.
Is there a similar equivalent I can us... | Yes, in GCC (GNU Compiler Collection), you can use the standard integer types defined in the `<stdint.h>` header for fixed-width integer types. These types are part of the C99 standard and provide a way to declare integer types with specific sizes, which is very useful for low-level programming, similar to MSVC++'s `__... | 29,354 | [
{
"from": "human",
"value": "On the MSVC++ compiler, one can use the __int8, __int16, __int32 and similar types for integers with specific sizes. This is extremely useful for applications which need to work with low-level data structures like custom file formats, hardware control data structures and the lik... |
I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck.
I read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct?
If not can anybody point me in the right direction using sql?
UPDAT... | The issue you're encountering with updating a column in a MySQL table from another table can typically be resolved, as MySQL does support multi-table updates. Your original attempts seem to follow the correct logic but might be encountering issues due to MySQL version limitations or syntax errors.
**Option 1: Single U... | 27,011 | [
{
"from": "human",
"value": "I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck. \nI read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct?\nIf not can anybody point ... |
I want to show the publish date in the About dialog.
| To show the publish date in an About dialog for a software application, you will need to follow a few steps depending on the programming language and framework you are using. Below are some general steps you can follow, along with a specific example using Python with Tkinter.
### General Steps
1. **Determine the Publ... | 24,212 | [
{
"from": "human",
"value": "I want to show the publish date in the About dialog.\n"
},
{
"from": "gpt",
"value": "To show the publish date in an About dialog for a software application, you will need to follow a few steps depending on the programming language and framework you are using. Below ... |
I need a well tested Regular Expression (.net style preferred), or some other simple bit of code that will parse a USA/CA phone number into component parts, so:
3035551234122
1-303-555-1234x122
(303)555-1234-122
1 (303) 555 -1234-122
etc...
all parse into:
AreaCode: 303
Exchange: 555
Suffix: 1234
Extension: 122
| You can use a regular expression to parse various formats of USA/CA phone numbers and extract the area code, exchange, suffix, and extension. Below is an example of a regex pattern in C# that accomplishes this:
```csharp
using System;
using System.Text.RegularExpressions;
class Program
{
static void Main()
{
... | 23,937 | [
{
"from": "human",
"value": "I need a well tested Regular Expression (.net style preferred), or some other simple bit of code that will parse a USA/CA phone number into component parts, so:\n\n3035551234122\n1-303-555-1234x122\n(303)555-1234-122\n1 (303) 555 -1234-122\n\netc...\nall parse into:\n\nAreaCode:... |
I could use some advice on tracking down the cause of memory leaks in C#. I understand what is a memory leak and I get why they occur in C# but I'm wondering what tools/strategies have you used in the past to resolve them?
I am using .NET Memory Profiler and I've found that one of my huge main objects is staying in mem... | Tracking down and resolving memory leaks in C# can indeed be challenging. Here are some strategies and tools you can use, including additional information that can help you resolve your specific issue with the memory profiler:
### Tools and Techniques
1. **Visual Studio Diagnostic Tools**:
- Use the built-in Diagn... | 25,733 | [
{
"from": "human",
"value": "I could use some advice on tracking down the cause of memory leaks in C#. I understand what is a memory leak and I get why they occur in C# but I'm wondering what tools/strategies have you used in the past to resolve them?\nI am using .NET Memory Profiler and I've found that one... |
I have a Page that has a single instance of a UserControl that itself has a single UpdatePanel. Inside the UpdatePanel are several Button controls. The Click event for these controls are wired up in the code-behind, in the Init event of the UserControl.
I get the Click event for the first button I push, every time, n... | The issue you're encountering, where only the `SearchButton` Click event is getting processed after the first button click, often stems from how the controls are being added to the event handlers in the `Page_Init` method. There are a few things you might consider checking and modifying in your code:
### 1. Ensure All... | 25,905 | [
{
"from": "human",
"value": "I have a Page that has a single instance of a UserControl that itself has a single UpdatePanel. Inside the UpdatePanel are several Button controls. The Click event for these controls are wired up in the code-behind, in the Init event of the UserControl.\nI get the Click event ... |
I have the following layout for my test suite:
TestSuite1.cmd:
Run my program
Check its return result
If the return result is not 0, convert the error to textual output and abort the script. If it succeeds, write out success.
In my single .cmd file, I call my program about 10 times with different input.
The problem ... | Yes, you can achieve parallel execution of your program in a `.cmd` file by using the `start` command to spawn new processes for each invocation of your program. Here's a sample structure that illustrates how to do this:
### TestSuite1.cmd
```cmd
@echo off
setlocal
rem Define the output file
set "outputFile=output.t... | 25,375 | [
{
"from": "human",
"value": "I have the following layout for my test suite:\nTestSuite1.cmd:\n\nRun my program\nCheck its return result\nIf the return result is not 0, convert the error to textual output and abort the script. If it succeeds, write out success.\n\nIn my single .cmd file, I call my program a... |
The new Vista Audio subsystem is set up to be a chain of devices starting with the inputs, going through all the various controls (like mixers and volumen controls) and then ending up at various endpoints (like speakers or headphones).
My question is: Is there a tool out there that will show all the endpoints devices i... | Yes, there are tools available that can help you visualize and manage audio devices and their connections within the Vista Audio subsystem.
1. **Windows Device Manager**: While not a dedicated audio tool, Device Manager provides an overview of all the audio devices connected to your system. You can view properties for... | 30,116 | [
{
"from": "human",
"value": "The new Vista Audio subsystem is set up to be a chain of devices starting with the inputs, going through all the various controls (like mixers and volumen controls) and then ending up at various endpoints (like speakers or headphones).\nMy question is: Is there a tool out there ... |
I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it?
I am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but not defined (or spelled differently) in the web.xml file.
| Yes, you can retrieve the complete list of security roles defined in the `web.xml` file in Java, although it requires a bit of work since the standard Servlet API does not directly provide a method to list all defined roles. You will need to access the `ServletContext` to read the deployment descriptor (the `web.xml`).... | 19,280 | [
{
"from": "human",
"value": "I was wondering if it would be possible to retrieve the complete list of security roles defined in a web.xml file in the java code? And if so how to do it?\nI am aware of the 'isUserInRole' method but I also want to handle cases where a role is requested but not defined (or spel... |
Is there a way I can control columns from code.
I had a drop drop box with select : Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday.
If the user selects Daily i want to show columns only from Monday to Friday.
It is possible to control from the code. Oh i a... | Yes, you can control the visibility of columns in a GridView based on user selections in a dropdown (DropDownList) in an ASP.NET Web Forms application. Here is a step-by-step guide to achieve this using C#.
### Step 1: Set Up Your Web Form
Assume you have a DropDownList for selecting "Daily" or "Weekend" and a GridVi... | 22,041 | [
{
"from": "human",
"value": "Is there a way I can control columns from code. \nI had a drop drop box with select : Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday. \nIf the user selects Daily i want to show columns only from Monday to Friday.\nIt ... |
After moving a project from .NET 1.1 to .NET 2.0, MsBuild emits lots of warnings for some COM objects.
Sample code for test (actual code doesn't matter, just used to create the warnings):
using System;
using System.DirectoryServices;
using ActiveDs;
namespace Test
{
public class Class1
{
public static v... | The warnings you're encountering when migrating from .NET 1.1 to .NET 2.0 are related to the marshaling of COM types. When using COM interop in .NET, certain types need special handling for them to be marshaled correctly between managed and unmanaged code. The specific warning message indicates that some of the paramet... | 28,763 | [
{
"from": "human",
"value": "After moving a project from .NET 1.1 to .NET 2.0, MsBuild emits lots of warnings for some COM objects.\nSample code for test (actual code doesn't matter, just used to create the warnings):\nusing System;\nusing System.DirectoryServices;\nusing ActiveDs;\nnamespace Test\n{\n p... |
My team developed a GUI application on Visual Studio 2005, managed C++. Since some deliveries it is not possible to open the form in the designer, even if the source code and the project settings have not been changed. The designer reports this error:
Exception of type 'System.OutOfMemoryException' was thrown.
at Mic... | The `System.OutOfMemoryException` error when trying to open a form in the designer can be quite frustrating, especially when the project appears to be functioning normally otherwise. Here are some troubleshooting steps and potential solutions that might help resolve the issue:
1. **Restart Visual Studio**: Sometimes, ... | 26,478 | [
{
"from": "human",
"value": "My team developed a GUI application on Visual Studio 2005, managed C++. Since some deliveries it is not possible to open the form in the designer, even if the source code and the project settings have not been changed. The designer reports this error: \nException of type 'System... |
What's the fastest way to get a framebuffer and render to in software on the iPhone?
Basically getting into a mode 13h style thing going so I can make some effects? :)
| Rendering to a framebuffer in software on iOS can be accomplished using a few different methods. However, it's important to note that iOS doesn't support a direct equivalent to the DOS graphics mode 13h, but you can achieve similar results through the use of lower-level graphics APIs or by using a higher-level framewor... | 25,290 | [
{
"from": "human",
"value": "What's the fastest way to get a framebuffer and render to in software on the iPhone?\nBasically getting into a mode 13h style thing going so I can make some effects? :)\n"
},
{
"from": "gpt",
"value": "Rendering to a framebuffer in software on iOS can be accomplished... |
An older application using System.Web.Mail is throwing an exception on emails coming from hr@domain.com. Other addresses appear to be working correctly. We changed our mail server to Exchange 2007 when the errors started, so I assume that is where the problem is. Does anyone know what is happening?
Here is the exceptio... | The error you are experiencing indicates that there is a problem with the email sending process in your older application when sending emails specifically from `hr@domain.com`. The error message `The transport lost its connection to the server` can have several underlying causes, especially after a migration to a new m... | 23,938 | [
{
"from": "human",
"value": "An older application using System.Web.Mail is throwing an exception on emails coming from hr@domain.com. Other addresses appear to be working correctly. We changed our mail server to Exchange 2007 when the errors started, so I assume that is where the problem is. Does anyone kno... |
One small function of a large program examines assemblies in a folder and replaces out-of-date assemblies with the latest versions. To accomplish this, it needs to read the version numbers of the existing assembly files without actually loading those assemblies into the executing process.
| To read the version numbers of assembly files in a folder without loading them into the executing process, you can use the `System.Reflection.AssemblyName` class in .NET. This allows you to inspect the assembly's metadata. Here is a sample function in C# that examines all the DLL files in a specified directory and retr... | 29,054 | [
{
"from": "human",
"value": "One small function of a large program examines assemblies in a folder and replaces out-of-date assemblies with the latest versions. To accomplish this, it needs to read the version numbers of the existing assembly files without actually loading those assemblies into the executi... |
I've got a relatively large .Net system that consists of a number of different applications. Rather than having lots of different app.config files, I would like to share a single configuration file between all the apps.
I would also like to have one version when developing on my machine, one version for someone else de... | Yes, you can effectively manage a single configuration file across multiple .NET applications while maintaining different configurations for various environments (development, testing, live, etc.). Here’s a common approach to achieve this:
### Steps to Share a Configuration File
1. **Create a Central Configuration Fi... | 19,327 | [
{
"from": "human",
"value": "I've got a relatively large .Net system that consists of a number of different applications. Rather than having lots of different app.config files, I would like to share a single configuration file between all the apps.\nI would also like to have one version when developing on m... |
I am using a navigation controller, and I have the style set to :
navController.navigationBar.barStyle = UIBarStyleBlackTranslucent;
But when I run my program, the navigation controller looks like it is on top of a white background, not my background. When I push a controller, left or right, all my view, the current o... | It sounds like you're experiencing an issue with the layout of your views when using a translucent navigation bar. When you set the `navigationBar.barStyle` to `UIBarStyleBlackTranslucent`, it makes the navigation bar translucent, allowing the content beneath it to show through. However, this can lead to some layout is... | 26,040 | [
{
"from": "human",
"value": "I am using a navigation controller, and I have the style set to :\nnavController.navigationBar.barStyle = UIBarStyleBlackTranslucent;\n\nBut when I run my program, the navigation controller looks like it is on top of a white background, not my background. When I push a controlle... |
I'm inspired by the C/C++ question for a code flow visualization tool.
Is there such a thing for Java servlets or applications?
| Yes, there are several tools and techniques available for visualizing the code flow of Java servlets and applications. While some tools are specifically designed for Java, others can be adapted to work with Java-based web applications. Here are some options you might consider:
1. **IntelliJ IDEA**:
- IntelliJ IDEA ... | 27,798 | [
{
"from": "human",
"value": "I'm inspired by the C/C++ question for a code flow visualization tool.\nIs there such a thing for Java servlets or applications?\n"
},
{
"from": "gpt",
"value": "Yes, there are several tools and techniques available for visualizing the code flow of Java servlets and ... |
What's the best way to perform a deep copy in the constructor of an object that is part of multi-threaded C++ code?
| Performing a deep copy in a multi-threaded C++ environment requires careful consideration of thread safety and object ownership. Here are some best practices and techniques to ensure that your deep copy is performed correctly:
### Best Practices for Deep Copy in Multi-threaded C++
1. **Use Copy Constructors and Assig... | 20,818 | [
{
"from": "human",
"value": "What's the best way to perform a deep copy in the constructor of an object that is part of multi-threaded C++ code?\n"
},
{
"from": "gpt",
"value": "Performing a deep copy in a multi-threaded C++ environment requires careful consideration of thread safety and object ... |
I suppose this question is a variation on a theme, but different.
Torrents will never replace HTTP, or even FTP download options. This said, why aren't there torrent links next to those options on more websites?
I'm imagining a web-system whereby downloaded files are able to be downloaded via HTTP, say from http://exam... | Your idea for combining HTTP and BitTorrent for file delivery is quite interesting and has potential benefits. While I can't point to a specific widespread implementation that matches your exact vision, there are several factors to consider regarding the adoption of such systems and whether they exist in practice.
###... | 27,242 | [
{
"from": "human",
"value": "I suppose this question is a variation on a theme, but different.\nTorrents will never replace HTTP, or even FTP download options. This said, why aren't there torrent links next to those options on more websites?\nI'm imagining a web-system whereby downloaded files are able to b... |
I have a question with fluent interfaces.
We have some objects that are used as parameter objects for a SQL interface, here's an example:
using (DatabaseCommand cmd = conn.CreateCommand(
"SELECT A, B, C FROM tablename WHERE ID = :ID",
SqlParameter.Int32(":ID", 1234)))
{
...
}
For some of these parameters, ... | You're tackling a common issue in designing fluent interfaces, especially when it comes to method chaining and creating a clean and expressive API. Your exploration of different approaches demonstrates a solid understanding of the principles of fluent interfaces, but let's clarify some points and provide direction.
##... | 24,173 | [
{
"from": "human",
"value": "I have a question with fluent interfaces.\nWe have some objects that are used as parameter objects for a SQL interface, here's an example:\nusing (DatabaseCommand cmd = conn.CreateCommand(\n \"SELECT A, B, C FROM tablename WHERE ID = :ID\",\n SqlParameter.Int32(\":ID\", 12... |
In our code we used to have something like this:
*(controller->bigstruct) = ( struct bigstruct ){ 0 };
This used to work great, and then we upgraded versions of GCC and suddenly started seeing stack overflows. Looking at the assembly, the old GCC code (2.x) was basically doing this:
memset(controller->bigstruct, 0,... | Your situation highlights a common challenge in initializing large structures in C, especially given changes in compiler behavior with new standards. As you've noted, directly assigning an anonymous structure to a pointer can lead to unwanted behavior due to stack overflow when the structure is large. Here are a few st... | 25,812 | [
{
"from": "human",
"value": "In our code we used to have something like this:\n *(controller->bigstruct) = ( struct bigstruct ){ 0 };\n\nThis used to work great, and then we upgraded versions of GCC and suddenly started seeing stack overflows. Looking at the assembly, the old GCC code (2.x) was basically ... |
Can someone suggest a good module in perl which can be used to store collection of objects?
Or is ARRAY a good enough substitute for most of the needs?
Update:
I am looking for a collections class because I want to be able to do an operation like compute collection level property from each element.
Since I need to perf... | In Perl, you have several options for managing collections of objects, especially if you're looking for more advanced functionality than what arrays (or hashes) provide. Here are some options that might suit your needs:
### 1. **List::Util**
While it's not a dedicated collection class, the `List::Util` module provide... | 23,416 | [
{
"from": "human",
"value": "Can someone suggest a good module in perl which can be used to store collection of objects?\nOr is ARRAY a good enough substitute for most of the needs?\nUpdate:\nI am looking for a collections class because I want to be able to do an operation like compute collection level prop... |
I have an SQLite table that contains a BLOB I need to do a size/length check on. How do I do that?
According to documentation length(blob) only works on texts and will stop counting after the first NULL. My tests confirmed this. I'm using SQLite 3.4.2.
| In SQLite, if you want to get the size or length of a BLOB, you can use the `LENGTH()` function. However, as you pointed out, the `LENGTH()` function behaves differently with BLOBs and may stop counting at the first NULL if you use it in a context that interprets it as text.
To correctly get the size of a BLOB without... | 29,783 | [
{
"from": "human",
"value": "I have an SQLite table that contains a BLOB I need to do a size/length check on. How do I do that?\nAccording to documentation length(blob) only works on texts and will stop counting after the first NULL. My tests confirmed this. I'm using SQLite 3.4.2.\n"
},
{
"from": "... |
I have a PHP client that requests an XML file over HTTP (i.e. loads an XML file via URL). As of now, the XML file is only several KB in size. A problem I can foresee is that the XML becomes several MBs or Gbs in size. I know that this is a huge question and that there are probably a myriad of solutions, but What ide... | When dealing with the transfer of large XML files over HTTP, there are several strategies you can employ to efficiently transport the data without overwhelming the client or server resources. Here are some approaches you might consider:
### 1. **Pagination or Chunking:**
- **Divide the Data**: Instead of transferri... | 25,110 | [
{
"from": "human",
"value": "I have a PHP client that requests an XML file over HTTP (i.e. loads an XML file via URL). As of now, the XML file is only several KB in size. A problem I can foresee is that the XML becomes several MBs or Gbs in size. I know that this is a huge question and that there are pro... |
I have a Server 2003 box with about 6 sites that each have about 15-20 host headers.
Is there a tool out there that will copy all the host header records and automatically move them to the new server so I don't have to manually enter each host header again in the new server?
Thanks.
| Migrating host headers from a Windows Server 2003 IIS environment to a newer version of IIS can be a bit challenging, but there are tools and methods available to make this process easier. Here are some options you can consider:
### 1. **Metabase Migration**
Windows Server 2003 uses the IIS metabase to store configur... | 27,557 | [
{
"from": "human",
"value": "I have a Server 2003 box with about 6 sites that each have about 15-20 host headers.\nIs there a tool out there that will copy all the host header records and automatically move them to the new server so I don't have to manually enter each host header again in the new server?\nT... |
I have a table that looks something like this:
word big expensive smart fast
dog 9 -10 -20 4
professor 2 4 40 -7
ferrari 7 50 0 48
alaska 10 0 1 0
gnat -3 0 0 0
The + and - values are as... | To achieve the goal of analyzing the data in your table, we'll start by outlining the steps needed to calculate the required values and their proportions, followed by an example using Python. We'll also outline how to format the output based on the results.
### Steps to Analyze the Data
1. **Calculate the Absolute Va... | 25,157 | [
{
"from": "human",
"value": "I have a table that looks something like this:\n\nword big expensive smart fast\n\ndog 9 -10 -20 4\nprofessor 2 4 40 -7\nferrari 7 50 0 48\nalaska 10 0 1 0\ngnat -3 ... |
Windbg fans claim that it is quite powerful and I tend to agree. But when it comes to debugging STL containers, I am always stuck. If the variable is on the stack, the !stl extension sometimes figures it out, but when a container with a complex type (e.g. std::vector<TemplateField, std::allocator<TemplateField> >) is o... | Debugging STL containers in WinDbg can be challenging, especially when dealing with complex types and heap-allocated containers. Here are some tips and pointers to help you debug STL containers like `std::vector` effectively:
### 1. **Use the STL Extension (`!stl`)**:
The `!stl` extension can be quite powerful when us... | 25,786 | [
{
"from": "human",
"value": "Windbg fans claim that it is quite powerful and I tend to agree. But when it comes to debugging STL containers, I am always stuck. If the variable is on the stack, the !stl extension sometimes figures it out, but when a container with a complex type (e.g. std::vector<TemplateFie... |
I'm building an application in Java to retrieve data from MySQL database. After executing a query I get a ResultSet and do the following to extract records:
while (rs.next())
{
for (int column = 1; column <= rm.getColumnCount(); column++) {
row.add(rs.getObject(column));
... | The issue you're encountering stems from how you're managing the `row` variable in your code. When you call `row.clear()`, you're clearing the `ArrayList` instance that you use to collect the column values of each record. The `row` variable should be a new instance for each record you want to add to the `result` list.
... | 26,111 | [
{
"from": "human",
"value": "I'm building an application in Java to retrieve data from MySQL database. After executing a query I get a ResultSet and do the following to extract records:\nwhile (rs.next())\n {\n for (int column = 1; column <= rm.getColumnCount(); column++) {\n ... |
This is the PATH variable without sudo:
$ echo 'echo $PATH' | sh
/opt/local/ruby/bin:/usr/bin:/bin
This is the PATH variable with sudo:
$ echo 'echo $PATH' | sudo sh
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin
As far as I can tell, sudo is supposed to leave PATH untouched. What's goin... | The behavior you're observing with `sudo` is due to how it manages the environment variables, including `PATH`. While it's true that `sudo` is designed to preserve the environment variables of the user invoking it, there are important nuances in how `PATH` is handled, particularly in certain configurations.
In Ubuntu,... | 28,030 | [
{
"from": "human",
"value": "This is the PATH variable without sudo:\n$ echo 'echo $PATH' | sh \n/opt/local/ruby/bin:/usr/bin:/bin\n\nThis is the PATH variable with sudo:\n$ echo 'echo $PATH' | sudo sh\n/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin\n\nAs far as I can tell, sudo... |
With the jQuery datepicker, how does one change the year range that is displayed? On the jQuery UI site it says the default is "10 years before and after the current year are shown". I want to use this for a birthday selection and 10 years before today is no good. Can this be done with the jQuery datepicker or will ... | Yes, you can definitely customize the year range displayed by the jQuery datepicker. To change the year range that is displayed, you can use the `changeYear` option in combination with the `yearRange` option.
You can set the `yearRange` to any value you prefer. For example, if you want to allow users to select a year... | 29,317 | [
{
"from": "human",
"value": "With the jQuery datepicker, how does one change the year range that is displayed? On the jQuery UI site it says the default is \"10 years before and after the current year are shown\". I want to use this for a birthday selection and 10 years before today is no good. Can this ... |
How do I broadcast a message from a single source to all nodes, and from multiple sources to all nodes?
Are there any libraries in java that may help?
| To broadcast messages from a single source to all nodes, and from multiple sources to all nodes in a distributed system or network, you can use several approaches depending on your needs and the environment you're working in. Here are some options:
### Single Source Broadcasting
1. **Multicast Sockets**:
- You can... | 24,783 | [
{
"from": "human",
"value": "How do I broadcast a message from a single source to all nodes, and from multiple sources to all nodes? \nAre there any libraries in java that may help?\n"
},
{
"from": "gpt",
"value": "To broadcast messages from a single source to all nodes, and from multiple sourc... |
I am using TortoiseSVN for my Subversion repository held on a USB drive. When I move from one PC to another, is there a way to automatically identify that files are out of date (without using the Check for Modifications menu). It would be nice just to be able to see that the folder on my hard drive did not match that o... | TortoiseSVN does provide some visual indications for the status of files and folders, but by default, it doesn’t automatically highlight folders that are out of sync with the repository without performing an explicit check, like using the "Check for Modifications" menu. However, there are a few strategies you can emplo... | 26,510 | [
{
"from": "human",
"value": "I am using TortoiseSVN for my Subversion repository held on a USB drive. When I move from one PC to another, is there a way to automatically identify that files are out of date (without using the Check for Modifications menu). It would be nice just to be able to see that the fol... |
I have tried to integrate the Picasa API on iPhone, compiles fine, but I am seeing the following error on launch.
dyld: Library not loaded: @loader_path/../Frameworks/GData.framework/Versions/A/GData
Referenced from: /Users/jacksu/Library/Application Support/iPhone Simulator/User/Applications/9A7E3F54-022F-4771-BD6A-... | The error message you're encountering suggests that the app cannot find the `GData.framework` at runtime. Here are several steps to troubleshoot and resolve the issue:
1. **Check Framework Path**: Ensure that the `GData.framework` is included in the correct location relative to your application bundle. Specifically, y... | 26,068 | [
{
"from": "human",
"value": "I have tried to integrate the Picasa API on iPhone, compiles fine, but I am seeing the following error on launch.\ndyld: Library not loaded: @loader_path/../Frameworks/GData.framework/Versions/A/GData\n Referenced from: /Users/jacksu/Library/Application Support/iPhone Simulator... |
If I have a table like:
CREATE TABLE FRED
(
recordId number(18) primary key,
firstName varchar2(50)
);
Is there an easy way to clone it's structure (not it's data) into another table of a given name. Basically I want to create table with exactly the same structure, but a different name, so that I can perform some func... | Yes, you can easily clone the structure of a table in SQL without copying the data. In Oracle, you can achieve this by using the `CREATE TABLE ... AS` syntax with a `SELECT` statement that returns no rows. However, to clone just the structure without any data, you can use the `CREATE TABLE` statement along with a `SELE... | 27,638 | [
{
"from": "human",
"value": "If I have a table like:\nCREATE TABLE FRED\n(\nrecordId number(18) primary key,\nfirstName varchar2(50)\n);\n\nIs there an easy way to clone it's structure (not it's data) into another table of a given name. Basically I want to create table with exactly the same structure, but a... |
My division has been tasked with recording the morning presentation audio for future use, using the built-in Windows Sound Recorder. Because of human nature, we don't always remember to start it on time.
Windows doesn't have a built-in equivalent to the Unix cron function. Besides installing a new software program (wh... | No problem! You can automate the recording process using a combination of Windows Task Scheduler and a simple Python script that you can create. The idea is to have the Task Scheduler open your Python script at the scheduled time, which in turn will start the recording using the Windows Sound Recorder.
### Step-by-Ste... | 23,920 | [
{
"from": "human",
"value": "My division has been tasked with recording the morning presentation audio for future use, using the built-in Windows Sound Recorder. Because of human nature, we don't always remember to start it on time. \nWindows doesn't have a built-in equivalent to the Unix cron function. Bes... |
I am in charge of a website at work and recently I have added ajaxy requests to make it faster and more responsive. But it has raised an issue.
On my pages, there is an index table on the left, like a menu. Once you have clicked on it, it makes a request that fills the rest of the page. At anytime you can click on anot... | Yes, you can achieve the desired functionality of combining both AJAX requests for left-clicks and traditional navigation for middle-clicks by adding some event handling in JavaScript. The approach involves listening for mouse click events and determining whether the event was a left click or a middle click. Here's a b... | 21,945 | [
{
"from": "human",
"value": "I am in charge of a website at work and recently I have added ajaxy requests to make it faster and more responsive. But it has raised an issue.\nOn my pages, there is an index table on the left, like a menu. Once you have clicked on it, it makes a request that fills the rest of ... |
I need to create a database table to store different changelog/auditing
(when something was added, deleted, modified, etc). I don't need to store particularly detailed info, so I was thinking something along the lines of:
id (for the event)
user that triggered it
event name
event description
timestamp of the event
Am... | Your initial design for a changelog/audit table is a good starting point. However, there are a few additional considerations you may want to include, depending on your specific requirements and future use cases. Here’s a refined version of your proposed table structure:
### Suggested Table Structure: `changelog`
| Co... | 26,186 | [
{
"from": "human",
"value": "I need to create a database table to store different changelog/auditing\n(when something was added, deleted, modified, etc). I don't need to store particularly detailed info, so I was thinking something along the lines of:\n\nid (for the event)\nuser that triggered it\nevent nam... |
Sorting has been studied for decades, so surely the sorting algorithms provide by any programming platform (java, .NET, etc.) must be good by now, right? Is there any reason to override something like System.Collections.SortedList?
| Yes, while sorting algorithms have been well-studied and implemented in various programming platforms like Java and .NET, there are still valid reasons why one might consider overriding or extending classes like `System.Collections.SortedList` in .NET. Here are some reasons you might want to do this:
1. **Custom Behav... | 26,840 | [
{
"from": "human",
"value": "Sorting has been studied for decades, so surely the sorting algorithms provide by any programming platform (java, .NET, etc.) must be good by now, right? Is there any reason to override something like System.Collections.SortedList?\n"
},
{
"from": "gpt",
"value": "Y... |
Trying to write a PowerShell cmdlet that will mute the sound at start, unless already muted, and un-mute it at the end (only if it wasn't muted to begin with).
Couldn't find any PoweShell or WMI object I could use. I was toying with using Win32 functions like auxGetVolume or auxSetVolume, but couldn't quite get it to w... | To achieve the functionality of muting and unmuting the sound in PowerShell, we can utilize the `System.Windows.Forms` namespace, specifically the `System.Windows.Forms.Audio` class if it's available in your context. However, a more straightforward approach would be to leverage the Windows Core Audio APIs through Power... | 26,758 | [
{
"from": "human",
"value": "Trying to write a PowerShell cmdlet that will mute the sound at start, unless already muted, and un-mute it at the end (only if it wasn't muted to begin with).\nCouldn't find any PoweShell or WMI object I could use. I was toying with using Win32 functions like auxGetVolume or au... |
Is there a way to programaticaly install a ssl cert for iis 6 and 7?
| Yes, you can programmatically install an SSL certificate for IIS 6 and IIS 7 using different methods. Here’s how you can do it for each version:
### IIS 6
For IIS 6, you can use the Windows command line with the `certutil` utility to install SSL certificates. Typically, you would use a `.pfx` (PKCS#12) file containin... | 23,661 | [
{
"from": "human",
"value": "Is there a way to programaticaly install a ssl cert for iis 6 and 7?\n"
},
{
"from": "gpt",
"value": "Yes, you can programmatically install an SSL certificate for IIS 6 and IIS 7 using different methods. Here’s how you can do it for each version:\n\n### IIS 6\n\nFor ... |
I have this Perl script with many defined constants of configuration files. For example:
use constant {
LOG_DIR => "/var/log/",
LOG_FILENAME => "/var/log/file1.log",
LOG4PERL_CONF_FILE => "/etc/app1/log4perl.conf",
CONF_FILE1 ... | In Perl, the `use constant` pragma does not support the use of previously defined constants within the same block. However, you can achieve your goal of reducing duplication in a clean way by using lexical variables with `my` instead of constants, or by defining constants in separate blocks if you still want to use `us... | 22,753 | [
{
"from": "human",
"value": "I have this Perl script with many defined constants of configuration files. For example:\nuse constant {\nLOG_DIR => \"/var/log/\",\nLOG_FILENAME => \"/var/log/file1.log\",\nLOG4PERL_CONF_FILE => \"/etc/app1/lo... |
Is there a way to delete a folder, lets call it FolderX from an SVN trunk recursively? A quick search on google only tells me how to recursively delete all .svn folders and this is not what I want to do
| Yes, you can delete a specific folder (like `FolderX`) from an SVN repository recursively using the `svn delete` command. The command will remove the folder and all its contents from your working copy, and if you want to make the change permanent, you will need to commit the change to the repository.
Here’s how to do ... | 30,412 | [
{
"from": "human",
"value": "Is there a way to delete a folder, lets call it FolderX from an SVN trunk recursively? A quick search on google only tells me how to recursively delete all .svn folders and this is not what I want to do\n"
},
{
"from": "gpt",
"value": "Yes, you can delete a specific ... |
How to load only the schema of the tables into a dataset.
| Loading only the schema of tables into a dataset can be accomplished using different methods depending on the database management system (DBMS) you are working with. Below, I'll outline some general approaches for popular databases:
### 1. **Using SQL Queries**
Most DBMS provide system tables or information schema vi... | 26,531 | [
{
"from": "human",
"value": "How to load only the schema of the tables into a dataset.\n"
},
{
"from": "gpt",
"value": "Loading only the schema of tables into a dataset can be accomplished using different methods depending on the database management system (DBMS) you are working with. Below, I'l... |
I have the need to display a nested set structure in HTML. I am doing it with the following partial:
<ul<%= ' id="tree"' if depth == 0 %>>
<% items.each do |item| %>
<li id="node_<%= item.id %>"><a><%= item.name %></a>
<% if item.has_children? %>
<%= render :partial => 'tree_level', :locals => {:items => item.c... | The approach you're using to render a nested set structure in HTML using a partial is a common and acceptable pattern in Rails. However, you do raise a good point about separating concerns and encapsulating logic within your model. A `to_html` method can indeed provide a cleaner and more reusable approach.
Here's an o... | 26,567 | [
{
"from": "human",
"value": "I have the need to display a nested set structure in HTML. I am doing it with the following partial:\n<ul<%= ' id=\"tree\"' if depth == 0 %>>\n<% items.each do |item| %>\n <li id=\"node_<%= item.id %>\"><a><%= item.name %></a>\n <% if item.has_children? %>\n <%= render :par... |
I came across an article about Car remote entry system at http://auto.howstuffworks.com/remote-entry2.htm In the third bullet, author says,
Both the transmitter and the receiver use the same pseudo-random number generator. When the transmitter sends a 40-bit code, it uses the pseudo-random number generator to pick a n... | Yes, it is possible for two pseudo-random number generator (PRNG) functions to produce the same sequence of random numbers at the same time, but certain conditions must be met. PRNGs generate sequences of numbers based on an initial value called a seed. If both the transmitter and the receiver use the same algorithm an... | 26,902 | [
{
"from": "human",
"value": "I came across an article about Car remote entry system at http://auto.howstuffworks.com/remote-entry2.htm In the third bullet, author says,\n\nBoth the transmitter and the receiver use the same pseudo-random number generator. When the transmitter sends a 40-bit code, it uses the... |
In .Net (VB more specifically, but that doesn't really matter), is there a way to change the format of a number from one culture to another strictly through the that number's type?
The issue is this: In English, the number is say, 123.45. Whereas in Sweden, the number would be 123,45
Is there a way to convert 123,45 ... | In .NET, especially in VB.NET, the formatting of numbers is inherently linked to the culture-specific settings for displaying numerical values. However, when working with numerical types (like `Single`, `Double`, etc.), these types don't carry any cultural information or formatting. They are simply raw numeric values.
... | 28,953 | [
{
"from": "human",
"value": "In .Net (VB more specifically, but that doesn't really matter), is there a way to change the format of a number from one culture to another strictly through the that number's type? \nThe issue is this: In English, the number is say, 123.45. Whereas in Sweden, the number would b... |
atoi() is giving me this error:
error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'
Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
from this line:
int pid = atoi( token.at(0) );
where token is a vector
how can i go around... | The error you're encountering is due to the fact that `token.at(0)` is returning a `char` (the first character of the string in the vector), while the `atoi` function expects a `const char *`, which is a pointer to a character array (i.e., a C-style string).
To solve this issue, you need to convert the first character... | 29,584 | [
{
"from": "human",
"value": "atoi() is giving me this error:\n\nerror C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *'\n Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast\n\nfrom this line:\nint pid = atoi( token.at(0)... |
I have an ASP.NET 2.0 [no ajax...yet] web site that will be deployed in compiled form on multiple customer sites. Typically the site will be intranet only. Some customers trust all of their people and don't care about limiting access to the site and/or page functions, others trust no one and want only certain people an... | For your ASP.NET 2.0 application, it sounds like you're looking for a flexible and manageable way to handle role-based security both for page access and for specific actions (like button clicks) within those pages. Given the constraints you've mentioned, here's a suggested approach that combines configuration, a databa... | 25,347 | [
{
"from": "human",
"value": "I have an ASP.NET 2.0 [no ajax...yet] web site that will be deployed in compiled form on multiple customer sites. Typically the site will be intranet only. Some customers trust all of their people and don't care about limiting access to the site and/or page functions, others tru... |
I've gone through most of the example code and I still need some help. I want to make an uber-simple app: show one screen at startup with a label and a button. click the button and we slide over to another screen (I suppose these are called views) which has another label and the "back" button in the top menu bar. I... | To create a simple app with two screens (views) using a framework like SwiftUI for iOS or a similar setup in Android, we can achieve your goal by utilizing a navigation stack or navigation controller. Here's an example for both SwiftUI and Android.
### SwiftUI (iOS)
If you're using SwiftUI for your app, here's a simp... | 24,312 | [
{
"from": "human",
"value": "I've gone through most of the example code and I still need some help. I want to make an uber-simple app: show one screen at startup with a label and a button. click the button and we slide over to another screen (I suppose these are called views) which has another label and ... |
I'm looking to create an Intellij IDEA language support plugin for Erlang.
The first and biggest problem I've had is in making the JFlex Erlang syntax definition.
Does anyone know where can I get the EBNF or BNF for Erlang?
| Creating a syntax definition for Erlang using JFlex can be quite a challenge, especially if you are looking for a formal grammar in BNF or EBNF. Unfortunately, there isn't an official EBNF or BNF grammar for Erlang readily available as part of the standard documentation, but there are a few resources you can consider:
... | 28,764 | [
{
"from": "human",
"value": "I'm looking to create an Intellij IDEA language support plugin for Erlang.\nThe first and biggest problem I've had is in making the JFlex Erlang syntax definition.\nDoes anyone know where can I get the EBNF or BNF for Erlang?\n"
},
{
"from": "gpt",
"value": "Creating... |
I'm writing a Resource Adaptor which does not support two phase commit.
I know there is an optimization technique called: "Last Resource Optimization".
On JBoss your XAResource class should implement LastResource in order to have the optimization.
My question is: how this can be done in WebLogic, WebSpehre, Glassfish, ... | In Java EE application servers, Last Resource Optimization is a technique that allows non-XA resources (like a single database connection) to participate in a distributed transaction when there are no other resources that are using the two-phase commit protocol. In cases where a resource manager does not support two-ph... | 21,669 | [
{
"from": "human",
"value": "I'm writing a Resource Adaptor which does not support two phase commit.\nI know there is an optimization technique called: \"Last Resource Optimization\".\nOn JBoss your XAResource class should implement LastResource in order to have the optimization.\nMy question is: how this c... |
How can we find out that how many applications are there in a database?
| To determine the number of applications in a database, you typically need to perform a query against the database that stores this information. Here are some general approaches depending on the type of database you are using:
### SQL Databases
If you are using a relational database like MySQL, PostgreSQL, SQL Server, ... | 29,257 | [
{
"from": "human",
"value": "How can we find out that how many applications are there in a database?\n"
},
{
"from": "gpt",
"value": "To determine the number of applications in a database, you typically need to perform a query against the database that stores this information. Here are some gene... |
I have some written a number of unit tests that test a wrapper around a FTP server API.
Both the unit tests and the FTP server are on the same machine.
The wrapper API gets deployed to our platform and are used in both remoting and web service scenarios. The wrapper API essentially takes XML messages to perform tasks s... | Your scenario does raise some interesting questions about unit testing, specifically regarding the separation of concerns and ensuring that tests are indeed unit tests and not integration tests.
### Current Approach Concerns
1. **Dependency on External Systems**: By querying the FTP server's COM API to verify the sta... | 25,997 | [
{
"from": "human",
"value": "I have some written a number of unit tests that test a wrapper around a FTP server API.\nBoth the unit tests and the FTP server are on the same machine.\nThe wrapper API gets deployed to our platform and are used in both remoting and web service scenarios. The wrapper API essent... |
Why won't my connection string to SQL server work with Windows authentication? A sql user works fine, acme\administrator or administrator@acme.com won't work. This is a Win Form app written in C#.
{
OdbcConnection cn = null;
String connectionString;
connectionString = "Driver={SQL Server... | If your connection string works with SQL Server authentication (using a SQL user) but not with Windows authentication, this is likely due to a misconfiguration in how you're constructing your connection string.
Windows Authentication does not require a username (`UID`) or password (`PWD`) in the connection string, as... | 28,578 | [
{
"from": "human",
"value": "Why won't my connection string to SQL server work with Windows authentication? A sql user works fine, acme\\administrator or administrator@acme.com won't work. This is a Win Form app written in C#.\n {\n OdbcConnection cn = null;\n String connectionString;\n ... |
I need to create a cherrypy main page that has a login area. I want the login area to be secure, but not the rest of the page. How can I do this in CherryPy?
Ideally, any suggestions will be compatible with http://web.archive.org/web/20170210040849/http://tools.cherrypy.org:80/wiki/AuthenticationAndAccessRestrictions... | To create a secure login area in a CherryPy application while leaving the rest of the page unsecured, you can use CherryPy's built-in authentication mechanisms. Below is a simple example demonstrating how to implement this using a secure login area with HTTP basic authentication while keeping the rest of the applicatio... | 24,425 | [
{
"from": "human",
"value": "I need to create a cherrypy main page that has a login area. I want the login area to be secure, but not the rest of the page. How can I do this in CherryPy?\nIdeally, any suggestions will be compatible with http://web.archive.org/web/20170210040849/http://tools.cherrypy.org:8... |
Currently I'm running several websites that have several (branded) duplicates each, in the same IIS.
I wanted to have an easy overview of all the website groups so I used a naming convention like [siteName].[brandCode].
But lo and behold, IIS has its very own (seemingly random) way of ordering the entries in the "Web S... | If you're looking to organize your websites in IIS for better visibility and management, and the default sorting method isn't suitable for your needs, here are several suggestions that can help you achieve a more organized structure:
1. **Custom Sorting with Prefixes**: You can modify your naming convention slightly t... | 28,758 | [
{
"from": "human",
"value": "Currently I'm running several websites that have several (branded) duplicates each, in the same IIS.\nI wanted to have an easy overview of all the website groups so I used a naming convention like [siteName].[brandCode].\nBut lo and behold, IIS has its very own (seemingly random... |
How do you find out the local time of the user browsing your website in ASP.NET?
| To find out the local time of the user browsing your website in ASP.NET, you can use a combination of client-side and server-side approaches. Since the server does not have access to the client's local time directly, you can achieve this through JavaScript on the client side and then send that information back to the s... | 22,741 | [
{
"from": "human",
"value": "How do you find out the local time of the user browsing your website in ASP.NET? \n"
},
{
"from": "gpt",
"value": "To find out the local time of the user browsing your website in ASP.NET, you can use a combination of client-side and server-side approaches. Since the... |
How can I make Ctrl + K + D work in a pure C file?
I really enjoy the auto formatting in C#, and I would like to have the same functionality in C as well.
I am using Visual Studio 2008, but it would probably be helpful if this worked in Visual Studio 2005 as well.
| In Visual Studio, the shortcut `Ctrl + K + D` is used to format the document in languages like C# and others. However, for C/C++ files, the formatting and indentation capabilities are different, and the default shortcut may not always function as expected.
To enable auto-formatting for C/C++ files, you can use the fol... | 28,631 | [
{
"from": "human",
"value": "How can I make Ctrl + K + D work in a pure C file?\nI really enjoy the auto formatting in C#, and I would like to have the same functionality in C as well.\nI am using Visual Studio 2008, but it would probably be helpful if this worked in Visual Studio 2005 as well.\n"
},
{
... |
Wordpress provides a function called "the_permalink()" that returns, you guessed it!, the permalink to a given post while in a loop of posts.
I am trying to URL encode that permalink and when I execute this code:
<?php
print(the_permalink());
$permalink = the_permalink();
print($permalink);
print(urlencode(the_permalin... | The behavior you're observing with the `the_permalink()` function in WordPress is due to how it functions and returns data. The `the_permalink()` function is primarily used for outputting the permalink directly to the browser and does not return it in a way that can be captured as a variable or further manipulated. Ins... | 30,035 | [
{
"from": "human",
"value": "Wordpress provides a function called \"the_permalink()\" that returns, you guessed it!, the permalink to a given post while in a loop of posts.\nI am trying to URL encode that permalink and when I execute this code:\n<?php\nprint(the_permalink());\n$permalink = the_permalink();\... |
I'm embedding a JRE in an existing C application using the invocation API, and
I'd like to be able to use JDBC to work with the database in that code. This
application is a transaction processing application, and the database
transaction is managed by code in the C portion of the application, and the
java code must ru... | Integrating Java's JDBC with an existing C application using ODBC can be challenging, especially with the requirement to reuse an existing connection within a transaction. Unfortunately, there isn't a straightforward solution that allows you to directly share an existing ODBC connection handle with JDBC due to the diff... | 23,561 | [
{
"from": "human",
"value": "I'm embedding a JRE in an existing C application using the invocation API, and\nI'd like to be able to use JDBC to work with the database in that code. This\napplication is a transaction processing application, and the database\ntransaction is managed by code in the C portion o... |
StateServer or SQLServer?
What is the best solution for storing ASP.NET session variables?
What are the pros and cons of each?
Are one better then other in any particular situation?
| When it comes to storing ASP.NET session state, the two primary options you mentioned—State Server and SQL Server—each have their pros and cons. The best solution depends on your specific application requirements, such as scalability, reliability, and performance. Below is a comparison of both options:
### 1. State Se... | 24,652 | [
{
"from": "human",
"value": "StateServer or SQLServer?\n\nWhat is the best solution for storing ASP.NET session variables?\nWhat are the pros and cons of each?\nAre one better then other in any particular situation?\n\n"
},
{
"from": "gpt",
"value": "When it comes to storing ASP.NET session stat... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.