instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
The scenario You have developed a webapp using EJBs version 3. The system is deployed, delivered and is used by the customer. If you would have to rewrite the system from scratch, would you use EJBs again? Yes: Don't answer this question, answer this one instead. No: Provide the top reason for not using EJBs again, b...
No: The top reason for not using EJBs again is their complexity and steep learning curve, which can lead to increased development time and difficulty in onboarding new developers.
25,024
[ { "from": "human", "value": "The scenario\n\nYou have developed a webapp using EJBs version 3.\nThe system is deployed, delivered and is used by the customer.\n\nIf you would have to rewrite the system from scratch, would you use EJBs again?\nYes: Don't answer this question, answer this one instead.\nNo: Pr...
I'm working with embedded C for the first time. Although my C is rusty, I can read the code but I don't really have a grasp on why certain lines are the way the are. For example, I want to know if a variable is true or false and send it back to another application. Rather than setting the variable to 1 or 0, the origin...
In embedded C programming, the choice of using specific values like `0xFF` instead of the more conventional `1` (true) or `0` (false) for boolean variables can have various reasons. Here are some potential explanations: 1. **Full Byte Representation**: In many embedded systems, especially those involving low-level har...
20,466
[ { "from": "human", "value": "I'm working with embedded C for the first time. Although my C is rusty, I can read the code but I don't really have a grasp on why certain lines are the way the are. For example, I want to know if a variable is true or false and send it back to another application. Rather than s...
Is there a way to access file system info via some type of Windows API? If not what other methods are available to a user mode developer?
Yes, there are several ways to access file system information via the Windows API. Here are some common methods that user mode developers can use: ### 1. **Win32 API Functions** The Win32 API provides several functions that allow developers to retrieve file system information. Here are a few key functions: - **GetFi...
20,001
[ { "from": "human", "value": "Is there a way to access file system info via some type of Windows API? If not what other methods are available to a user mode developer?\n" }, { "from": "gpt", "value": "Yes, there are several ways to access file system information via the Windows API. Here are some...
As an example, lets say I wanted to list the frequency of each letter of the alphabet in a string. What would be the easiest way to do it? This is an example of what I'm thinking of... the question is how to make allTheLetters equal to said letters without something like allTheLetters = "abcdefg...xyz". In many other l...
In Python, you can generate all the letters of the alphabet using the `string` module, which provides a convenient constant called `string.ascii_lowercase`. This allows you to easily iterate through each letter without needing to define the string manually. Here's how you can implement your `alphCount` function using t...
22,608
[ { "from": "human", "value": "As an example, lets say I wanted to list the frequency of each letter of the alphabet in a string. What would be the easiest way to do it?\nThis is an example of what I'm thinking of... the question is how to make allTheLetters equal to said letters without something like allThe...
How does one get a list of running applications as shown in the "Applications" tab inside the Windows Task Manager using PowerShell or VBScript?
You can retrieve a list of running applications in Windows using PowerShell or VBScript. Below are examples for both methods. ### Using PowerShell You can use the `Get-Process` cmdlet in PowerShell to list all running applications. Here's a basic example: ```powershell Get-Process | Where-Object { $_.MainWindowTitle...
21,080
[ { "from": "human", "value": "How does one get a list of running applications as shown in the \"Applications\" tab inside the Windows Task Manager using PowerShell or VBScript?\n" }, { "from": "gpt", "value": "You can retrieve a list of running applications in Windows using PowerShell or VBScript...
<div style="width: 300px"> <div id="one" style="float: left">saved</div><input type="submit" id="two" style="float: right" value="Submit" /> </div> I would like div#one to be centred in the space between the left edge of the parent div and the left edge of the submit button.
To center `div#one` in the space between the left edge of the parent `div` and the left edge of the submit button, you can use CSS flexbox instead of float. Here’s how you can achieve that: ```html <div style="width: 300px; display: flex; justify-content: space-between; align-items: center;"> <div id="one">saved</...
23,044
[ { "from": "human", "value": "<div style=\"width: 300px\">\n<div id=\"one\" style=\"float: left\">saved</div><input type=\"submit\" id=\"two\" style=\"float: right\" value=\"Submit\" />\n</div>\n\nI would like div#one to be centred in the space between the left edge of the parent div and the left edge of the...
Is there a way using Flash (CS3+AS3) to determine if the published swf is running in a debug player or in Flash's debug mode? I'm aware that Flex provides the ability to setup different build targets (release/debug) and that you can use something like CONFIG::debug for #ifdef style inclusion of code at compile time. I'...
In ActionScript 3 (AS3), there isn't a built-in method like `System.isDebug()` to directly check if the SWF is running in a debug environment. However, you can implement a workaround by utilizing the `Capabilities` class and some conventions regarding how you publish your SWFs. Here's a common approach: 1. **Define a...
17,134
[ { "from": "human", "value": "Is there a way using Flash (CS3+AS3) to determine if the published swf is running in a debug player or in Flash's debug mode?\nI'm aware that Flex provides the ability to setup different build targets (release/debug) and that you can use something like CONFIG::debug for #ifdef s...
The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?
Yes, the `gcc -S` option will generate assembly code in AT&T syntax by default. However, you can generate assembly code in Intel syntax using the `-masm=intel` option. Here’s how you can do it: ```bash gcc -S -masm=intel your_file.c ``` This command will produce an assembly file `your_file.s` with the Intel syntax. ...
22,865
[ { "from": "human", "value": "The gcc -S option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?\n" }, { "from": "gpt", "value": "Yes, the `gcc -S` option will generate assembly code in AT&T syntax by defa...
last time I asked how to populate a data structure here. Now I would like to know if there's something in Java, like the print_r I use in PHP, to represent what I have populated in the Maps and lists without having to do my own algorithm. Any ideas?
In Java, while there isn't a direct equivalent of PHP's `print_r()` function, there are several ways to easily print the contents of data structures like Maps and Lists. Here are a few methods you can use: ### 1. Using `toString()` Method Most Java collections (like `ArrayList`, `HashMap`, etc.) override the `toStrin...
16,004
[ { "from": "human", "value": "last time I asked how to populate a data structure here. Now I would like to know if there's something in Java, like the print_r I use in PHP, to represent what I have populated in the Maps and lists without having to do my own algorithm.\nAny ideas?\n" }, { "from": "gpt...
I have some integration points where I want to test various responses - where do you think should I store these artifacts in my spec/ directory of my rails application?
In a Rails application, you can organize your test artifacts related to integration points in a few structured ways within the `spec/` directory. Here are some suggestions: 1. **Creating a dedicated folder under `spec/`**: You can create a dedicated directory for your integration tests and their related artifacts. ...
20,930
[ { "from": "human", "value": "I have some integration points where I want to test various responses - where do you think should I store these artifacts in my spec/ directory of my rails application?\n" }, { "from": "gpt", "value": "In a Rails application, you can organize your test artifacts rela...
On Windows NTFS there is a nice but mostly unused feature called "Alternate Data Streams" (ADS) which I recently used in a hobby-dev project. On Mac HFS+ there is also a similarly nice but mostly unused feature called "named forks". I am thinking of porting this project to Linux, but I do not know if any Filesystem on...
In Linux, the concept of alternate data streams (ADS) or named forks does not have a direct equivalent in the same way that NTFS or HFS+ implement them. However, some filesystems and features in Linux can offer similar functionality. 1. **Extended Attributes (xattrs)**: Many Linux filesystems, such as ext4, XFS, and B...
21,556
[ { "from": "human", "value": "On Windows NTFS there is a nice but mostly unused feature called \n\"Alternate Data Streams\" (ADS) which I recently used in a hobby-dev project.\nOn Mac HFS+ there is also a similarly nice but mostly unused feature called \"named forks\".\nI am thinking of porting this project ...
I'm trying to write some SQL that will delete files of type '.7z' that are older than 7 days. Here's what I've got that's not working: DECLARE @DateString CHAR(8) SET @DateString = CONVERT(CHAR(8), DATEADD(d, -7, GETDATE()), 1) EXECUTE master.dbo.xp_delete_file 0, N'e:\Database Backups',N'7z', @DateS...
The SQL statement you've constructed uses `xp_delete_file`, which is designed to delete files, but it can sometimes be a bit finicky, especially regarding the date format and how it interprets the date for deletion. From your provided code, you're setting `@DateString` using `CHAR(8)`, but the format may not be suitab...
20,619
[ { "from": "human", "value": "I'm trying to write some SQL that will delete files of type '.7z' that are older than 7 days.\nHere's what I've got that's not working:\nDECLARE @DateString CHAR(8)\nSET @DateString = CONVERT(CHAR(8), DATEADD(d, -7, GETDATE()), 1)\nEXECUTE master.dbo.xp_delete_file 0, \n ...
I have a pretty standard django app, and am wondering how to set the url routing so that I don't have to explicitly map each url to a view. For example, let's say that I have the following views: Project, Links, Profile, Contact. I'd rather not have my urlpatterns look like this: (r'^Project/$', 'mysite.app.views.proj...
In Django, you can achieve a similar effect using a combination of Django's class-based views (CBVs) and the `include` functionality along with dynamic URL routing. This approach allows you to define a generic view pattern that can route to different views based on the URL. To create a more dynamic routing setup in Dj...
18,599
[ { "from": "human", "value": "I have a pretty standard django app, and am wondering how to set the url routing so that I don't have to explicitly map each url to a view. \nFor example, let's say that I have the following views: Project, Links, Profile, Contact. I'd rather not have my urlpatterns look like th...
I have a base URL : http://my.server.com/folder/directory/sample And a relative one : ../../other/path How to get the absolute URL from this ? It's pretty straighforward using string manipulation, but I would like to do this in a secure way, using the Uri class or something similar. It's for a standard a C# app, not ...
In C#, you can use the `Uri` class to combine a base URL with a relative URL in a secure way. The `Uri` class provides a way to handle URLs that respects the rules of URI manipulation. Here's how you can do it: 1. Create a `Uri` object for the base URL. 2. Create another `Uri` object for the relative URL. 3. Use the ...
20,802
[ { "from": "human", "value": "I have a base URL :\nhttp://my.server.com/folder/directory/sample\n\nAnd a relative one :\n../../other/path\n\nHow to get the absolute URL from this ? It's pretty straighforward using string manipulation, but I would like to do this in a secure way, using the Uri class or someth...
The standard model has been that OpenGL is for professional apps (CAD) and Direct3D is for games. With the debacle of openGL 3.0, is openGl still the natural choice for technical 3D apps (cad/GIS)? Are there scenegraph libraries for Direct3D? (Of course Direct3D is windows only.)
The landscape of graphics APIs has indeed evolved over the years, and while OpenGL has traditionally been associated with professional applications (like CAD and GIS) and Direct3D with games, the lines have blurred somewhat due to various factors, including the rise of cross-platform development and advancements in bot...
21,695
[ { "from": "human", "value": "The standard model has been that OpenGL is for professional apps (CAD) and Direct3D is for games. \nWith the debacle of openGL 3.0, is openGl still the natural choice for technical 3D apps (cad/GIS)?\nAre there scenegraph libraries for Direct3D? \n(Of course Direct3D is window...
I'd like to track changes in inputs in a form via javascript. My intent is (but not limited) to enable "save" button only when something has changed alert if the user wants to close the page and something is not saved Ideas?
To track changes in form inputs using JavaScript and achieve the functionalities you've mentioned, you can follow these steps: 1. **Track Input Changes**: Listen for input events on your form fields and compare the current state of the fields with their original values. 2. **Enable/Disable Save Button**: Based on whe...
18,029
[ { "from": "human", "value": "I'd like to track changes in inputs in a form via javascript. My intent is (but not limited) to\n\nenable \"save\" button only when something has changed\nalert if the user wants to close the page and something is not saved\n\nIdeas?\n" }, { "from": "gpt", "value": "...
I'm trying to convert an incoming sting of 1s and 0s from stdin into their respective binary values (where a string such as "11110111" would be converted to 0xF7). This seems pretty trivial but I don't want to reinvent the wheel so I'm wondering if there's anything in the C/C++ standard libs that can already perform su...
Yes, you can achieve this conversion in C++ using the standard library. Specifically, you can use the `std::stoi` function to convert a binary string (a string of 1s and 0s) to an integer. Then you can format that integer as a hexadecimal value using `std::cout`. Here’s an example of how you can implement this: ```cp...
21,491
[ { "from": "human", "value": "I'm trying to convert an incoming sting of 1s and 0s from stdin into their respective binary values (where a string such as \"11110111\" would be converted to 0xF7). This seems pretty trivial but I don't want to reinvent the wheel so I'm wondering if there's anything in the C/C+...
I'm trying to produce just the day number in a WPF text block, without leading zeroes and without extra space padding (which throws off the layout). The first produces the day number with a space, the second produces the entire date. According to the docs, 'd' should produce the day (1-31). string.Format("{0:d }", Date...
In WPF, when you want to display just the day of the month (without leading zeros and without any extra padding), you can use the custom date formatting string to achieve that. The `d` format specifier alone does not fulfill your requirement because it represents the short date pattern based on the current culture, whi...
19,628
[ { "from": "human", "value": "I'm trying to produce just the day number in a WPF text block, without leading zeroes and without extra space padding (which throws off the layout). The first produces the day number with a space, the second produces the entire date. According to the docs, 'd' should produce the...
If not, is smoke testing still used?
Yes, smoke testing is still widely used in software development and quality assurance processes. Smoke testing is a preliminary testing process that checks the basic functionality of an application to ensure that it works as intended before more rigorous testing is performed. It helps to identify critical issues early ...
24,328
[ { "from": "human", "value": "If not, is smoke testing still used?\n" }, { "from": "gpt", "value": "Yes, smoke testing is still widely used in software development and quality assurance processes. Smoke testing is a preliminary testing process that checks the basic functionality of an application...
I am aware that you can lock an object in c# using lock but can you give up the lock and wait for something else to notify you that it's changed like you can in java with wait and notify? It seems to me that synchronised and lock in java and c# respectively are synonomous.
In C#, while the `lock` statement provides a way to synchronize access to a block of code, it does not directly offer wait and notify capabilities like Java's `Object.wait()` and `Object.notify()`. However, you can achieve similar functionality using the `Monitor` class in C#. ### C# Equivalent of wait and notify In ...
21,113
[ { "from": "human", "value": "I am aware that you can lock an object in c# using lock but can you give up the lock and wait for something else to notify you that it's changed like you can in java with wait and notify?\nIt seems to me that synchronised and lock in java and c# respectively are synonomous.\n" ...
How do some programs edit whats being displayed on the terminal (to pick a random example, the program 'sl')? I'm thinking of the Linux terminal here, it may happen in other OS's too, I don't know. I've always thought once some text was displayed, it stayed there. How do you change it without redrawing the entire scre...
In a terminal, once text is printed, it generally remains on the screen unless explicitly modified or erased. However, programs like `sl`, `htop`, `vim`, or other interactive applications can manipulate the terminal display in various ways without needing to completely redraw the entire screen. Here's how they achieve ...
19,088
[ { "from": "human", "value": "How do some programs edit whats being displayed on the terminal (to pick a random example, the program 'sl')? I'm thinking of the Linux terminal here, it may happen in other OS's too, I don't know. I've always thought once some text was displayed, it stayed there. How do you ch...
In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods on the instance. I want the syntax to be concise. What is the best way? (I give my current best answer below.....
In Python, you can achieve readonly attributes by using properties, along with a private attribute to store the value. By doing this, you can control access to the attribute, preventing external code from altering it directly. Here is a concise way to implement readonly attributes: ```python class MyClass: def _...
23,173
[ { "from": "human", "value": "In Python, I want to make selected instance attributes of a class be readonly to code outside of the class. I want there to be no way outside code can alter the attribute, except indirectly by invoking methods on the instance. I want the syntax to be concise. What is the best wa...
I tried this XAML: <Slider Width="250" Height="25" Minimum="0" Maximum="1" MouseLeftButtonDown="slider_MouseLeftButtonDown" MouseLeftButtonUp="slider_MouseLeftButtonUp" /> And this C#: private void slider_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { sliderMouseDown = true; } private void slider_MouseL...
The issue you're facing is likely due to the way the `Slider` control handles mouse events. The `Slider` control internally captures the mouse events and does not propagate the `MouseLeftButtonDown` and `MouseLeftButtonUp` events to the parent control. This is why your event handlers are not being called. To achieve t...
22,357
[ { "from": "human", "value": "I tried this XAML:\n<Slider Width=\"250\" Height=\"25\" Minimum=\"0\" Maximum=\"1\" MouseLeftButtonDown=\"slider_MouseLeftButtonDown\" MouseLeftButtonUp=\"slider_MouseLeftButtonUp\" />\n\nAnd this C#:\nprivate void slider_MouseLeftButtonDown(object sender, MouseButtonEventArgs e...
I have this Python application that gets stuck from time to time and I can't find out where. Is there any way to signal Python interpreter to show you the exact code that's running? Some kind of on-the-fly stacktrace? Related questions: Print current call stack from a method in Python code Check what a running proces...
Yes, you can obtain a stack trace of a running Python application to help debug it. There are a few methods you can use to achieve this: ### 1. Using `faulthandler` The `faulthandler` module can be used to dump the current stack trace to the console when a signal is received (like a keyboard interrupt). To enable it,...
19,432
[ { "from": "human", "value": "I have this Python application that gets stuck from time to time and I can't find out where.\nIs there any way to signal Python interpreter to show you the exact code that's running? \nSome kind of on-the-fly stacktrace?\nRelated questions:\n\nPrint current call stack from a met...
It's common in C++ to name member variables with some kind of prefix to denote the fact that they're member variables, rather than local variables or parameters. If you've come from an MFC background, you'll probably use m_foo. I've also seen myFoo occasionally. C# (or possibly just .NET) seems to recommend using just ...
Yes, using an underscore as a prefix for member variables in C++ is allowed by the C++ standard. The C++ standard does not impose restrictions on naming conventions for identifiers, including member variables. Using an underscore prefix (e.g., `_foo`) is a common practice in many coding standards and can help differe...
22,648
[ { "from": "human", "value": "It's common in C++ to name member variables with some kind of prefix to denote the fact that they're member variables, rather than local variables or parameters. If you've come from an MFC background, you'll probably use m_foo. I've also seen myFoo occasionally.\nC# (or possibly...
I have a table in the database that I'm retrieving using LINQ to SQL, and as a part of my processing I want to add to this list, then update the database with the new items + any changes I've made. What I thought I could do was this: var list = (from item in db.Table select item).ToList(); [do processing w...
In LINQ to SQL, when you retrieve entities from the database, they are tracked by the DataContext. This means that any changes made to these entities (such as updates) will be automatically recognized when you call `SubmitChanges()`. However, when you create a new instance of an entity and add it to a list, that new in...
19,666
[ { "from": "human", "value": "I have a table in the database that I'm retrieving using LINQ to SQL, and as a part of my processing I want to add to this list, then update the database with the new items + any changes I've made.\nWhat I thought I could do was this:\nvar list = (from item in db.Table\n ...
I've got an app that my client wants to open a kiosk window to ie on startup that goes to their corporate internet. Vb isn't my thing but they wanted it integrated into their current program and I figured it would be easy so I've got Shell ("explorer.exe http://www.corporateintranet.com") and command line thing that ...
To open a URL in kiosk mode using the command line, you will need to modify your current `Shell` command to include the `-k` switch. However, the `explorer.exe` command does not support kiosk mode directly. Instead, if you want to open Microsoft Edge or Google Chrome in kiosk mode, you would need to use their respectiv...
14,799
[ { "from": "human", "value": "I've got an app that my client wants to open a kiosk window to ie on startup that goes to their corporate internet. Vb isn't my thing but they wanted it integrated into their current program and I figured it would be easy so I've got\nShell (\"explorer.exe http://www.corporatei...
Does anyone have a good recommendation for a drop shadow jQuery plugin? I've been working on a project that had every element on the page with a subtle drop shadow, we started using RUZEE to do the shadows but there was a severe performance hit when you had more then 4 or 5 shadows being calculated on the page. I went ...
If you’re looking for lightweight alternatives to create drop shadows with jQuery, here are some options you might consider: 1. **BoxShadow.js**: This is a lightweight and simple jQuery plugin that allows you to apply CSS box shadows. It doesn't rely heavily on complex calculations and can be more performant than othe...
20,462
[ { "from": "human", "value": "Does anyone have a good recommendation for a drop shadow jQuery plugin?\nI've been working on a project that had every element on the page with a subtle drop shadow, we started using RUZEE to do the shadows but there was a severe performance hit when you had more then 4 or 5 sha...
What ReSharper 4.0 templates for C# do you use? Let's share these in the following format: [Title] Optional description Shortcut: shortcut Available in: [AvailabilitySetting] // Resharper template code snippet // comes here Macros properties (if present): Macro1 - Value - EditableOccurence Macro2 - Value - Editable...
Sure! Here's a ReSharper template for creating a basic C# property. --- [Property Template] A template for generating a C# property with a backing field. Shortcut: prop Available in: C# // Resharper template code snippet { access modifier } { type } { name } { get; set; } // Backing field private { type} _{ name };...
20,493
[ { "from": "human", "value": "What ReSharper 4.0 templates for C# do you use?\nLet's share these in the following format:\n\n[Title]\nOptional description \nShortcut: shortcut\nAvailable in: [AvailabilitySetting]\n// Resharper template code snippet\n// comes here\n\nMacros properties (if present):\n\nMacro1 ...
I am reading an XML file into a DataSet and need to get the data out of the DataSet. Since it is a user-editable config file the fields may or may not be there. To handle missing fields well I'd like to make sure each column in the DataRow exists and is not DBNull. I already check for DBNull but I don't know how to ma...
When working with a `DataSet` and `DataTable`, you can check for the existence of a column and its value in a `DataRow` without causing exceptions by using the `DataColumnCollection.Contains` method. This approach allows you to verify if a column exists without needing to loop through all the column names manually. He...
18,120
[ { "from": "human", "value": "I am reading an XML file into a DataSet and need to get the data out of the DataSet. Since it is a user-editable config file the fields may or may not be there. To handle missing fields well I'd like to make sure each column in the DataRow exists and is not DBNull. \nI already c...
In a C++ file, I have code like this: #if ACTIVATE # pragma message( "Activated" ) #else # pragma message( "Not Activated") #endif I want to set this ACTIVE define to 1 with the MSBuild command line. It tried this, but it doesn't work: msbuild /p:DefineConstants="ACTIVATE=1" How can I do it?
To set the `ACTIVATE` define to 1 in an MSBuild command line, you need to ensure that you're passing it in a way that the C++ compiler recognizes. The `DefineConstants` property is typically used for C# projects and may not have the desired effect in a C++ project. Instead, you should use the `/p:AdditionalIncludeDire...
19,366
[ { "from": "human", "value": "In a C++ file, I have code like this:\n#if ACTIVATE\n# pragma message( \"Activated\" )\n#else\n# pragma message( \"Not Activated\")\n#endif\n\nI want to set this ACTIVE define to 1 with the MSBuild command line.\nIt tried this, but it doesn't work:\nmsbuild /p:DefineConsta...
I'm looking for software to create PNG8 format transparent images as per this article. NOTE: I need a Linux solution myself, but please submit answers for other OSes.
Creating PNG8 images with transparency can be done using various software tools across different operating systems. Here's a list of solutions for Linux, Windows, and macOS: ### Linux Solutions 1. **GIMP**: - GIMP is a powerful open-source image editor that can create PNG8 images. - To save an image in PNG8 for...
21,003
[ { "from": "human", "value": "I'm looking for software to create PNG8 format transparent images as per this article.\nNOTE: I need a Linux solution myself, but please submit answers for other OSes.\n" }, { "from": "gpt", "value": "Creating PNG8 images with transparency can be done using various s...
I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it?
The pre-revprop-change hook is a server-side hook used in Subversion (SVN) repositories. Its primary purpose is to control changes to revision properties, which are metadata associated with revisions (such as log messages, committers, and dates). ### Understanding pre-revprop-change Hook When you attempt to change a ...
19,527
[ { "from": "human", "value": "I wanted to edit a log comment in the repository browser and received an error message that no pre-revprop-change hook exists for the repository. Besides having a scary name, what is a pre-revprop-change hook, and how do I create it?\n" }, { "from": "gpt", "value": "...
I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using <a href="url" target="_blank"> opens the link in IE regardless of the default browser. Is there a way to use the default browser? Using JavaScript is an option....
Yes, you can open links in the system's default web browser from an HTA (HTML Application) by using JavaScript. The standard `<a>` tag with `target="_blank"` will open links in Internet Explorer since HTAs run in the Internet Explorer engine. Instead, you can use the `WScript.Shell` object to open URLs in the default w...
16,809
[ { "from": "human", "value": "I'm working on an application that is implemented as an HTA. I have a series of links that I would like to have open in the system's default web browser. Using <a href=\"url\" target=\"_blank\"> opens the link in IE regardless of the default browser.\nIs there a way to use the d...
I've been reading that Adobe has made crossdomain.xml stricter in flash 9-10 and I'm wondering of someone can paste me a copy of one that they know works. Having some trouble finding a recent sample on Adobe's site.
The `crossdomain.xml` file is used to specify which domains are allowed to access resources on your server when you're using technologies like Flash or Silverlight. Adobe indeed tightened security rules in Flash Player 9 and 10, and it's important to ensure that your `crossdomain.xml` file is set up correctly. Here's ...
21,175
[ { "from": "human", "value": "I've been reading that Adobe has made crossdomain.xml stricter in flash 9-10 and I'm wondering of someone can paste me a copy of one that they know works. Having some trouble finding a recent sample on Adobe's site.\n" }, { "from": "gpt", "value": "The `crossdomain.x...
Can you use the bash "getopts" function twice in the same script? I have a set of options that would mean different things depending on the value of a specific option. Since I can't guarantee that getopts will evaluate that specific option first, I would like to run getopts one time, using only that specific option, t...
Yes, you can use `getopts` multiple times in the same Bash script to parse different sets of options. This is a common practice when you have a situation where certain options need to be processed separately based on the value of a specific option. Here's a general approach to achieve that: 1. Run `getopts` for the f...
20,412
[ { "from": "human", "value": "Can you use the bash \"getopts\" function twice in the same script?\nI have a set of options that would mean different things depending on the value of a specific option. Since I can't guarantee that getopts will evaluate that specific option first, I would like to run getopts ...
What is the best way to get the names of all of the tables in a specific database on SQL Server?
To get the names of all tables in a specific database in SQL Server, you can use one of the following methods: ### Method 1: Using `INFORMATION_SCHEMA.TABLES` You can query the `INFORMATION_SCHEMA.TABLES` view, which is a standard way to get metadata information about the database objects. ```sql USE YourDatabaseNam...
23,134
[ { "from": "human", "value": "What is the best way to get the names of all of the tables in a specific database on SQL Server?\n" }, { "from": "gpt", "value": "To get the names of all tables in a specific database in SQL Server, you can use one of the following methods:\n\n### Method 1: Using `IN...
How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?
In VBA, if you want to trigger a recalculation of spreadsheet data without directly changing a cell value, you can use the `Calculate` method on the `Worksheet` or `Workbook` object. This method forces Excel to recalculate all the formulas on the specified worksheet or workbook, effectively refreshing the data. Here’s...
21,594
[ { "from": "human", "value": "How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?\n" }, { "from": "gpt", "value": "In VBA, if you want to trigger a recalculation of spreadsheet data without directly changing a cell value...
I've seen the other post about this, but is there a clean way of doing this in Haskell? As a 2nd part, can it also be done without making the function monadic?
Certainly! To provide a clean solution in Haskell, we need more context about what specific functionality you're trying to achieve, but I can give you a general approach based on two common scenarios: working with lists or maybe performing an I/O action. ### Clean Way in Haskell Assuming you are looking to work with ...
20,417
[ { "from": "human", "value": "I've seen the other post about this, but is there a clean way of doing this in Haskell?\nAs a 2nd part, can it also be done without making the function monadic?\n" }, { "from": "gpt", "value": "Certainly! To provide a clean solution in Haskell, we need more context a...
I have an object that needs a test if the object data is valid. The validation itself would be called from the thread that instatiated the object, it looks like this: { if (_step.Equals(string.Empty)) return false; if (_type.Equals(string.Empty)) return false; if (_setup.Equals(string.Empty)) return false; ret...
The decision to implement the validation as a property or a method depends on the semantics and intended usage of the validation logic. ### Implementing as a Method 1. **Clear Intent**: If you implement it as a method (e.g., `IsValid()`), it explicitly communicates that the operation being performed is a check or val...
21,498
[ { "from": "human", "value": "I have an object that needs a test if the object data is valid. The validation itself would be called from the thread that instatiated the object, it looks like this:\n {\n if (_step.Equals(string.Empty)) return false;\n if (_type.Equals(string.Empty)) return false;\n if (_se...
I'm setting up my first site using the asp authentication provider and using the built in asp.net login control. My question, is the password encrypted or hashed as it's sent to the server using the asp.net login control? or do I need to use https/ssl to accomplish this? Thanks
When using ASP.NET's built-in login controls, passwords are sent to the server in plaintext unless you take measures to secure the connection. By default, the ASP.NET membership system does not encrypt or hash passwords during transmission. To ensure that the password is not sent in plaintext over the network, you **...
22,830
[ { "from": "human", "value": "I'm setting up my first site using the asp authentication provider and using the built in asp.net login control.\nMy question, is the password encrypted or hashed as it's sent to the server using the asp.net login control? or do I need to use https/ssl to accomplish this?\nThank...
I am working on a project that is built on an extended version of the default PDO and PDOStatement classes and as such it uses PDO style named parameters instead of the "?" placeholder for variables. However, the client is now requesting that we look into using a different driver because their version OS X Web Server ...
If you are looking for alternatives to PDO that support named parameters and are easy to extend, here are a few options you can consider: 1. **MySQLi (MySQL Improved)**: - MySQLi supports prepared statements, but it doesn't natively support named parameters like PDO does. However, you can wrap MySQLi in a custom cl...
20,075
[ { "from": "human", "value": "I am working on a project that is built on an extended version of the default PDO and PDOStatement classes and as such it uses PDO style named parameters instead of the \"?\" placeholder for variables. \nHowever, the client is now requesting that we look into using a different d...
Trying to find the sqlserver adapter for rails on windows. I have tried getting it from (without luck): gem install activerecord-sqlserver-adapter --source=http://gems.rubyonrails.org Where else can I get this gem? UPDATE: Make sure to run the command prompt as the administrator. Right click on the command prompt and c...
If you're looking to use SQL Server with Ruby on Rails, you generally use the `activerecord-sqlserver-adapter` gem. Here are some steps to help you install it, especially on a Windows system: 1. **Add the Gem to Your Gemfile**: Instead of installing the gem directly from the command line, you can add it to your Rails ...
19,404
[ { "from": "human", "value": "Trying to find the sqlserver adapter for rails on windows.\nI have tried getting it from (without luck):\ngem install activerecord-sqlserver-adapter --source=http://gems.rubyonrails.org\nWhere else can I get this gem?\nUPDATE:\nMake sure to run the command prompt as the administ...
Is there a good way to import time data into either timesprite or fogbugz? Both seem to have very clunky interfaces for adding single items at a time. What I want is a spreadsheet-style format that I can enter a bunch of rows and suck them in. Noticed timesprite has an import on it, but it seems to only want timespri...
Both TimeSprite and FogBugz can be cumbersome when it comes to entering time data individually. However, here are some approaches you can take to streamline the import process for both platforms. ### TimeSprite 1. **XML Format**: As you've noted, TimeSprite requires its own XML format for importing data. You can crea...
20,027
[ { "from": "human", "value": "Is there a good way to import time data into either timesprite or fogbugz? Both seem to have very clunky interfaces for adding single items at a time. What I want is a spreadsheet-style format that I can enter a bunch of rows and suck them in. Noticed timesprite has an import ...
I'm working on an application that makes extensive use of ComponentOne's C1FlexGrid. Of the dozens we use, three are missing their licenses.licx file and cause the demo splash screen to pop up while I'm starting the application. Is there any way to determine which forms are causing this behavior. Short of checking hund...
To identify which forms in your application are missing their `licenses.licx` file and causing the ComponentOne demo splash screen to appear, you can utilize a few strategies. Here are some approaches that may help you: ### 1. Use Visual Studio's Licensing Tool If you're using Visual Studio, you can leverage its lice...
19,477
[ { "from": "human", "value": "I'm working on an application that makes extensive use of ComponentOne's C1FlexGrid. Of the dozens we use, three are missing their licenses.licx file and cause the demo splash screen to pop up while I'm starting the application.\nIs there any way to determine which forms are cau...
When I try to login to this site using my yahoo openid, it takes me to the yahoo site, I click "continue" meaning that i want to send my authentication details to stackoverflow.com and stackoverflow.com gives me the following error underneath the login text field: Unable to log in with your OpenID provider: failed to a...
The error you're encountering when trying to log in to Stack Overflow using Yahoo OpenID may be caused by a few different factors. Here are some troubleshooting steps you can try to resolve the issue: 1. **Check Your Identifier**: Make sure that the OpenID identifier you are using is correct. For Yahoo, it should typi...
21,058
[ { "from": "human", "value": "When I try to login to this site using my yahoo openid, it takes me to the yahoo site, I click \"continue\" meaning that i want to send my authentication details to stackoverflow.com and stackoverflow.com gives me the following error underneath the login text field:\nUnable to l...
After making it through the major parts of an introductory Lisp book, I still couldn't understand what the special operator (quote) (or equivalent ') function does, yet this has been all over Lisp code that I've seen. What does it do?
In Lisp, the `quote` special operator (or its shorthand version, the apostrophe `'`) is used to prevent the evaluation of its argument. When you use `quote`, Lisp treats the argument as a literal value rather than trying to evaluate it as an expression. Here's how it works: 1. **Preventing Evaluation**: When you quot...
20,474
[ { "from": "human", "value": "After making it through the major parts of an introductory Lisp book, I still couldn't understand what the special operator (quote) (or equivalent ') function does, yet this has been all over Lisp code that I've seen. \nWhat does it do?\n" }, { "from": "gpt", "value...
On a Use Case diagram can you show things that an actor cannot do, for example because they won't have permissions to do it? Or is it just implied due to the fact that they won't have a line joining them to the particular use case?
In a Use Case diagram, it is generally implied that if an actor does not have a line connecting them to a particular use case, then they cannot perform that action, usually due to reasons such as permissions or roles. The absence of a line indicates that the actor does not have direct interaction with the use case. Ho...
23,683
[ { "from": "human", "value": "On a Use Case diagram can you show things that an actor cannot do, for example because they won't have permissions to do it?\nOr is it just implied due to the fact that they won't have a line joining them to the particular use case?\n" }, { "from": "gpt", "value": "I...
I'm trying to have the modrewrite rules skip the directory vip. I've tried a number of things as you can see below, but to no avail. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / #RewriteRule ^vip$ - [PT] RewriteRule ^vip/.$ - [PT] #RewriteCond %{REQUEST_URI} !/vip RewriteCond %{REQUEST_FIL...
To ensure that the `/vip/` directory is entirely ignored by the mod_rewrite rules, you need to adjust your rewrite rules correctly. Based on your update and what you want to achieve, you can modify your `.htaccess` file as follows: ```apache # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / # ...
21,780
[ { "from": "human", "value": "I'm trying to have the modrewrite rules skip the directory vip. I've tried a number of things as you can see below, but to no avail.\n# BEGIN WordPress\n<IfModule mod_rewrite.c>\nRewriteEngine On\nRewriteBase /\n#RewriteRule ^vip$ - [PT]\nRewriteRule ^vip/.$ - [PT]\n#RewriteCond...
Is it possible to have both NetTcp bound endpoints, and basicHttp bound endpoints with SSL within a single deployment, either using Windows Service or IIS6?
Yes, it is possible to have both NetTcp bound endpoints and basicHttp bound endpoints with SSL within a single deployment using either a Windows Service or IIS 6. ### 1. Windows Service Deployment: - In a Windows Service, you can host a WCF service that has multiple endpoints configured. You can define a NetTcp endpoi...
19,592
[ { "from": "human", "value": "Is it possible to have both\n\nNetTcp bound endpoints, and\nbasicHttp bound endpoints with SSL\n\nwithin a single deployment, either using Windows Service or IIS6?\n" }, { "from": "gpt", "value": "Yes, it is possible to have both NetTcp bound endpoints and basicHttp ...
I know there is a command line syntax for adding custom stacks to the OSX Leopard dock besides the "Downloads" which comes by default. What is it?
In OS X Leopard, you can add custom stacks to the Dock using the command line with the `defaults` command. Here’s a step-by-step guide to adding a custom stack: 1. **Open Terminal**: You can find it in `Applications > Utilities > Terminal`. 2. **Use the following command to add a custom stack**: Replace `path/to/your...
21,938
[ { "from": "human", "value": "I know there is a command line syntax for adding custom stacks to the OSX Leopard dock besides the \"Downloads\" which comes by default. What is it?\n" }, { "from": "gpt", "value": "In OS X Leopard, you can add custom stacks to the Dock using the command line with t...
I am building a project involving natural language processing, since the nlp module currently only deal with english text, so I have to make sure the user submitted content (not long, only several words) is in english. Are there established ways to achieve this? Python or Javascript way preferred.
Yes, there are several established methods to determine whether a string of text is in English. Below are some approaches using both Python and JavaScript. ### Python Methods 1. **Using the `langdetect` library:** You can use the `langdetect` library to detect the language of a given text. Install it using pip: ...
18,960
[ { "from": "human", "value": "I am building a project involving natural language processing, since the nlp module currently only deal with english text, so I have to make sure the user submitted content (not long, only several words) is in english. Are there established ways to achieve this? Python or Javasc...
Sometimes when I try to start Firefox it says "a Firefox process is already running". So I have to do this: jeremy@jeremy-desktop:~$ ps aux | grep firefox jeremy 7451 25.0 27.4 170536 65680 ? Sl 22:39 1:18 /usr/lib/firefox-3.0.1/firefox jeremy 7578 0.0 0.3 3004 768 pts/0 S+ 22:44 0:00 grep...
You can create a simple shell script to achieve your goal of killing all processes by name. Here’s a script named `killbyname` that will do exactly that: 1. Open your terminal. 2. Create a new shell script file: ```bash nano killbyname ``` 3. Add the following code to the file: ```bash #!/bin/bash ...
21,297
[ { "from": "human", "value": "Sometimes when I try to start Firefox it says \"a Firefox process is already running\". So I have to do this:\njeremy@jeremy-desktop:~$ ps aux | grep firefox\njeremy 7451 25.0 27.4 170536 65680 ? Sl 22:39 1:18 /usr/lib/firefox-3.0.1/firefox\njeremy 7578 0.0 0....
I want to be able to set my country of origin - does this involve testing through a proxy, or is there something that can be set else where?
Setting your country of origin typically refers to how your geographic location is perceived online, which can affect things like content access, pricing, or regional services. Here are some options to set or simulate your country of origin: 1. **Using a VPN (Virtual Private Network)**: This is the most common method....
22,160
[ { "from": "human", "value": "I want to be able to set my country of origin - does this involve testing through a proxy, or is there something that can be set else where?\n" }, { "from": "gpt", "value": "Setting your country of origin typically refers to how your geographic location is perceived ...
If I avoid referencing assemblies that don't exist in the silverlight 2.0 runtime, will the.Net 2.0 library dlls I create with VS2008 work with silverlight without recompilation or other alteration?
In Silverlight 2.0, there are specific limitations regarding the compatibility of .NET Framework libraries. While Silverlight uses a subset of the .NET Framework, it's important to note that Silverlight does not support all the assemblies and features available in the full .NET Framework. If you create a .NET 2.0 libr...
17,861
[ { "from": "human", "value": "If I avoid referencing assemblies that don't exist in the silverlight 2.0 runtime, will the.Net 2.0 library dlls I create with VS2008 work with silverlight without recompilation or other alteration?\n" }, { "from": "gpt", "value": "In Silverlight 2.0, there are speci...
Is Occam-pi a good language to learn to program LEGO MINDSTORMS & Surveyor Corporation SRV-1 robots for an programming newbie. Are there any opensource projects making use of the same -- to read source code. url for occam-pi :- http://www.transterpreter.org/
Occam-pi is a programming language designed for concurrent programming, originally inspired by the occam programming language for the Transputer architecture. While it has some interesting features, it may not be the best choice for a programming newbie looking to program LEGO MINDSTORMS or Surveyor Corporation SRV-1 r...
19,835
[ { "from": "human", "value": "Is Occam-pi a good language to learn to program LEGO MINDSTORMS & Surveyor Corporation SRV-1 robots for an programming newbie. Are there any opensource projects making use of the same -- to read source code. url for occam-pi :- http://www.transterpreter.org/\n" }, { "fro...
I'm creating some text boxes on my form programmatically which I need to reference later using FindControl. I've put the FindControl instruction in the page load method after the code which creates them but get an error: Object reference not set to an instance of an object. I assume this is because the textbox contro...
The issue you're encountering arises from the ASP.NET page lifecycle. When you create controls programmatically, they need to be created at the right time in the lifecycle so that they are available when you try to access them via `FindControl`. In ASP.NET Web Forms, dynamically created controls must be recreated on ...
17,624
[ { "from": "human", "value": "I'm creating some text boxes on my form programmatically which I need to reference later using FindControl.\nI've put the FindControl instruction in the page load method after the code which creates them but get an error:\n\nObject reference not set to an instance of an object.\...
I know there is built-in Internet explorer, but what I'm looking for is to open Firefox/Mozilla window (run the application) with specified URL. Anyone can tell me how to do that in C# (.nET) ?
You can open Firefox with a specified URL using C# by leveraging the `Process` class from the `System.Diagnostics` namespace. Here’s a simple example of how you can achieve this: ```csharp using System; using System.Diagnostics; class Program { static void Main(string[] args) { string url = "https://w...
22,402
[ { "from": "human", "value": "I know there is built-in Internet explorer, but what I'm looking for is to open Firefox/Mozilla window (run the application) with specified URL. Anyone can tell me how to do that in C# (.nET) ?\n" }, { "from": "gpt", "value": "You can open Firefox with a specified UR...
We've all seen in-browser rich text editors, which allow you to edit colored/styled text in a WYSIWYG manner. But what about code editors, which automatically highlight code based on language rules as you type? Think Eclipse in a textarea (but without the refactoring support). Do such things exist? I imagine scaling wo...
Yes, in-browser code editors that provide syntax highlighting and other features commonly found in IDEs do exist. These editors are often based on JavaScript libraries that allow for a rich editing experience directly within the browser. Some of the most notable libraries and frameworks include: 1. **CodeMirror**: A v...
20,304
[ { "from": "human", "value": "We've all seen in-browser rich text editors, which allow you to edit colored/styled text in a WYSIWYG manner. But what about code editors, which automatically highlight code based on language rules as you type? Think Eclipse in a textarea (but without the refactoring support).\n...
I want something like an std::map, but I only want to see if the item exists or not, I don't actually need a key AND a value. What should I use?
If you only need to check for the existence of items without needing to associate them with values, you can use `std::set` in C++. The `std::set` is a container that stores unique elements and provides efficient membership checking (i.e., checking if an element exists) in logarithmic time. Here’s a quick overview of h...
22,591
[ { "from": "human", "value": "I want something like an std::map, but I only want to see if the item exists or not, I don't actually need a key AND a value. What should I use?\n" }, { "from": "gpt", "value": "If you only need to check for the existence of items without needing to associate them w...
I have an application that I have to run as Administrator. One small part of that application is to start other applications with Process.Start The started applications will also be run as administrators, but I'd rather see them run as the 'normal' user. How do I accomplish that? /johan/
To start other applications with `Process.Start` in a way that they run as a normal user instead of as an Administrator (even if your main application is running with elevated privileges), you can use a couple of different methods. Here are two common approaches: ### Method 1: Use `runas` Command You can use the `run...
18,993
[ { "from": "human", "value": "I have an application that I have to run as Administrator.\nOne small part of that application is to start other applications with Process.Start\nThe started applications will also be run as administrators, but I'd rather see them run as the 'normal' user.\nHow do I accomplish t...
I have a SQL Server 2005 database and I have 4 GB of text files that I need to import into it. The question is, if these 4 GB of text files are 1.2 GB when they are zipped, how big would the database be if they are imported? Does SQL Server shrink data by default, or how would I set this (think create a database as a d...
When importing data from text files into a SQL Server database, the size of the resulting database can vary significantly based on several factors, including: 1. **Data Type Usage**: The data types used for the columns in your database schema will influence the amount of space consumed. Text data, especially if stored...
17,557
[ { "from": "human", "value": "I have a SQL Server 2005 database and I have 4 GB of text files that I need to import into it. The question is, if these 4 GB of text files are 1.2 GB when they are zipped, how big would the database be if they are imported? Does SQL Server shrink data by default, or how would I...
How do I do this Select top 10 Foo from MyTable in Linq to SQL?
To retrieve the top 10 records from a table using LINQ to SQL, you can use the `Take` method. Here's how you can do that in C#: Assuming you have a data context and a table named `MyTable` with a property `Foo`, the LINQ query would look like this: ```csharp using (var context = new MyDataContext()) { var top10Fo...
23,752
[ { "from": "human", "value": "How do I do this\nSelect top 10 Foo from MyTable\n\nin Linq to SQL?\n" }, { "from": "gpt", "value": "To retrieve the top 10 records from a table using LINQ to SQL, you can use the `Take` method. Here's how you can do that in C#:\n\nAssuming you have a data context an...
Is there an exact overview what has changed in the SP1 for .NET 3.5? New classes, methods, etc. For example, I've noticed there is a new WaitOne(TimeSpan) and WaitOne(int) overloads in the WaitHandle class.
Service Pack 1 (SP1) for .NET Framework 3.5 introduced various enhancements, bug fixes, and some new features. Here is an overview of some of the key changes made in .NET 3.5 SP1, including new classes, methods, and enhancements: ### New Features and Enhancements: 1. **New APIs and Overloads**: - As you noted, new...
20,198
[ { "from": "human", "value": "Is there an exact overview what has changed in the SP1 for .NET 3.5? New classes, methods, etc.\nFor example, I've noticed there is a new WaitOne(TimeSpan) and WaitOne(int) overloads in the WaitHandle class.\n" }, { "from": "gpt", "value": "Service Pack 1 (SP1) for ....
I am looking for a concise way to check a value to see if it is nil or zero. Currently I am doing something like: if (!val || val == 0) # Is nil or zero end But this seems very clumsy.
You can simplify your check using a more concise expression. If you're working in a language like Ruby, JavaScript, or similar, you can define a method or use a simple condition. Here's a cleaner way to check for both `nil` and `zero`: ### In Ruby You can use the `blank?` method if you're working within a Rails enviro...
21,402
[ { "from": "human", "value": "I am looking for a concise way to check a value to see if it is nil or zero. Currently I am doing something like:\nif (!val || val == 0)\n # Is nil or zero\nend\n\nBut this seems very clumsy.\n" }, { "from": "gpt", "value": "You can simplify your check using a more...
UPDATED: on win2k it seems it works OK. Sorry for the confusion. MS Windows Vista internal ftp client has a strange behavior. When redirecting its output and error to a file, the errors do not show up there: ftp -n -s:commands.txt host >output.log 2>&1 When running it from Task Scheduler inside a batch file, I don'...
When using the internal FTP client on Windows Vista, you're experiencing an issue where error messages are not being redirected to your log file. This can indeed happen because of how the FTP client handles output and errors. Here are a few potential workarounds to capture error messages effectively: ### Workaround Op...
20,471
[ { "from": "human", "value": "\nUPDATED: on win2k it seems it works OK. Sorry for the confusion.\n\nMS Windows Vista internal ftp client has a strange behavior.\nWhen redirecting its output and error to a file, the errors do not show up there:\n\nftp -n -s:commands.txt host >output.log 2>&1\n\nWhen running i...
Is it possible to view an MS Access report in the .Net ReportViewer control?
Yes, it is possible to view an MS Access report in the .NET ReportViewer control, but it involves some steps since the ReportViewer control does not natively support MS Access reports directly. Here’s a general approach to achieve this: ### Steps to View an MS Access Report in .NET ReportViewer: 1. **Export the MS Ac...
18,361
[ { "from": "human", "value": "Is it possible to view an MS Access report in the .Net ReportViewer control?\n" }, { "from": "gpt", "value": "Yes, it is possible to view an MS Access report in the .NET ReportViewer control, but it involves some steps since the ReportViewer control does not natively...
How do you detect if Socket#close() has been called on a socket on the remote side?
Detecting whether a socket has been closed on the remote side typically involves trying to perform a read or write operation on the socket. If the remote side closes the socket, you will generally notice this in one of the following ways: ### 1. Reading from the Socket If you attempt to read from a socket and the remo...
19,091
[ { "from": "human", "value": "How do you detect if Socket#close() has been called on a socket on the remote side?\n" }, { "from": "gpt", "value": "Detecting whether a socket has been closed on the remote side typically involves trying to perform a read or write operation on the socket. If the rem...
I know that it does consider ' ' as NULL, but that doesn't do much to tell me why this is the case. As I understand the SQL specifications, ' ' is not the same as NULL -- one is a valid datum, and the other is indicating the absence of that same information. Feel free to speculate, but please indicate if that's the ca...
Your understanding is correct: in SQL, `NULL` represents the absence of a value, while a string with a single space character (or multiple spaces) is indeed a valid string value. They are conceptually different in SQL semantics. ### SQL NULL vs. Empty String 1. **NULL**: It represents an unknown or inapplicable valu...
19,982
[ { "from": "human", "value": "I know that it does consider ' ' as NULL, but that doesn't do much to tell me why this is the case. As I understand the SQL specifications, ' ' is not the same as NULL -- one is a valid datum, and the other is indicating the absence of that same information.\nFeel free to specu...
A prospective client wants to have a calendar feature on their website. They want the option to go edit this calendar to update the events. Does Word Press offer something like this?
Yes, WordPress offers several options for integrating a calendar feature that allows for event management and editing. Here are some popular options: 1. **WordPress Plugins**: There are several plugins specifically designed for adding calendar features to WordPress sites. Some of the most popular ones include: - **...
22,118
[ { "from": "human", "value": "A prospective client wants to have a calendar feature on their website. They want the option to go edit this calendar to update the events. Does Word Press offer something like this?\n" }, { "from": "gpt", "value": "Yes, WordPress offers several options for integrati...
With the advent of new features like lambda expressions (inline code), does it mean we dont have to use delegates or anonymous methods anymore? In almost all the samples I have seen, it is for rewriting using the new syntax. Any place where we still have to use delegates and lambda expressions won't work?
Lambda expressions provide a more concise and readable syntax for creating inline functions, especially for use in LINQ queries and event handling. However, there are still scenarios where you will need to use delegates or where lambda expressions might not be the best fit. ### Scenarios Where Delegates Are Still Rele...
18,356
[ { "from": "human", "value": "With the advent of new features like lambda expressions (inline code), does it mean we dont have to use delegates or anonymous methods anymore? In almost all the samples I have seen, it is for rewriting using the new syntax.\nAny place where we still have to use delegates and la...
What is the difference between a BitmapFrame and BitmapImage in WPF? Where would you use each (ie. why would you use a BitmapFrame rather than a BitmapImage?)
In WPF (Windows Presentation Foundation), `BitmapFrame` and `BitmapImage` are both part of the imaging capabilities, but they serve different purposes and have different functionalities. ### BitmapImage - **Definition**: `BitmapImage` is a subclass of `BitmapSource` that is used to represent an image that can be disp...
21,127
[ { "from": "human", "value": "What is the difference between a BitmapFrame and BitmapImage in WPF? Where would you use each (ie. why would you use a BitmapFrame rather than a BitmapImage?)\n" }, { "from": "gpt", "value": "In WPF (Windows Presentation Foundation), `BitmapFrame` and `BitmapImage` ...
I have code like this: var newMsg = new Msg { Var1 = var1, Var2 = var2 }; using (AppDataContext appDataContext = new AppDataContext(ConnectionString)) { appDataContext.CClass.InsertOnSubmit(newMsg); appDataContext.SubmitChanges(); } After reading this post I believe that the same logic applies. Does a...
The code you've provided is using an object-relational mapping (ORM) approach with a data context (likely from LINQ to SQL or a similar framework). In this case, you are creating a new instance of a class (`Msg`) and inserting it into the database using `InsertOnSubmit` and `SubmitChanges`. Here are some key points to...
22,956
[ { "from": "human", "value": "I have code like this:\nvar newMsg = new Msg\n{\n Var1 = var1,\n Var2 = var2\n};\n\nusing (AppDataContext appDataContext = new AppDataContext(ConnectionString))\n{\n appDataContext.CClass.InsertOnSubmit(newMsg);\n appDataContext.SubmitChanges();\n}\n\nAfter reading t...
the function addresses (Rva+Base) in my MAP-file from visual studio doesn't match the one I see in the debugger (or when I manually inspect my stack frame). What could be causing this? /A.B.
When you see discrepancies between the addresses in a MAP file generated by Visual Studio and what you see in the debugger or your stack frame, several factors could be contributing to the issue. Here are some possible reasons: 1. **Different Build Configurations**: Ensure that you're looking at the MAP file generated...
20,894
[ { "from": "human", "value": "the function addresses (Rva+Base) in my MAP-file from visual studio doesn't match the one I see in the debugger (or when I manually inspect my stack frame).\nWhat could be causing this?\n/A.B.\n" }, { "from": "gpt", "value": "When you see discrepancies between the ad...
How do I set gc.reflogExpire so that items will never expire? What other time interval formats does it accept? The man page says that you can set it to "90 days or 3 months," but doesn't specify what format it expects.
To configure the Git reflog expiration behavior, you can set the `gc.reflogExpire` and `gc.reflogExpireUnreachable` options. To ensure that items in the reflog never expire, you can set these options to a very long duration, typically using a large value that exceeds realistic timeframes (such as years). ### Setting `...
21,284
[ { "from": "human", "value": "How do I set gc.reflogExpire so that items will never expire?\nWhat other time interval formats does it accept?\nThe man page says that you can set it to \"90 days or 3 months,\" but doesn't specify what format it expects.\n" }, { "from": "gpt", "value": "To configur...
I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... For more info look here I set in my project the reference path for all the needed folder, but if a developper checkout ...
To simplify the management of reference paths in a Visual Studio 2008 project, you can consider the following strategies: ### 1. **Use Project File Properties** - In your solution, you can specify paths relative to the project file in your references. This means when a developer checks out the project, the paths will ...
20,803
[ { "from": "human", "value": "I usually format my project directory like J-P Boodhoo. a main dir containing solution file, then a lib folder for all third-party lib, a src dir, a tools lib for third-party that wont be deployed.... For more info look here\nI set in my project the reference path for all the ne...
Using subversion 1.5 I have branch B which was branched off of branch A. After doing work in both branches I go to merge changes from A into B (using svn merge http://path/to/A in the working directory of B) and get svn: Target path does not exist. What does this mean?
The error message "svn: Target path does not exist" typically means that Subversion (SVN) cannot find the specified source path you provided for the merge operation. Here are a few things you can check and steps to troubleshoot: 1. **Check the Repository URL**: Make sure that the URL `http://path/to/A` is correct and ...
20,710
[ { "from": "human", "value": "Using subversion 1.5 I have branch B which was branched off of branch A. After doing work in both branches I go to merge changes from A into B (using svn merge http://path/to/A in the working directory of B) and get svn: Target path does not exist. What does this mean?\n" }, ...
One of our developers is continually writing code and putting it into version control without testing it. The quality of our code is suffering as a result. Besides getting rid of the developer, how can I solve this problem? EDIT I have talked to him about it number of times and even given him written warning
Dealing with a developer who consistently submits untested code can be challenging, especially after multiple conversations and warnings have failed to yield results. Here are some strategies you can consider to address the issue without resorting to termination: 1. **Implement a Code Review Process**: Establish a man...
11,983
[ { "from": "human", "value": "One of our developers is continually writing code and putting it into version control without testing it. The quality of our code is suffering as a result.\nBesides getting rid of the developer, how can I solve this problem?\nEDIT\nI have talked to him about it number of times ...
I'm trying to get started writing some Ruby on Rails apps and have been successful with Mongrel but, I'd like to deploy my apps to my Apache 2.2 instance on Windows? All the tutorials I've found seem out of date and are for older versions of Apache/Rails. Does anyone know of a good, current tutorial for configuring Ap...
Deploying a Ruby on Rails application with Apache on Windows can be a bit tricky, especially since many resources are outdated or focused on Unix-like environments. However, you can use a combination of Passenger (a popular application server for Ruby applications) and Apache to serve your Rails applications. Below is ...
17,258
[ { "from": "human", "value": "I'm trying to get started writing some Ruby on Rails apps and have been successful with Mongrel but, I'd like to deploy my apps to my Apache 2.2 instance on Windows? All the tutorials I've found seem out of date and are for older versions of Apache/Rails.\nDoes anyone know of a...
I have a basic cs-major understanding of multi-threading but have never had to do anything beyond simple timers in an application. Does anyone know of a good resource that will give me a tour how to work with multi-threaded applications, explaining the basics and maybe posing some of the more difficult stuff?
Certainly! Multi-threading can be a complex topic, but there are many resources available that can help you understand the basics and dive into more advanced concepts. Here are some recommendations that cover both fundamental and more challenging aspects of multi-threaded programming: ### Books: 1. **"Java Concurrency...
16,278
[ { "from": "human", "value": "I have a basic cs-major understanding of multi-threading but have never had to do anything beyond simple timers in an application. Does anyone know of a good resource that will give me a tour how to work with multi-threaded applications, explaining the basics and maybe posing so...
You can have different naming convention for class members, static objects, global objects, and structs. Some of the examples of them are as below. _member m_member or in Java case, the usage of this.member. But is there any good technique or naming convention for function variables scope that conveys when a single va...
When it comes to naming conventions for function variables based on their scope and lifespan, there are a few approaches you can consider to enhance clarity and convey intent. While there isn't a universally accepted standard, adopting a consistent convention within your codebase can greatly improve readability and mai...
19,131
[ { "from": "human", "value": "You can have different naming convention for class members, static objects, global objects, and structs. Some of the examples of them are as below.\n_member\nm_member\n\nor in Java case, the usage of this.member.\nBut is there any good technique or naming convention for function...
Scenario: Document library in SharePoint with column x of "Person or Group" type. From within a VBA macro (or VSTO add-in) we're trying to access the MetaProperty on the document to set/get the user name. Any attempt to access the value via the ContentTypeProperties collection throws a Type MisMatch error (13). Th...
When working with SharePoint document libraries and metadata in VBA or a VSTO add-in, interacting with "Person or Group" type fields can be a bit tricky. This is especially true when you encounter a `Type Mismatch` error while accessing properties. Here's a general approach you can take to set or get the value of a "P...
12,830
[ { "from": "human", "value": "Scenario: Document library in SharePoint with column x of \"Person or Group\" type. From within a VBA macro (or VSTO add-in) we're trying to access the MetaProperty on the document to set/get the user name. Any attempt to access the value via the ContentTypeProperties collecti...
I need to create a configuration section, that is able to store key-value pairs in an app.config file and the key-value pairs can be added runtime regardless of their type. It is also important that the value keeps its original type. I need to extend the following interface public interface IPreferencesBackend { b...
To implement a dynamic configuration section that allows for runtime key-value storage with original types maintained, you can extend the `ConfigurationSection` class from the `System.Configuration` namespace. Below, I'll guide you through the necessary steps to create this configuration section along with the interfac...
10,308
[ { "from": "human", "value": "I need to create a configuration section, that is able to store key-value pairs in an app.config file and the key-value pairs can be added runtime regardless of their type. It is also important that the value keeps its original type. I need to extend the following interface \npu...
Recent versions of PHP have a cache of filenames for knowing the real path of files, and require_once() and include_once() can take advantage of it. There's a value you can set in your php.ini to set the size of the cache, but I have no idea how to tell what the size should be. The default value is 16k, but I see no w...
To monitor the usage of the realpath cache in PHP, you can use a few different approaches, although there isn't a built-in PHP function to directly check the cache utilization. Here are some strategies you can use: ### 1. PHP Configuration (`php.ini`) Ensure you have the following directives set in your `php.ini`: `...
20,560
[ { "from": "human", "value": "Recent versions of PHP have a cache of filenames for knowing the real path of files, and require_once() and include_once() can take advantage of it.\nThere's a value you can set in your php.ini to set the size of the cache, but I have no idea how to tell what the size should be....
Is there a C# class for interacting with SWFAddress deeplink URL strings (reading deeplink parameters, building SWFAddress URLs, etc.)? Planning to write one myself otherwise; but I wanted to make sure I wasn't reinventing the wheel first.
As of my last knowledge update in October 2023, there is no widely recognized C# class specifically designed for interacting with SWFAddress deep link URL strings. SWFAddress is primarily a JavaScript library used for managing deep linking in Adobe Flash applications and is commonly used in web applications built with ...
16,440
[ { "from": "human", "value": "Is there a C# class for interacting with SWFAddress deeplink URL strings (reading deeplink parameters, building SWFAddress URLs, etc.)? Planning to write one myself otherwise; but I wanted to make sure I wasn't reinventing the wheel first. \n" }, { "from": "gpt", "va...
Suppose I want to implement a reasonably efficient 'keyword recognition algorithm', that is first given a list of keyword, and must then answer if another given word was in the list. In an imperative language, I would store the keywords in a tree (one node per character). Then, when receiving a word to test, I would s...
In functional programming, you can indeed implement a keyword recognition algorithm in a way that maintains the benefits of functional paradigms, such as immutability and statelessness, while still achieving good efficiency. The approach generally involves building a data structure that can be efficiently queried witho...
14,371
[ { "from": "human", "value": "Suppose I want to implement a reasonably efficient 'keyword recognition algorithm', that is first given a list of keyword, and must then answer if another given word was in the list. \nIn an imperative language, I would store the keywords in a tree (one node per character). Then...
I decided to use log4net as a logger for a new webservice project. Everything is working fine, but I get a lot of messages like the one below, for every log4net tag I am using in my web.config: Could not find schema information for the element 'log4net'... Below are the relevant parts of my web.config: <configSec...
The warning message you're encountering about not being able to find schema information for the `<log4net>` element in your `web.config` file is generally due to the XML schema validation in your configuration file. This issue occurs when the XML elements you have defined do not have a corresponding schema definition o...
15,585
[ { "from": "human", "value": "I decided to use log4net as a logger for a new webservice project. Everything is working fine, but I get a lot of messages like the one below, for every log4net tag I am using in my web.config:\n\nCould not find schema information for\n the element 'log4net'...\n\nBelow are the...
I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods. I understand there may be several conventions and habits and think about this question as an aggregator of the best techniques people use dealing with private methods in Obj...
In Objective-C, managing private methods can indeed be a bit different from what you might be used to in Java. Here are some common approaches, including the use of categories and other techniques, along with their pros and cons: ### 1. Class Extensions (Anonymous Categories) **Usage:** Class extensions (or anonymous...
15,907
[ { "from": "human", "value": "I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods.\nI understand there may be several conventions and habits and think about this question as an aggregator of the best techniques peop...
I have a user reporting that when they use the back button to return to a web page that they come back as a different person. It seems like they may be accessing a different users profile. Here are the important parts of the code: //here's the code on the web page public static WebProfile p = null; protected void Pag...
Yes, the way you are using static methods and a static variable for the `WebProfile` object can lead to the issue you're encountering. By using a static variable `p`, you are essentially creating a single instance of `WebProfile` that is shared across all users and sessions. This can lead to different users accessing t...
20,095
[ { "from": "human", "value": "I have a user reporting that when they use the back button to return to a web page that they come back as a different person. It seems like they may be accessing a different users profile.\nHere are the important parts of the code:\n//here's the code on the web page\n\npublic st...
We have a set of applications that were developed for the ASCII character set. Now, we're trying to install it in Iceland, and are running into problems where the Icelandic characters are getting screwed up. We are working through our issues, but I was wondering: Is there a good "guide" out there for writing C++ code...
It's great that you're looking to share resources with your team to help address the character encoding issues you're facing with Icelandic characters in your applications. Here are some additional resources and tips that might help you and your team better understand how to handle UTF-8 and character encoding in a way...
16,889
[ { "from": "human", "value": "We have a set of applications that were developed for the ASCII character set. Now, we're trying to install it in Iceland, and are running into problems where the Icelandic characters are getting screwed up.\nWe are working through our issues, but I was wondering: Is there a g...
Say that I write an article or document about a certain topic, but the content is meant for readers with certain prior knowledge about the topic. To help people who don't have the "required" background information, I would like to add a note to the top of the page with an explanation and possibly a link to some referen...
When you're working with a platform like WordPress.com and you have limited control over the HTML and SEO settings, there are still a few options you can consider to minimize the visibility of a note or disclaimer while providing useful context for readers. 1. **Use a Short Disclaimer with Discreet Formatting**: You c...
20,135
[ { "from": "human", "value": "Say that I write an article or document about a certain topic, but the content is meant for readers with certain prior knowledge about the topic. To help people who don't have the \"required\" background information, I would like to add a note to the top of the page with an expl...
Applications which run on mobile devices have special user interface requirements. I think Apple did a great job introducing innovative controls on the iPhone/iPod touch platform. Now, I have to design an application for the Windows Mobile platform using the .NET Compact Framework (Visual Studio 2008). I wonder if ther...
Designing a mobile application with an engaging user interface that incorporates touch gestures and intuitive controls can be challenging, especially when working with older platforms like Windows Mobile. However, there are a few resources, UI control sets, and libraries that you might find helpful for creating an iPho...
20,935
[ { "from": "human", "value": "Applications which run on mobile devices have special user interface requirements. I think Apple did a great job introducing innovative controls on the iPhone/iPod touch platform.\nNow, I have to design an application for the Windows Mobile platform using the .NET Compact Framew...
I have some hierarchical data - each entry has an id and a (nullable) parent entry id. I want to retrieve all entries in the tree under a given entry. This is in a SQL Server 2005 database. I am querying it with LINQ to SQL in C# 3.5. LINQ to SQL does not support Common Table Expressions directly. My choices are to ass...
When dealing with hierarchical data in SQL Server 2005 and retrieving all entries under a given entry, you have a couple of options, and your choice will impact performance and maintainability, especially with large data volumes. ### 1. Using Multiple LINQ Queries: This approach involves fetching the data in multiple ...
19,461
[ { "from": "human", "value": "I have some hierarchical data - each entry has an id and a (nullable) parent entry id.\nI want to retrieve all entries in the tree under a given entry. This is in a SQL Server 2005 database. I am querying it with LINQ to SQL in C# 3.5.\nLINQ to SQL does not support Common Table ...
We have a customer that is trying to call our web service written in C# from PHP code. The web service call takes a long as parameter. This call works fine for other customers calling from C# or Java but this customer is getting an error back from the call. I haven't debugged their specific call but I am guessing that ...
When dealing with web services, especially when passing data types like 64-bit integers (which are often represented as `long` in C#), it's important to understand how different languages handle data types. PHP has specific ways it represents numbers, and this can lead to issues when interoperability is required, espec...
19,146
[ { "from": "human", "value": "We have a customer that is trying to call our web service written in C# from PHP code. The web service call takes a long as parameter.\nThis call works fine for other customers calling from C# or Java but this customer is getting an error back from the call. I haven't debugged t...
I tend to implement UI functionality using fairly self-documenting void doSomething() methods, i.e. if the user presses this button then perform this action then enable this list box, disable that button, etc. Is this the best approach? Is there a better pattern for general UI management i.e. how to control when contro...
When developing UI applications, especially in WinForms or similar frameworks, it's essential to adopt design patterns and practices that promote decoupling, maintainability, and testability. Here are some suggestions to help you avoid the pitfalls of a large, unwieldy class structure and to create a more modular and m...
16,589
[ { "from": "human", "value": "I tend to implement UI functionality using fairly self-documenting void doSomething() methods, i.e. if the user presses this button then perform this action then enable this list box, disable that button, etc. Is this the best approach? Is there a better pattern for general UI m...
I am mentoring the programming group of a high school robotics team. I would like to set up a source control repository to avoid the mess of manually copying directories for sharing/backups and merging these by hand. The build location will not usually have network access, so this has led me to distributed version co...
Given your requirements, Mercurial (Hg) would indeed be a solid choice for your high school robotics team. It meets your criteria well for several reasons: 1. **Compatibility**: Mercurial works on Windows XP and Vista, which is essential for your situation. 2. **Local Commits**: You can easily commit changes locally w...
20,800
[ { "from": "human", "value": "I am mentoring the programming group of a high school robotics team. I would like to set up a source control repository to avoid the mess of manually copying directories for sharing/backups and merging these by hand. The build location will not usually have network access, so ...
Just looking at ways of getting named constants in python. class constant_list: (A_CONSTANT, B_CONSTANT, C_CONSTANT) = range(3) Then of course you can refer to it like so: constant_list.A_CONSTANT I suppose you could use a dictionary, using strings: constant_dic = { "A_CONSTANT" : 1, "B_CONSTANT" : 2,...
Yes, there are several common idioms and patterns in Python for defining named constants beyond the approaches you've mentioned. Here are a few additional ones: ### 1. Using an Enum The `enum` module provides a more structured and self-documenting way to define named constants: ```python from enum import Enum class...
18,848
[ { "from": "human", "value": "Just looking at ways of getting named constants in python.\nclass constant_list:\n (A_CONSTANT, B_CONSTANT, C_CONSTANT) = range(3)\n\nThen of course you can refer to it like so: \nconstant_list.A_CONSTANT\n\nI suppose you could use a dictionary, using strings: \nconstant_di...
Suppose I have a LimitedValue class which holds a value, and is parameterized on int types 'min' and 'max'. You'd use it as a container for holding values which can only be in a certain range. You could use it such: LimitedValue< float, 0, 360 > someAngle( 45.0 ); someTrigFunction( someAngle ); so that 'someTrigFunc...
Yes, it is indeed possible to implement a `LimitedValue` class template that enforces compile-time checks for type compatibility when copying or assigning between different instances of `LimitedValue` with different template parameters. You can leverage C++ template specialization and `std::enable_if` or `static_assert...
16,543
[ { "from": "human", "value": "Suppose I have a LimitedValue class which holds a value, and is parameterized on int types 'min' and 'max'. You'd use it as a container for holding values which can only be in a certain range. You could use it such:\nLimitedValue< float, 0, 360 > someAngle( 45.0 );\nsomeTrigFu...
What's a simple way to combine feed and feed2? I want the items from feed2 to be added to feed. Also I want to avoid duplicates as feed might already have items when a question is tagged with both WPF and Silverlight. Uri feedUri = new Uri("http://stackoverflow.com/feeds/tag/silverlight"); XmlReader reader = XmlReader....
To combine `feed` and `feed2`, while avoiding duplicates, you can use a `HashSet` to keep track of unique item IDs or titles from the combined feeds. Below is a simple way to achieve this using LINQ and collections. Here's an example implementation: ```csharp using System; using System.Collections.Generic; using Syst...
5,473
[ { "from": "human", "value": "What's a simple way to combine feed and feed2? I want the items from feed2 to be added to feed. Also I want to avoid duplicates as feed might already have items when a question is tagged with both WPF and Silverlight.\nUri feedUri = new Uri(\"http://stackoverflow.com/feeds/tag/s...
I'm trying to return a transparent GIF from an .aspx page for display within a web page. I am trying to get the image to have transparency, but I just keep getting Black being where the image should be Transparent. Does anyone know what I'm doing wrong? Protected Sub Page_Load(ByVal sender As Object, ByVal e As System....
The issue you're experiencing with the transparency in the GIF may arise from the way the graphics object and the bitmap are created. The `Bitmap` constructor you're using does not create a bitmap that supports an alpha channel (transparency). To ensure proper transparency is handled, you can create a bitmap with a for...
17,882
[ { "from": "human", "value": "I'm trying to return a transparent GIF from an .aspx page for display within a web page. I am trying to get the image to have transparency, but I just keep getting Black being where the image should be Transparent.\nDoes anyone know what I'm doing wrong?\nProtected Sub Page_Load...