instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Are there any ncurses libraries in C/C++ for Windows that emulate ncurses in native resizable Win32 windows (not in console mode)?
Yes, there are libraries that provide ncurses-like functionality for Windows, enabling the creation of text user interfaces (TUIs) in native resizable Win32 windows. Here are a few options you can consider: 1. **PDCurses**: PDCurses is a public domain implementation of the ncurses library that is compatible with Windo...
11,510
[ { "from": "human", "value": "Are there any ncurses libraries in C/C++ for Windows that emulate ncurses in native resizable Win32 windows (not in console mode)?\n" }, { "from": "gpt", "value": "Yes, there are libraries that provide ncurses-like functionality for Windows, enabling the creation of ...
In the web-application I'm developing I currently use a naive solution when connecting to the database: Connection c = DriverManager.getConnection("url", "username", "password"); This is pretty unsafe. If an attacker gains access to the sourcecode he also gains access to the database itself. How can my web-application...
Storing database credentials directly in the source code is indeed a security risk. There are several best practices you can adopt to enhance the security of your web application and protect sensitive information like database passwords. Here are some strategies you might consider: 1. **Environment Variables**: St...
5,671
[ { "from": "human", "value": "In the web-application I'm developing I currently use a naive solution when connecting to the database:\nConnection c = DriverManager.getConnection(\"url\", \"username\", \"password\");\n\nThis is pretty unsafe. If an attacker gains access to the sourcecode he also gains access ...
One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?
Yes, in Python, dictionaries are implemented internally as hash tables. This implementation allows for efficient key-value pair storage and retrieval, typically providing average time complexity of O(1) for lookup, insertion, and deletion operations. When you add a key-value pair to a dictionary, Python computes a has...
12,640
[ { "from": "human", "value": "One of the basic data structures in Python is the dictionary, which allows one to record \"keys\" for looking up \"values\" of any type. Is this implemented internally as a hash table? If not, what is it?\n" }, { "from": "gpt", "value": "Yes, in Python, dictionarie...
I am using YUI reset/base, after the reset it sets the ul and li tags to list-style: disc outside; My markup looks like this: <div id="nav"> <ul class="links"> <li><a href="">Testing</a></li> </ul> </div> My CSS is: #nav {} #nav ul li { list-style: none; } Now that makes the small disc beside...
The issue you're experiencing is due to the CSS specificity and how the YUI CSS reset/base styles are applied. When you use the base stylesheet from YUI, it has its own default styles that may include `list-style: disc outside;` for `ul` and `li` elements. Let's break down the two CSS rules you mentioned: 1. **This w...
8,327
[ { "from": "human", "value": "I am using YUI reset/base, after the reset it sets the ul and li tags to list-style: disc outside;\nMy markup looks like this:\n<div id=\"nav\">\n <ul class=\"links\">\n <li><a href=\"\">Testing</a></li>\n </ul>\n\n</div>\n\nMy CSS is:\n#nav {}\n#nav ul li {\n ...
I have two tables Organisation and Employee having one to many relation i.e one organisation can have multiple employees. Now I want to select all information of a particular organisation plus first name of all employees for this organisation. What’s the best way to do it? Can I get all of this in single record set or ...
To achieve the desired output of selecting all information from the `Organisation` table alongside the first names of all employees associated with that organisation, you will need to format the output in such a way that it consolidates employee names into a single string. This can typically be done using SQL function...
10,028
[ { "from": "human", "value": "I have two tables Organisation and Employee having one to many relation i.e one organisation can have multiple employees. Now I want to select all information of a particular organisation plus first name of all employees for this organisation. What’s the best way to do it? Can I...
So I've been poking around with C# a bit lately, and all the Generic Collections have me a little confused. Say I wanted to represent a data structure where the head of a tree was a key value pair, and then there is one optional list of key value pairs below that (but no more levels than these). Would this be suitable?...
Yes, your `TokenTree` class is a suitable way to represent a simple tree structure with a key-value pair at the head and an optional list of additional key-value pairs. Let's break it down: 1. **IDictionary and Dictionary**: You're correct that `IDictionary` is an interface that defines a collection of key-value pairs...
4,803
[ { "from": "human", "value": "So I've been poking around with C# a bit lately, and all the Generic Collections have me a little confused. Say I wanted to represent a data structure where the head of a tree was a key value pair, and then there is one optional list of key value pairs below that (but no more le...
Given the following XML structure <html> <body> <div> <span>Test: Text2</span> </div> <div> <span>Test: Text3</span> </div> <div> <span>Test: Text5</span> </div> </body> </html> What is the best XPath query to locate any span with text that starts with Test?
To locate any `<span>` elements with text that starts with "Test" in the provided XML structure, you can use the following XPath query: ```xpath //span[starts-with(text(), 'Test')] ``` This XPath expression does the following: - `//span` selects all `<span>` elements in the document. - `[starts-with(text(), 'Test')]...
13,402
[ { "from": "human", "value": "Given the following XML structure\n<html>\n <body>\n <div>\n <span>Test: Text2</span>\n </div>\n <div>\n <span>Test: Text3</span>\n </div>\n <div>\n <span>Test: Text5</span>\n </div>\n </body>\n</html>\n\nWhat is the best XPath query to locate ...
I've drawn an ellipse in the XZ plane, and set my perspective slightly up on the Y-axis and back on the Z, looking at the center of ellipse from a 45-degree angle, using gluPerspective() to set my viewing frustrum. Unrotated, the major axis of the ellipse spans the width of my viewport. When I rotate 90-degrees about...
The issue you're experiencing arises from the perspective projection, which can cause objects to appear differently depending on their orientation in relation to the camera. When you rotate the ellipse, its projection onto the viewport changes, leading to the deformation you're seeing. To address this issue and minimi...
7,497
[ { "from": "human", "value": "I've drawn an ellipse in the XZ plane, and set my perspective slightly up on the Y-axis and back on the Z, looking at the center of ellipse from a 45-degree angle, using gluPerspective() to set my viewing frustrum.\n\nUnrotated, the major axis of the ellipse spans the width of m...
In a project our team is using object lists to perform mass operations on sets of data that should all be processed in a similar way. In particular, different objects would ideally act the same, which would be very easily achieved with polymorphism. The problem I have with it is that inheritance implies the is a rela...
In object-oriented programming, it’s important to consider the relationships between your objects when designing your classes, especially regarding inheritance and polymorphism. You're right that inheritance typically implies an "is-a" relationship, which can sometimes lead to conceptual misalignment in your design. Wh...
2,974
[ { "from": "human", "value": "In a project our team is using object lists to perform mass operations on sets of data that should all be processed in a similar way. In particular, different objects would ideally act the same, which would be very easily achieved with polymorphism. The problem I have with it ...
I would like my website to record flvs using webcams. These flvs need to play smoothly so I can play with them afterwards, for example transcoding them to avis. I've tried many different servers to handle the flv recording. The resulting flvs play OK in Wimpy FLV Player, for example, except that the progress indicator ...
Creating a smooth FLV recording that can be transcoded correctly can indeed be a challenge, especially when dealing with different server setups and streaming technologies. Here are some steps and tips that you can follow to achieve a better outcome with your video recordings: ### Key Points to Consider 1. **Constant...
5,676
[ { "from": "human", "value": "I would like my website to record flvs using webcams. These flvs need to play smoothly so I can play with them afterwards, for example transcoding them to avis.\nI've tried many different servers to handle the flv recording. The resulting flvs play OK in Wimpy FLV Player, for ex...
I've Added a setup project to my solution (didn't use the wizard) I then added the primary output of the Windows Application I have coded to the Applcation Folder node (Right click the setup project in Solution-Explorer and select View -> File System). I Right clicked the User's Desktop node and selected 'Create Shortc...
It sounds like you’re experiencing a frustrating issue while trying to create a shortcut to the primary output of your application in the setup project. Here are some steps you can take to troubleshoot and potentially resolve the issue: 1. **Verify Project References**: Ensure that the setup project has a proper refer...
10,211
[ { "from": "human", "value": "I've Added a setup project to my solution (didn't use the wizard) I then added the primary output of the Windows Application I have coded to the Applcation Folder node (Right click the setup project in Solution-Explorer and select View -> File System). I Right clicked the User's...
I wrote an application in Java and when it runs on one customer's computer running OS X The Save and Export buttons are disabled. (Everything else works in the application.) Both of these buttons open up a standard save file dialog. Any ideas?
When your Java application runs on macOS and the "Save" and "Export" buttons are disabled, there could be several reasons for this behavior. Here are some troubleshooting steps and potential solutions: 1. **Check Action Listeners**: Ensure that the buttons have the correct ActionListeners attached and that they are be...
9,270
[ { "from": "human", "value": "I wrote an application in Java and when it runs on one customer's computer running OS X The Save and Export buttons are disabled. (Everything else works in the application.)\nBoth of these buttons open up a standard save file dialog.\nAny ideas?\n" }, { "from": "gpt", ...
I've got quite a few GreaseMonkey scripts that I wrote at my work which automatically log me into the internal sites we have here. I've managed to write a script for nearly each one of these sites except for our time sheet application, which uses HTTP authentication. Is there a way I can use GreaseMonkey to log me i...
Using GreaseMonkey to automatically log into a site that uses HTTP authentication can be challenging since HTTP authentication is generally handled by the browser and not by JavaScript running in a user script. However, there are a few approaches you could take to automate this process. ### Approach 1: Using URL with ...
7,949
[ { "from": "human", "value": "I've got quite a few GreaseMonkey scripts that I wrote at my work which automatically log me into the internal sites we have here. I've managed to write a script for nearly each one of these sites except for our time sheet application, which uses HTTP authentication. \nIs ther...
An important part of mobile development, especially when you are talking about mobile games, is dealing with the application size restrictions. Some devices enforce their own size limits, while all the carriers have their own size requirements for applications to be released in their deck space. My question is, is ther...
It's great that you've found Proguard to be a reliable tool for Java obfuscation and size reduction. Proguard is indeed widely used and well-supported, particularly for Android development. It provides several optimizations that help reduce the size of the final APK, including dead code elimination and class/method ren...
10,196
[ { "from": "human", "value": "An important part of mobile development, especially when you are talking about mobile games, is dealing with the application size restrictions. Some devices enforce their own size limits, while all the carriers have their own size requirements for applications to be released in ...
I'm working in a .net application where we need to generate XML files on the fly based on the dataset retrieved from the db. XML schema should be based on a xsd provided. I would like to know is there any way to bind or associate a dataset or each datarow with the xsd. I dont know whether it can be done at all or i may...
You're on the right track by considering XML Schema Definitions (XSD) to validate the structure of the XML files you generate in your .NET application. However, it’s essential to clarify a few points regarding the use of XSDs, DataSets, and DataRows. ### Understanding XSD 1. **Purpose of XSD**: An XSD defines the str...
7,804
[ { "from": "human", "value": "I'm working in a .net application where we need to generate XML files on the fly based on the dataset retrieved from the db. XML schema should be based on a xsd provided. I would like to know is there any way to bind or associate a dataset or each datarow with the xsd. I dont kn...
What's the best, crossplatform way to perform blackbox tests on AJAX web applications? Ideally, the solution should have the following attributes: Able to integrate into a continuous integration build loop Cross platform so I you can run it on Windows laptops and Linux continuous integration servers Easy way to script...
For blackbox testing of AJAX web applications, there are several tools that meet your criteria for being cross-platform, easy to script, capable of integration into CI/CD pipelines, and open-source (free-as-in-freedom). Here are some popular options: ### 1. **Selenium WebDriver** - **Description**: Selenium is one of ...
9,439
[ { "from": "human", "value": "What's the best, crossplatform way to perform blackbox tests on AJAX web applications?\nIdeally, the solution should have the following attributes:\n\nAble to integrate into a continuous integration build loop\nCross platform so I you can run it on Windows laptops and Linux cont...
I'm trying to display the date for a year from now in an xslt file using umbraco like so: <xsl:variable name="now" select="umbraco.library:CurrentDate()"/> <xsl:value-of select="umbraco.library:DateAdd($now, 'year', 1)"/> The value-of tag outputs today's date. How can I get the DateAdd to add a year to the current da...
In XSLT, using Umbraco's built-in functions, the approach you're trying to take is almost correct, but you need to make sure that the date manipulation is done properly. The `DateAdd` function should be applied correctly. The first thing to ensure is that the `CurrentDate()` function returns the date in a format that ...
6,563
[ { "from": "human", "value": "I'm trying to display the date for a year from now in an xslt file using umbraco like so:\n<xsl:variable name=\"now\" select=\"umbraco.library:CurrentDate()\"/>\n<xsl:value-of select=\"umbraco.library:DateAdd($now, 'year', 1)\"/>\n\nThe value-of tag outputs today's date. How ca...
I'm really interested in speech-to-text algorithms, but I'm not sure where to start studying up on them. A bunch of searching around led me to this, but it's from 1996 and I'm fairly certain that there have been improvements since then. Does anyone who has any experience with this sort of stuff have any recommendations...
It's great to hear that you're interested in speech-to-text algorithms and voice command applications! The field has indeed seen significant advancements since 1996, and there are plenty of resources to help you get started. Here are some suggestions for reading materials, libraries, and general areas of study. ### Re...
6,396
[ { "from": "human", "value": "I'm really interested in speech-to-text algorithms, but I'm not sure where to start studying up on them. A bunch of searching around led me to this, but it's from 1996 and I'm fairly certain that there have been improvements since then.\nDoes anyone who has any experience with t...
What's the most efficient way to convert the output of this function from a varbinary() to a a varchar()?
To convert the output of a `varbinary` type to a `varchar` type in SQL Server, you can use the `CAST` or `CONVERT` functions. Here’s the most efficient way to do this: ### Using `CAST` ```sql SELECT CAST(your_varbinary_column AS VARCHAR(MAX)) AS YourVarcharColumn FROM your_table; ``` ### Using `CONVERT` ```sql SELE...
9,172
[ { "from": "human", "value": "What's the most efficient way to convert the output of this function from a varbinary() to a a varchar()?\n" }, { "from": "gpt", "value": "To convert the output of a `varbinary` type to a `varchar` type in SQL Server, you can use the `CAST` or `CONVERT` functions. He...
In SQL Server what is the simplest/cleanest way to make a datetime representing the first of the month based on another datetime? eg I have a variable or column with 3-Mar-2005 14:23 and I want to get 1-Mar-2005 00:00 (as a datetime, not as varchar)
In SQL Server, you can easily get the first day of the month from a `DATETIME` value using the `EOMONTH` function along with some date arithmetic. Here's a clean and simple way to do that: ```sql DECLARE @OriginalDate DATETIME = '2005-03-03 14:23'; -- Get the first day of the month at 00:00:00 DECLARE @FirstOfMonth D...
10,915
[ { "from": "human", "value": "In SQL Server what is the simplest/cleanest way to make a datetime representing the first of the month based on another datetime? eg I have a variable or column with 3-Mar-2005 14:23 and I want to get 1-Mar-2005 00:00 (as a datetime, not as varchar)\n" }, { "from": "gpt"...
How can i check in JavaScript if a variable is defined in a page? Suppose I want to check if a variable named "x" is defined in a page, if I do if(x != null), it gives me an error.
To check if a variable is defined in JavaScript without causing an error, you can use the `typeof` operator. This operator returns a string indicating the type of the unevaluated operand. If the variable is not defined, `typeof` will return the string `"undefined"` instead of throwing a ReferenceError. Here’s how you ...
12,121
[ { "from": "human", "value": "How can i check in JavaScript if a variable is defined in a page? Suppose I want to check if a variable named \"x\" is defined in a page, if I do if(x != null), it gives me an error.\n" }, { "from": "gpt", "value": "To check if a variable is defined in JavaScript wit...
We have a situation in our product where for a long time some data has been stored in the application's database as SQL string (choice of MS SQL server or sybase SQL anywhere) which was encrypted via the Windows API function CryptEncrypt. (direct and de-cryptable) The problem is that CryptEncrypt can produce NULL's in...
You’re facing a challenge with storing encrypted data in a database due to the potential for NULL characters being introduced in the encrypted output, which can cause issues with string manipulation in SQL. Here are a few approaches you might consider for your situation: ### 1. Use an Encryption Algorithm with Base64 ...
6,480
[ { "from": "human", "value": "We have a situation in our product where for a long time some data has been stored in the application's database as SQL string (choice of MS SQL server or sybase SQL anywhere) which was encrypted via the Windows API function CryptEncrypt. (direct and de-cryptable)\nThe problem ...
Possible Duplicate: How does the Google “Did you mean?” Algorithm work? Suppose you have a search system already in your website. How can you implement the "Did you mean:<spell_checked_word>" like Google does in some search queries?
Implementing a "Did you mean?" feature for your search system involves several key steps. Here's a structured approach to creating a spell-checking and suggestion mechanism similar to Google's: ### 1. **Collect Data** - **Search Queries**: Gather data on user search queries to identify common misspellings and the cor...
6,752
[ { "from": "human", "value": "\nPossible Duplicate:\nHow does the Google “Did you mean?” Algorithm work? \n\nSuppose you have a search system already in your website. How can you implement the \"Did you mean:<spell_checked_word>\" like Google does in some search queries?\n" }, { "from": "gpt", "v...
I'm a CompSci student, and fairly new at C#, and I was doing a "Josephus Problem" program for a class, and I created an Exit button that calls Application.Exit() to exit at anytime, but if C# is still working on painting and the button is pressed it throws an ObjectDisposedExeception for the Graphics object. Is there a...
The `ObjectDisposedException` you're encountering is likely due to the application trying to access a Graphics object that has already been disposed when `Application.Exit()` is called while a painting operation is still in progress. There are indeed a few ways you can handle this scenario gracefully. ### Suggested Ap...
8,775
[ { "from": "human", "value": "I'm a CompSci student, and fairly new at C#, and I was doing a \"Josephus Problem\" program for a class, and I created an Exit button that calls Application.Exit() to exit at anytime, but if C# is still working on painting and the button is pressed it throws an ObjectDisposedExe...
Given an arbitrary string, what is an efficient method of finding duplicate phrases? We can say that phrases must be longer than a certain length to be included. Ideally, you would end up with the number of occurrences for each phrase.
To efficiently find duplicate phrases in a given string, especially when they must be longer than a certain length, you can use a combination of a sliding window approach and a dictionary (or hashmap) to count occurrences of each phrase. Here’s a step-by-step outline of the method you can follow: ### Steps to Find Dup...
7,639
[ { "from": "human", "value": "Given an arbitrary string, what is an efficient method of finding duplicate phrases? We can say that phrases must be longer than a certain length to be included.\nIdeally, you would end up with the number of occurrences for each phrase.\n" }, { "from": "gpt", "value...
I'm trying to build a better username/password field for my workplace and would like to be able to complain when they have their caps lock on. Is this possible? And if so I'd like to have it detected before the client types their first letter. Is there a non-platform specific way to do this?
Yes, it is possible to detect if the Caps Lock key is on before the user types their first letter in a username/password field, and you can do this in a non-platform-specific way using JavaScript. Here’s how you can achieve this: ### Approach You can listen for the `keydown` event on the input fields to check the sta...
7,428
[ { "from": "human", "value": "I'm trying to build a better username/password field for my workplace and would like to be able to complain when they have their caps lock on.\nIs this possible? And if so I'd like to have it detected before the client types their first letter.\nIs there a non-platform specific...
I am about to write an audio file converter for my side job at the university. As part of this I would need sample rate conversion. However, my professor said that it would be pretty hard to write a sample rate converter that was both of good quality and fast. On my research on the subject, I found some functions in th...
For sample rate conversion in a C/C++ application on Windows, you have several options that are either part of the OS or open source. Here are a few commonly used libraries and methods: 1. **Windows Audio Session API (WASAPI)**: WASAPI is the core audio API for Windows and does provide some facilities for audio proces...
7,132
[ { "from": "human", "value": "I am about to write an audio file converter for my side job at the university.\nAs part of this I would need sample rate conversion. However, my professor said that it would be pretty hard to write a sample rate converter that was both of good quality and fast.\nOn my research o...
I am looking for attributes I can use to ensure the best runtime performance for my .Net application by giving hints to the loader, JIT compiler or ngen. For example we have DebuggableAttribute which should be set to not debug and not disable optimization for optimal performance. [Debuggable(false, false)] Are there a...
Certainly! In .NET, there are various attributes and options you can use to optimize runtime performance by providing hints to the loader, JIT compiler, and the NGen (Native Image Generator). Here are some of the key attributes and techniques you can use: 1. **DebuggableAttribute**: As you mentioned, setting `Debug...
7,112
[ { "from": "human", "value": "I am looking for attributes I can use to ensure the best runtime performance for my .Net application by giving hints to the loader, JIT compiler or ngen.\nFor example we have DebuggableAttribute which should be set to not debug and not disable optimization for optimal performanc...
I need a JavaScript library that supports Ajax as well as help me in making simple and neat animation effects in a website I am working on. Which library do you recommend?
For your requirements, I recommend using **jQuery**. jQuery is a well-established JavaScript library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. Here’s why it might be a good fit for you: 1. **Ajax Support**: jQuery provides a straightforward wa...
4,534
[ { "from": "human", "value": "I need a JavaScript library that supports Ajax as well as help me in making simple and neat animation effects in a website I am working on.\nWhich library do you recommend?\n" }, { "from": "gpt", "value": "For your requirements, I recommend using **jQuery**. jQuery i...
I need to present the user with a matrix of which one column is editable. What is the most appropriate control to use? I can't use a ListView because you can only edit the first column (the label) and that's no good to me. Is the DataGridView the way to go, or are there third party alternative components that do a bett...
If you need to present a matrix (or table) where one column is editable and others are read-only, the **DataGridView** in WinForms is indeed a suitable choice. It allows you to customize individual columns by setting properties such as `ReadOnly` to make specific columns non-editable while allowing user input in others...
12,135
[ { "from": "human", "value": "I need to present the user with a matrix of which one column is editable. What is the most appropriate control to use?\nI can't use a ListView because you can only edit the first column (the label) and that's no good to me.\nIs the DataGridView the way to go, or are there third ...
I've got just one page that I want to force to be accessed as an HTTPS page (PHP on Apache). How do I do this without making the whole directory require HTTPS? Or, if you submit a form to an HTTPS page from an HTTP page, does it send it by HTTPS instead of HTTP? Here is my example: http://www.example.com/some-page.php ...
To enforce HTTPS for a specific page while keeping the rest of your site accessible via HTTP, you can use a simple check in your PHP script. Your approach is correct in general, but the condition in your code snippet has some issues. You can check the request scheme using `$_SERVER['HTTPS']` to determine if the current...
3,728
[ { "from": "human", "value": "I've got just one page that I want to force to be accessed as an HTTPS page (PHP on Apache). How do I do this without making the whole directory require HTTPS? Or, if you submit a form to an HTTPS page from an HTTP page, does it send it by HTTPS instead of HTTP?\nHere is my exam...
Sorry the title isn't more help. I have a database of media-file URLs that came from two sources: (1) RSS feeds and (2) manual entries. I want to find the ten most-recently added URLs, but a maximum of one from any feed. To simplify, table 'urls' has columns 'url, feed_id, timestamp'. feed_id='' for any URL that was...
To achieve your goal of retrieving the ten most-recently added URLs from your `urls` table, while ensuring that only one URL is selected from each unique `feed_id`, you can use a common table expression (CTE) along with a window function. Here's how you can write the query: ```sql WITH RankedURLs AS ( SELECT ...
11,609
[ { "from": "human", "value": "Sorry the title isn't more help. I have a database of media-file URLs that came from two sources: \n(1) RSS feeds and (2) manual entries. \nI want to find the ten most-recently added URLs, but a maximum of one from any feed. To simplify, table 'urls' has columns 'url, feed_id, t...
Is anyone familiar with a service or open-source scripts that can import contacts from Gmail, Yahoo mail, AOL, Hotmail and other prominent webmail services? (Not plaxo, it has a problem in IE7)
Yes, there are several services and open-source scripts that can help you import contacts from various webmail services like Gmail, Yahoo Mail, AOL, and Hotmail. Here are a few options you might consider: 1. **OAuth Libraries**: Many modern web applications use OAuth to access user data securely. Libraries exist for v...
11,177
[ { "from": "human", "value": "Is anyone familiar with a service or open-source scripts that can import contacts from Gmail, Yahoo mail, AOL, Hotmail and other prominent webmail services? (Not plaxo, it has a problem in IE7)\n" }, { "from": "gpt", "value": "Yes, there are several services and open...
The CSS rules visibility:hidden and display:none both result in the element not being visible. Are these synonyms?
No, the CSS rules `visibility: hidden` and `display: none` are not synonyms; they have different effects on the visibility and layout of an element. 1. **`visibility: hidden`:** - The element is hidden from view, but it still occupies space in the layout. This means that other elements will not move to fill the sp...
12,257
[ { "from": "human", "value": "The CSS rules visibility:hidden and display:none both result in the element not being visible. Are these synonyms?\n" }, { "from": "gpt", "value": "No, the CSS rules `visibility: hidden` and `display: none` are not synonyms; they have different effects on the visibil...
I need to find out what ports are attached to which processes on a Unix machine (HP Itanium). Unfortunately, lsof is not installed and I have no way of installing it. Does anyone know an alternative method? A fairly lengthy Googling session hasn't turned up anything.
If `lsof` is not available on your HP Itanium Unix machine, you can use alternative commands and methods to identify which processes are using which ports. Here are a few options: ### 1. Using `netstat` The `netstat` command can display network connections, routing tables, and interface statistics. You can use it to i...
10,767
[ { "from": "human", "value": "I need to find out what ports are attached to which processes on a Unix machine (HP Itanium). Unfortunately, lsof is not installed and I have no way of installing it. \nDoes anyone know an alternative method? A fairly lengthy Googling session hasn't turned up anything.\n" }, ...
How can I retrieve the page title of a webpage (title html tag) using Python?
You can retrieve the page title of a webpage (the content of the `<title>` HTML tag) using Python by employing libraries like `requests` to fetch the webpage and `BeautifulSoup` from the `bs4` module to parse the HTML. Here’s a step-by-step guide and an example code snippet: ### Step-by-Step Guide 1. **Install Requir...
9,589
[ { "from": "human", "value": "How can I retrieve the page title of a webpage (title html tag) using Python?\n" }, { "from": "gpt", "value": "You can retrieve the page title of a webpage (the content of the `<title>` HTML tag) using Python by employing libraries like `requests` to fetch the webpag...
I'm confused with how views are organized, and it is important to understand this as ASP.NET MVC uses conventions to get everything working right. Under the views directory, there are subdirectories. Inside these subdirectories are views. I'm assuming that the subdirectories map to controllers, and the controllers ac...
In ASP.NET MVC, the organization of views within the `Views` directory is indeed significant, as it follows certain conventions that help the framework understand how to map requests to the appropriate views. Here's how it typically works: ### Directory Structure 1. **Controller-Focused Organization**: Each controlle...
10,961
[ { "from": "human", "value": "I'm confused with how views are organized, and it is important to understand this as ASP.NET MVC uses conventions to get everything working right.\nUnder the views directory, there are subdirectories. Inside these subdirectories are views. I'm assuming that the subdirectories ...
I have some code with multiple functions very similar to each other to look up an item in a list based on the contents of one field in a structure. The only difference between the functions is the type of the structure that the look up is occurring in. If I could pass in the type, I could remove all the code duplicat...
To reduce code duplication when you have multiple functions performing similar operations on different types of structures, you can consider using function templates or generic programming, depending on the programming language you're using. Since you mentioned mutex locking, I'll assume you're working in a language li...
6,381
[ { "from": "human", "value": "I have some code with multiple functions very similar to each other to look up an item in a list based on the contents of one field in a structure. The only difference between the functions is the type of the structure that the look up is occurring in. If I could pass in the t...
In a destructor, is there a way to determine if an exception is currently being processed?
In C++, a destructor does not have a built-in way to directly check if an exception is currently being processed. However, there are some important considerations regarding exception handling and destructors: 1. **Destructors and Exceptions**: If an exception is thrown during the stack unwinding process (which occurs ...
11,326
[ { "from": "human", "value": "In a destructor, is there a way to determine if an exception is currently being processed?\n" }, { "from": "gpt", "value": "In C++, a destructor does not have a built-in way to directly check if an exception is currently being processed. However, there are some impor...
I wrote an application that currently runs against a local instance of MySql. I would like to centralize the DB somewhere on the Net, and share my application. But, I'm cheap, and don't want to pay for it. Does anyone know of a free on-line relational DB service that I could connect to via C#?
Yes, there are several options for free online relational database services that you can use to centralize your MySQL database and connect to it via C#. Here are some popular options: 1. **ClearDB**: ClearDB offers a free tier that provides a limited amount of storage and concurrent connections. You can use it with My...
5,577
[ { "from": "human", "value": "I wrote an application that currently runs against a local instance of MySql. I would like to centralize the DB somewhere on the Net, and share my application.\nBut, I'm cheap, and don't want to pay for it. Does anyone know of a free on-line relational DB service that I could ...
My workplace has sales people using a 3rd party desktop application that connects directly the a Sql Server and the software is leaving hundreds of sleeping connections for each user. Is there anyway to clear these connection programmatically?
Yes, you can clear sleeping connections programmatically using T-SQL commands, but it is essential to understand the implications and ensure that it aligns with your organization's policies regarding database access and usage. ### 1. **Understanding Sleeping Connections** Sleeping connections in SQL Server are idle co...
7,172
[ { "from": "human", "value": "My workplace has sales people using a 3rd party desktop application that connects directly the a Sql Server and the software is leaving hundreds of sleeping connections for each user. Is there anyway to clear these connection programmatically?\n" }, { "from": "gpt", ...
I'm currently updating a legacy system which allows users to dictate part of the schema of one of its tables. Users can create and remove columns from the table through this interface. This legacy system is using ADO 2.8, and is using SQL Server 2005 as its database (you don't even WANT to know what database it was u...
The behavior you're encountering is not uncommon when trying to perform schema modifications in SQL Server within a transaction. It is important to understand how SQL Server handles schema changes and transactions. ### Key Points to Consider: 1. **Schema Changes and Transactions**: SQL Server allows schema changes (l...
9,463
[ { "from": "human", "value": "I'm currently updating a legacy system which allows users to dictate part of the schema of one of its tables. Users can create and remove columns from the table through this interface. This legacy system is using ADO 2.8, and is using SQL Server 2005 as its database (you don't...
Does anyone know how to change the Bordercolor for a Datagridviewcell in c#? Here's a picture of what I mean: Datagridviewstyle http://www.zivillian.de/datagridview.png Picture Backgroundcolor, Textcolor and Images are no Problem, but I don't know how to realise the Borders. EDIT: I want to realise this with winforms....
In WinForms, the `DataGridView` does not provide a direct property to change the border color of individual cells. However, you can achieve a similar effect by customizing the drawing of the cells using the `CellPainting` event. This event allows you to render the cells yourself, including the borders. Here’s an examp...
9,400
[ { "from": "human", "value": "Does anyone know how to change the Bordercolor for a Datagridviewcell in c#?\nHere's a picture of what I mean: \nDatagridviewstyle http://www.zivillian.de/datagridview.png\nPicture\nBackgroundcolor, Textcolor and Images are no Problem, but I don't know how to realise the Borders...
In Python for *nix, does time.sleep() block the thread or the process?
In Python, the `time.sleep()` function blocks the thread that calls it, not the entire process. When you call `time.sleep(seconds)`, the current thread will be paused for the specified number of seconds, during which it will not execute any further code until the sleep duration has elapsed. Other threads in the same ...
9,626
[ { "from": "human", "value": "In Python for *nix, does time.sleep() block the thread or the process?\n" }, { "from": "gpt", "value": "In Python, the `time.sleep()` function blocks the thread that calls it, not the entire process. When you call `time.sleep(seconds)`, the current thread will be pau...
I'm looking to implement httpOnly in my legacy ASP classic sites. Anyone knows how to do it?
To implement the `HttpOnly` flag for cookies in legacy ASP Classic applications, you will need to set the `HttpOnly` attribute for any cookies that you create. This helps protect the cookies from being accessed through client-side scripts, thereby mitigating the risk of certain types of attacks, such as cross-site scri...
7,514
[ { "from": "human", "value": "I'm looking to implement httpOnly in my legacy ASP classic sites.\nAnyone knows how to do it?\n" }, { "from": "gpt", "value": "To implement the `HttpOnly` flag for cookies in legacy ASP Classic applications, you will need to set the `HttpOnly` attribute for any cooki...
Is there any way to capture the trace statements of your Flex app while not running in debug mode? Or is there any other way to output logging information when not running a debugger? Currently I'm trying to fix a bug that only presents itself in very specific deployment scenario, but I could see this being useful in s...
Yes, you can capture trace statements and log information in your Flex application even when it's not running in debug mode. Here are some strategies to achieve that: ### 1. Use `trace` with a Custom Handler While `trace` statements are typically not available in release mode, you can create a custom logging system th...
9,569
[ { "from": "human", "value": "Is there any way to capture the trace statements of your Flex app while not running in debug mode?\nOr is there any other way to output logging information when not running a debugger?\nCurrently I'm trying to fix a bug that only presents itself in very specific deployment scena...
Wondering if there is any Text to Speech software available as a plug in for IE or Firefox.
As of my last knowledge update in October 2023, there are several text-to-speech (TTS) software options available as browser extensions for both Internet Explorer (IE) and Firefox. However, please note that IE is largely outdated and not recommended for regular use due to security concerns and limited support. Therefor...
12,125
[ { "from": "human", "value": "Wondering if there is any Text to Speech software available as a plug in for IE or Firefox.\n" }, { "from": "gpt", "value": "As of my last knowledge update in October 2023, there are several text-to-speech (TTS) software options available as browser extensions for bo...
I have a small gallery of thumbnails. When I place my mouse pointer over a thumbnail image I'd like to have a full size image pop up in a div in the top right of the screen. I've seen this done using just CSS and I'd like to go down that route rather than use javascript if possible.
You can achieve a simple hover effect to show a full-size image using only CSS. Below is an example of how you can set this up using HTML and CSS. This example includes a small gallery of thumbnails, and when you hover over each thumbnail, a full-size image will pop up in the top right corner of the screen. ### HTML ...
9,297
[ { "from": "human", "value": "I have a small gallery of thumbnails. When I place my mouse pointer over a thumbnail image I'd like to have a full size image pop up in a div in the top right of the screen. I've seen this done using just CSS and I'd like to go down that route rather than use javascript if possi...
In a try/except block, how do I extract the Oracle error number?
In Python, when you're working with Oracle databases (typically using a library like `cx_Oracle`), you can handle exceptions and extract the error number from an exception raised during database operations using a `try/except` block. When an Oracle error occurs, the exception raised is an instance of the `cx_Oracle.Dat...
3,607
[ { "from": "human", "value": "In a try/except block, how do I extract the Oracle error number?\n" }, { "from": "gpt", "value": "In Python, when you're working with Oracle databases (typically using a library like `cx_Oracle`), you can handle exceptions and extract the error number from an excepti...
I'm using C# and connecting to a WebService via an auto-generated C# proxy object. The method I'm calling can be long running, and sometimes times out. I get different errors back, sometimes I get a System.Net.WebException or a System.Web.Services.Protocols.SoapException. These exceptions have properties I can interrog...
The `InvalidOperationException` you're encountering indicates that the response from the web service does not match the expected content type. Specifically, the client received a response with a content type of `text/html` instead of the expected `text/xml`. The reason for this discrepancy is likely due to a timeout oc...
8,785
[ { "from": "human", "value": "I'm using C# and connecting to a WebService via an auto-generated C# proxy object. The method I'm calling can be long running, and sometimes times out. I get different errors back, sometimes I get a System.Net.WebException or a System.Web.Services.Protocols.SoapException. These ...
I'm seeing some errors that would indicate a "connection leak". That is, connections that were not closed properly and the pool is running out. So, how do I go about instrumenting this to see exactly how many are open at a given time?
To diagnose a connection leak and monitor the number of open connections in your application, you can follow these steps: ### 1. **Database Connection Pool Configuration** Ensure you are using a connection pool, which is standard practice for managing database connections efficiently. Common libraries include HikariCP...
9,640
[ { "from": "human", "value": "I'm seeing some errors that would indicate a \"connection leak\". That is, connections that were not closed properly and the pool is running out. So, how do I go about instrumenting this to see exactly how many are open at a given time?\n" }, { "from": "gpt", "value"...
Where can I get the 64 bit bootstrapper for SQL Server Express 2005 64 bit. The default bootstrapper is 32 bit only. This will not install on Vista 64 bit.
To download the 64-bit bootstrapper for SQL Server Express 2005, you'll need to access Microsoft's official website or a trusted download source that has archived versions of SQL Server products. Since SQL Server Express 2005 is an older version, it might not be immediately visible on the main download pages, but here ...
10,668
[ { "from": "human", "value": "Where can I get the 64 bit bootstrapper for SQL Server Express 2005 64 bit. The default bootstrapper is 32 bit only. This will not install on Vista 64 bit.\n" }, { "from": "gpt", "value": "To download the 64-bit bootstrapper for SQL Server Express 2005, you'll need...
For a project we're currently working on, we need a library of spoken words in many different languages. Two options seem possible: text-to-speech or "real" recordings by native speakers. As the quality is important to us, we're thinking about going the latter path. In order to create a prototype for our application,...
Yes, there are several resources and libraries that provide high-quality spoken word recordings by native speakers in various languages. Here are some options you might consider: 1. **Open Multilingual Wordnet**: While this primarily offers word translations and meanings, it often links to audio resources or external ...
11,596
[ { "from": "human", "value": "For a project we're currently working on, we need a library of spoken words in many different languages. \nTwo options seem possible: text-to-speech or \"real\" recordings by native speakers. As the quality is important to us, we're thinking about going the latter path. \nIn ord...
I have this setup where in my development copy I can commit changes on a certain file to the repository. Then in my production copy, which does checkouts only, I would normally edit this file because this contains references which are environment independent. Is there any way I can ignore this file on the subsequent ch...
In Subversion (SVN), there isn't a built-in `--ignore-files` option for checkouts or updates that allows you to ignore specific files while still keeping them in the repository. However, there are a few approaches you can consider to achieve a similar effect: ### 1. Use `svn:ignore` on a Directory Level You mentioned ...
8,273
[ { "from": "human", "value": "I have this setup where in my development copy I can commit changes on a certain file to the repository. Then in my production copy, which does checkouts only, I would normally edit this file because this contains references which are environment independent. Is there any way I ...
We are currently looking to adopt some type of "standard" developer framework and have looked into using the Enterprise Library. Would you recommend using these blocks as the foundation for software development, or should we do something home grown?
When considering whether to adopt Microsoft's Enterprise Library or to develop a homegrown framework for your software development, there are several factors to weigh. Here's a breakdown of the pros and cons of both approaches: ### Using Enterprise Library: #### Pros: 1. **Established Practices**: Enterprise Library ...
5,742
[ { "from": "human", "value": "We are currently looking to adopt some type of \"standard\" developer framework and have looked into using the Enterprise Library. Would you recommend using these blocks as the foundation for software development, or should we do something home grown?\n" }, { "from": "g...
I am a student studying software development, and I feel programming, in general, is too broad of a subject to try to know everything. To be proficient, you have to decide which areas to focus your learning and understanding. Certain skill sets synergize with each other, like data-driven web development and SQL experie...
You’ve raised some excellent points regarding specialization in software development. The field can indeed be overwhelming due to its breadth, but understanding common specializations and how they interrelate can guide your journey as a programmer. Let’s break down your questions one by one. ### Common Specializations...
4,833
[ { "from": "human", "value": "I am a student studying software development, and I feel programming, in general, is too broad of a subject to try to know everything. To be proficient, you have to decide which areas to focus your learning and understanding. Certain skill sets synergize with each other, like da...
I run a rather complex project with several independent applications. These use however a couple of shared components. So I have a source tree looking something like the below. My Project Application A Shared1 Shared2 Application B Application C All applications have their own MSBuild script that builds the pro...
Your project setup and requirements are quite clear, and you've raised some important considerations regarding versioning, build tracking, and rollback strategies. Here’s a detailed approach to solve your needs while also discussing the differences between revision numbers and build numbers. ### Proposed Solution ###...
8,585
[ { "from": "human", "value": "I run a rather complex project with several independent applications. These use however a couple of shared components. So I have a source tree looking something like the below.\n\nMy Project \n\n\nApplication A\nShared1\nShared2 \nApplication B \nApplication C\n\n\nAll applicati...
1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting .NET Framework 2.0. 2, Create a Setup project that installs just the single executable from the Windows Forms project. 3, Run that installer and it always says that it needs to install .NET 3...
The issue you're experiencing with your installer demanding .NET Framework 3.5 SP1, even when your Windows Forms project targets .NET Framework 2.0, could be due to several reasons. Here are some steps you can take to diagnose and potentially resolve the issue: ### 1. Check the Project Dependencies Make sure that none...
9,528
[ { "from": "human", "value": "1, Create and build a default Windows Forms project and look at the project properties. It says that the project is targetting .NET Framework 2.0. \n2, Create a Setup project that installs just the single executable from the Windows Forms project. \n3, Run that installer and it ...
I keep hearing from associates about grid computing which, from what I can gather, is highly distributed stuff along the lines of SETI@Home. Is anyone working on these sort of systems for business use? My interest is in figuring out if there's a commercial reason for starting software development in this field.
Yes, grid computing is indeed a technology that has applications beyond scientific projects like SETI@Home. It involves distributed computing where a network of computers works together to perform complex calculations or manage large data sets. The concept leverages the unused resources of various computers across a ne...
7,280
[ { "from": "human", "value": "I keep hearing from associates about grid computing which, from what I can gather, is highly distributed stuff along the lines of SETI@Home.\nIs anyone working on these sort of systems for business use? My interest is in figuring out if there's a commercial reason for starting s...
Once again one of those: "Is there an easier built-in way of doing things instead of my helper method?" So it's easy to get the underlying type from a nullable type, but how do I get the nullable version of a .NET type? So I have typeof(int) typeof(DateTime) System.Type t = something; and I want int? DateTime? or Nu...
In .NET, there isn't a built-in method specifically designed to get the nullable version of a given type directly. However, you can create a simple helper method to achieve this. The logic you need involves checking if the type is a value type and then returning the corresponding nullable type. Here is a sample method...
8,563
[ { "from": "human", "value": "Once again one of those: \"Is there an easier built-in way of doing things instead of my helper method?\"\nSo it's easy to get the underlying type from a nullable type, but how do I get the nullable version of a .NET type?\nSo I have\ntypeof(int)\ntypeof(DateTime)\nSystem.Type t...
I was discussing neural networks (NN) with a friend over lunch the other day and he claimed the the performance of a NN written in Java would be similar to one written in C++. I know that with 'just in time' compiler techniques Java can do very well, but somehow I just don't buy it. Does anyone have any experience th...
Your question about the performance of neural networks implemented in Java versus C++ touches on several important aspects of programming languages, performance optimization, and how neural networks are typically executed. ### Performance Comparison 1. **Execution Speed**: - **C++**: Generally, C++ is known for it...
8,620
[ { "from": "human", "value": "I was discussing neural networks (NN) with a friend over lunch the other day and he claimed the the performance of a NN written in Java would be similar to one written in C++. I know that with 'just in time' compiler techniques Java can do very well, but somehow I just don't bu...
I've got a java servlet which is hitting this bug when down-scaling images... https://bugs.java.com/bugdatabase/view_bug?bug_id=5101502 I'm trying to work out the best way to work around it and would appreciate any ideas from the community. Thanks, Steve
Hi Steve, The bug you referenced (Java Bug ID: 5101502) relates to issues when downscaling images using certain Java libraries. While the exact details of the bug might impact specific implementations, I can suggest a few potential workarounds you can consider for downscaling images in your Java servlet. ### Workarou...
8,036
[ { "from": "human", "value": "I've got a java servlet which is hitting this bug when down-scaling images...\nhttps://bugs.java.com/bugdatabase/view_bug?bug_id=5101502\nI'm trying to work out the best way to work around it and would appreciate any ideas from the community.\nThanks, Steve\n" }, { "from...
I'm looking for a way to redirect all the stderr streams in interactive bash (ideally to its calling parent process). I don't want to redirect stderr stream from each individual command, which I could do by appending 2> a_file to each command. By default, these stderr streams are redirected to the stdout of an interact...
In an interactive Bash shell, the standard error (stderr) stream is normally directed to the same terminal as the standard output (stdout). However, you can redirect stderr for all commands within a session to a separate destination, such as a file or to the parent process. If your goal is to redirect stderr to the te...
11,005
[ { "from": "human", "value": "I'm looking for a way to redirect all the stderr streams in interactive bash (ideally to its calling parent process).\nI don't want to redirect stderr stream from each individual command, which I could do by appending 2> a_file to each command.\nBy default, these stderr streams ...
If I go to www.paypal.com, Firefox displays a huge icon in the location bar. Is it possible to get my web site to do this without paying $2700 to Verisign? Where is the best place to buy SSL certificates and not break the bank?
Yes, it's possible to get your website to display a secure connection icon in the browser's location bar without spending a lot of money. The large icon you're seeing in Firefox's location bar is likely due to the presence of an Extended Validation (EV) SSL certificate, which is what companies like Verisign primarily i...
11,225
[ { "from": "human", "value": "If I go to www.paypal.com, Firefox displays a huge icon in the location bar. Is it possible to get my web site to do this without paying $2700 to Verisign? Where is the best place to buy SSL certificates and not break the bank?\n" }, { "from": "gpt", "value": "Yes, i...
I've been looking at ways people test their apps in order decide where to do caching or apply some extra engineering effort, and so far httperf and a simple sesslog have been quite helpful. What tools and tricks did you apply on your projects?
Testing applications for performance and deciding where to apply caching or optimization efforts can involve a variety of tools and techniques. Here are several commonly used tools and methodologies that could enhance your testing strategy: ### Load Testing Tools 1. **Apache JMeter**: - A popular open-source tool ...
7,650
[ { "from": "human", "value": "I've been looking at ways people test their apps in order decide where to do caching or apply some extra engineering effort, and so far httperf and a simple sesslog have been quite helpful.\nWhat tools and tricks did you apply on your projects?\n" }, { "from": "gpt", ...
So, I've been reading through and it appears that the Boost libraries get used a lot in practice (not at my shop, though). Why is this? and what makes it so wonderful?
Boost is a widely used collection of C++ libraries that offers a range of features and functionalities, making it a valuable resource for developers. Here are some reasons why Boost is popular and considered "wonderful" in the C++ ecosystem: ### 1. **Rich Library Set:** - Boost consists of over 160 libraries that c...
10,431
[ { "from": "human", "value": "So, I've been reading through and it appears that the Boost libraries get used a lot in practice (not at my shop, though). Why is this? and what makes it so wonderful? \n" }, { "from": "gpt", "value": "Boost is a widely used collection of C++ libraries that offers a ...
I have an Asp.Net repeater, which contains a textbox and a checkbox. I need to add client-side validation that verifies that when the checkbox is checked, the textbox can only accept a value of zero or blank. I would like to use one or more of Asp.Net's validator controls to accomplish this, to provide a consistent di...
You're correct in that using an `asp:CustomValidator` would be a suitable approach for your scenario, especially given the specific validation requirements. Since you are dealing with a Repeater and need to validate controls dynamically based on their IDs, I recommend using the `ValidationGroup` and `ClientValidationFu...
7,345
[ { "from": "human", "value": "I have an Asp.Net repeater, which contains a textbox and a checkbox. I need to add client-side validation that verifies that when the checkbox is checked, the textbox can only accept a value of zero or blank.\nI would like to use one or more of Asp.Net's validator controls to a...
I would like to use Haskell more for my projects, and I think if I can get started using it for web apps, it would really help that cause. I have tried happs once or twice but had trouble getting off the ground. Are there simpler/more conventional (more like lamp) frameworks out there that I can use or should I just gi...
If you're looking to use Haskell for web applications and want something that might be simpler or more conventional than Happs, there are indeed several other frameworks and libraries that you can explore. Here are some options you might find more approachable: 1. **Yesod**: Yesod is a powerful and type-safe web frame...
7,105
[ { "from": "human", "value": "I would like to use Haskell more for my projects, and I think if I can get started using it for web apps, it would really help that cause. I have tried happs once or twice but had trouble getting off the ground. Are there simpler/more conventional (more like lamp) frameworks out...
I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply: Given a site map of: RootSite ---SubSite1 = navigation set at "Display the current site, the navigation items belo...
To achieve the desired Quick Launch menu configuration, you may need to adjust the settings for the `SiteMapProvider` and ensure that your navigation settings correctly inherit or display the required items. Here's a step-by-step approach to troubleshoot and configure your Quick Launch as intended: ### Understanding Y...
10,352
[ { "from": "human", "value": "I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply:\nGiven a site map of:\nRootSite\n---SubSite1 = navigation set at \"Displa...
I am writing a small application that will receive messages to process over smtp port 25. I am looking for an .NET assembly that I can incorporate that will listen to port 25 and talk SMTP. I invision that when a message arrives some event is triggered where I can read the message and process it. Esstentilly I need ...
To create a simple SMTP server in .NET that listens on port 25 and processes incoming messages, you can use an existing library designed for SMTP server functionality. One popular choice is **MailKit**, which is a robust email handling library for .NET that includes support for SMTP and other email protocols. However, ...
6,030
[ { "from": "human", "value": "I am writing a small application that will receive messages to process over smtp port 25. \nI am looking for an .NET assembly that I can incorporate that will listen to port 25 and talk SMTP. I invision that when a message arrives some event is triggered where I can read the m...
We have a couple of developers asking for allow_url_fopen to be enabled on our server. What's the norm these days and if libcurl is enabled is there really any good reason to allow? Environment is: Windows 2003, PHP 5.2.6, FastCGI
As of my last update, the `allow_url_fopen` directive in PHP allows files to be accessed using URLs, which can be convenient for fetching remote resources directly with file functions (like `file_get_contents()` or `include`). However, enabling this feature comes with security risks, particularly if you're not fully co...
10,566
[ { "from": "human", "value": "We have a couple of developers asking for allow_url_fopen to be enabled on our server. What's the norm these days and if libcurl is enabled is there really any good reason to allow?\nEnvironment is: Windows 2003, PHP 5.2.6, FastCGI\n" }, { "from": "gpt", "value": "As...
Suppose we have: interface Foo { bool Func(int x); } class Bar: Foo { bool Func(int x) { return (x>0); } } class Baz: Foo { bool Func(int x) { return (x<0); } } Now we can toss around Bar and Baz as a Foos and call their Func methods. Delegates simplify this a little bit: delegate bool Foo(in...
Delegates in C# provide several benefits beyond just shorter code. Here are some key advantages of using delegates: 1. **Type Safety**: Delegates are strongly typed. When you define a delegate type, it specifies the exact signature that any methods assigned to it must follow (return type and parameters). This ensures ...
9,235
[ { "from": "human", "value": "Suppose we have:\ninterface Foo \n{\n bool Func(int x);\n}\n\nclass Bar: Foo\n{\n bool Func(int x)\n {\n return (x>0);\n } \n}\n\nclass Baz: Foo\n{\n bool Func(int x)\n {\n return (x<0);\n } \n}\n\nNow we can toss around Bar and Baz as a Foos and call their Func meth...
I see often (rewritten) URLs without ID in it, like on some wordpress installations. What is the best way of achieve this? Example: site.com/product/some-product-name/ Maybe to keep an array of page names and IDs in cache, to avoid DB query on every page request? How to avoid conflicts, and what are other issues on usi...
Using "pretty" URLs (also known as "clean" or "user-friendly" URLs) without IDs is a common practice in web development, particularly in content management systems like WordPress. This approach improves SEO and enhances user experience. Here’s how you can achieve this, along with some considerations regarding conflicts...
6,445
[ { "from": "human", "value": "I see often (rewritten) URLs without ID in it, like on some wordpress installations. What is the best way of achieve this?\nExample: site.com/product/some-product-name/\nMaybe to keep an array of page names and IDs in cache, to avoid DB query on every page request?\nHow to avoid...
How to serve users a dynamically generated ZIP archive in Django? I'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my server down to a crawl. I have also heard that Django doesn't currentl...
Serving dynamically generated ZIP archives in Django is certainly feasible, but you're right to consider the performance implications. Generating ZIP files on-the-fly can be resource-intensive, particularly if multiple users are requesting downloads simultaneously. However, with proper optimization and queuing, you can...
5,440
[ { "from": "human", "value": "How to serve users a dynamically generated ZIP archive in Django?\nI'm making a site, where users can choose any combination of available books and download them as ZIP archive. I'm worried that generating such archives for each request would slow my server down to a crawl. I ha...
In Internet Explorer I can use the clipboardData object to access the clipboard. How can I do that in FireFox, Safari and/or Chrome?
In modern web browsers like Firefox, Safari, and Chrome, you can access the clipboard using the Clipboard API, which provides a more standardized way to work with clipboard operations than the old `clipboardData` object used in Internet Explorer. Here's a basic example of how to use the Clipboard API for both reading ...
9,998
[ { "from": "human", "value": "In Internet Explorer I can use the clipboardData object to access the clipboard. How can I do that in FireFox, Safari and/or Chrome?\n" }, { "from": "gpt", "value": "In modern web browsers like Firefox, Safari, and Chrome, you can access the clipboard using the Clipb...
With Google's newfound inability to do math correctly (check it! according to Google 500,000,000,000,002 - 500,000,000,000,001 = 0), I figured I'd try the following in C to run a little theory. int main() { char* a = "399999999999999"; char* b = "399999999999998"; float da = atof(a); float db = atof(b); ...
Yes, you're on the right track regarding the limitations of floating-point representation in C. The `float` type in C typically uses 32 bits of precision, which can lead to inaccuracies when dealing with very large numbers or numbers with a lot of decimal places. When you use `atof()` to convert your large numeric str...
9,613
[ { "from": "human", "value": "With Google's newfound inability to do math correctly (check it! according to Google 500,000,000,000,002 - 500,000,000,000,001 = 0), I figured I'd try the following in C to run a little theory.\nint main()\n{\n char* a = \"399999999999999\";\n char* b = \"399999999999998\";\...
On Windows I can do: HANDLE hProcess = GetCurrentProcess(); FILETIME ftCreation, ftExit, ftKernel, ftUser; GetProcessTimes(hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser); SYSTEMTIME stKernel; FileTimeToSystemTime(&ftKernel, &stKernel); SYSTEMTIME stUser; FileTimeToSystemTime(&ftUser, &stUser); printf("Time in...
On Unix-like operating systems, you can retrieve similar information about process times using the `getrusage` or `times` system calls, along with the `clock_gettime` function to get the current time. The `getrusage` function is often the preferred way to get user and system CPU time for the calling process. Here's ho...
7,068
[ { "from": "human", "value": "On Windows I can do:\nHANDLE hProcess = GetCurrentProcess();\n\nFILETIME ftCreation, ftExit, ftKernel, ftUser;\n\nGetProcessTimes(hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser);\n\nSYSTEMTIME stKernel;\nFileTimeToSystemTime(&ftKernel, &stKernel);\n\nSYSTEMTIME stUser;\nFile...
I have a table containing prices for a lot of different "things" in a MS SQL 2005 table. There are hundreds of records per thing per day and the different things gets price updates at different times. ID uniqueidentifier not null, ThingID int NOT NULL, PriceDateTime datetime NOT NULL, Price decimal(18,4) NOT NULL I ne...
To get the latest price for each `ThingID` from your table for the current day, you can use a Common Table Expression (CTE) or a subquery combined with the `ROW_NUMBER()` function available in SQL Server 2005. This function allows you to assign a unique sequential integer to rows within a partition of a result set. He...
11,223
[ { "from": "human", "value": "I have a table containing prices for a lot of different \"things\" in a MS SQL 2005 table. There are hundreds of records per thing per day and the different things gets price updates at different times.\nID uniqueidentifier not null,\nThingID int NOT NULL,\nPriceDateTime datetim...
I'm designing a web site navigation hierarchy. It's a tree of nodes. Most nodes are pages. Some nodes are links (think shortcuts in Windows). Most pages hold HTML content. Some execute code. I'd like to represent these as this collection of classes and abstract (MustInherit) classes… This is the database table wher...
In your case, you're dealing with a tree structure where certain nodes serve as the roots of sub-trees. The challenge lies in designing your class hierarchy to efficiently represent both the pages and their relationships without creating redundant classes. ### Hierarchy Suggestion Instead of having separate classes f...
4,013
[ { "from": "human", "value": "I'm designing a web site navigation hierarchy. It's a tree of nodes.\nMost nodes are pages. Some nodes are links (think shortcuts in Windows).\nMost pages hold HTML content. Some execute code.\nI'd like to represent these as this collection of classes and abstract (MustInheri...
In C++, can member function pointers be used to point to derived (or even base) class members? EDIT: Perhaps an example will help. Suppose we have a hierarchy of three classes X, Y, Z in order of inheritance. Y therefore has a base class X and a derived class Z. Now we can define a member function pointer p for clas...
In C++, member function pointers are specific to the class they are defined in. This means that a member function pointer for a certain class cannot directly point to member functions of its base class or derived class without specific handling. Given your example with classes `X`, `Y`, and `Z`, where `Y` is derived f...
7,447
[ { "from": "human", "value": "In C++, can member function pointers be used to point to derived (or even base) class members? \nEDIT: \nPerhaps an example will help. Suppose we have a hierarchy of three classes X, Y, Z in order of inheritance. \nY therefore has a base class X and a derived class Z.\nNow we ca...
How do you access the response from the Request object in MooTools? I've been looking at the documentation and the MooTorial, but I can't seem to make any headway. Other Ajax stuff I've done with MooTools I haven't had to manipulate the response at all, so I've just been able to inject it straight into the document, bu...
In MooTools, the `Request` object is asynchronous, meaning that the `send()` method does not block the execution of your script while it waits for the response. Because of this, when you try to return the `feed` variable immediately after calling `req.send()`, it will still be `undefined` since the response hasn't been...
9,691
[ { "from": "human", "value": "How do you access the response from the Request\nobject in MooTools? I've been looking at the documentation and the MooTorial, but\nI can't seem to make any headway. Other Ajax stuff I've done with\nMooTools I haven't had to manipulate the response at all, so I've just\nbeen abl...
I need to implement a 4-to-1 function in Veriog. The input is 4 bits, a number from 0-15. The output is a single bit, 0 or 1. Each input gives a different output and the mapping from inputs to outputs is known, but the inputs and outputs themselves are not. I want vcs to successfully optimizing the code and also ha...
Your approach to implement a 4-to-1 function in Verilog using a constant assignment is a reasonable starting point. However, there are a couple of improvements and considerations you can make to ensure the code is both concise and potentially more optimized by the synthesis tool (like VCS). ### 1. Direct Mapping witho...
5,168
[ { "from": "human", "value": "I need to implement a 4-to-1 function in Veriog. The input is 4 bits, a number from 0-15. The output is a single bit, 0 or 1. Each input gives a different output and the mapping from inputs to outputs is known, but the inputs and outputs themselves are not. I want vcs to suc...
I have an HTML Mail template, with a place holder for the image. I am getting the image I need to send out of a database and saving it into a photo directory. I need to embed the image in the HTML Message. I have explored using an AlternateView: AlternateView htmlView = AlternateView.CreateAlternateViewFromString("<HTM...
To successfully embed an image in an HTML email using the `AlternateView` and `LinkedResource` classes in C#, you've already made a good start. Below, I'll show you the complete implementation, ensuring that the email is sent with the embedded image included correctly. ### Complete Example Here's a basic example that...
8,935
[ { "from": "human", "value": "I have an HTML Mail template, with a place holder for the image. I am getting the image I need to send out of a database and saving it into a photo directory. I need to embed the image in the HTML Message.\nI have explored using an AlternateView:\nAlternateView htmlView = Altern...
I am a big fan of the light colors on a dark background color scheme for programming - which is unfortunately not what Quest's Toad comes with by default. I notice that it is possible to export and import settings under the language management window, and I know that Toad has a large level of community involvement. ...
Toad for Oracle does indeed allow for customization of the color schemes for the editor and other interface elements. However, finding shared themes or color schemes can be a bit tricky since Toad doesn't have a widely recognized term for these customizations. They are typically referred to as "color schemes," "syntax ...
10,724
[ { "from": "human", "value": "I am a big fan of the light colors on a dark background color scheme for programming - which is unfortunately not what Quest's Toad comes with by default. \nI notice that it is possible to export and import settings under the language management window, and I know that Toad ha...
What would be the best way to do an scp or sftp copy in a Unix environment using C? I'm interested in knowing the best library to use and an example if at all possible. I'm working on a Solaris server with the Sun tools installed.
To perform SCP (Secure Copy Protocol) or SFTP (SSH File Transfer Protocol) operations in a Unix environment using C, you can utilize libraries that provide the necessary functionality to interact with SSH and SFTP servers. Two popular libraries for this purpose are: 1. **libssh**: A C library for implementing SSH2 cli...
4,933
[ { "from": "human", "value": "What would be the best way to do an scp or sftp copy in a Unix environment using C?\nI'm interested in knowing the best library to use and an example if at all possible. I'm working on a Solaris server with the Sun tools installed.\n" }, { "from": "gpt", "value": "To...
I have writtent some Oracle storedprocedures in these there are more then 20 input parameters and from them morethen 10 parameters are required , I want all with some value and do not want to accept null values for that , Is there anything that I can declare in the Procedure defination itself which can restrict null in...
In Oracle PL/SQL, there is no direct syntax to declare a parameter as non-nullable in the procedure definition itself. However, you can implement a validation check within the procedure body to ensure that required parameters are not null and raise an exception if they are. Here’s a common approach to achieve this by ...
9,473
[ { "from": "human", "value": "I have writtent some Oracle storedprocedures in these there are more then 20 input parameters and from them morethen 10 parameters are required , I want all with some value and do not want to accept null values for that , Is there anything that I can declare in the Procedure def...
I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.
Testing web pages in older versions of Internet Explorer (like IE 6, 7, and the beta of IE 8) can be challenging, especially when working on a Mac. Here are some methods you can use to test your web pages in these older versions of Internet Explorer: 1. **Virtual Machines**: Microsoft provides free virtual machine ima...
10,095
[ { "from": "human", "value": "I want to test the web pages I create in all the modern versions of Internet Explorer (6, 7 and 8 beta) but I work mainly on a Mac and often don't have direct access to a PC.\n" }, { "from": "gpt", "value": "Testing web pages in older versions of Internet Explorer (l...
I'm using castle windsor for a pet-project I'm working on. I'm starting to notice that I need to call the IoC container in different places in my code to create new objects. This dependency on the container makes my code harder to maintain. There are two solutions I've used to solve this problem I tried to create abstr...
It's a common challenge in IoC (Inversion of Control) to manage dependencies without tightly coupling your code to the container itself, especially when dealing with the need to create objects at runtime. Here are several strategies you could consider to alleviate the problems you're facing with Castle Windsor: ### 1....
7,853
[ { "from": "human", "value": "I'm using castle windsor for a pet-project I'm working on. I'm starting to notice that I need to call the IoC container in different places in my code to create new objects. This dependency on the container makes my code harder to maintain.\nThere are two solutions I've used to ...
Do you actively manage technical debt debt on your software development projects and if so, how do you do it?
Managing technical debt is an essential aspect of software development, as it can significantly affect the long-term maintainability and scalability of a project. Here are several strategies for actively managing technical debt: 1. **Identification and Assessment**: - **Regular Code Reviews**: Conduct code reviews ...
9,397
[ { "from": "human", "value": "Do you actively manage technical debt debt on your software development projects and if so, how do you do it?\n" }, { "from": "gpt", "value": "Managing technical debt is an essential aspect of software development, as it can significantly affect the long-term maintai...
Could any one give an explanation on how a DHT works? Nothing too heavy, just the basics.
Sure! A Distributed Hash Table (DHT) is a decentralized system used for storing and retrieving key-value pairs across a distributed network of nodes. Here are the basics: 1. **Key-Value Store**: In a DHT, data is stored in pairs—each piece of data (value) is associated with a unique identifier (key). 2. **Distributi...
12,315
[ { "from": "human", "value": "Could any one give an explanation on how a DHT works?\nNothing too heavy, just the basics.\n" }, { "from": "gpt", "value": "Sure! A Distributed Hash Table (DHT) is a decentralized system used for storing and retrieving key-value pairs across a distributed network of ...
I'm trying to use the OpenNETCF RAPI class to interact with a windows mobile device using the RAPI.Invoke() method. According to the following article: http://blog.opennetcf.com/ncowburn/2007/07/27/HOWTORetrieveTheDeviceIDFromTheDesktop.aspx You can do the communication in either block or stream mode. I have used bloc...
If you want to use the IRAPIStream interface with a Windows Mobile device in a .NET application, you will likely have to use P/Invoke to call the necessary methods in the RAPI library directly, as the OpenNETCF RAPI library's `Invoke()` method does not support streaming. Here's a basic guide on how you can implement t...
5,254
[ { "from": "human", "value": "I'm trying to use the OpenNETCF RAPI class to interact with a windows mobile device using the RAPI.Invoke() method.\nAccording to the following article:\nhttp://blog.opennetcf.com/ncowburn/2007/07/27/HOWTORetrieveTheDeviceIDFromTheDesktop.aspx\nYou can do the communication in ei...
I'm working on an ASP.NET website which targets desktop browsers. We want to enable an optional mobile view (e.g. http://m.sample.com) which will offer a few simple pages which will be mostly text. There will be not need for AJAX or even Javascript, and there's no user input - it's really just tables of text with a few...
For your project, since you are targeting simple mobile views with mostly text content, you have a couple of approaches available, especially since you've mentioned that you don’t need complex functionalities like AJAX or user input. Here are some suggestions: ### 1. **Custom Mobile Pages Approach** Creating your own ...
8,135
[ { "from": "human", "value": "I'm working on an ASP.NET website which targets desktop browsers. We want to enable an optional mobile view (e.g. http://m.sample.com) which will offer a few simple pages which will be mostly text. There will be not need for AJAX or even Javascript, and there's no user input - i...
I have a Google App Engine app - http://mylovelyapp.appspot.com/ It has a page - mylovelypage For the moment, the page just does self.response.out.write('OK') If I run the following Python at my computer: import urllib2 f = urllib2.urlopen("http://mylovelyapp.appspot.com/mylovelypage") s = f.read() print s f.close() i...
To access a Google App Engine (GAE) application with `login: required` using Python, you will need to authenticate in a way that respects Google's OAuth 2.0 mechanisms, since older methods like ClientLogin have been deprecated. Below is a step-by-step guide to set up and authenticate using OAuth 2.0 for accessing your...
7,571
[ { "from": "human", "value": "I have a Google App Engine app - http://mylovelyapp.appspot.com/\nIt has a page - mylovelypage\nFor the moment, the page just does self.response.out.write('OK')\nIf I run the following Python at my computer:\nimport urllib2\nf = urllib2.urlopen(\"http://mylovelyapp.appspot.com/m...
Has anyone used Oracle Coherence? It looks very promising at the roadshows. My concern is whether it's a stable and robust enough to implement mission-critical financial solutions. I'd be grateful for any feedback on its performance, robustness and ease of maintenance.
Oracle Coherence is a distributed in-memory data grid solution that is designed to provide scalability, high availability, and performance for applications that require real-time data access. It has been widely adopted in various industries, including finance, for its capabilities to handle large volumes of data and pr...
11,028
[ { "from": "human", "value": "Has anyone used Oracle Coherence? It looks very promising at the roadshows.\nMy concern is whether it's a stable and robust enough to implement mission-critical financial solutions.\nI'd be grateful for any feedback on its performance, robustness and ease of maintenance.\n" },...
Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT? Bonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) array?
To convert a date/time represented as an array of `(year, month, day, hour, minute, second)` to epoch time (the number of seconds since January 1, 1970, 00:00:00 UTC), you can follow these steps: ### Converting to Epoch Time You can use Python's `datetime` module to perform the conversion easily. Here's how you can d...
9,053
[ { "from": "human", "value": "Given a date/time as an array of (year, month, day, hour, minute, second), how would you convert it to epoch time, i.e., the number of seconds since 1970-01-01 00:00:00 GMT?\nBonus question: If given the date/time as a string, how would you first parse it into the (y,m,d,h,m,s) ...
Why does the use of temp tables with a SELECT statement improve the logical I/O count? Wouldn't it increase the amount of hits to a database instead of decreasing it. Is this because the 'problem' is broken down into sections? I'd like to know what's going on behind the scenes.
Using temporary tables with a `SELECT` statement can improve the logical I/O count in several ways, and understanding why requires a look at how SQL Server (or any relational database management system) processes queries and manages data. Here are several key points to consider: ### 1. **Breaking Down Complex Queries*...
6,956
[ { "from": "human", "value": "Why does the use of temp tables with a SELECT statement improve the logical I/O count? Wouldn't it increase the amount of hits to a database instead of decreasing it. Is this because the 'problem' is broken down into sections? I'd like to know what's going on behind the scenes.\...
I've published schema, and no longer have the dll's that contained the wmi provider that the schema was published from. How can I remove the schema?
If you need to remove a schema that has been published in a WMI (Windows Management Instrumentation) repository but no longer have the associated DLLs, you can use the `mofcomp` tool with the `-remove` option or use the `wbemtest` tool to delete the classes manually. Here's how to do it: ### Option 1: Using MOF Files ...
8,944
[ { "from": "human", "value": "I've published schema, and no longer have the dll's that contained the wmi provider that the schema was published from. How can I remove the schema?\n" }, { "from": "gpt", "value": "If you need to remove a schema that has been published in a WMI (Windows Management ...
In ruby I am parsing a date in the following format: 24092008. I want to convert each section (year, month, date) into a number. I have split them up using a regex which produces three Strings which I am passing into the Integer constructor. date =~ /^([\d]{2})([\d]{2})([\d]{4})/ year = Integer($3) month = Intege...
The issue you're encountering is due to how the `Integer` constructor in Ruby interprets strings that represent numbers with leading zeros. In Ruby 2.0 and above, you can simply use the `to_i` method instead, which handles strings with leading zeros correctly and converts them to decimal integers. Here's how you can m...
12,277
[ { "from": "human", "value": "In ruby I am parsing a date in the following format: 24092008.\nI want to convert each section (year, month, date) into a number.\nI have split them up using a regex which produces three Strings which I am passing into the Integer constructor.\n date =~ /^([\\d]{2})([\\d]{2})([...
In particular, wouldn't there have to be some kind of function pointer in place anyway?
Yes, in many programming languages, function pointers or similar constructs are used to refer to functions dynamically. This is especially true in languages like C and C++, where function pointers allow for the creation of callback functions, event handling, or implementing polymorphism without the need for inheritance...
13,293
[ { "from": "human", "value": "In particular, wouldn't there have to be some kind of function pointer in place anyway? \n" }, { "from": "gpt", "value": "Yes, in many programming languages, function pointers or similar constructs are used to refer to functions dynamically. This is especially true i...
We're trying to get SMB volume listings in our OS X application, and have been using NMBLookup, as suggested by Apple, to get listings. However, more often than not, we're not able to get a full listing of available SMB volumes using the tool. We've got a good benchmark in that we can see the full listing the Apple Fin...
Getting a complete listing of available SMB volumes on your network can sometimes be tricky, as SMB (Server Message Block) relies on a combination of broadcast and direct queries to discover available servers. Here are some suggestions and methods you might try to improve your chances of getting a complete listing: ##...
7,079
[ { "from": "human", "value": "We're trying to get SMB volume listings in our OS X application, and have been using NMBLookup, as suggested by Apple, to get listings. However, more often than not, we're not able to get a full listing of available SMB volumes using the tool. We've got a good benchmark in that ...