instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I need to get authentication credentials from the users within a Windows script but the classic "first Google result" approach: SET /P USR=Username: SET /P PWD=Password: is less than satisfying, so I was wondering if there's let's say an "equivalent" to HTML's input type="password"? Any comment would be really appre...
In a Windows batch script, there isn't a built-in method to securely prompt for a password without echoing the input to the console. However, you can utilize PowerShell to achieve this functionality, as it allows you to create a password prompt that hides the input. Here's an example of how you can achieve this by call...
44,694
[ { "from": "human", "value": "I need to get authentication credentials from the users within a Windows script but the classic \"first Google result\" approach:\nSET /P USR=Username: \nSET /P PWD=Password: \n\nis less than satisfying, so I was wondering if there's let's say an \"equivalent\" to HTML's input t...
Does anyone know of a good code static code analyser for vb.net? I've seen plenty for c#, and I think VS 2008 some one built in. But we're currently only using vs 2005...
For VB.NET in Visual Studio 2005, there are a few static code analysis tools you can consider: 1. **FxCop**: This is a code analysis tool from Microsoft that helps you analyze managed code assemblies for compliance with the .NET Framework Design Guidelines. While it primarily targets C#, it can also analyze VB.NET cod...
47,508
[ { "from": "human", "value": "Does anyone know of a good code static code analyser for vb.net? \nI've seen plenty for c#, and I think VS 2008 some one built in. But we're currently only using vs 2005...\n" }, { "from": "gpt", "value": "For VB.NET in Visual Studio 2005, there are a few static code...
I'm using Windows XP and I want to know if the local area is available or not? And if I'm using another OS would that affect on my code?
To check if the local area network (LAN) is available on Windows XP, you can follow these steps: ### Checking Local Area Connection on Windows XP 1. **Open Network Connections**: - Click on the "Start" button. - Go to "Control Panel". - Click on "Network Connections". 2. **Check Status**: - You should s...
45,221
[ { "from": "human", "value": "I'm using Windows XP and I want to know if the local area is available or not?\nAnd if I'm using another OS would that affect on my code?\n" }, { "from": "gpt", "value": "To check if the local area network (LAN) is available on Windows XP, you can follow these steps:...
did anyone try to view a Silverlight site on a Linux machine? afaik, there is something called mono on Linux which is a try to port .NET on Linux machines, but did one really try to use it? did it work?
Silverlight was a framework developed by Microsoft for building rich internet applications, similar to Adobe Flash. However, Silverlight is no longer actively supported as of October 2021, and its usage has declined significantly since then, especially with the rise of HTML5. Regarding using Silverlight on Linux, Mono...
47,895
[ { "from": "human", "value": "did anyone try to view a Silverlight site on a Linux machine? afaik, there is something called mono on Linux which is a try to port .NET on Linux machines, but did one really try to use it? did it work?\n" }, { "from": "gpt", "value": "Silverlight was a framework dev...
I am developing a HTML form designer that needs to generate static HTML and show this to the user. I keep writing ugly code like this: public string GetCheckboxHtml() { return ("<input type="checkbox" name="somename" />"); } Isn't there a set of strongly typed classes that describe html elements and allow me...
What you're looking for can often be found in libraries or frameworks that deal with HTML generation and templating in a more structured manner. Here are a few libraries and frameworks that you might consider: ### 1. **HtmlAgilityPack** - **Namespace**: `HtmlAgilityPack` - This is a popular .NET library for parsing an...
45,127
[ { "from": "human", "value": "I am developing a HTML form designer that needs to generate static HTML and show this to the user. I keep writing ugly code like this:\npublic string GetCheckboxHtml()\n{\n return (\"<input type=\"checkbox\" name=\"somename\" />\");\n}\n\nIsn't there a set of strongly t...
Velocity DisplayTool has a useful method: $display.list($list) That will format a collection or array into the form "A, B and C". The problem is lets say I have an ArrayList of objects, how do I output a specific object field instead of the whole object? For example the regular loop would look like this: #foreach($ob...
It's great to hear that you implemented a solution and contributed to DisplayTools! If you're looking for a way to format a list of specific fields in Velocity without modifying the original objects or relying on `toString()`, you can create a utility method to extract and format the desired field. Here's a way to ach...
46,718
[ { "from": "human", "value": "Velocity DisplayTool has a useful method:\n$display.list($list)\n\nThat will format a collection or array into the form \"A, B and C\". \nThe problem is lets say I have an ArrayList of objects, how do I output a specific object field instead of the whole object?\nFor example the...
I'm currently estimating how to best share data between offices at different geographical locations. My current preference is for using SQL Server Merge Replication and have a main database and handful of subscribers. The system will also need to allow a few work sites to work disconnected (no or little connectivity on...
When considering data sharing solutions for offices and work sites with intermittent connectivity, you're on the right track with SQL Server Merge Replication and the Sync Framework, both of which have their benefits in this context. Here are some additional systems and considerations you might want to explore: ### Ot...
44,104
[ { "from": "human", "value": "I'm currently estimating how to best share data between offices at different geographical locations.\nMy current preference is for using SQL Server Merge Replication and have a main database and handful of subscribers.\nThe system will also need to allow a few work sites to work...
How can I tell unix "find" to include in it's recursive search a folder which is softlinked?
In Unix, when using the `find` command, you can instruct it to follow symbolic links (soft links) by using the `-L` option. This option tells `find` to follow symbolic links to directories, effectively including them in the recursive search. Here is the general syntax: ```bash find -L <starting_directory> -type <type...
48,222
[ { "from": "human", "value": "How can I tell unix \"find\" to include in it's recursive search a folder which is softlinked? \n" }, { "from": "gpt", "value": "In Unix, when using the `find` command, you can instruct it to follow symbolic links (soft links) by using the `-L` option. This option te...
I'm working on a idea where my a:link have one state (blue, no underline etc) with a a:hover being white. I want my visited links to have the same state as a:link and a:hover. Is this possible? supported in most common browsers?
Yes, it is possible to style your links in the way you've described, and it should be supported in all common browsers. Here's how you can achieve it using CSS. You can define your link styles for the normal state (`a:link`), the hover state (`a:hover`), and the visited state (`a:visited`). Since you want the visited ...
45,298
[ { "from": "human", "value": "I'm working on a idea where my a:link have one state (blue, no underline etc) with a a:hover being white. I want my visited links to have the same state as a:link and a:hover. Is this possible? supported in most common browsers?\n" }, { "from": "gpt", "value": "Yes, ...
I'm trying to get the pixel information from an image and have got to the point where I have my void* data object which is a pointer to the image data. What exactly is this object? I've tried iterating over it hoping that it's an array of pixel info but it doesn't seem to work. I want to get the rgb values for eac...
In image processing, the `void* data` object you're dealing with is typically a pointer to the raw pixel data of an image. However, to interpret the data correctly, you need to understand the format of the image and the way the pixel data is organized. ### Common Image Formats Images can be stored in various formats, ...
36,680
[ { "from": "human", "value": "I'm trying to get the pixel information from an image and have got to the point where I have my void* data object which is a pointer to the image data. \nWhat exactly is this object? I've tried iterating over it hoping that it's an array of pixel info but it doesn't seem to wo...
Does anybody know a good tool to assist in the development of an SNMP MIB with correct formatting and syntax? If possible, it should be free and run under Linux.
Yes, there are several tools available for developing and editing SNMP MIBs (Management Information Bases) that are free and can run under Linux. Here are a few popular ones: 1. **MIB Smithy**: This is a powerful tool for creating and managing MIB files. While it is primarily designed for Windows, it can be run on Lin...
48,605
[ { "from": "human", "value": "Does anybody know a good tool to assist in the development of an SNMP MIB with correct formatting and syntax?\nIf possible, it should be free and run under Linux.\n" }, { "from": "gpt", "value": "Yes, there are several tools available for developing and editing SNMP ...
Does anyone know if it's possible to open a file in the file system via a link in a WebBrowser component? I'm writing a little reporting tool in which I display a summary as HTML in a WebBrowser component with a link to a more detailed analysis which is saved as an Excel file on disk. I want the user to be able to cli...
The WebBrowser control in C# Windows Forms is a wrapper around the Internet Explorer rendering engine, but it can have some limitations when handling local file links (like `file://`). Here are some suggestions to help you get the desired behavior: ### 1. Use `Process.Start` Instead of relying on the WebBrowser contr...
43,477
[ { "from": "human", "value": "Does anyone know if it's possible to open a file in the file system via a link in a WebBrowser component? I'm writing a little reporting tool in which I display a summary as HTML in a WebBrowser component with a link to a more detailed analysis which is saved as an Excel file on...
I am looking for a Ajax Grid control that can be used easily for binding data using js methods. I have tried using the GridView in AjaxDataControls, and it's okay - but I am also looking for multiple select support in the GridView. Any pointers would be much appreciated.
If you're looking for an Ajax Grid control that supports multiple selections and allows for easy data binding through JavaScript methods, you have a few great options to consider. Here are some popular libraries and controls that could fit your needs: 1. **Kendo UI Grid**: - **Overview**: Kendo UI provides a robust...
39,821
[ { "from": "human", "value": "I am looking for a Ajax Grid control that can be used easily for binding data using js methods. I have tried using the GridView in AjaxDataControls, and it's okay - but I am also looking for multiple select support in the GridView. Any pointers would be much appreciated.\n" },...
By default sqlplus truncates column names to the length of the underlying data type. Many of the column names in our database are prefixed by the table name, and therefore look identical when truncated. I need to specify select * queries to remote DBAs in a locked down production environment, and drag back spooled resu...
In SQL*Plus, when using the `SET MARKUP HTML ON` command, you have the ability to output results in an HTML format, which can help in preserving the visibility of column names even if they are long. However, SQL*Plus has a limitation in truncating column names based on their datatype lengths by default, which can cause...
45,725
[ { "from": "human", "value": "By default sqlplus truncates column names to the length of the underlying data type. Many of the column names in our database are prefixed by the table name, and therefore look identical when truncated.\nI need to specify select * queries to remote DBAs in a locked down producti...
How can I return to the start of a line and overwrite what has already been output on the console? The following does not appear to work: System.out.print(mystuff+'\r');
In Java, if you want to return to the start of the current line in the console and overwrite what has already been output, you can use the carriage return character (`\r`) properly, but you also need to ensure that the console output is flushed after printing. The carriage return moves the cursor back to the beginning...
44,476
[ { "from": "human", "value": "How can I return to the start of a line and overwrite what has already been output on the console? The following does not appear to work:\nSystem.out.print(mystuff+'\\r');\n\n" }, { "from": "gpt", "value": "In Java, if you want to return to the start of the current l...
Is it possible to avoid the automatic collapse of a Silverlight ComboBox after LostFocus?
In Silverlight, the default behavior of a ComboBox is to automatically close when it loses focus. This is by design, as it allows for a clean user interface. However, if you want to prevent the ComboBox from collapsing when it loses focus, you can employ some workarounds. One common approach is to handle the `LostFocu...
45,999
[ { "from": "human", "value": "Is it possible to avoid the automatic collapse of a Silverlight ComboBox after LostFocus?\n" }, { "from": "gpt", "value": "In Silverlight, the default behavior of a ComboBox is to automatically close when it loses focus. This is by design, as it allows for a clean us...
I have a problem with a bash script. I have to use the operator * to multiplicate. Instead the script bugs me with expansion and using as operator the name of the script itself. I tried with single quotes but it doesn't work :( Here's the code #!/bin/bash -x # Bash script that calculates an arithmetic expression # NO ...
The issue you're facing is due to how Bash parses and interprets the script. The multiplication operator `*` in Bash is interpreted as a wildcard for filename expansion (globbing) unless properly escaped or quoted in the arithmetic context. Here's how you can modify your script to ensure it correctly handles the multi...
46,190
[ { "from": "human", "value": "I have a problem with a bash script. I have to use the operator * to multiplicate. Instead the script bugs me with expansion and using as operator the name of the script itself. I tried with single quotes but it doesn't work :( Here's the code\n#!/bin/bash -x\n\n# Bash script th...
I'm migrating a website made in classic asp to asp.net, but the asp.net dev server doesn't handle .asp pages. Is it possible to make it run .asp pages? Maybe a custom httphandler for .asp? thanks!
ASP.NET does not natively support the execution of classic ASP (.asp) files since it is designed to work with the ASP.NET framework and its corresponding file types, primarily .aspx, .cshtml, and so on. However, there are a few approaches you can take to handle this situation while migrating your website: ### 1. **Run...
43,621
[ { "from": "human", "value": "I'm migrating a website made in classic asp to asp.net, but the asp.net dev server doesn't handle .asp pages.\nIs it possible to make it run .asp pages? Maybe a custom httphandler for .asp?\nthanks!\n" }, { "from": "gpt", "value": "ASP.NET does not natively support t...
I am looking for suggestions on how to find the sizes (in bits) and range of floating point numbers in an architecture independent manner. The code could be built on various platforms (AIX, Linux, HPUX, VMS, maybe Windoze) using different flags - so results should vary. The sign, I've only seen as one bit, but how to...
To find the sizes (in bits) and range of floating point numbers in an architecture-independent manner, you can use the following strategies. The two standard floating point types typically considered are single precision (float) and double precision (double). The layout of these types in memory is defined by the IEEE 7...
38,832
[ { "from": "human", "value": "I am looking for suggestions on how to find the sizes (in bits) and range of floating point numbers in an architecture independent manner. The code could be built on various platforms (AIX, Linux, HPUX, VMS, maybe Windoze) using different flags - so results should vary. The si...
I entered this statement in JSLint: var number = new Number(3); And received the following message: Do not use Number as a constructor. Why is that? The statement is creating a number object, not a primitive value, so I don't see why using new is a problem. EDIT: Thanks for all the responses. They've got me thinking...
The warning from JSLint regarding the use of `Number` as a constructor is rooted in JavaScript's design and best practices regarding primitive values versus object values. When you use `new Number(3)`, you are creating a `Number` object, which is different from a primitive number. While this may seem beneficial becaus...
46,383
[ { "from": "human", "value": "I entered this statement in JSLint:\nvar number = new Number(3);\n\nAnd received the following message:\n\nDo not use Number as a constructor.\n\nWhy is that? The statement is creating a number object, not a primitive value, so I don't see why using new is a problem.\nEDIT: Than...
In the following, I'd like to alter the CSS such that the right-sibling is truly centered in the container div. (Edit: without using absolute positioning). <html> <head> <style type='text/css'> #container { width: 500px; } #left-sibling { float: left; } #right-siblin...
To center the right sibling within the container without using absolute positioning and without modifying the HTML structure, you can use a combination of `display: flex` for the container and some flex properties for the children. Here's how you can achieve this: ```html <html> <head> <style type='text/css'> ...
47,357
[ { "from": "human", "value": "In the following, I'd like to alter the CSS such that the right-sibling is truly centered in the container div. (Edit: without using absolute positioning). \n<html>\n <head>\n <style type='text/css'>\n #container {\n width: 500px;\n }\n #left-sibling {\...
I am planning to design an address validation for users registering in my app. Possibly validating by zipcode and state. Any idea how to handle addresses from around the globe? Do i need to insert all the zipcodes in the database and then validate the address. Any possible suggestion for the implementation? Thanks and ...
Hello Krisp, Designing a global address validation system is a complex but rewarding task. Here are some steps and best practices to consider when implementing such a feature in your app: ### 1. **Use Standardized Address Formats** - Familiarize yourself with international addressing standards, such as those set b...
44,134
[ { "from": "human", "value": "I am planning to design an address validation for users registering in my app. Possibly validating by zipcode and state.\nAny idea how to handle addresses from around the globe?\nDo i need to insert all the zipcodes in the database and then validate the address. Any possible sug...
I am using Delphi TApplication.OnException Event to catch unhandled exceptions This works well but does not give sufficient information about where the exception happened i.e. ‘Catastrophic failure’ How can I find out which procedure made the error happened? procedure TFrmMain.FormCreate(Sender: TObject); begin A...
To get more detailed information about where the exception occurred in Delphi, you can use the `ExceptAddr` and `ExceptObject` functions in conjunction with the `OnException` event handler. These functions provide information about the state of the program at the time the exception was raised. Here’s how you can enhan...
43,974
[ { "from": "human", "value": "I am using Delphi TApplication.OnException Event to catch unhandled exceptions\nThis works well but does not give sufficient information about where the exception happened \ni.e. ‘Catastrophic failure’ \nHow can I find out which procedure made the error happened?\nprocedure TF...
I need to perform a LINQ query for both a time period from a database table (Period) and a list of invoices from a table (Invoice) that fall within the period's start and end dates. There is no key reference between the two tables, how can I do the Invoice subquery? I am trying to do something similar to the following...
In your scenario, since there is no direct relationship (key reference) between the `Periods` and `Invoices` tables, you will need to structure your query to perform a join based on the condition that the `InvoiceDate` falls within the `StartDate` and `EndDate` of each `Period`. The best way to do this is to utilize ...
45,896
[ { "from": "human", "value": "I need to perform a LINQ query for both a time period from a database table (Period) and a list of invoices from a table (Invoice) that fall within the period's start and end dates. There is no key reference between the two tables, how can I do the Invoice subquery?\nI am tryin...
I would like to know if there is a function to correctly escape string literals for filter expressions. e.g.: DataTable.Select(String.Format("[name] = '{0}'", MyName)) If MyName contains ' or a number of other key characters an exception is generated. The Microsoft documentation indicates that these charaters should b...
In .NET, the `DataTable.Select` method uses SQL-like syntax for filtering. When constructing filter expressions, it’s crucial to handle special characters correctly to avoid exceptions. To escape single quotes (`'`), which are commonly found in string literals, you should use double single quotes (`''`). This means th...
48,491
[ { "from": "human", "value": "I would like to know if there is a function to correctly escape string literals for filter expressions. e.g.:\nDataTable.Select(String.Format(\"[name] = '{0}'\", MyName))\n\nIf MyName contains ' or a number of other key characters an exception is generated. The Microsoft documen...
I am using FxCop and I would like to find all the methods or variables without an access modifier explicitly defined. For example: class MyClass { int myInt = 0; internal MyClass() { } } I would like FxCop to warn me that I didn't specify what access modifier will be applied to the variable "myInt" or the...
In FxCop, there isn't a built-in rule that specifically checks for missing access modifiers on variables and classes. However, you can create a custom rule to perform this check. Below are the steps to help you get started with creating a custom FxCop rule. ### Step 1: Set Up Your Environment To create a custom FxCop ...
44,150
[ { "from": "human", "value": "I am using FxCop and I would like to find all the methods or variables without an access modifier explicitly defined. For example:\nclass MyClass\n{\n int myInt = 0;\n\n internal MyClass()\n {\n }\n}\n\nI would like FxCop to warn me that I didn't specify what access modi...
Visual Studio syntax highlighting colors this word blue as if it were a keyword or reserved word. I tried searching online for it but the word "array" throws the search off, I get mostly pages explaining what an array is. What is it used for?
In many programming languages, the word "array" is not only a data structure but can also be a keyword or part of the syntax, depending on the language you are using. The color coding in Visual Studio typically signifies that the editor recognizes "array" as a significant term, which may indicate that it's used in a co...
46,019
[ { "from": "human", "value": "Visual Studio syntax highlighting colors this word blue as if it were a keyword or reserved word. I tried searching online for it but the word \"array\" throws the search off, I get mostly pages explaining what an array is. What is it used for?\n" }, { "from": "gpt", ...
i want ask some question about asp.net mvc Is static constructor will init every user request? Is static data share for every user?
Certainly! Let's break down your questions regarding ASP.NET MVC: ### 1. Is a static constructor initialized for every user request? No, a static constructor is not initialized for every user request. A static constructor is called once per type (class) when the type is first accessed, regardless of how many users ar...
46,933
[ { "from": "human", "value": "i want ask some question about asp.net mvc\n\nIs static constructor will init every user request?\nIs static data share for every user?\n\n" }, { "from": "gpt", "value": "Certainly! Let's break down your questions regarding ASP.NET MVC:\n\n### 1. Is a static construc...
I need to make a Java component that turns the background a certain colour when a process passed, and another colour when the process failed. My first thought was: green for success, red for failure. But then I read that 10% of males can't differentiate between these two colours. What would be a better combination of c...
It's great that you're considering color accessibility for your Java component. Since red and green can be problematic for some individuals, here are some alternative color combinations that maintain clear differentiation while being more accessible: 1. **Blue for Success, Orange for Failure:** - Blue is generally ...
49,267
[ { "from": "human", "value": "I need to make a Java component that turns the background a certain colour when a process passed, and another colour when the process failed.\nMy first thought was: green for success, red for failure.\nBut then I read that 10% of males can't differentiate between these two colou...
I have a webpage where I want the user to see a new image when they put thier mouse over a certain part of the image. I used an image map. <img src="pic.jpg" usemap="#picmap" /> <map id="picmap" name="picmap"><area shape="rect" coords ="10,20,30,40" onMouseOver="mouse_on_write('mouse is on spot')" onMouseOut="mouse_of...
To improve the seamlessness of your image switching and reduce lag, there are a couple of strategies you can employ. Here are two different approaches to consider: preloading images and using CSS for image transitions. Additionally, I'll provide a way to switch the images as you mentioned. ### Method 1: Preload Images...
42,251
[ { "from": "human", "value": "I have a webpage where I want the user to see a new image when they put thier mouse over a certain part of the image. I used an image map.\n<img src=\"pic.jpg\" usemap=\"#picmap\" />\n<map id=\"picmap\" name=\"picmap\"><area shape=\"rect\" coords =\"10,20,30,40\"\nonMouseOver=\...
I have a few questions about when and how viewstate is encrypted in asp.net 3.5. For instance, if I have a machinekey entry in my web.config like: decryptionKey="AutoGenerate,IsolateApps" validation="AES" decryption="Auto" /> Is viewstate encrypted at this point? Or do I need to ...
In ASP.NET 3.5, the handling of ViewState encryption and the associated configuration can sometimes be a bit confusing. Let’s address your questions regarding ViewState encryption and related settings. ### 1. Is ViewState Encrypted with the Provided MachineKey? The machineKey configuration you provided: ```xml <machi...
46,462
[ { "from": "human", "value": "I have a few questions about when and how viewstate is encrypted in asp.net 3.5.\nFor instance, if I have a machinekey entry in my web.config like:\n \n decryptionKey=\"AutoGenerate,IsolateApps\" \n validation=\"AES\" \n decryption=\"Auto\" />\nI...
I found http://www.databaseanswers.org/data_models/ very useful. Any other suggestions?
Certainly! Here are some additional resources where you can find data models, database design information, and related resources: 1. **Vertabelo** - [Vertabelo Database Modeler](https://www.vertabelo.com/blog/): This site provides a variety of database modeling resources, tutorials, and a web-based database design too...
47,172
[ { "from": "human", "value": "I found http://www.databaseanswers.org/data_models/ very useful. Any other suggestions?\n" }, { "from": "gpt", "value": "Certainly! Here are some additional resources where you can find data models, database design information, and related resources:\n\n1. **Vertabel...
I need to write some code to analyze whether or not a given user on our site is a bot. If it's a bot, we'll take some specific action. Looking at the User Agent is not something that is successful for anything but friendly bots, as you can specify any user agent you want in a bot. I'm after behaviors of unfriendly b...
Detecting bots on a website can be challenging, especially when they impersonate legitimate users. You’re already considering some good indicators, but here are additional strategies and methods that can help you identify potential bots more effectively: 1. **Rate of Requests**: - Monitor the frequency of requests ...
43,488
[ { "from": "human", "value": "I need to write some code to analyze whether or not a given user on our site is a bot. If it's a bot, we'll take some specific action. Looking at the User Agent is not something that is successful for anything but friendly bots, as you can specify any user agent you want in a ...
I need to take production data with real customer info (names, address, phone numbers, etc) and move it into a dev environment, but I'd like to remove any semblance of real customer info. Some of the answers to this question can help me generating NEW test data, but then how do I replace those columns in my production ...
When dealing with sensitive customer data, it's crucial to ensure that you anonymize or pseudonymize that data appropriately before transferring it to a development environment. You can use different methods for this, including generating new test data and replacing the sensitive fields with this new data. Below, I’ll ...
43,728
[ { "from": "human", "value": "I need to take production data with real customer info (names, address, phone numbers, etc) and move it into a dev environment, but I'd like to remove any semblance of real customer info.\nSome of the answers to this question can help me generating NEW test data, but then how do...
I'm looking at using ADO.NET Data Services with silverlight. I've been looking at the Data Model and Data Service Implementations (ADO.NET Data Services/Silverlight) topic on msdn. In their example, they build a data model generated from a database, and query entities in the datamodel. In my case I want to use stor...
Using ADO.NET Data Services (also known as WCF Data Services) with Silverlight can be a bit tricky when it comes to executing stored procedures, as the standard approach primarily focuses on querying entities mapped to tables. However, you can still achieve this by following these steps: ### 1. Create a Data Model wit...
44,737
[ { "from": "human", "value": "I'm looking at using ADO.NET Data Services with silverlight. I've been looking at the \nData Model and Data Service Implementations (ADO.NET Data Services/Silverlight) topic on msdn. In their example, they build a data model generated from a database, and query entities in the...
The only reliable method that I a have found for using a script to download text from wikipedia is with cURL. So far the only way I have for doing that is to call os.system(). Even though the output appears properly in the python shell I can't seem to the function it to return anything other than the exit code(0). Alte...
Using `cURL` with `os.system()` can indeed be a bit cumbersome when you're looking to process the output in Python. Instead, you can use the `subprocess` module for more control, or use `urllib` to download content directly. Here's how you can achieve both using `subprocess` and `urllib`. ### Method 1: Using `subproc...
45,196
[ { "from": "human", "value": "The only reliable method that I a have found for using a script to download text from wikipedia is with cURL. So far the only way I have for doing that is to call os.system(). Even though the output appears properly in the python shell I can't seem to the function it to return a...
Suppose you have a file that contains IP addresses, one address in each line: 10.0.10.1 10.0.10.1 10.0.10.3 10.0.10.2 10.0.10.1 You need a shell script that counts for each IP address how many times it appears in the file. For the previous input you need the following output: 10.0.10.1 3 10.0.10.2 1 10.0.10.3 1 One w...
Certainly! If you're looking for a more efficient way to count occurrences of IP addresses in a file using bash, you can utilize associative arrays, which act similarly to hash tables. This allows you to read through the file just once while counting the occurrences, and then print the results. Here's how you can do i...
47,323
[ { "from": "human", "value": "Suppose you have a file that contains IP addresses, one address in each line:\n10.0.10.1\n10.0.10.1\n10.0.10.3\n10.0.10.2\n10.0.10.1\n\nYou need a shell script that counts for each IP address how many times it appears in the file. For the previous input you need the following ou...
From what I have read best practice is to have classes based on an interface and loosely couple the objects, in order to help code re-use and unit test. Is this correct and is it a rule that should always be followed? The reason I ask is I have recently worked on a system with 100’s of very different objects. A few sh...
Your understanding of using interfaces for loose coupling and reusability is correct, and it is generally considered a good practice in object-oriented design. However, the idea of having an interface for every class can lead to unnecessary complexity and is not always necessary or practical. Let’s break down some key ...
45,403
[ { "from": "human", "value": "From what I have read best practice is to have classes based on an interface and loosely couple the objects, in order to help code re-use and unit test.\nIs this correct and is it a rule that should always be followed? \nThe reason I ask is I have recently worked on a system wit...
Presently, I am working on a project using classic ASP. My development machine is Vista Enterprise. Although Vista does allow you to have multiple Web Sites (not without a workaround in XP), it has removed the SMTP service from IIS. Is there a standard workaround for this issue? As more web developers at my company re...
Yes, it’s true that the SMTP service is not included by default with IIS on Windows Vista, which can create challenges for web developers relying on email functionality within their applications. Here are some standard workarounds you can consider: ### 1. Use an External SMTP Service One of the simplest workarounds is...
43,228
[ { "from": "human", "value": "Presently, I am working on a project using classic ASP. My development machine is Vista Enterprise. Although Vista does allow you to have multiple Web Sites (not without a workaround in XP), it has removed the SMTP service from IIS. \nIs there a standard workaround for this issu...
Let's say I have a simple stored procedure that looks like this (note: this is just an example, not a practical procedure): CREATE PROCEDURE incrementCounter AS DECLARE @current int SET @current = (select CounterColumn from MyTable) + 1 UPDATE MyTable SET CounterColumn = current GO We're assuming I have a ta...
Yes, the scenario you described is indeed possible and can lead to a race condition when the `incrementCounter` stored procedure is executed concurrently by multiple sessions. In the given example, if two concurrent executions of the stored procedure occur, both executions can read the same initial value of `CounterCol...
40,126
[ { "from": "human", "value": "Let's say I have a simple stored procedure that looks like this (note: this is just an example, not a practical procedure):\nCREATE PROCEDURE incrementCounter AS\n\nDECLARE @current int\nSET @current = (select CounterColumn from MyTable) + 1\n\nUPDATE\n MyTable\nSET\n Coun...
I am looking for a cross-platform solution for saving and viewing 3D scenes (visualizations of engineering simulation models and results) but there (still) doesn't seem to be much out there. I looked into this almost 10 years ago and settled on VRML then (and started the project that eventually turned in OpenVRML). Unf...
As of my last knowledge update in October 2023, there are a few cross-platform solutions that can help you with saving and viewing 3D scenes. Below are some options that you might find useful: ### 1. **Assimp (Open Asset Import Library)** - **Description**: Assimp is an open-source library to import and export various...
42,368
[ { "from": "human", "value": "I am looking for a cross-platform solution for saving and viewing 3D scenes (visualizations of engineering simulation models and results) but there (still) doesn't seem to be much out there.\nI looked into this almost 10 years ago and settled on VRML then (and started the projec...
Does anyone have any experience with installing the Visual Studio Isolated Shell and using it with F#? It installed successfully, but when I click on the devenv.exe, it opens VS, but gives me the error "Invalid License Data. Reinstall is required". I have done that many times to no avail. Googling for this issue, I fi...
Using the Visual Studio Isolated Shell can be a bit tricky, especially when it comes to integrating languages like F#. Here are a few points you might find helpful in resolving the "Invalid License Data" issue and getting F# to work within the isolated shell: 1. **Isolated Shell Purpose**: The Visual Studio Isolated S...
44,319
[ { "from": "human", "value": "Does anyone have any experience with installing the Visual Studio Isolated Shell and using it with F#? \nIt installed successfully, but when I click on the devenv.exe, it opens VS, but gives me the error \"Invalid License Data. Reinstall is required\". I have done that many time...
I have put together a script which is very much like the flickr photostream feature. Two thumbnails next to each other, and when you click the next or prev links the next (or previous) two images slide in. Cool! Currently when the page loads it loads the two images. The first time nxt / prv is used then the next two im...
You've outlined several interesting approaches to handling image loading for your sliding pane feature. Let's evaluate each option while considering both performance and user experience: ### 1. Call Each Set of Images via JSON This approach allows you to dynamically load only the images you need on demand. It could be...
42,195
[ { "from": "human", "value": "I have put together a script which is very much like the flickr photostream feature. Two thumbnails next to each other, and when you click the next or prev links the next (or previous) two images slide in. Cool!\nCurrently when the page loads it loads the two images. The first t...
Using jQuery, is there a way to select all tag that reference a specific css class, and set the display to "inline"? example: <span class="theclass">junk</span> <span class="theclass">other junk</span> <span class="theclass">more junk</span> in .css: .theclass { display: none; }
Yes, you can use jQuery to select all elements that reference a specific CSS class and set their display property to "inline." In your case, you want to target elements with the class `.theclass` and change their display from `none` to `inline`. Here's how you can do it: 1. Make sure you have included jQuery in your...
45,190
[ { "from": "human", "value": "Using jQuery, is there a way to select all tag that reference a specific css class, and set the display to \"inline\"?\nexample:\n<span class=\"theclass\">junk</span>\n<span class=\"theclass\">other junk</span>\n<span class=\"theclass\">more junk</span>\n\nin .css: \n.theclass {...
so that you can make your program concurrent easily in the future.
To make a program concurrent easily in the future, consider the following best practices and design principles: 1. **Modular Design**: Structure your code into distinct, reusable modules or components. This separation makes it easier to identify which parts of the program can be run concurrently. 2. **Use of Asynchro...
46,417
[ { "from": "human", "value": "so that you can make your program concurrent easily in the future.\n" }, { "from": "gpt", "value": "To make a program concurrent easily in the future, consider the following best practices and design principles:\n\n1. **Modular Design**: Structure your code into dist...
I know that -applicationWillResignActive gets called upon an incoming call, but is there a standard method that gets called if the user hits the "exit" button (the only button on the front of the iPhone)?
Yes, when the user presses the Home button (the "exit" button) on an iPhone, the app transitions to the background. This triggers a series of lifecycle methods in your app's delegate. The primary method that gets called when the app transitions from active to inactive state due to the user pressing the Home button is ...
45,000
[ { "from": "human", "value": "I know that -applicationWillResignActive gets called upon an incoming call, but is there a standard method that gets called if the user hits the \"exit\" button (the only button on the front of the iPhone)? \n" }, { "from": "gpt", "value": "Yes, when the user presse...
Is there a reason why most function definition in device driver in linux code is defined as static? Is there a reason for this? I was told this is for scoping and to prevent namespace pollution, could anyone explain it in detail why static definition is used in this context?
In the context of Linux device drivers (and C programming in general), defining functions as `static` has several implications and benefits, particularly concerning scope and namespace management. Here’s a detailed explanation of why `static` is commonly used in device driver code: ### 1. **Scope Limitation** When a f...
44,631
[ { "from": "human", "value": "Is there a reason why most function definition in device driver in linux code is defined as static? Is there a reason for this? \nI was told this is for scoping and to prevent namespace pollution, could anyone explain it in detail why static definition is used in this context?\n...
How do I remove the urls of repositories that no longer exist in the dropdown in the TortoiseSvn repo-browser?
If you want to remove the URLs of repositories that no longer exist in the dropdown menu of the TortoiseSVN Repo Browser, you can clear the history stored by TortoiseSVN. Here are the steps to do that: 1. **Open TortoiseSVN Settings**: - Right-click on any folder in Windows Explorer. - Navigate to the `TortoiseS...
49,220
[ { "from": "human", "value": "How do I remove the urls of repositories that no longer exist in the dropdown in the TortoiseSvn repo-browser?\n" }, { "from": "gpt", "value": "If you want to remove the URLs of repositories that no longer exist in the dropdown menu of the TortoiseSVN Repo Browser, y...
I'm looking for an Earley parser generator that is able to generate Java output code, i.e. that generates Java code for the lexer and parser, and allows to include actions (realised as Java code) that are performed for the grammar rules. I looked at two Earley parser generators that generate Java code (Pep and PEN) but...
If you're looking for an Earley parser generator that can produce Java output and allows you to embed actions in your grammar, you might want to consider using **ANTLR (ANother Tool for Language Recognition)**. While ANTLR traditionally uses a parsing algorithm based on LL(*), it also supports some aspects of Earley pa...
44,327
[ { "from": "human", "value": "I'm looking for an Earley parser generator that is able to generate Java output code,\ni.e. that generates Java code for the lexer and parser, and allows to include actions\n(realised as Java code) that are performed for the grammar rules.\nI looked at two Earley parser generato...
I'm trying to update a variable in APC, and will be many processes trying to do that. APC doesn't provide locking functionality, so I'm considering using other mechanisms... what I've found so far is mysql's GET_LOCK(), and php's flock(). Anything else worth considering? Update: I've found sem_acquire, but it seems to ...
When dealing with concurrent updates to a shared resource in PHP, especially when using APC (Alternative PHP Cache), you are correct that you need to implement some form of locking mechanism to prevent race conditions. Here are several options you can consider for managing concurrency when updating variables in APC: #...
44,846
[ { "from": "human", "value": "I'm trying to update a variable in APC, and will be many processes trying to do that.\nAPC doesn't provide locking functionality, so I'm considering using other mechanisms... what I've found so far is mysql's GET_LOCK(), and php's flock(). Anything else worth considering?\nUpdat...
I've got an ASP.NET application running and on the production box it's using about 450MB RAM, however, it shouldn't be using quite so much, and it seems to increase over time, so it seems there might be a leak or atleast something not being released properly. I took a look with PerfMon and there was 416MB in GC Gen2. ...
It sounds like you're dealing with a memory leak in your ASP.NET application. Here are some steps you can take to diagnose and potentially resolve the issue: ### 1. **Use Memory Profilers** Using a memory profiler like dotTrace or ANTS Memory Profiler is a great way to analyze memory usage in your ASP.NET application....
42,434
[ { "from": "human", "value": "I've got an ASP.NET application running and on the production box it's using about 450MB RAM, however, it shouldn't be using quite so much, and it seems to increase over time, so it seems there might be a leak or atleast something not being released properly. \nI took a look wit...
I recently had a problem in my app where some of the subviews I was creating in a UIViewController subclass's -awakeFromNib method were disappearing from the view. After some poking around I found that moving the code I had put in -awakeFromNib to -viewDidLoad solved the problem. Seems that -awakeFromNib gets called o...
You're on the right track with your understanding of the `-awakeFromNib` and `-viewDidLoad` methods in a `UIViewController` subclass. Let's clarify the purpose and best practices for using these methods: 1. **`-awakeFromNib`**: This method is called when the view controller is unarchived from a nib or storyboard file....
48,539
[ { "from": "human", "value": "I recently had a problem in my app where some of the subviews I was creating in a UIViewController subclass's -awakeFromNib method were disappearing from the view. After some poking around I found that moving the code I had put in -awakeFromNib to -viewDidLoad solved the proble...
The Eclipse IDE has a neat little feature that I really miss in Visual Studio. If I place the cursor on a variable or method name, the IDE will automatically highlight all references to it in the current document within the relevant scope. I can't seem to find an option to turn on similar behaviour in VS2008 or Resharp...
As of Visual Studio 2008 and even with ReSharper 4, there isn't a built-in feature to highlight all references to a variable or method automatically on the fly like Eclipse does. However, there are some alternatives you can consider to achieve similar functionality. 1. **ReSharper Settings**: Even though ReSharper 4 d...
46,979
[ { "from": "human", "value": "The Eclipse IDE has a neat little feature that I really miss in Visual Studio.\nIf I place the cursor on a variable or method name, the IDE will automatically highlight all references to it in the current document within the relevant scope.\nI can't seem to find an option to tur...
According to the C# compiler and the Silverlight 2 documentation, Silverlight doesn't provide a FindName method for the DataTemplate class. I want to find a Border that's inside a ContentPresenter. What's the best way in SilverLight 2?
In Silverlight 2, since `DataTemplate` does not provide a `FindName` method, you cannot directly access elements defined in a `DataTemplate` like you would in a traditional WPF application. Instead, you have to work with the visual tree of the created elements after they have been instantiated. To find a `Border` cont...
44,184
[ { "from": "human", "value": "According to the C# compiler and the Silverlight 2 documentation, Silverlight doesn't provide a FindName method for the DataTemplate class. I want to find a Border that's inside a ContentPresenter. What's the best way in SilverLight 2?\n" }, { "from": "gpt", "value...
I'm having a difficult time figuring out how to add a .jar/library to a Netbeans project in such a way that I can get it committed to the repository. The typical way to add a library (per the Netbeans documents I've already gone through) ends up with it just being local to me. Anyone who checks out my project ends up ...
To ensure that a `.jar` library is included in your NetBeans project and can be committed to your Subversion repository, you can follow these steps: ### Step 1: Create a `lib` Directory 1. In your project folder, create a new directory named `lib` (you can name it anything you want, but `lib` is a common convention). ...
44,935
[ { "from": "human", "value": "I'm having a difficult time figuring out how to add a .jar/library to a Netbeans project in such a way that I can get it committed to the repository.\nThe typical way to add a library (per the Netbeans documents I've already gone through) ends up with it just being local to me. ...
I long thought that in C, all variables had to be declared at the beginning of the function. I know that in C99, the rules are the same as in C++, but what are the variable declaration placement rules for C89/ANSI C? The following code compiles successfully with gcc -std=c89 and gcc -ansi: #include <stdio.h> int main()...
In C89 (also known as ANSI C), the rules for variable declarations are indeed more restrictive compared to C99 and later versions. According to the C89 standard, all variables must be declared at the beginning of a block or function before any executable statements. This means that you typically have to declare all var...
47,040
[ { "from": "human", "value": "I long thought that in C, all variables had to be declared at the beginning of the function. I know that in C99, the rules are the same as in C++, but what are the variable declaration placement rules for C89/ANSI C?\nThe following code compiles successfully with gcc -std=c89 an...
(I asked this question but did not receive much response. It was recommended that I ask the same question with regards to C#. ) I am a VB.NET developer with little C# experience (yes, I know I need to write more in C#), looking for small open source projects that demonstrate high unit testing coverage from which to lea...
It's great that you're looking to improve your skills in C# and unit testing! Here are some small open-source C# projects that demonstrate good unit testing practices. These projects are generally concise and manageable, making them suitable for learning. ### Small Open Source Projects in C# 1. **NUnit**: - **Repo...
41,470
[ { "from": "human", "value": "(I asked this question but did not receive much response. It was recommended that I ask the same question with regards to C#. )\nI am a VB.NET developer with little C# experience (yes, I know I need to write more in C#), looking for small open source projects that demonstrate hi...
I'm using local shared objects within flash both to store significant amounts of user data, as well as for caching data fetched from the server. However, I'm very concerned about hitting the 100kb default limit. Because the 100kb limit is for the whole domain, I'm concerned that the sum of multiple local shared objecs...
You are correct in your understanding of Local Shared Objects (LSOs) in Flash. The 100 KB limit is indeed applied to the entire domain, meaning that the combined size of all Local Shared Objects you create cannot exceed this limit. If you reach this limit, users will encounter a prompt asking if they want to allow addi...
46,556
[ { "from": "human", "value": "I'm using local shared objects within flash both to store significant amounts of user data, as well as for caching data fetched from the server.\nHowever, I'm very concerned about hitting the 100kb default limit. Because the 100kb limit is for the whole domain, I'm concerned th...
I am trying to write a unix command line utility that will extract the "application" icon from a Windows Mobile executable. When I look inside the .exe with wrestool from the icoutils package, I see multiple icon and group_icon resources. I am trying to figure out which icon the Windows Mobile Programs view would cho...
When extracting icons from Windows Mobile executables, the process can be a bit nuanced, as there isn't a single standard for how application icons are handled. However, there are some guidelines that can help you determine which icon the Windows Mobile Programs view is likely to display. ### Key Points to Consider: ...
43,891
[ { "from": "human", "value": "I am trying to write a unix command line utility that will extract the \"application\" icon from a Windows Mobile executable. When I look inside the .exe with wrestool from the icoutils package, I see multiple icon and group_icon resources. I am trying to figure out which icon...
Is it possible to implement Bluetooth devices to provide conference rather than one-to-one operation. Are there any development toolkits that will allow me to configure BT devices in this way, or modifications that can be done to the BT stack or an add-on protocol. I need to configure several Bluetooth adaptors to simu...
Bluetooth technology primarily operates on a master-slave basis, where a master device can connect to multiple slave devices in a "piconet" configuration. In standard Bluetooth, a piconet can include up to 7 active slave devices, while additional devices can be paired but are not active participants in data transfer. F...
42,433
[ { "from": "human", "value": "Is it possible to implement Bluetooth devices to provide conference rather than one-to-one operation.\nAre there any development toolkits that will allow me to configure BT devices in this way, or modifications that can be done to the BT stack or an add-on protocol.\nI need to c...
I need to programatically find the users name using C#. Specifically, I want to get the system/network user attached to the current process. I'm writing a web application that uses windows integrated security.
To retrieve the username of the currently logged-in user in a C# web application that uses Windows Integrated Security, you can use the `HttpContext.Current.User.Identity` property. The `User.Identity` property holds information about the user making the request, including their username. Here's how you can do it: 1....
44,991
[ { "from": "human", "value": "I need to programatically find the users name using C#. Specifically, I want to get the system/network user attached to the current process. I'm writing a web application that uses windows integrated security.\n" }, { "from": "gpt", "value": "To retrieve the username...
I'm looking for the best way to provide authorization, authentication, and auditing to web services. I'll be using a web service gateway appliance deployed to the DMZ, and there will be an LDAP instance as a user store behind the firewall. How should it be built? Cheers KA Update As pointed out in an answer below, LDAP...
To provide effective authorization, authentication, and auditing for your web services in the described architecture, you can follow these guidelines: ### 1. Architecture Overview - **Web Service Gateway**: Deploy a gateway appliance in the DMZ that serves as a reverse proxy and an API gateway. This will handle incom...
43,387
[ { "from": "human", "value": "I'm looking for the best way to provide authorization, authentication, and auditing to web services. I'll be using a web service gateway appliance deployed to the DMZ, and there will be an LDAP instance as a user store behind the firewall. How should it be built?\nCheers\nKA\nUp...
I found in a bug in an old C++ MFC program we have that calculates an offset (in days) for a given date from a fixed base date. We were seeing results that were off by one for some reason, and I tracked it down to where the original programmer had used the CTimeSpan.GetDays() method. According to the documentation: ...
Using `GetTotalHours()` plus an adjustment, like adding 1 before dividing by 24, can help mitigate the issues caused by Daylight Saving Time (DST), but it may not be the most straightforward or reliable solution. Here are a few considerations and alternatives you might want to think about before implementing your propo...
42,604
[ { "from": "human", "value": "I found in a bug in an old C++ MFC program we have that calculates an offset (in days) for a given date from a fixed base date. We were seeing results that were off by one for some reason, and I tracked it down to where the original programmer had used the CTimeSpan.GetDays() m...
Related to this question: URL characters replacement in JSP with UrlRewrite I want to have masked URLs in this JSP Java EE web project. For example if I had this: http://mysite.com/products.jsp?id=42&name=Programming_Book I would like to turn that URL into something more User/Google friendly like: http://mysite.com/p...
To achieve user-friendly URLs in a JSP Java EE web project, you've already identified a few key components: URL rewriting and possibly using servlets. Since you've updated that servlets worked for you, I'll outline a general approach using servlets to create clean URLs. ### Steps to Create User-Friendly URLs: 1. **Se...
43,878
[ { "from": "human", "value": "Related to this question:\nURL characters replacement in JSP with UrlRewrite\nI want to have masked URLs in this JSP Java EE web project. \nFor example if I had this:\nhttp://mysite.com/products.jsp?id=42&name=Programming_Book\n\nI would like to turn that URL into something more...
I have a method which is given the parameter "bool sortAscending". Now I want to use LINQ to create sorted list depending on this parameter. I got then this: var ascendingQuery = from data in dataList orderby data.Property ascending select data; var descendingQuery = from da...
You can simplify your code by using a conditional operator to decide on the sort order based on the `sortAscending` parameter. You can use `OrderBy` and `OrderByDescending` methods from LINQ to handle the sorting. Here's how you can do that: ```csharp var sortedQuery = sortAscending ? dataList.OrderBy(data => dat...
49,371
[ { "from": "human", "value": "I have a method which is given the parameter \"bool sortAscending\". Now I want to use LINQ to create sorted list depending on this parameter. I got then this:\nvar ascendingQuery = from data in dataList\n orderby data.Property ascending\n ...
Ive been playing around with XAudio2 but have encountered some strange problems with the mmioOpen function For some reason it seems to fail with MMIOERR_FILENOTFOUND, even though the file is there, in fact the file is in the same directory as other files I'm loading which work fine... The wav files im using to test wit...
It looks like you're experiencing issues with the `mmioOpen` function while attempting to load WAV files using XAudio2. Given that some files open successfully while others do not, it may be worth considering the following potential reasons for the `MMIOERR_FILENOTFOUND` error: 1. **File Path Issues**: - Ensure tha...
45,575
[ { "from": "human", "value": "Ive been playing around with XAudio2 but have encountered some strange problems with the mmioOpen function\nFor some reason it seems to fail with MMIOERR_FILENOTFOUND, even though the file is there, in fact the file is in the same directory as other files I'm loading which work ...
I'm new to mocking, I have a new .net web project that is in UI->BLL->DAL->DB structure, I use NUnit to do some testing currently. I intent to use it to test middle tier so I don't have to actually write to DB. Now, I've never done any mocking, don't quite know where to start, so I am looking for a mocking framework th...
Welcome to the world of mocking! Mocking is a powerful technique to isolate your code during testing, allowing you to focus on the logic in your application without relying on external systems like a database. Since you're using NUnit for testing and you have a layered architecture (UI -> BLL -> DAL -> DB), using a moc...
40,913
[ { "from": "human", "value": "I'm new to mocking, I have a new .net web project that is in UI->BLL->DAL->DB structure, I use NUnit to do some testing currently. I intent to use it to test middle tier so I don't have to actually write to DB.\nNow, I've never done any mocking, don't quite know where to start, ...
State should include at least the following: All settings set via SetStreamResource() Indices I have a class whose Draw() function will call SetStreamResource, set Indices and eventually call DrawIndexedPrimitive(). I would like to restore the device state before Draw() returns. I am looking for something along the l...
In Direct3D, there isn't a direct equivalent to GDI's `SaveDC()` and `RestoreDC()`, but you can implement your own state management to achieve similar functionality. You will need to keep track of the state that you're modifying (like stream resources and indices) and then restore those states after your draw call. He...
41,546
[ { "from": "human", "value": "State should include at least the following:\n\nAll settings set via\nSetStreamResource()\nIndices\n\nI have a class whose Draw() function will call SetStreamResource, set Indices and eventually call DrawIndexedPrimitive(). I would like to restore the device state before Draw() ...
As of right now I believe only Firefox support -moz-border-radius property. I am surprised that twitter uses it. Are any other browsers planning on supporting this or does CSS3 have something like this in the works? Edit: I also found -webkit-border-top-left-radius and then the CSS3 version So when is CSS3 coming out?
As of my last update in October 2023, the `-moz-border-radius` property was an early vendor prefix for Mozilla Firefox, while `-webkit-border-radius` was for browsers based on WebKit, such as Google Chrome and Safari. These vendor prefixes were used to implement CSS3 features before they were fully standardized and ado...
47,089
[ { "from": "human", "value": "As of right now I believe only Firefox support -moz-border-radius property. I am surprised that twitter uses it.\nAre any other browsers planning on supporting this or does CSS3 have something like this in the works?\nEdit: I also found -webkit-border-top-left-radius and then th...
I was working with the generic class in vb.net. And it seems extension method cannot be applied to generic class without specifying the type. I have this generic class Public Class MyGeneric(Of T) 'Methods and properties go here ' ' End Class This is Ok <Extension()> _ Public Sub DoSomething(ByVal myGen...
In VB.NET, extension methods cannot be defined in a way that includes a generic type parameter without also specifying what that type parameter is at the point of declaration. This is due to the fact that extension methods are static members that operate on a specific type at compile time, and the type parameters need ...
45,018
[ { "from": "human", "value": "I was working with the generic class in vb.net.\nAnd it seems extension method cannot be applied to generic class without specifying the type.\nI have this generic class\nPublic Class MyGeneric(Of T)\n 'Methods and properties go here \n '\n '\nEnd Class \n\nThis is Ok\...
the homework: http://www.cs.rit.edu/~waw/networks/prob1.082.html Ok, I am still confused why this question was asked for my data communications and networks class, but here is the question from my homework: Write a computer program that reads the header on an e-mail message and deletes all lines except those that ...
Your Perl solution is quite concise already! However, if you’re looking to make it even shorter, you can experiment with different programming languages and focus on minimizing the number of characters in your code. Here are a few suggestions: ### Alternative Approaches 1. **Python:** A very compact version in Pyt...
46,132
[ { "from": "human", "value": "the homework: http://www.cs.rit.edu/~waw/networks/prob1.082.html\nOk, I am still confused why this question was asked for my data communications and networks class, but here is the question from my homework:\n\n\nWrite a computer program that reads the header on an e-mail messag...
I am looking for a way to clean up the mess when my top-level script exits. Especially if I want to use set -e, I wish the background process would die when the script exits.
To ensure that background processes are properly terminated when a top-level script exits in a Bash script, you can use a combination of trap commands and signal handling. When you use `set -e`, it will cause the script to exit immediately if any command fails, which can potentially leave background processes running. ...
44,663
[ { "from": "human", "value": "I am looking for a way to clean up the mess when my top-level script exits.\nEspecially if I want to use set -e, I wish the background process would die when the script exits.\n" }, { "from": "gpt", "value": "To ensure that background processes are properly terminate...
Does anybody know how I can get the number of the elements (rows*cols) returned after I do an SQL query? If that can't be done, then is there something that's going to be relatively representative of the size of data I get back? I'm trying to make a status bar that indicates how much of the returned data I have proces...
In SQL, the ability to determine the number of rows returned by a `SELECT` query before actually retrieving the data depends on the specific database management system (DBMS) you are using. Here are some general strategies: 1. **Use a `COUNT` Query**: Before running your actual `SELECT` query, you can run a `SELEC...
44,154
[ { "from": "human", "value": "Does anybody know how I can get the number of the elements (rows*cols) returned after I do an SQL query? If that can't be done, then is there something that's going to be relatively representative of the size of data I get back?\nI'm trying to make a status bar that indicates h...
Is this valid and correct? RewriteRule ^myOldPage.html$ /index.php#info [R] I'm specifically interested about the #info part.
In an Apache `.htaccess` file, the `RewriteRule` directive does not process URL fragments (the part after the `#`, known as the fragment identifier). This means that the `#info` part will not be included in the redirection, as fragments are not sent to the server; they are handled by the browser. The rule you've writt...
48,848
[ { "from": "human", "value": "Is this valid and correct?\nRewriteRule ^myOldPage.html$ /index.php#info [R]\n\nI'm specifically interested about the #info part.\n" }, { "from": "gpt", "value": "In an Apache `.htaccess` file, the `RewriteRule` directive does not process URL fragments (the part afte...
In brief: Is it ever excusable to have assembly names and class names stored in the database? Does it break the layers of an application for the data layer to have explicit knowledge of the internals of the business layer? Full explanation: I have a boot strapper that runs "jobs" (classes that inherit from a common bas...
You've raised an interesting point about the separation of concerns in software architecture, particularly in relation to the layers of an application. The decision to store assembly names and class names in the database does indeed have implications for maintainability, coupling, and the overall architecture of your a...
42,579
[ { "from": "human", "value": "In brief:\nIs it ever excusable to have assembly names and class names stored in the database? Does it break the layers of an application for the data layer to have explicit knowledge of the internals of the business layer?\nFull explanation:\nI have a boot strapper that runs \"...
Could someone show me a regular expression that would look through this document and select the href value of every href that has RELATION_ID on the end of it? Then if it does, I have to get the Id that is before the question mark (example href="dctm://ISDOFSDdev/37004e1f800021f3?DMS_OBJECT_SPEC=RELATION_ID") Thanks! <...
To extract the `href` values from the provided XML document where the `href` attribute ends with `DMS_OBJECT_SPEC=RELATION_ID`, and subsequently retrieve the ID (the part before the `?`), you can use the following regular expression: ```regex href="(dctm://[^?]+?)(?=\?DMS_OBJECT_SPEC=RELATION_ID)" ``` ### Explanation...
38,057
[ { "from": "human", "value": "Could someone show me a regular expression that would look through this document and select the href value of every href that has RELATION_ID on the end of it?\nThen if it does, I have to get the Id that is before the question mark (example href=\"dctm://ISDOFSDdev/37004e1f80002...
I'm writing some tests in Perl which have a fair amount of set up. This setup all lives in a module that the test scripts use. I want to be able to print some diagnostics from the module, and intended to use the diag function from Test::More. Problem is, when you use Test::More, it writes the plan so I get You tried ...
When using `Test::More` in Perl, the issue you encounter occurs because `Test::More` expects to be in a test context when it processes the testing commands (including `diag`). If you attempt to call these functions from a module that isn't in a test context, you'll run into errors. To print diagnostic messages without...
46,742
[ { "from": "human", "value": "I'm writing some tests in Perl which have a fair amount of set up. This setup all lives in a module that the test scripts use. I want to be able to print some diagnostics from the module, and intended to use the diag function from Test::More. Problem is, when you use Test::More,...
In a comment on a previous question, someone said that the following sql statement opens me up to sql injection: select ss.*, se.name as engine, ss.last_run_at + interval ss.refresh_frequency day as next_run_at, se.logo_name from searches ss join search_engines se on ss.engine_id = se.id where ...
The SQL statement you provided indeed has potential vulnerabilities regarding SQL injection, particularly if the variable `$user_id` is not properly handled. **Why it might be vulnerable:** 1. **String Concatenation**: If `$user_id` is directly concatenated into the SQL string without sufficient validation or sanitat...
43,403
[ { "from": "human", "value": "In a comment on a previous question, someone said that the following sql statement opens me up to sql injection:\nselect\n ss.*,\n se.name as engine,\n ss.last_run_at + interval ss.refresh_frequency day as next_run_at,\n se.logo_name \nfrom \n searches ss join ...
I would like to do the equivalent of the following: #define print_max(TYPE) \ # ifdef TYPE##_MAX \ printf("%lld\n", TYPE##_MAX); \ # endif print_max(INT); Now the #ifdef or any nested preprocessor directive is not allowed as far as I can see in a function macro. Any ideas? Update: So it seems like this is not ...
You're correct in your observation that the C preprocessor doesn't allow for `#ifdef` checks within a function-like macro. Preprocessor directives like `#ifdef` are evaluated during the preprocessing phase, while function-like macros are expanded during the compilation phase. Your workaround of using `#ifndef` to def...
44,203
[ { "from": "human", "value": "I would like to do the equivalent of the following:\n#define print_max(TYPE) \\\n# ifdef TYPE##_MAX \\\n printf(\"%lld\\n\", TYPE##_MAX); \\\n# endif\n\nprint_max(INT);\n\nNow the #ifdef or any nested preprocessor directive is\nnot allowed as far as I can see in a function...
I want to serialize the following Xml structure: <XmlRootElement> <Company name="Acme Widgets LLC"> <DbApplication name="ApplicationA" vendor="oracle"> <ConnSpec environment="DEV" server="DBOraDev1201" database="AppA" userId="My...
The issue you are encountering with XML serialization in .NET relates to the design of the `XmlSerializer` and how it handles collections with attributes in the same class. The `XmlSerializer` expects a straightforward mapping between classes and XML elements, and when you have complex structures—like a collection of i...
41,873
[ { "from": "human", "value": "I want to serialize the following Xml structure:\n <XmlRootElement>\n <Company name=\"Acme Widgets LLC\">\n <DbApplication name=\"ApplicationA\" vendor=\"oracle\">\n <ConnSpec environment=\"DEV\" \n server=\"DBOraDev1201\" \n ...
I came across this code today AsyncInvoke(OnTimeMessageTimer, (object)null, (ElapsedEventArgs)null); Is there anything wrong with it or no?
The code snippet you provided uses `AsyncInvoke` to call a method named `OnTimeMessageTimer` with two parameters: `(object)null` and `(ElapsedEventArgs)null`. However, without more context about the `AsyncInvoke` method and the `OnTimeMessageTimer` method signature, it is difficult to determine if there is anything fun...
47,579
[ { "from": "human", "value": "I came across this code today\nAsyncInvoke(OnTimeMessageTimer, (object)null, (ElapsedEventArgs)null);\n\nIs there anything wrong with it or no?\n" }, { "from": "gpt", "value": "The code snippet you provided uses `AsyncInvoke` to call a method named `OnTimeMessageTime...
I want to be able to run my SqlDataProvider against an oracle stored procedure. I can use Microsoft's Oracle Provider but that wouldn't allow me to call a stored procedure. has anyone been able to get this to work? I particularly want to be able to use declarative data binding. I have been able to programatically creat...
Using a stored procedure in Oracle from an ASP.NET application can be challenging, especially when you're looking to leverage declarative data binding in ASP.NET. While the Microsoft Oracle Data Provider (ODP.NET) offers functionality for executing stored procedures, it does not directly support declarative data bindin...
43,119
[ { "from": "human", "value": "I want to be able to run my SqlDataProvider against an oracle stored procedure. I can use Microsoft's Oracle Provider but that wouldn't allow me to call a stored procedure. has anyone been able to get this to work? I particularly want to be able to use declarative data binding. ...
I have the same problem as this guy: I have a table that has references my tblstaff table twice for two different people. Now that I have added this second reference neither of them work. What is up w/ that?
It sounds like you are dealing with a database table that has two foreign key references to the same `tblstaff` table. This scenario can create confusion if not handled correctly, especially in terms of how you manage those relationships. Here are a few things to check to troubleshoot your issue: 1. **Column Naming**...
44,853
[ { "from": "human", "value": "I have the same problem as this guy: \nI have a table that has references my tblstaff table twice for two different people. Now that I have added this second reference neither of them work.\nWhat is up w/ that?\n" }, { "from": "gpt", "value": "It sounds like you are...
Capistrano is a great solution for building scripts that automatically deploy a website and/or a database. But, it's also very *nix centric, and from I've read it would probably be more trouble than it's worth to get it working with a Windows server. Is there a similar solution that would allow me to deploy an ASP.Net ...
If you're looking for a deployment solution for ASP.NET applications that runs on Windows and offers similar flexibility to Capistrano, there are several options you can consider: 1. **Octopus Deploy**: Octopus is a popular deployment automation tool that integrates well with various CI/CD tools like Azure DevOps, Jen...
41,275
[ { "from": "human", "value": "Capistrano is a great solution for building scripts that automatically deploy a website and/or a database. But, it's also very *nix centric, and from I've read it would probably be more trouble than it's worth to get it working with a Windows server. Is there a similar solution ...
I have to transform a few hundred images every day in a specific way. I need the best freeware tool or a piece of C# code that supports batch watermarking, resizing of images and can be automated (old configuration can be reused). What tool do you suggest?
For your requirements of batch watermarking, resizing images, and automation, I recommend using **ImageMagick**. It is a powerful and versatile image processing tool that can handle a wide range of image manipulations, including the tasks you outlined. Here are some reasons why it could be a good fit: ### ImageMagick ...
44,044
[ { "from": "human", "value": "I have to transform a few hundred images every day in a specific way.\nI need the best freeware tool or a piece of C# code that supports batch watermarking, resizing of images and can be automated (old configuration can be reused).\nWhat tool do you suggest?\n" }, { "fro...
In your workplace, where do you store your common, non-database specific scripts that you use in SQL Server? Do you keep them in .SQL scripts on the file server, do you store them in the Master database, or do you keep them in a database you defined specifically for these kinds of things?
In a typical workplace setting, common, non-database specific scripts used in SQL Server can be stored in several ways, each with its own advantages and use cases. Here are some common practices: 1. **File Server**: - Many organizations opt to store their scripts in .SQL files on a file server. This approach allow...
48,757
[ { "from": "human", "value": "In your workplace, where do you store your common, non-database specific scripts that you use in SQL Server? Do you keep them in .SQL scripts on the file server, do you store them in the Master database, or do you keep them in a database you defined specifically for these kinds ...
How can I prune old revisions from my development subversion repository? I keep a subversion sandbox in which I have lots of test projects, binaries, etc. I'd like to prune the history occasionally.
Pruning old revisions from a Subversion (SVN) repository involves removing older revisions, which can be complex due to how Subversion handles its history. Generally, SVN is designed to maintain all history, and there isn't a built-in command to simply delete old revisions. However, you can achieve a similar effect by ...
44,002
[ { "from": "human", "value": "How can I prune old revisions from my development subversion repository? I keep a subversion sandbox in which I have lots of test projects, binaries, etc. I'd like to prune the history occasionally.\n" }, { "from": "gpt", "value": "Pruning old revisions from a Subv...
How is it that tools like this one can make an ajax style call back to a central site? basically they give you a " tag to put on your site where ever it is. So in this widget you have the ability to ask for an email to be sent to you for the page you're currently on. I assume this makes an ajax style call back to share...
The mechanism you are describing—where a third-party service provides a snippet of code (like a JavaScript `<script>` tag) that allows you to perform actions such as sending an email—typically relies on a technique known as "cross-origin resource sharing" (CORS), along with AJAX (Asynchronous JavaScript and XML) calls....
44,687
[ { "from": "human", "value": "How is it that tools like this one can make an ajax style call back to a central site? basically they give you a \" tag to put on your site where ever it is. So in this widget you have the ability to ask for an email to be sent to you for the page you're currently on. I assume t...
What is a good C/C++ CSS parser? All that I can find is CSSTidy, and it seems to be more of an application than a parsing library.
If you're looking for a C/C++ CSS parser, there are a few libraries that can be useful for parsing and manipulating CSS. While CSSTidy is more of an application, there are other libraries you may want to consider: 1. **libcss**: This is a CSS parsing library that is part of the LibWeb project, which is used in the Web...
45,607
[ { "from": "human", "value": "What is a good C/C++ CSS parser? All that I can find is CSSTidy, and it seems to be more of an application than a parsing library.\n" }, { "from": "gpt", "value": "If you're looking for a C/C++ CSS parser, there are a few libraries that can be useful for parsing and...
How am I supposed to use merge with the latest version of Tortoise SVN? I'm an old ClearCase guy, and I've never understood it. When I merge a branch back into the trunk, I just select range of revisions and then leave the version numbers blank and it starts spitting out all kinds of files that it's merging. It basical...
It sounds like you’re getting accustomed to TortoiseSVN's merge functionality, and you're right in observing some key differences compared to ClearCase. Let’s clarify how merging works in TortoiseSVN and address your concerns: ### Understanding Merging in TortoiseSVN 1. **Merge Basics**: - When you merge in SVN, y...
44,372
[ { "from": "human", "value": "How am I supposed to use merge with the latest version of Tortoise SVN? I'm an old ClearCase guy, and I've never understood it. When I merge a branch back into the trunk, I just select range of revisions and then leave the version numbers blank and it starts spitting out all kin...
What do I gain by adding a timestamp column called recordversion to a table in ms-sql?
Adding a timestamp column, often referred to as a "rowversion" column in SQL Server, can provide several benefits: 1. **Concurrency Control**: The primary purpose of a timestamp (rowversion) column is to manage concurrency. It allows you to implement optimistic concurrency control. By checking the value of the timesta...
44,715
[ { "from": "human", "value": "What do I gain by adding a timestamp column called recordversion to a table in ms-sql?\n" }, { "from": "gpt", "value": "Adding a timestamp column, often referred to as a \"rowversion\" column in SQL Server, can provide several benefits:\n\n1. **Concurrency Control**:...
I would like to be able to create an MDI UI layout that extends the behavior of MDI Tabbed Groups in the following way. Within a pane for a split tabbed group, I'd like to create a nested tab group with the opposite directional alignment. For instance, given a horizontally split top level, I would like to create a ve...
Creating an MDI (Multiple Document Interface) UI layout that supports nested tab groups with opposing directional alignments can indeed be a complex task, especially if you are looking to extend existing functionality in classes like `CMDIFrameWndEx`. The functionality you are aiming for is somewhat specialized, and wh...
45,288
[ { "from": "human", "value": "I would like to be able to create an MDI UI layout that extends the behavior of MDI Tabbed Groups in the following way. Within a pane for a split tabbed group, I'd like to create a nested tab group with the opposite directional alignment. For instance, given a horizontally spl...
I used to do this: SELECT layerID FROM layers WHERE ownerID = ? AND collectionID = ? Which would give me an array of layerID's, and then I'd loop and do this for each one: SELECT DATA FROM drawings WHERE layerID = ? And it all worked fine. So now I'm trying to do it in one step, so I try this: SELECT DATA , layerID F...
The issue you're experiencing with your combined query not utilizing the index effectively might stem from the fact that you're using a subquery with the `ANY` operator. Although your subquery is efficient, the main query’s plan can be impacted negatively if the database optimizer determines that it cannot make optimal...
44,883
[ { "from": "human", "value": "I used to do this:\nSELECT layerID\nFROM layers\nWHERE ownerID = ?\nAND collectionID = ?\n\nWhich would give me an array of layerID's, and then I'd loop and do this for each one:\nSELECT DATA\nFROM drawings\nWHERE layerID = ?\n\nAnd it all worked fine. So now I'm trying to do it...
I want to keep the class simple and not defined a constructor so i can do Pt data = {0, 5}; so i figured the best way convert Pt_t from a short to long or vice versa is to do something like this. template <class T> struct Pt_t { T x, y; template <class T2> operator Pt_t<T2>() { Pt_t pt = {x, y}; return pt; } };...
The issue you're facing is that your conversion operator is recursively calling itself because the conversion involves constructing another `Pt_t` of the same type, leading to a stack overflow. To fix this, you can change your conversion operator to construct a new `Pt_t` of type `T2` using a proper constructor or ini...
48,566
[ { "from": "human", "value": "I want to keep the class simple and not defined a constructor so i can do Pt data = {0, 5};\nso i figured the best way convert Pt_t from a short to long or vice versa is to do something like this.\ntemplate <class T>\nstruct Pt_t\n{\n T x, y;\n template <class T2> operator...
I've been looking for some guidelines on how to layout PHP code. I've found some good references, such as the following: http://www.dagbladet.no/development/phpcodingstandard/ and this question on SO. However, none of that quite gets to what I'm specifically wondering about, which is the integration of HTML and PHP. Fo...
When working with PHP and HTML, it's important to establish clear guidelines to maintain readability, organization, and a good separation of concerns. Here are some best practices you can follow, along with resources for further reading. ### Best Practices for Mixing PHP and HTML: 1. **HTML Structure First**: - It...
44,013
[ { "from": "human", "value": "I've been looking for some guidelines on how to layout PHP code. I've found some good references, such as the following:\nhttp://www.dagbladet.no/development/phpcodingstandard/\nand this question on SO.\nHowever, none of that quite gets to what I'm specifically wondering about, ...
Is there a way to get the same sort of speedup on x64 architecture as you can get from psyco on 32 bit processors?
Psyco was a Just-In-Time (JIT) compiler for Python that provided significant speedups by translating Python code into optimized machine code at runtime. However, it was specifically designed for 32-bit architectures and is not available for 64-bit architectures like x64. For 64-bit architectures, there are several alt...
47,829
[ { "from": "human", "value": "Is there a way to get the same sort of speedup on x64 architecture as you can get from psyco on 32 bit processors?\n" }, { "from": "gpt", "value": "Psyco was a Just-In-Time (JIT) compiler for Python that provided significant speedups by translating Python code into o...
Is the new ControlState feature only applicable to custom controls or is it available for the standard server controls as well? That is..can you disable ViewState for an entire page with standard controls like Detailsview, Gridview and would it still work? Does ControlState apply to standard server controls? Or in orde...
The `ControlState` feature in ASP.NET is designed to maintain essential data for controls across postbacks, even when ViewState is disabled. This is particularly useful for cases where certain properties of controls must be preserved for their correct functioning, regardless of whether ViewState is being used. ### Con...
47,742
[ { "from": "human", "value": "Is the new ControlState feature only applicable to custom controls or is it available for the standard server controls as well?\nThat is..can you disable ViewState for an entire page with standard controls like Detailsview, Gridview and would it still work? Does ControlState app...
Probably not much more to elaborate on here - I'm using a NumericStepper control and I want the user to use the buttons only to change the value in the NS, not by typing into the control - I couldn't find a property to disable the text - does it exist? If it doesn't, how would I subclass this thing to disable the text...
In ActionScript (assuming you're working with Flex or Flash), the `NumericStepper` control does not have a built-in property to completely disable the text input part, but you can achieve the desired functionality by subclassing the `NumericStepper` and modifying its behavior. Here’s a general approach to create a cus...
45,888
[ { "from": "human", "value": "Probably not much more to elaborate on here - I'm using a NumericStepper control and I want the user to use the buttons only to change the value in the NS, not by typing into the control - I couldn't find a property to disable the text - does it exist? \nIf it doesn't, how would...
Yesterday I've tried to get serious about rightly caching some PHP generated pages (think "Articles with comments"). Big fail. Long story short: I set the ETag header, set the Last-Modified one and check server side every Article browser request with them to see if I can send back a 304. The problem is simple: the brow...
It sounds like you're encountering issues with browser caching behavior when implementing ETags and Last-Modified headers in your PHP application. While ETags and Last-Modified headers are designed to help manage caching effectively, browsers may not always behave as expected when it comes to checking for updates. Here...
40,597
[ { "from": "human", "value": "Yesterday I've tried to get serious about rightly caching some PHP generated pages (think \"Articles with comments\"). Big fail.\nLong story short: I set the ETag header, set the Last-Modified one and check server side every Article browser request with them to see if I can send...
I trying to implement a typical languages menu where users can select the language they want to view the site in through a menu that appears throughout all pages in the site. The menu will appear on multiple master pages (currently one for pages where users are logged in and one for pages where users are not). My curre...
Your current implementation provides a functional way to handle language changes, but it's true that it can be improved to enhance maintainability and user experience. Here are some suggestions for a more elegant solution that addresses both concerns: ease of understanding for new developers and improving navigation wi...
37,514
[ { "from": "human", "value": "I trying to implement a typical languages menu where users can select the language they want to view the site in through a menu that appears throughout all pages in the site.\nThe menu will appear on multiple master pages (currently one for pages where users are logged in and on...