instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am wrapping a native C++ class, which has the following methods: class Native { public: class Local { std::string m_Str; int m_Int; }; typedef std::vector<Local> LocalVec; typedef LocalVec::iterator LocalIter; LocalIter BeginLocals(); LocalIter EndLocals(); priva...
Wrapping a native C++ class in a .NET-compatible way requires considering how to expose its functionalities and data types to the managed world. Let’s address your questions one by one. ### 1) Representing the Interface in .NET In .NET, a common approach to represent a collection of items (like your `Local` objects) ...
4,614
[ { "from": "human", "value": "I am wrapping a native C++ class, which has the following methods:\nclass Native\n{\n public:\n class Local\n {\n std::string m_Str;\n int m_Int;\n };\n\n typedef std::vector<Local> LocalVec;\n typedef LocalVec::iterator LocalIter;\n\n LocalIte...
I have some code which collects points (consed integers) from a loop which looks something like this: (loop for x from 1 to 100 for y from 100 downto 1 collect `(,x . ,y)) My question is, is it correct to use `(,x . ,y) in this situation? Edit: This sample is not about generating a table of 100x1...
Yes, it is correct to use `(,x . ,y)` in that context. The syntax you're using is a Common Lisp construction where the backquote (or quasiquote) allows for unquoting with a comma (`,`). When you write `(,x . ,y)`, you're effectively creating a cons cell with `x` as the car (first element) and `y` as the cdr (second ele...
6,769
[ { "from": "human", "value": "I have some code which collects points (consed integers) from a loop which looks something like this:\n(loop\n for x from 1 to 100\n for y from 100 downto 1\n collect `(,x . ,y))\n\nMy question is, is it correct to use `(,x . ,y) in this situation?\nEdit: This...
I have a bunch of .NET frameworks installed on my machine. I know that with the Java JDK, I can use the 6.0 version to target 5.0 and earlier. Can I do something similar with the .NET framework - target 1.0 and 2.0 with the 3.0 framework?
In the .NET ecosystem, targeting earlier framework versions works differently compared to the Java JDK. With .NET, each framework version has a specific set of APIs and features, and while later versions of the framework (like .NET 3.0 and 3.5) do provide backward compatibility to some extent, they do not allow you to ...
4,262
[ { "from": "human", "value": "I have a bunch of .NET frameworks installed on my machine.\nI know that with the Java JDK, I can use the 6.0 version to target 5.0 and earlier. \nCan I do something similar with the .NET framework - target 1.0 and 2.0 with the 3.0 framework?\n" }, { "from": "gpt", "...
After installing VS2008, the platform builder mod, and the WM7 aku, VS usually prompts you, upon first startup, for your default mode. If you make a mistake and select something other than PB7, how do you get back into PB mode? I can get the device window, but it is always greyed out. I can also configure my normal con...
Namaste, Mark! If you've accidentally selected the wrong default option when starting Visual Studio 2008 (VS2008) with Platform Builder (PB) and want to switch back to PB mode, you can try the following steps to correct the setting without reinstalling everything: ### Method 1: Change the Default Mode in VS2008 1. *...
4,638
[ { "from": "human", "value": "After installing VS2008, the platform builder mod, and the WM7 aku, VS usually prompts you, upon first startup, for your default mode. If you make a mistake and select something other than PB7, how do you get back into PB mode?\nI can get the device window, but it is always grey...
We're using Forms Authentication in SharePoint. When the account is created, the administrator can add some information, like name and address. But the required fields are username and email address. When a user goes to their profile page, all the fields are blank and they are unable to edit them. I have read a numb...
In SharePoint, user profiles are typically managed through the User Profile Service, and by default, certain properties may not be editable or visible to users depending on their permissions and how the user profiles have been set up. Since you are using Forms Authentication and not a connected directory like Active Di...
4,631
[ { "from": "human", "value": "We're using Forms Authentication in SharePoint. When the account is created, the administrator can add some information, like name and address. But the required fields are username and email address.\nWhen a user goes to their profile page, all the fields are blank and they ar...
I have a third party library that internally constructs and uses the SqlConnection class. I can inherit from the class, but it has a ton of overloads, and so far I have been unable to find the right one. What I'd like is to tack on a parameter to the connection string being used. Is there a way for me to put a breakpoi...
Debugging into .NET library code, such as the `SqlConnection` class, can be a bit tricky, but it's definitely possible with the right setup. Here's a step-by-step guide to help you enable source code debugging in Visual Studio: ### Step 1: Enable Source Link and Symbol Server Support 1. **Open Visual Studio Options:*...
2,959
[ { "from": "human", "value": "I have a third party library that internally constructs and uses the SqlConnection class. I can inherit from the class, but it has a ton of overloads, and so far I have been unable to find the right one. What I'd like is to tack on a parameter to the connection string being used...
Hey so what I want to do is snag the content for the first paragraph. The string $blog_post contains a lot of paragraphs in the following format: <p>Paragraph 1</p><p>Paragraph 2</p><p>Paragraph 3</p> The problem I'm running into is that I am writing a regex to grab everything between the first <p> tag and the first c...
The issue you're facing with your regex is that the `.+` or `[\\s\\S]+` pattern is greedy, meaning it will match as much text as possible, including multiple paragraphs. To solve this problem, you should make your regex pattern non-greedy (or lazy) so that it stops at the first `</p>` tag. Here's a modified version of...
6,596
[ { "from": "human", "value": "Hey so what I want to do is snag the content for the first paragraph. The string $blog_post contains a lot of paragraphs in the following format:\n<p>Paragraph 1</p><p>Paragraph 2</p><p>Paragraph 3</p>\n\nThe problem I'm running into is that I am writing a regex to grab everythi...
Java has generics and C++ provides a very strong programming model with templates. So then, what is the difference between C++ and Java generics?
Java generics and C++ templates both provide mechanisms for creating generic programming constructs, but they have significant differences in their design and functionality. Here are some of the key differences: ### 1. **Type Erasure vs. Code Generation** - **Java Generics:** Java uses a feature called *type erasure*....
1,175
[ { "from": "human", "value": "Java has generics and C++ provides a very strong programming model with templates.\nSo then, what is the difference between C++ and Java generics?\n" }, { "from": "gpt", "value": "Java generics and C++ templates both provide mechanisms for creating generic programmin...
I am considering log-shipping of Write Ahead Logs (WAL) in PostgreSQL to create a warm-standby database. However I have one table in the database that receives a huge amount of INSERT/DELETEs each day, but which I don't care about protecting the data in it. To reduce the amount of WALs produced I was wondering, is ther...
In PostgreSQL, Write Ahead Logging (WAL) is an essential part of its durability and crash recovery mechanism. As such, all changes to data that are considered part of the transaction must be recorded in the WAL, including changes to specific tables that you might not care about protecting. However, there are a few str...
5,244
[ { "from": "human", "value": "I am considering log-shipping of Write Ahead Logs (WAL) in PostgreSQL to create a warm-standby database. However I have one table in the database that receives a huge amount of INSERT/DELETEs each day, but which I don't care about protecting the data in it. To reduce the amount ...
Does anybody have any pointers on how to successfully draw a bitmap that has an alpha channel using Graphics::DrawImage() when the Graphics context is created based on a printer HDC? The printer drivers don't generally support alpha blending - so is there an alternative to rendering everything to an offscreen bitmap an...
When printing images with an alpha channel to a printer using GDI+ in a Windows environment, you may encounter issues because many printer drivers do not support alpha blending directly. Here are some approaches to handle this situation: ### 1. Rasterize the Image As you mentioned, one common solution is to render yo...
1,841
[ { "from": "human", "value": "Does anybody have any pointers on how to successfully draw a bitmap that has\nan alpha channel using Graphics::DrawImage() when the Graphics context is\ncreated based on a printer HDC? The printer drivers don't generally support alpha blending - so is there an alternative to ren...
This question is slightly related to this question about exception handling. The workaround I found there consists of rolling my own message loop. So my Main method now looks basically like this: [STAThread] static void Main() { // this is needed so there'll actually an exception be thrown by // Application.Run/App...
Your approach of replacing `Application.Run(new MainForm());` with a custom message loop using `Application.DoEvents()` is an interesting workaround, but it's important to note several factors regarding safety and best practices. ### Considerations for Your Approach 1. **Thread Safety**: The Windows Forms message loo...
3,004
[ { "from": "human", "value": "This question is slightly related to this question about exception handling. The workaround I found there consists of rolling my own message loop.\nSo my Main method now looks basically like this:\n[STAThread]\nstatic void Main() {\n // this is needed so there'll actually an ex...
For my blog I am wanting to use the Output Cache to save a cached version of a perticular post for around 10 minutes, and thats fine... <%@OutputCache Duration="600" VaryByParam="*" %> However, if someone posts a comment, I want to clear the cache so that the page is refreshed and the comment can be seen. How do I do ...
To manage the Output Cache in ASP.NET, especially for a scenario where you want to invalidate the cache when a comment is posted, you can follow these steps: 1. **Use the `OutputCache` Directive**: You already have this part, where you cache your page output for 10 minutes (600 seconds). ```aspx <%@ OutputCache...
2,103
[ { "from": "human", "value": "For my blog I am wanting to use the Output Cache to save a cached version of a perticular post for around 10 minutes, and thats fine...\n<%@OutputCache Duration=\"600\" VaryByParam=\"*\" %>\n\nHowever, if someone posts a comment, I want to clear the cache so that the page is ref...
I am intentionally leaving this quite vague at first. I'm looking for discussion and what issues are important more than I'm looking for hard answers. I'm in the middle of designing an app that does something like portfolio management. The design I have so far is Problem: a problem that needs to be solved Solution: ...
The design of your portfolio management application, particularly regarding the handling of problems, solutions, and their relationships, certainly presents some interesting challenges—especially when you consider the temporal nature of these entities. Here are some thoughts on your design options, along with some addi...
2,735
[ { "from": "human", "value": "I am intentionally leaving this quite vague at first. I'm looking for discussion and what issues are important more than I'm looking for hard answers.\nI'm in the middle of designing an app that does something like portfolio management. The design I have so far is\n\nProblem: ...
I am using Lotus Notes as my email client, and how to change the defailt email delete date to something new so my older emails don't get deleted after pre-defined date?
To change the default email delete date in Lotus Notes, you will typically need to adjust the settings in your mail file properties. Here are the general steps you can follow to extend the delete date for older emails: 1. **Open your Mail Database**: - Start Lotus Notes and navigate to your mail database. 2. **Acc...
4,855
[ { "from": "human", "value": "I am using Lotus Notes as my email client, and how to change the defailt email delete date to something new so my older emails don't get deleted after pre-defined date?\n" }, { "from": "gpt", "value": "To change the default email delete date in Lotus Notes, you will ...
I find I can do more with NHibernate, and even Castle than with the Linq to Entities, or linq to SQL. Am I crazy?
You're definitely not crazy! Your preference for NHibernate or Castle over LINQ to Entities or LINQ to SQL is valid and can stem from several factors: 1. **Flexibility and Control**: NHibernate is known for its flexibility and powerful features, such as caching, lazy loading, and support for complex mappings. It provi...
5,738
[ { "from": "human", "value": "I find I can do more with NHibernate, and even Castle than with the Linq to Entities, or linq to SQL.\nAm I crazy?\n" }, { "from": "gpt", "value": "You're definitely not crazy! Your preference for NHibernate or Castle over LINQ to Entities or LINQ to SQL is valid and...
Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit? Currently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch & compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse distro is unstable for us, so I'm curious if...
Using the 64-bit version of Eclipse Ganymede (Eclipse 3.4) on Windows XP or Vista 64-bit has had mixed experiences among users. Some users report that they have successfully run the 64-bit version without major issues, while others have encountered stability problems and bugs. Here are a few points to consider based o...
4,863
[ { "from": "human", "value": "Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit?\nCurrently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch & compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse di...
I am developing a website that relies much on XML data. The web site has an interface where user can update data. The data provided by user will be updated to the respective XML file. However, the changes is not reflected until after 1 or 2 minutes. Anyone knows how to force the browser to load the latest XML file imme...
To ensure that the browser loads the latest version of your XML file immediately after an update, you can implement one or more of the following strategies: ### 1. Disable Caching You can use HTTP headers to prevent caching of the XML file. This way, the browser will always request the latest version from the server. ...
4,007
[ { "from": "human", "value": "I am developing a website that relies much on XML data. The web site has an interface where user can update data. The data provided by user will be updated to the respective XML file. However, the changes is not reflected until after 1 or 2 minutes.\nAnyone knows how to force th...
Currently we have a project with a standard subversion repository layout of: ./trunk ./branches ./tags However, as we're moving down the road of OSGi and a modular project, we've ended up with: ./trunk/bundle/main ./trunk/bundle/modulea ./trunk/bundle/moduleb ./tags/bundle/main-1.0.0 ./tags/bundle/main-1.0.1 ./tags/bun...
When transitioning to a modular architecture in your project, especially in the context of OSGi, rethinking your repository layout is indeed a crucial step. Modularization allows for better separation of concerns, more manageable builds, and improved dependency management. Below are some guidelines and best practices t...
2,454
[ { "from": "human", "value": "Currently we have a project with a standard subversion repository layout of:\n./trunk\n./branches\n./tags\nHowever, as we're moving down the road of OSGi and a modular project, we've ended up with:\n./trunk/bundle/main\n./trunk/bundle/modulea\n./trunk/bundle/moduleb\n./tags/bund...
Say I have two strings, String s1 = "AbBaCca"; String s2 = "bac"; I want to perform a check returning that s2 is contained within s1. I can do this with: return s1.contains(s2); I am pretty sure that contains() is case sensitive, however I can't determine this for sure from reading the documentation. If it is then I ...
Yes, you are correct that the `contains()` method in Java is case-sensitive, meaning that it will return `false` when the case of the characters does not match. Your approach of converting both strings to lowercase using `toLowerCase()` is a valid way to perform a case-insensitive check. However, if you're looking fo...
5,090
[ { "from": "human", "value": "Say I have two strings,\nString s1 = \"AbBaCca\";\nString s2 = \"bac\";\n\nI want to perform a check returning that s2 is contained within s1. I can do this with:\nreturn s1.contains(s2);\n\nI am pretty sure that contains() is case sensitive, however I can't determine this for s...
I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use ?
Yes, if you're looking for a simple line count tool that isn't part of a larger package, you can use a basic command-line utility called `wc` (word count). It's available on most Unix-like operating systems, including Linux and macOS. To count lines in a file, you can use: ```bash wc -l filename ``` This command will...
6,551
[ { "from": "human", "value": "I know there are quite a few line count tools around. Is there something simple that's not a part some other big package that you use ?\n" }, { "from": "gpt", "value": "Yes, if you're looking for a simple line count tool that isn't part of a larger package, you can u...
What files can we modify so that our solution is still supported by Microsoft? Is it allowed to customize error pages? Can we modify the web.config files to use custom HTTPHandlers?
When developing applications on Microsoft platforms, especially for ASP.NET and other Microsoft technologies, it's important to know which files can be modified while ensuring that your solution remains supported by Microsoft. Here are answers to your questions: ### 1. What files can we modify to ensure support by Mic...
3,014
[ { "from": "human", "value": "What files can we modify so that our solution is still supported by Microsoft?\nIs it allowed to customize error pages? \nCan we modify the web.config files to use custom HTTPHandlers?\n" }, { "from": "gpt", "value": "When developing applications on Microsoft platfor...
I'm a longtime Java programmer working on a PHP project, and I'm trying to get PHPUnit up and working. When unit testing in Java, it's common to put test case classes and regular classes into separate directories, like this - /src MyClass.java /test MyClassTest.java and so on. When unit testing with PHPUnit,...
When using PHPUnit for unit testing in PHP, it is indeed common to adopt a directory structure that separates your application code from your test code, similar to the Java structure you're familiar with. Here’s a typical directory structure that many PHP projects follow: ``` /project-root /src # Applicati...
4,278
[ { "from": "human", "value": "I'm a longtime Java programmer working on a PHP project, and I'm trying to get PHPUnit up and working. When unit testing in Java, it's common to put test case classes and regular classes into separate directories, like this -\n/src \n MyClass.java\n\n/test \n MyClassTest.ja...
I've seen a few fixes for allowing PNG images to have transparency in Internet Explorer 6, but I've yet to find one that also allows you to set the background position in CSS. If you use sprites, it's a deal-breaker. I've resorted to using GIF's (which are not as high quality), not using transparent images at all, or s...
Yes, you can achieve PNG transparency and background positioning in Internet Explorer 6 with a combination of techniques. Here are two common methods that you can use to accomplish this: ### Method 1: Using AlphaImageLoader Internet Explorer 6 has limited support for PNG transparency, but you can use the `AlphaImageL...
4,625
[ { "from": "human", "value": "I've seen a few fixes for allowing PNG images to have transparency in Internet Explorer 6, but I've yet to find one that also allows you to set the background position in CSS. If you use sprites, it's a deal-breaker. I've resorted to using GIF's (which are not as high quality), ...
Here's a challenge that I was tasked with recently. I still haven't figured out the best way to do it, maybe someone else has an idea. Using PHP and/or HTML, create a page that cycles through any number of other pages at a given interval. For instance, we would load this page and it would take us to google for 20 seco...
Certainly! You can create a simple PHP and HTML page that uses JavaScript to cycle through different URLs at specified intervals. Below is an example of how you can implement this functionality. ### Steps to Create the Cycling Page 1. **Create an array of URLs** with their corresponding display duration. 2. Use JavaS...
3,964
[ { "from": "human", "value": "Here's a challenge that I was tasked with recently. I still haven't figured out the best way to do it, maybe someone else has an idea. \nUsing PHP and/or HTML, create a page that cycles through any number of other pages at a given interval.\nFor instance, we would load this page...
Using CSS, I'm trying to specify the height of a span tag in Firefox, but it's just not accepting it (IE does). Firefox accepts the height if I use a div, but the problem with using a div is the annoying line break after it, which I can't have in this particular instance. I tried setting the CSS style attribute of: di...
When it comes to styling elements like `<span>` in CSS, there are a few key points to keep in mind: 1. **Inline Elements:** By default, `<span>` is an inline element, which means it does not accept height or width properties the same way block elements do. Similarly, a `<div>` is a block-level element and will start o...
3,617
[ { "from": "human", "value": "Using CSS,\nI'm trying to specify the height of a span tag in Firefox, but it's just not accepting it (IE does).\nFirefox accepts the height if I use a div, but the problem with using a div is the annoying line break after it, which I can't have in this particular instance. \nI ...
I am getting the following error trying to read from a socket. I'm doing a readInt() on that InputStream, and I am getting this error. Perusing the documentation suggests that the client part of the connection closed the connection. In this scenario, I am the server. I have access to the client log files and it is not ...
The error you're encountering while trying to read an integer from a socket input stream in Java may suggest a few potential issues, especially since you are using `socket.setSoTimeout(10000);`. Here's a breakdown of possible causes and what you might want to check: 1. **Socket Timeout**: When you set a socket timeout...
2,092
[ { "from": "human", "value": "I am getting the following error trying to read from a socket. I'm doing a readInt() on that InputStream, and I am getting this error. Perusing the documentation suggests that the client part of the connection closed the connection. In this scenario, I am the server.\nI have acc...
Is there a simple way to drop a group of interrelated tables in SQL Server? Ideally I'd like to avoid having to worry about what order they're being dropped in since I know the entire group will be gone by the end of the process.
Dropping a group of interrelated tables in SQL Server can be a bit tricky due to foreign key constraints, as SQL Server requires that the child tables (those with foreign keys) be dropped before the parent tables. However, you can simplify the process by using the following methods: ### 1. Drop Foreign Key Constraints...
4,045
[ { "from": "human", "value": "Is there a simple way to drop a group of interrelated tables in SQL Server? Ideally I'd like to avoid having to worry about what order they're being dropped in since I know the entire group will be gone by the end of the process.\n" }, { "from": "gpt", "value": "Drop...
I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work). Here is the error that is thrown by the custom code I've written. System.Security.SecurityException: Request for the permission of type...
The error you are encountering indicates that your custom code in the Reporting Services report is trying to perform an operation that requires a specific security permission, which is not granted in the environment in which the report server operates. Reporting Services runs under a more restricted security context w...
3,644
[ { "from": "human", "value": "I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work).\nHere is the error that is thrown by the custom code I've written.\n\nSystem.Security.SecurityExc...
The two connection limit can be particularly troublesome when you have multiple tabs open simultaneously. Besides "ignore the problem," what coping mechanisms have you seen used to get multiple tabs both doing heavily interactive Ajax despite the two connection limit?
The two connection limit refers to the limitation that most browsers impose on the number of simultaneous connections to a single domain. This can be particularly troublesome for web applications that rely heavily on AJAX for interactivity across multiple tabs. Here are some coping mechanisms that developers and users ...
4,087
[ { "from": "human", "value": "The two connection limit can be particularly troublesome when you have multiple tabs open simultaneously. Besides \"ignore the problem,\" what coping mechanisms have you seen used to get multiple tabs both doing heavily interactive Ajax despite the two connection limit?\n" },...
The university I work at uses Oracle for the database system. We currently have programs we run at night to download what we need into some local Access tables for our testing needs. Access is getting to small for this now and we need something bigger. Also, the nightly jobs require constant maintance to keep working (...
To automate the process of copying tables from Oracle to MySQL, there are several approaches you can take, depending on your specific needs, the complexity of your data, and the tools available to you. Here are some commonly used methods: ### 1. **Oracle SQL Developer** Oracle SQL Developer has a built-in feature to m...
3,362
[ { "from": "human", "value": "The university I work at uses Oracle for the database system. We currently have programs we run at night to download what we need into some local Access tables for our testing needs. Access is getting to small for this now and we need something bigger. Also, the nightly jobs req...
The default rails XML builder escapes all HTML, so something like: atom_feed do |feed| @stories.each do |story| feed.entry story do |entry| entry.title story.title entry.content "<b>foo</b>" end end end will produce the text: <b>foo</b> instead of: foo Is there any way to instruct t...
Yes, you can instruct the Rails XML builder to not escape HTML by using the `raw` method or by using a `CDATA` section for the content you want to include without escaping. Here's how you can do it: ### Using `raw` Method You can use the `raw` helper to output the HTML as it is without escaping: ```ruby atom_feed do...
6,858
[ { "from": "human", "value": "The default rails XML builder escapes all HTML, so something like:\natom_feed do |feed| \n @stories.each do |story| \n feed.entry story do |entry| \n entry.title story.title\n entry.content \"<b>foo</b>\"\n end \n end \nend\n\nwill produce the text:\n<b>f...
I'm currently working on a project that requires encrypted data be passed between WCF hosts. As I understand it there are only 2 ways to ensure that data passed over WCF is secure. Using Certificates Using a Domain (or having the same username and password on every machine on the network) Using certificates can be e...
WCF (Windows Communication Foundation) offers several options to secure communication between hosts, and while certificates and domain-based security are commonly discussed, there are alternative methods you might consider that are built into the framework: ### 1. **Message Security with Username/Password** Instead o...
4,308
[ { "from": "human", "value": "I'm currently working on a project that requires encrypted data be passed between WCF hosts. As I understand it there are only 2 ways to ensure that data passed over WCF is secure. \n\nUsing Certificates\nUsing a Domain (or having the same username and password on every machine ...
I'm trying to unit test a custom ConfigurationSection I've written, and I'd like to load some arbitrary configuration XML into a System.Configuration.Configuration for each test (rather than put the test configuration xml in the Tests.dll.config file. That is, I'd like to do something like this: Configuration testConf...
You're correct that the `ConfigurationManager` class is designed to work with configuration files that are physically present on the disk and associated with an executable or the machine. Unfortunately, it does not provide a built-in method to load an arbitrary XML string directly into a `Configuration` object. Howeve...
3,456
[ { "from": "human", "value": "I'm trying to unit test a custom ConfigurationSection I've written, and I'd like to load some arbitrary configuration XML into a System.Configuration.Configuration for each test (rather than put the test configuration xml in the Tests.dll.config file. That is, I'd like to do so...
I am attempting to use the .Net System.Security.SslStream class to process the server side of a SSL/TLS stream with client authentication. To perform the handshake, I am using this code: SslStream sslStream = new SslStream(innerStream, false, RemoteCertificateValidation, LocalCertificateSelectionCallback); sslStream.Au...
When using the `SslStream` class to handle SSL/TLS communication with client authentication, the default behavior is indeed to request certificates from the client based on the server's trusted root certificate store. This behavior cannot be directly overridden through `SslStream` to limit the `CertificateRequest` to s...
5,488
[ { "from": "human", "value": "I am attempting to use the .Net System.Security.SslStream class to process the server side of a SSL/TLS stream with client authentication.\nTo perform the handshake, I am using this code:\nSslStream sslStream = new SslStream(innerStream, false, RemoteCertificateValidation, Local...
Is there a way to enable code outlining for Classic ASP in Visual Studio 2005? It outlines the HTML code pretty well and I get a big outline between <% and %>, but nothing for the code itself.
In Visual Studio 2005, while it does provide some basic support for Classic ASP (VBScript), the IDE's outlining features for ASP code are somewhat limited compared to modern environments. Here are a few suggestions you could try to improve your experience with code outlining for Classic ASP: 1. **Use Regions**: Althou...
4,871
[ { "from": "human", "value": "Is there a way to enable code outlining for Classic ASP in Visual Studio 2005? It outlines the HTML code pretty well and I get a big outline between <% and %>, but nothing for the code itself.\n" }, { "from": "gpt", "value": "In Visual Studio 2005, while it does pro...
I've seen this done in a few sites, an example is artofadambetts.com. The scroll bar on the page scrolls only an element of the page, not the entire page. I looked at the source and havent't been able to figure it out yet. How is this done?
What you're referring to is a common technique used in web design where a specific element (like a div) is made scrollable while the rest of the page remains fixed. This is typically achieved using CSS for layout and overflow properties, and sometimes JavaScript to enhance functionality. Here's a basic guide on how to ...
3,345
[ { "from": "human", "value": "I've seen this done in a few sites, an example is artofadambetts.com. The scroll bar on the page scrolls only an element of the page, not the entire page. I looked at the source and havent't been able to figure it out yet. How is this done?\n" }, { "from": "gpt", "va...
I would like to bypass the web-server functionality of a Sony SNC-RZ30N network attached web cam and display the video feed in a Silverlight application. I can't seem to find any examples of interfacing with the camera programatically. Any leads would be much appreciated. Thx. Update 09/09/2008: Found a good site with...
To display the video feed from a Sony SNC-RZ30N network camera in a Silverlight application, you can take a few different approaches. Here's a general guide to help you get started: ### 1. Understand the Camera's Streaming Protocol First, you need to understand how the camera streams video. The SNC-RZ30N supports Real...
3,643
[ { "from": "human", "value": "I would like to bypass the web-server functionality of a Sony SNC-RZ30N network attached web cam and display the video feed in a Silverlight application.\nI can't seem to find any examples of interfacing with the camera programatically.\nAny leads would be much appreciated. Thx...
I have a byte[] array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the BinaryWriter object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a System.Drawing.Image object so that I can use it for later manipulation (feeding into a multipage...
To convert a byte array representing a TIFF image into a `System.Drawing.Image` object, you should ensure that the byte array is indeed valid and represents a complete TIFF image. The error you are experiencing with `Image.FromStream()` indicates that the memory stream is not in a valid format for creating an image. H...
5,174
[ { "from": "human", "value": "I have a byte[] array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the BinaryWriter object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a System.Drawing.Image object so that I can use it for lat...
I'm curious about OpenID. While I agree that the idea of unified credentials is great, I have a few reservations. What is to prevent an OpenID provider from going crazy and holding the OpenID accounts they have hostage until you pay $n? If I decide I don't like the provider I'm with this there a way to migrate to a dif...
Your concerns about OpenID are valid, and they touch on some of the broader issues related to account portability, control, and the dependency on third-party providers. 1. **Provider Lock-In**: As you've pointed out, if an OpenID provider were to impose restrictions or fees on account access, users could be effectivel...
4,481
[ { "from": "human", "value": "I'm curious about OpenID. While I agree that the idea of unified credentials is great, I have a few reservations. What is to prevent an OpenID provider from going crazy and holding the OpenID accounts they have hostage until you pay $n? If I decide I don't like the provider I'm ...
I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to help me fast track this?
Using PowerShell to leverage your own .NET components is a great way to build utilities quickly without needing to create a full console application. Here are some resources and tips to help you get started: ### 1. **Understanding PowerShell and .NET Interoperability** - **PowerShell Documentation**: The official M...
2,525
[ { "from": "human", "value": "I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to h...
The Open button on the open file dialog used in certain windows applications includes a dropdown arrow with a list of additional options — namely Open With... I haven't seen this in every Windows application, so you may have to try a few to get it, but SQL Server Management Studio and Visual Studio 2017 will both sh...
In Windows Forms applications, the button you are describing is known as a "Split Button." This type of button combines a standard button action with a dropdown list for additional options. While there isn't a direct built-in "Split Button" control in standard Visual Studio controls, you can achieve a similar effect us...
3,203
[ { "from": "human", "value": "The Open button on the open file dialog used in certain windows applications includes a dropdown arrow with a list of additional options — namely Open With... \n\nI haven't seen this in every Windows application, so you may have to try a few to get it, but SQL Server Management...
Let's say I have a complex .NET class, with lots of arrays and other class object members. I need to be able to generate a deep clone of this object - so I write a Clone() method, and implement it with a simple BinaryFormatter serialize/deserialize - or perhaps I do the deep clone using some other technique which is m...
Testing a deep clone implementation can be quite challenging, especially when you have a complex class structure with private members. However, there are several strategies you can employ to ensure your `Clone()` method is thoroughly tested, and that the cloned object behaves as expected. ### 1. Write Unit Tests Speci...
807
[ { "from": "human", "value": "Let's say I have a complex .NET class, with lots of arrays and other class object members. I need to be able to generate a deep clone of this object - so I write a Clone() method, and implement it with a simple BinaryFormatter serialize/deserialize - or perhaps I do the deep cl...
I am using the Photoshop's javascript API to find the fonts in a given PSD. Given a font name returned by the API, I want to find the actual physical font file that font name corresponds to on the disc. This is all happening in a python program running on OSX so I guess I'm looking for one of: Some Photoshop javascrip...
To locate the actual physical font file corresponding to a font name in a Photoshop PSD file, you can approach the problem in a few different ways. Since you're working with a Python program on macOS, I'll provide a method using Python along with a way to access macOS font management capabilities. ### Method 1: Using ...
2,310
[ { "from": "human", "value": "I am using the Photoshop's javascript API to find the fonts in a given PSD.\nGiven a font name returned by the API, I want to find the actual physical font file that font name corresponds to on the disc.\nThis is all happening in a python program running on OSX so I guess I'm lo...
Is there any way to include the SVN repository revision number in the version string of a .NET assembly? Something like Major.Minor.SVNRev I've seen mention of doing this with something like CC.NET (although on ASP.NET actually), but is there any way to do it without any extra software? I've done similar things in C/...
Yes, it's possible to include the SVN repository revision number in the version string of a .NET assembly without needing additional software. You can achieve this by using pre-build events in your project and manipulating assembly attributes via a custom script. Here's a step-by-step guide on how to implement this: ...
3,575
[ { "from": "human", "value": "Is there any way to include the SVN repository revision number in the version string of a .NET assembly? Something like Major.Minor.SVNRev\nI've seen mention of doing this with something like CC.NET (although on ASP.NET actually), but is there any way to do it without any extra...
How do I connect to a remote Oracle database instance from PHP? I need to query (read only) the remote Oracle database for some information; do I need to have an Oracle Instant Client installed? Is the OCI extension for PHP enough?
To connect to a remote Oracle database instance from PHP, you generally need to follow these steps: ### Prerequisites 1. **Oracle Instant Client**: Yes, you typically need to have Oracle Instant Client installed on your server (or development machine). This is a set of libraries that allows PHP to connect to Oracle d...
3,162
[ { "from": "human", "value": "How do I connect to a remote Oracle database instance from PHP?\nI need to query (read only) the remote Oracle database for some information; do I need to have an Oracle Instant Client installed?\nIs the OCI extension for PHP enough?\n" }, { "from": "gpt", "value": "...
I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside). Does anyone have a good way of remembering this? A little mnemonic, a good explanation as to why the...
The CSS box model can be tricky to remember at first, but there are some mnemonics and visualizations that can help. Here are a few strategies to help you remember the order of the box model components: ### Mnemonic: **"My Padding Makes Borders Big"** - **M** - Margin (outermost layer) - **P** - Padding (between cont...
4,669
[ { "from": "human", "value": "I don't edit CSS very often, and almost every time I need to go and google the CSS box model to check whether padding is inside the border and margin outside, or vice versa. (Just checked again and padding is inside).\nDoes anyone have a good way of remembering this? A little ...
I'm trying to register an externally hosted SQL 2000 server through Enterprise Manager which isn't on the default port and I can't see anywhere to change it within Enterprise Manager. So, the question is, how do I connect to the database if: I.P. Address is 123.456.789 (example) Port is 1334
In SQL Server 2000, you can connect to an externally hosted SQL Server that is listening on a non-default port using a specific syntax when establishing your connection. Since SQL Server 2000 Enterprise Manager does not have an option to specify a port directly in its interface, you can connect using the following meth...
4,581
[ { "from": "human", "value": "I'm trying to register an externally hosted SQL 2000 server through Enterprise Manager which isn't on the default port and I can't see anywhere to change it within Enterprise Manager.\nSo, the question is, how do I connect to the database if:\nI.P. Address is 123.456.789 (exampl...
How do you calculate the distance between 2 cities?
Calculating the distance between two cities can be done in several ways, depending on the precision required and the available information. Here are some common methods: ### 1. **Haversine Formula (Great-Circle Distance)** This formula calculates the shortest distance over the earth's surface, giving you the "as-the-c...
3,689
[ { "from": "human", "value": "How do you calculate the distance between 2 cities? \n" }, { "from": "gpt", "value": "Calculating the distance between two cities can be done in several ways, depending on the precision required and the available information. Here are some common methods:\n\n### 1. *...
How do I implement some logic that will allow me to reproduce on Windows the functionality that I have on Linux with the fork() system call, using Python? I'm specifically trying to execute a method on the SAPI Com component, while continuing the other logic in the main thread without blocking or waiting.
In Python, especially on Windows, you don't have direct access to the `fork()` system call like you do in Linux. Instead, Python provides alternative mechanisms for achieving similar behavior. One common approach to achieve concurrent execution is using the `threading` or `multiprocessing` modules. For your specific c...
3,219
[ { "from": "human", "value": "How do I implement some logic that will allow me to reproduce on Windows the functionality that I have on Linux with the fork() system call, using Python?\nI'm specifically trying to execute a method on the SAPI Com component, while continuing the other logic in the main thread ...
I've never been completely happy with the way exception handling works, there's a lot exceptions and try/catch brings to the table (stack unwinding, etc.), but it seems to break a lot of the OO model in the process. Anyway, here's the problem: Let's say you have some class which wraps or includes networked file IO oper...
This is a common challenge in designing robust systems that involve I/O operations, particularly when you want to implement a retry mechanism without duplicating code across multiple methods. Here are a few approaches that might help you avoid code duplication and improve the organization of your exception handling log...
305
[ { "from": "human", "value": "I've never been completely happy with the way exception handling works, there's a lot exceptions and try/catch brings to the table (stack unwinding, etc.), but it seems to break a lot of the OO model in the process.\nAnyway, here's the problem:\nLet's say you have some class whi...
What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries? ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
In SQL Server, the `SET NOCOUNT` option controls whether the number of rows affected by a query is returned in the result set. By default, when a SQL query is executed, SQL Server returns a message indicating how many rows were affected by the operation. When `NOCOUNT` is set to `ON`, these messages are suppressed. Tur...
5,262
[ { "from": "human", "value": "What are the advantages and disadvantages of turning NOCOUNT off in SQL server queries?\n­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­\n" }, { "from": "gpt", "value": "In SQL Server, the `SET NOCOUNT` option controls whether the number of rows affected by a query is returned in ...
This answer says that Linq is targeted at a slightly different group of developers than NHibernate, Castle, etc. Being rather new to C#, nevermind all the DB stuff surrounding it: Are there other major, for lack of a better term, SQL wrappers than NHibernate, Castle, Linq? What are the differences between them? What k...
Hi Adam, Welcome to the world of C# and databases! When it comes to data access in .NET applications, there are indeed several frameworks beyond LINQ, NHibernate, and Castle. Here's an overview of some major SQL wrappers and Object-Relational Mapping (ORM) tools, along with their key differences and target audiences: ...
2,881
[ { "from": "human", "value": "This answer says that Linq is targeted at a slightly different group of developers than NHibernate, Castle, etc.\nBeing rather new to C#, nevermind all the DB stuff surrounding it:\n\nAre there other major, for lack of a better term, SQL wrappers than NHibernate, Castle, Linq?\n...
I'm using IIS in Windows 2003 Server for a SharePoint intranet. External incoming requests will be using the host header portal.mycompany.com and be forced to use SSL. I was wondering if there's a way to set up an alternate host header such as http://internalportal/ which only accepts requests from the internal network...
Setting up IIS on Windows 2003 Server for both external and internal access to a SharePoint intranet while managing SSL and host headers requires some specific configurations. Here’s a step-by-step guide on how to achieve your goal of having a secure external URL and an unsecure internal URL. ### Step 1: Set Up Extern...
3,179
[ { "from": "human", "value": "I'm using IIS in Windows 2003 Server for a SharePoint intranet. External incoming requests will be using the host header portal.mycompany.com and be forced to use SSL.\nI was wondering if there's a way to set up an alternate host header such as http://internalportal/ which only ...
What's the best way to asynchronously load an BitmapImage in C# using WPF?
In WPF, loading a `BitmapImage` asynchronously can help keep the UI responsive, especially when loading large images from a file or a URI. One of the common ways to achieve this is by using the `Task` class along with the `BitmapImage` and its `BeginInit` and `EndInit` methods. Here’s how you can do it: ### Step-by-St...
3,586
[ { "from": "human", "value": "What's the best way to asynchronously load an BitmapImage in C# using WPF? \n" }, { "from": "gpt", "value": "In WPF, loading a `BitmapImage` asynchronously can help keep the UI responsive, especially when loading large images from a file or a URI. One of the common ...
I am starting a new client/server project at work and I want to start using some of the newer technologies I've been reading about, LINQ and Generics being the main ones. Up until now I have been developing these types of applications with MySQL as clients were unwilling to pay the large licence costs for MSSQL. I h...
MSSQL 2005 Express is no longer available for download on the official Microsoft site, as Microsoft typically phases out older versions and encourages users to upgrade to more recent versions. You might be able to find third-party websites that host old software, but it's generally safer to stick with the current offer...
6,549
[ { "from": "human", "value": "I am starting a new client/server project at work and I want to start using some of the newer technologies I've been reading about, LINQ and Generics being the main ones. Up until now I have been developing these types of applications with MySQL as clients were unwilling to pay...
I've written a control that inherits from the System.Web.UI.WebControls.DropDownList and so I don't have any code in front for this control, but I still want to set the OutputCache directive. I there any way to set this in the C# code, say with an attribute or something like that? I'm particularly hoping to be able ...
To set the `OutputCache` directive for a custom control in ASP.NET Web Forms, you can't directly use attributes like you would in ASP.NET MVC controllers. However, you can achieve similar functionality by programmatically adding the `OutputCache` directive at the page level or by using the `HttpContext.Current` object....
5,114
[ { "from": "human", "value": "I've written a control that inherits from the System.Web.UI.WebControls.DropDownList and so I don't have any code in front for this control, but I still want to set the OutputCache directive. I there any way to set this in the C# code, say with an attribute or something like th...
We are planning on moving for MS Source Safe (ouch) to SVN. We are working mostly in a Microsoft environment (windows, Visual Studio, .NET) and we have developers in multiple sites. I heard about VisualSVN and integration with visual studio. On the other hand I can get someone to host SVN for me and use TortoiseSVN. An...
Migrating from MS Source Safe to SVN is a positive move, as Source Safe has many limitations and issues, particularly in modern development workflows. Below are some recommendations, potential pitfalls, and insights into the tools you've mentioned. ### Recommendations 1. **Choosing the Right Tool**: - **VisualSVN*...
1,329
[ { "from": "human", "value": "We are planning on moving for MS Source Safe (ouch) to SVN. We are working mostly in a Microsoft environment (windows, Visual Studio, .NET) and we have developers in multiple sites. I heard about VisualSVN and integration with visual studio. On the other hand I can get someone t...
When {0} is used to initialize an object, what does it mean? I can't find any references to {0} anywhere, and because of the curly braces Google searches are not helpful. Example code: SHELLEXECUTEINFO sexi = {0}; // what does this do? sexi.cbSize = sizeof(SHELLEXECUTEINFO); sexi.hwnd = NULL; sexi.fMask = SEE_MASK_NOCL...
In C and C++, when you use an initializer like `{0}` for an object or struct, it sets all the members of that object or struct to zero (or to their equivalent null values). This is known as "zero initialization." In the example you provided, `SHELLEXECUTEINFO sexi = {0};` initializes all fields of the `sexi` variable...
5,196
[ { "from": "human", "value": "When {0} is used to initialize an object, what does it mean? I can't find any references to {0} anywhere, and because of the curly braces Google searches are not helpful.\nExample code:\nSHELLEXECUTEINFO sexi = {0}; // what does this do?\nsexi.cbSize = sizeof(SHELLEXECUTEINFO);\...
Is there any way to force a listview control to treat all clicks as though they were done through the Control key? I need to replicate the functionality of using the control key (selecting an item sets and unsets its selection status) in order to allow the user to easily select multiple items at the same time. Thank yo...
Yes, you can achieve this functionality by handling the `MouseClick` or `MouseDown` event of the ListView control in your application. You will need to programmatically toggle the selection status of items when the user clicks on them, effectively simulating the behavior of holding down the Control key. Here's a basic...
3,846
[ { "from": "human", "value": "Is there any way to force a listview control to treat all clicks as though they were done through the Control key?\nI need to replicate the functionality of using the control key (selecting an item sets and unsets its selection status) in order to allow the user to easily select...
I converted my company's calendar to XSL and changed all the tables to divs. It worked pretty well, but I had a lot of 8 day week bugs to work out initially owing to precarious cross-browser spacing issues. But I was reading another post regarding when to use tables v. divs and the consensus seemed to be that you shoul...
Creating a web calendar is a common requirement for many applications, and the choice of using `divs` versus `tables` can significantly affect the development process and the end user experience. Here’s a breakdown of the considerations and an ideal approach to designing a web calendar, potentially combining both `divs...
1,453
[ { "from": "human", "value": "I converted my company's calendar to XSL and changed all the tables to divs. It worked pretty well, but I had a lot of 8 day week bugs to work out initially owing to precarious cross-browser spacing issues. But I was reading another post regarding when to use tables v. divs and ...
here is what a I'm doing: object ReturnMatch(System.Type type) { foreach(object obj in myObjects) { if (obj == type) { return obj; } } } However, if obj is a subclass of type, it will not match. But I would like the function to return the same way as ...
In C#, the `is` operator checks if an object is compatible with a given type, including checking if the object is an instance of a derived class. However, in your case, you're trying to use a variable (`type`) with the `is` operator, which is not possible directly since `is` requires a type, not a `Type` object. To ac...
6,523
[ { "from": "human", "value": "here is what a I'm doing: \nobject ReturnMatch(System.Type type) \n{ \n foreach(object obj in myObjects) \n {\n if (obj == type) \n { \n return obj; \n } \n } \n} \n\nHowever, if obj is a subclass of type, it will not match. But...
So basically I'm building an app for my company and it NEEDS to be built using MS Access and it needs to be built on SQL Server. I've drawn up most of the plans but am having a hard time figuring out a way to handle the auditing system. Since it is being used internally only and you won't even be able to touch the db f...
Creating a robust auditing system in your application that involves both MS Access and SQL Server can be a bit challenging, especially when it comes to capturing user information from Active Directory. Here are some approaches and considerations to help you design your auditing system effectively: ### Option 1: Use SQ...
2,387
[ { "from": "human", "value": "So basically I'm building an app for my company and it NEEDS to be built using MS Access and it needs to be built on SQL Server.\nI've drawn up most of the plans but am having a hard time figuring out a way to handle the auditing system.\nSince it is being used internally only a...
As you may know, Silverlight does not have the TileBrush found in WPF. Is there a workaround to do tiling?
Yes, while Silverlight does not directly support the `TileBrush` found in WPF, you can achieve a tiling effect through alternative methods. Here are a few workarounds to create a tiled background or tiled pattern in Silverlight: ### 1. Using ImageBrush You can use an `ImageBrush` to tile an image. The `ImageBrush` aut...
4,921
[ { "from": "human", "value": "As you may know, Silverlight does not have the TileBrush found in WPF. Is there a workaround to do tiling?\n" }, { "from": "gpt", "value": "Yes, while Silverlight does not directly support the `TileBrush` found in WPF, you can achieve a tiling effect through alternat...
So for e.g. 0110 has bits 1 and 2 set, 1000 has bit 3 set 1111 has bits 0,1,2,3 set
In binary representation, each digit corresponds to a specific power of 2, starting from the rightmost bit (which is the least significant bit). The bits are indexed starting from 0. Here’s a breakdown of the examples you've provided: 1. **0110**: - This binary number can be interpreted as follows: - Bit 0 (2^...
5,808
[ { "from": "human", "value": "So for e.g. 0110 has bits 1 and 2 set, 1000 has bit 3 set 1111 has bits 0,1,2,3 set\n" }, { "from": "gpt", "value": "In binary representation, each digit corresponds to a specific power of 2, starting from the rightmost bit (which is the least significant bit). The b...
I'd like to set up a cheap Linux box as a web server to host a variety of web technologies (PHP & Java EE come to mind, but I'd like to experiment with Ruby or Python in the future as well). I'm fairly versed in setting up Tomcat to run on Linux for serving up Java EE applications, but I'd like to be able to open this...
Setting up a personal Linux web server for hosting a variety of web technologies can be a fun and educational project. Below are steps and tips to help you set it up securely, allowing you to serve external traffic while minimizing risks. ### 1. Choosing the Right Distribution Select a Linux distribution that suits yo...
1,948
[ { "from": "human", "value": "I'd like to set up a cheap Linux box as a web server to host a variety of web technologies (PHP & Java EE come to mind, but I'd like to experiment with Ruby or Python in the future as well). \nI'm fairly versed in setting up Tomcat to run on Linux for serving up Java EE applicat...
Is there a program or API I can code against to extract individual files from a Windows Vista Complete PC Backup image? I like the idea of having a complete image to restore from, but hate the idea that I have to make two backups, one for restoring individual files, and one for restoring my computer in the event of a c...
Extracting individual files from a Windows Vista Complete PC Backup image (which is essentially a system image created by Windows Backup) can be a bit tricky, as the backups are typically stored in a proprietary format that is not easily accessible. However, there are a few approaches you might consider to extract ind...
5,585
[ { "from": "human", "value": "Is there a program or API I can code against to extract individual files from a Windows Vista Complete PC Backup image?\nI like the idea of having a complete image to restore from, but hate the idea that I have to make two backups, one for restoring individual files, and one for...
I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my .NET product. I just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); thus, x64 customers were getting crashes on startup with errors about the assembly not be...
This is a common scenario when dealing with mixed architectures in an installer, especially when using Visual Studio setup projects. Unfortunately, Visual Studio 2008 setup projects have some limitations when it comes to targeting both x86 and x64 architectures in a single installer. However, there are some potential a...
2,801
[ { "from": "human", "value": "I'm using the VS2008 installer (plus a custom Orca action) to create an installer for my .NET product.\nI just recently found out that one of the third-party assemblies I was using is x86-specific (as it includes some native code); thus, x64 customers were getting crashes on sta...
Can someone explain the mechanics of a jump table and why is would be needed in embedded systems?
A jump table, also known as a dispatch table or branch table, is a programming construct often used to optimize control flow in software, particularly in embedded systems and low-level programming. Here's a detailed explanation of its mechanics and the reasons for its use in embedded systems. ### Mechanics of a Jump T...
4,369
[ { "from": "human", "value": "Can someone explain the mechanics of a jump table and why is would be needed in embedded systems?\n" }, { "from": "gpt", "value": "A jump table, also known as a dispatch table or branch table, is a programming construct often used to optimize control flow in software...
I am using a class library which represents some of its configuration in .xml. The configuration is read in using the XmlSerializer. Fortunately, the classes which represent the .xml use the XmlAnyElement attribute at which allows me to extend the configuration data for my own purposes without modifying the original cl...
To serialize an object back into an `XmlNode` using `XmlSerializer`, you can utilize the `MemoryStream` in combination with `XmlDocument`. Here's a step-by-step guide on how to accomplish this: 1. Serialize your object to a `MemoryStream`. 2. Load that `MemoryStream` into an `XmlDocument`. 3. Extract the root `XmlNode...
1,293
[ { "from": "human", "value": "I am using a class library which represents some of its configuration in .xml. The configuration is read in using the XmlSerializer. Fortunately, the classes which represent the .xml use the XmlAnyElement attribute at which allows me to extend the configuration data for my own p...
Anyone know a quick easy way to migrate a SQLite3 database to MySQL?
Migrating a SQLite3 database to MySQL can be done using several methods, depending on your comfort level with various tools and programming languages. Below are some common approaches to help you with the migration process: ### Method 1: Using `sqlite3` command-line tool and MySQL command-line tool 1. **Export SQLite...
1,303
[ { "from": "human", "value": "Anyone know a quick easy way to migrate a SQLite3 database to MySQL?\n" }, { "from": "gpt", "value": "Migrating a SQLite3 database to MySQL can be done using several methods, depending on your comfort level with various tools and programming languages. Below are some...
Singletons are a hotly debated design pattern, so I am interested in what the Stack Overflow community thought about them. Please provide reasons for your opinions, not just "Singletons are for lazy programmers!" Here is a fairly good article on the issue, although it is against the use of Singletons: scientificninja.c...
Singletons have long been a topic of debate within the programming community, with proponents and critics offering compelling arguments for and against their use. Here’s a summary of the reasons from both sides, as well as suggestions for additional reading. ### Arguments Against Singletons 1. **Global State Manageme...
2,967
[ { "from": "human", "value": "Singletons are a hotly debated design pattern, so I am interested in what the Stack Overflow community thought about them.\nPlease provide reasons for your opinions, not just \"Singletons are for lazy programmers!\"\nHere is a fairly good article on the issue, although it is aga...
I want to delete foo() if foo() isn't called from anywhere.
To safely delete the function `foo()` if it isn't being called from anywhere in your code, you can follow these steps: 1. **Search for Calls**: First, search through your codebase to see if `foo()` is being called. You can do this with a simple text search for `foo(`. Make sure to check: - All relevant files in yo...
4,127
[ { "from": "human", "value": "I want to delete foo() if foo() isn't called from anywhere.\n" }, { "from": "gpt", "value": "To safely delete the function `foo()` if it isn't being called from anywhere in your code, you can follow these steps:\n\n1. **Search for Calls**: First, search through your ...
I would like to flash a success message on my page. I am using the jQuery fadeOut method to fade and then remove the element. I can increase the duration to make it last longer, however this looks strange. What I would like to happen is have the element be displayed for five seconds, then fade quickly, and finally be r...
You can achieve this effect using jQuery by combining the `fadeIn`, `delay`, and `fadeOut` methods. Here's a simple implementation to show a success message for 5 seconds, then fade it out quickly, and finally remove it from the DOM. Below is an example of how you can do this: ```html <!DOCTYPE html> <html lang="en">...
2,038
[ { "from": "human", "value": "I would like to flash a success message on my page.\nI am using the jQuery fadeOut method to fade and then remove the element. I can increase the duration to make it last longer, however this looks strange.\nWhat I would like to happen is have the element be displayed for five s...
I've got a load-balanced (not using Session state) ASP.Net 2.0 app on IIS5 running back to a single Oracle 10g server, using version 10.1.0.301 of the ODAC/ODP.Net drivers. After a long period of inactivity (a few hours), the application, seemingly randomly, will throw an Oracle exception: Exception: ORA-03113: end-o...
The `ORA-03113: end-of-file on communication channel` error typically indicates that the connection between the application and the Oracle database has been lost unexpectedly. Since you mentioned that your application creates new connections on every request, there are a few possible factors to consider that may be cau...
3,185
[ { "from": "human", "value": "I've got a load-balanced (not using Session state) ASP.Net 2.0 app on IIS5 running back to a single Oracle 10g server, using version 10.1.0.301 of the ODAC/ODP.Net drivers. After a long period of inactivity (a few hours), the application, seemingly randomly, will throw an Oracl...
When making changes using SubmitChanges(), LINQ sometimes dies with a ChangeConflictException exception with the error message Row not found or changed, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another user has changed some data in that row. Is...
When working with LINQ to SQL, encountering a `ChangeConflictException` indicates that the state of the data in the database has changed since you retrieved it and the LINQ to SQL context has made changes to that data. This usually happens in a concurrent environment where another user has modified the same data before...
4,572
[ { "from": "human", "value": "When making changes using SubmitChanges(), LINQ sometimes dies with a ChangeConflictException exception with the error message Row not found or changed, without any indication of either the row that has the conflict or the fields with changes that are in conflict, when another u...
As part of a larger web-app (using CakePHP), I'm putting together a simple blog system. The relationships are exceedingly simple: each User has a Blog, which has many Entries, which have many Comments. An element I'd like to incorporate is a list of "Popular Entries." Popular Entries have been defined as those with the...
To implement a "Popular Entries" feature based on the number of Comments in the last month using CakePHP's Model retrieval methods, you can follow these steps. This solution will use CakePHP's Query Builder to construct a query that joins the necessary tables and aggregates the data accordingly. ### Step 1: Set Up You...
4,548
[ { "from": "human", "value": "As part of a larger web-app (using CakePHP), I'm putting together a simple blog system. The relationships are exceedingly simple: each User has a Blog, which has many Entries, which have many Comments.\nAn element I'd like to incorporate is a list of \"Popular Entries.\" Popular...
I'm looking for any resources on hosting a WPF form within an existing MFC application. Can anyone point me in the right direction on how to do this?
Integrating a Windows Presentation Foundation (WPF) form within an existing Microsoft Foundation Classes (MFC) application can be quite complex, but it is certainly possible. Here are the general steps and some resources to help you achieve this integration: ### Steps to Host WPF in MFC: 1. **Use WPF Interoperability...
1,967
[ { "from": "human", "value": "I'm looking for any resources on hosting a WPF form within an existing MFC application. Can anyone point me in the right direction on how to do this?\n" }, { "from": "gpt", "value": "Integrating a Windows Presentation Foundation (WPF) form within an existing Microso...
I'm trying to figure out how big a certain database would be (it hasn't been created yet). I know how many rows and what the tables will be. Is there a feature in Oracle that will tell me the size of such a theoretical database? Is there a known math formula I can use? I know there is a feature to determine the size of...
In Oracle, there isn't a built-in feature that directly calculates the size of a theoretical database before it's created. However, you can estimate the size of a future database by following a mathematical approach based on the expected schema. Here's a method to do this: ### Steps to Estimate Database Size 1. **Def...
884
[ { "from": "human", "value": "I'm trying to figure out how big a certain database would be (it hasn't been created yet). I know how many rows and what the tables will be. Is there a feature in Oracle that will tell me the size of such a theoretical database? Is there a known math formula I can use? I know th...
This is mostly geared toward desktop application developers. How do I design a caching block which plays nicely with the GC? How do I tell the GC that I have just done a cache sweep and it is time to do a GC? How do I get an accurate measure of when it is time to do a cache sweep? Are there any prebuilt caching sche...
Designing a caching mechanism that integrates well with the Garbage Collector (GC) in a desktop application involves understanding how memory management works in the context of managed environments (like .NET or Java) and the principles of caching. Here’s how you can approach designing such a caching block: ### 1. Des...
3,008
[ { "from": "human", "value": "This is mostly geared toward desktop application developers. How do I design a caching block which plays nicely with the GC? How do I tell the GC that I have just done a cache sweep and it is time to do a GC? How do I get an accurate measure of when it is time to do a cache s...
I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software. I'm considering MS Access or Berkeley DB. Can you share your experience with file databases? Which one did you use, did you have any problems with it?
When considering a file-based database for multi-user environments without server software, both MS Access and Berkeley DB offer distinct advantages and challenges. Here’s a comparison based on various aspects, including my experiences: ### MS Access **Advantages:** - **User-Friendly Interface:** MS Access offers a g...
2,572
[ { "from": "human", "value": "I need a database that could be stored network drive and would allow multiple users (up to 20) to use it without any server software.\nI'm considering MS Access or Berkeley DB.\nCan you share your experience with file databases? \nWhich one did you use, did you have any problems...
Disclaimer: I'm stuck on TFS and I hate it. My source control structure looks like this: /dev /releases /branches /experimental-upgrade I branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev and merged to experimental-upgrade. Somehow TFS complained that I had changes in b...
It sounds like you're dealing with a common issue when working with TFS (Team Foundation Server) and Visual Studio solutions, especially when merging branches and dealing with projects that may have had path changes or been misconfigured. Here are several steps to troubleshoot and potentially resolve your issue: ### 1...
4,103
[ { "from": "human", "value": "Disclaimer: I'm stuck on TFS and I hate it.\nMy source control structure looks like this:\n\n/dev\n/releases\n/branches\n/experimental-upgrade\n\nI branched from dev to experimental-upgrade and didn't touch it. I then did some more work in dev and merged to experimental-upgrade...
The Add view and the Edit view are often incredibly similar that it is unwarranted to write 2 views. As the app evolves you would be making the same changes to both. However, there are usually subtle differences. For instance, a field might be read-only once it's been added, and if that field is a DropDownList you no l...
When dealing with similar views such as Add and Edit, it’s indeed a common challenge to manage code duplication while still accommodating differences. Here are several approaches you can consider, along with their pros and cons: ### 1. Single View with Conditional Logic Using a single view and leveraging conditional ...
1,486
[ { "from": "human", "value": "The Add view and the Edit view are often incredibly similar that it is unwarranted to write 2 views. As the app evolves you would be making the same changes to both.\nHowever, there are usually subtle differences. For instance, a field might be read-only once it's been added, an...
How do I determine the (local-) path for the "Program Files" directory on a remote computer? There does not appear to any version of SHGetFolderPath (or related function) that takes the name of a remote computer as a parameter. I guess I could try to query HKLM\Software\Microsoft\Windows\CurrentVersion\ProgramFilesDir ...
To determine the path for the "Program Files" directory on a remote computer, you can use a few different methods, as there is no direct API call like `SHGetFolderPath` that accepts a remote computer name. Here are a few approaches you can consider: ### 1. Remote Registry Access You correctly mentioned querying the r...
4,547
[ { "from": "human", "value": "How do I determine the (local-) path for the \"Program Files\" directory on a remote computer? There does not appear to any version of SHGetFolderPath (or related function) that takes the name of a remote computer as a parameter.\nI guess I could try to query HKLM\\Software\\Mic...
I want to create a list of columns in SQL Server 2005 that have identity columns and their corresponding table in T-SQL. Results would be something like: TableName, ColumnName
In SQL Server 2005, you can retrieve a list of tables and their identity columns by querying the system catalog views. Specifically, you can use the `INFORMATION_SCHEMA.COLUMNS` view along with the `sys.identity_columns` view to gather this information. Here's a T-SQL query that will generate the desired result: ```s...
6,191
[ { "from": "human", "value": "I want to create a list of columns in SQL Server 2005 that have identity columns and their corresponding table in T-SQL.\nResults would be something like:\nTableName, ColumnName\n" }, { "from": "gpt", "value": "In SQL Server 2005, you can retrieve a list of tables an...
Is there a difference between NULL and null in PHP? Sometimes they seem to be interchangeable and sometimes not. edit: for some reason when I read the documentation linked to in the answer (before posting this question) I read it as "case sensitive" instead of "case insensitive" which was the whole reason I posted this...
In PHP, there is no difference between `NULL` and `null`; they are completely interchangeable. PHP is case-insensitive when it comes to its language constructs, which means you can use `NULL`, `Null`, or `null` without any impact on functionality. However, it is common practice to use `null` in lowercase for consistenc...
5,560
[ { "from": "human", "value": "Is there a difference between NULL and null in PHP? Sometimes they seem to be interchangeable and sometimes not.\nedit: for some reason when I read the documentation linked to in the answer (before posting this question) I read it as \"case sensitive\" instead of \"case insensit...
Does anyone know how to print a barcode to the Intermec PB20 bluetooth printer from a Windows Compact Framework application? We are currently using the Intermec LinePrinter API but have been unable to find a way to print a barcode. ­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­
To print a barcode to the Intermec PB20 Bluetooth printer using the Windows Compact Framework, you generally need to send commands directly to the printer in a format it understands, such as ZPL, EPL, or commands specific to the Intermec printers. Since you are using the Intermec LinePrinter API, it may not provide di...
4,206
[ { "from": "human", "value": "Does anyone know how to print a barcode to the Intermec PB20 bluetooth printer from a Windows Compact Framework application? We are currently using the Intermec LinePrinter API but have been unable to find a way to print a barcode.\n­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­...
I would like to execute an OS command from my ruby script but I want to add an argument from a ruby variable. I know that's possible by using keyword system like that : #!/usr/bin/env ruby directory = '/home/paulgreg/' system 'ls ' + directory but is that possible by using the "backquotes or backticks syntax" ? (I mea...
Yes, you can use backticks (also known as backquotes) in Ruby to execute OS commands, and you can also interpolate variables within that syntax. Here's how you can do it with your example using backticks: ```ruby #!/usr/bin/env ruby directory = '/home/paulgreg/' result = `ls #{directory}` puts result ``` In this co...
7,229
[ { "from": "human", "value": "I would like to execute an OS command from my ruby script but I want to add an argument from a ruby variable.\nI know that's possible by using keyword system like that :\n#!/usr/bin/env ruby\ndirectory = '/home/paulgreg/'\nsystem 'ls ' + directory\n\nbut is that possible by usin...
Is it possible to obtain raw logs from Google Analytic? Is there any tool that can generate the raw logs from GA?
Google Analytics does not provide access to raw logs directly due to privacy and data aggregation policies. However, there are ways to obtain more detailed data that can resemble raw logs: 1. **Google Analytics 4 (GA4) BigQuery Export**: If you're using GA4, one of the key features is the ability to export your event ...
6,494
[ { "from": "human", "value": "Is it possible to obtain raw logs from Google Analytic? Is there any tool that can generate the raw logs from GA?\n" }, { "from": "gpt", "value": "Google Analytics does not provide access to raw logs directly due to privacy and data aggregation policies. However, the...
I have found that skin files only work if they are placed at the root theme folder in the App_Themes folder. For example, if you have 2 themes in the App_Themes folder, you cannot add another sub folder to the theme folder and place a seperate skin file in that subfolder. It's not much of a limitation, but it would g...
The behavior you're observing with skin files in ASP.NET Web Forms (especially version 2.0 and later) is due to how the framework is designed to locate and apply these files. ### Key Points: 1. **Structure of App_Themes**: The `App_Themes` folder is specifically structured for themes in ASP.NET. Each theme is placed...
5,552
[ { "from": "human", "value": "I have found that skin files only work if they are placed at the root theme folder in the App_Themes folder.\nFor example, if you have 2 themes in the App_Themes folder, you cannot add another sub folder to the theme folder and place a seperate skin file in that subfolder. \nIt...
I have a Flex swf hosted at http://www.a.com/a.swf. I have a flash code on another doamin that tries loading the SWF: _loader = new Loader(); var req:URLRequest = new URLRequest("http://services.nuconomy.com/n.swf"); _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,onLoaderFinish); _loader.load(req); On the o...
The issue you are experiencing is due to Flash Player's security model, which restricts access between SWF files hosted on different domains. In your case, your SWF hosted at `http://www.a.com/a.swf` is trying to access the application domain of another SWF hosted at `http://services.nuconomy.com/n.swf`, resulting in a...
2,319
[ { "from": "human", "value": "I have a Flex swf hosted at http://www.a.com/a.swf.\nI have a flash code on another doamin that tries loading the SWF:\n_loader = new Loader();\nvar req:URLRequest = new URLRequest(\"http://services.nuconomy.com/n.swf\");\n_loader.contentLoaderInfo.addEventListener(Event.COMPLET...
I'm looking at the PHP Manual, and I'm not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything like this built in?
In PHP, the built-in data structures are primarily arrays, which are quite versatile and can act as both ordered lists and associative arrays (similar to dictionaries or hash tables in other languages). Here’s a brief overview: 1. **Arrays**: In PHP, an array can be indexed with integers (like a list) or strings (like...
5,324
[ { "from": "human", "value": "I'm looking at the PHP Manual, and I'm not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything like this built in?\n" }, { "from": "gpt", "value": "In PHP, the built-in data structures ar...
Why are SQL distributions so non-standard despite an ANSI standard existing for SQL? Are there really that many meaningful differences in the way SQL databases work or is it just the two databases with which I have been working: MS-SQL and PostgreSQL? Why do these differences arise?
The differences in SQL distributions, despite the existence of an ANSI SQL standard, stem from several key factors: ### 1. **Evolution of Database Systems** SQL has been around since the early 1970s, and over the years, various database vendors have extended the standard to introduce features that cater to their speci...
1,377
[ { "from": "human", "value": "Why are SQL distributions so non-standard despite an ANSI standard existing for SQL? Are there really that many meaningful differences in the way SQL databases work or is it just the two databases with which I have been working: MS-SQL and PostgreSQL? Why do these differences ar...
I'm looking for a good way to enumerate all the Video codecs on a Windows XP/Vista machine. I need present the user with a set of video codecs, including the compressors and decompressors. The output would look something like Available Decoders DiVX Version 6.0 XVID Motion JPEG CompanyX's MPEG-2 Decoder Windows Media...
Enumerating video codecs on Windows XP and Vista can indeed be quite challenging due to the lack of a unified API that seamlessly combines the information about both encoders and decoders. Here's a breakdown of how to tackle this problem using available APIs and libraries. ### Using DirectShow While DirectShow primar...
1,227
[ { "from": "human", "value": "I'm looking for a good way to enumerate all the Video codecs on a Windows XP/Vista machine.\nI need present the user with a set of video codecs, including the compressors and decompressors. The output would look something like\n\nAvailable Decoders\nDiVX Version 6.0\nXVID\nMoti...
I'm writing a C# application which downloads a compressed database backup via FTP. The application then needs to extract the backup and restore it to the default database location. I will not know which version of SQL Server will be installed on the machine where the application runs. Therefore, I need to find the def...
To solve your problem of determining the default database location for an instance of SQL Server and the NT account under which the SQL service is running, you can leverage the SQL Server Management Objects (SMO) library and some additional approaches. ### Step 1: Using SMO to Get Default Database Location To get the...
2,195
[ { "from": "human", "value": "I'm writing a C# application which downloads a compressed database backup via FTP. The application then needs to extract the backup and restore it to the default database location.\nI will not know which version of SQL Server will be installed on the machine where the applicati...
In one of our commercial applications (Win32, written in Delphi) we'd like to implement full text search. The application is storing user data in some kind of binary format that is not directly recognizable as a text. Ideally, I'd like to find either an in-process solution (DLL would be OK) or a local server that I cou...
Implementing full-text search for your application can be achieved through several solutions that can fit your requirements. Here are a few options, both in-process DLLs and external servers, that support full-text search with Unicode, and allow you to submit textual data along with metadata. ### In-Process Solutions ...
4,058
[ { "from": "human", "value": "In one of our commercial applications (Win32, written in Delphi) we'd like to implement full text search. The application is storing user data in some kind of binary format that is not directly recognizable as a text.\nIdeally, I'd like to find either an in-process solution (DLL...
I would like to convert the following string into an array/nested array: str = "[[this, is],[a, nested],[array]]" newarray = # this is what I need help with! newarray.inspect # => [['this','is'],['a','nested'],['array']]
You can convert the string `str = "[[this, is],[a, nested],[array]]"` into a nested array by first parsing the string and then converting it into the desired format. Here's how you can do that in Ruby: ```ruby str = "[[this, is],[a, nested],[array]]" # Use eval to convert the string into a Ruby structure newarray =...
5,967
[ { "from": "human", "value": "I would like to convert the following string into an array/nested array: \nstr = \"[[this, is],[a, nested],[array]]\"\n\nnewarray = # this is what I need help with!\n\nnewarray.inspect # => [['this','is'],['a','nested'],['array']]\n\n" }, { "from": "gpt", "value": "...
I saved my VB-Express code as .dll and registered it with regasm and made a .tlb file. But when I try to run a function from it in an Excel-modul I get: Run-time error ‘453’: Can’t find DLL entry point RegisterServiceProcess in kernel32 What step did I miss?
The error message "Run-time error '453': Can't find DLL entry point RegisterServiceProcess in kernel32" typically suggests that there is an issue with how your DLL is being referenced or registered in your VBA/Excel environment, rather than a direct problem with your code. Here are some steps to troubleshoot and resol...
3,868
[ { "from": "human", "value": "I saved my VB-Express code as .dll and registered it with regasm and made a .tlb file.\nBut when I try to run a function from it in an Excel-modul I get: Run-time error ‘453’: Can’t find DLL entry point RegisterServiceProcess in kernel32\nWhat step did I miss?\n" }, { "f...
Can anyone recommend a good Windows form component for displaying PDF documents and allowing users to add real annotation (by which I mean identical to that created by Adobe Reader). Update: I've tried the AxAcroPDF component which Abobe installs alongside Reader, but this doesn't support annotation. I basically want ...
There are several options you can consider for displaying and annotating PDF documents in a Windows Forms application. Here are some recommendations: 1. **PDFium**: This is an open-source PDF rendering library used by many applications, including Google Chrome. You can use it with a wrapper like `PDFiumViewer`, which ...
5,048
[ { "from": "human", "value": "Can anyone recommend a good Windows form component for displaying PDF documents and allowing users to add real annotation (by which I mean identical to that created by Adobe Reader). \nUpdate: I've tried the AxAcroPDF component which Abobe installs alongside Reader, but this doe...
What JavaScript keywords (function names, variables, etc) are reserved?
In JavaScript, certain keywords are reserved for the language's syntax and cannot be used as variable names, function names, or identifiers. These reserved keywords include: ### Reserved Keywords 1. **Keywords**: These are the primary reserved words in JavaScript. - `break` - `case` - `catch` - `class` ...
3,556
[ { "from": "human", "value": "What JavaScript keywords (function names, variables, etc) are reserved?\n" }, { "from": "gpt", "value": "In JavaScript, certain keywords are reserved for the language's syntax and cannot be used as variable names, function names, or identifiers. These reserved keywor...
I have a query where I am searching against a string: SELECT county FROM city WHERE UPPER(name) = 'SAN FRANCISCO'; Now, this works fine, but it doesn't scale well, and I need to optimize it. I have found an option along the lines of creating a generated view, or something like that, but I was hoping for a simpler sol...
To optimize your query in DB2 on Linux, you have a few options to consider, even though you can't create an expression index directly for the `UPPER(name)`. Here are some approaches you could consider: ### 1. Create a Computed Column (if applicable) If you're open to adding a new column to your table, you can create a...
4,394
[ { "from": "human", "value": "I have a query where I am searching against a string:\nSELECT county FROM city WHERE UPPER(name) = 'SAN FRANCISCO';\n\nNow, this works fine, but it doesn't scale well, and I need to optimize it. I have found an option along the lines of creating a generated view, or something l...