instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Element[] array = {new Element(1), new Element(2), new Element(3)}; How do I convert the above variable of type Element[] into a variable of type ArrayList<Element>? ArrayList<Element> arrayList = ...;
To convert an array of type `Element[]` to an `ArrayList<Element>`, you can use the `Arrays.asList()` method, which will create a fixed-size list backed by the specified array. Then, you can create a new `ArrayList` from that list. Here’s how you can do it: ```java import java.util.ArrayList; import java.util.Arrays; ...
13,611
[ { "from": "human", "value": "Element[] array = {new Element(1), new Element(2), new Element(3)};\n\nHow do I convert the above variable of type Element[] into a variable of type ArrayList<Element>?\nArrayList<Element> arrayList = ...;\n\n" }, { "from": "gpt", "value": "To convert an array of typ...
Was wondering if there was a way to put a wildcard in the schema.ini for example [*.txt] FMT=TabDelimited I've got an app that is imported tab delimited files and the only place I can seem to get the FMT="TabDelimited" is in the schema.ini (doesn't work in the connection string for some reason), but I will have no idea...
Unfortunately, the `schema.ini` file does not support wildcard entries like `[*.txt]` to apply settings to multiple files based on their extension. Each entry in the `schema.ini` file must correspond to a specific file or be explicitly named. If you have a set of `.txt` files and you want to ensure they are all treate...
9,529
[ { "from": "human", "value": "Was wondering if there was a way to put a wildcard in the schema.ini for example\n[*.txt]\nFMT=TabDelimited\nI've got an app that is imported tab delimited files and the only place I can seem to get the FMT=\"TabDelimited\" is in the schema.ini (doesn't work in the connection st...
Context: The environment is .Net 3.0 + WPF land, the DB is abstracted well out into the distance and the solution would need to work for Office 2000 and up I guess.. The need is to get a customized report for which the user would like to have certain application windows/boxes (e.g. a trend graph) displayed in Word. Th...
For your scenario, you will be working with **Office Interop** for Word automation. Specifically, you would use the **Microsoft.Office.Interop.Word** library to create, manipulate, and interact with Word documents programmatically from your .NET application. Since you want to embed objects (such as a trend graph) into...
10,754
[ { "from": "human", "value": "Context: The environment is .Net 3.0 + WPF land, the DB is abstracted well out into the distance and the solution would need to work for Office 2000 and up I guess.. \nThe need is to get a customized report for which the user would like to have certain application windows/boxes ...
What is the best way of doing this? tmpnam() returns a path to a file in the root of the drive, which requires administrator privileges on Windows Vista, so this is not an option.
Using `tmpnam()` is generally not recommended for various reasons, including security concerns, and as you've noted, it can create problems with file permissions on modern Windows systems. Instead, you can use more reliable and secure methods to create temporary files. ### Recommended Approaches: 1. **Use `GetTempPat...
9,897
[ { "from": "human", "value": "What is the best way of doing this?\ntmpnam() returns a path to a file in the root of the drive, which requires administrator privileges on Windows Vista, so this is not an option.\n" }, { "from": "gpt", "value": "Using `tmpnam()` is generally not recommended for var...
I know how to test an object to see if it is of a type, using the IS keyword e.g. if (foo is bar) { //do something here } but how do you test for it not being "bar"?, I can't seem to find a keyword that works with IS to test for a negative result. BTW - I have a horrible feeling this is soooo obvious, so apologies...
No need to apologize! It's completely understandable to have questions about language features. In C#, if you want to check if an object is **not** of a certain type using the `is` keyword, you can simply negate the condition using the logical negation operator `!`. Here's how you can do it: ```csharp if (!(foo is ba...
13,572
[ { "from": "human", "value": "I know how to test an object to see if it is of a type, using the IS keyword e.g.\nif (foo is bar)\n{\n //do something here\n}\n\nbut how do you test for it not being \"bar\"?, I can't seem to find a keyword that works with IS to test for a negative result. \nBTW - I have a ho...
How can this line in Java be translated to Ruby: String className = "java.util.Vector"; ... Object o = Class.forName(className).newInstance(); Thanks!
In Ruby, you can achieve a similar result using the `Object.const_get` method combined with `new`. Here’s how you can translate that Java code to Ruby: ```ruby class_name = "Java::JavaUtil::Vector" o = Object.const_get(class_name).new ``` ### Explanation: 1. **Class Name**: In Java, you have the class name as a strin...
13,395
[ { "from": "human", "value": "How can this line in Java be translated to Ruby:\n String className = \"java.util.Vector\";\n ...\n Object o = Class.forName(className).newInstance(); \nThanks!\n" }, { "from": "gpt", "value": "In Ruby, you can achieve a similar result using the `Object.con...
I have a website with a lot of large files. However, I don't want users to start downloading like 10 files at a time. I noticed there are website out there where they only allow 2 simultaneous downloads. My website is programmed using ASP.net running on IIS. Does anyone know how I can limit simultaneous downloads?
To limit the number of simultaneous downloads in an ASP.NET application running on IIS, you can use a few different approaches. Here are a couple of common methods: ### Option 1: Using Session State You can track the number of active downloads per user using session state. Here’s a general approach: 1. **Set Up Sess...
7,876
[ { "from": "human", "value": "I have a website with a lot of large files. However, I don't want users to start downloading like 10 files at a time. I noticed there are website out there where they only allow 2 simultaneous downloads.\nMy website is programmed using ASP.net running on IIS. Does anyone know h...
I use Eclipse 3.3 in my daily work, and have also used Eclipse 3.2 extensively as well. In both versions, sometimes the Search options (Java Search, File Search, etc) in the menu get disabled, seemingly at random times. However, with Ctrl+H, I am able to access the search functionality. Does anyone know why this hap...
The issue you're experiencing with the search options being disabled in Eclipse 3.2 and 3.3 can be attributed to various factors, such as focus issues, problems with the workspace, or specific conditions within your project setup that may cause the menu options to become temporarily disabled. In Eclipse, certain menu ...
12,637
[ { "from": "human", "value": "I use Eclipse 3.3 in my daily work, and have also used Eclipse 3.2 extensively as well. In both versions, sometimes the Search options (Java Search, File Search, etc) in the menu get disabled, seemingly at random times. However, with Ctrl+H, I am able to access the search func...
I've removed a checked in file from the CVS branch, i.e.: cvs remove -f file.txt cvs commit How do I restore the file?
If you've removed a file from a CVS branch and committed that change, you can restore the file from the previous version in the CVS repository. Here’s how you can do it: 1. **Use the `cvs update` command** to bring back the file from the last version before the removal. This can be done with the `-r` option to specify...
12,507
[ { "from": "human", "value": "I've removed a checked in file from the CVS branch, i.e.:\ncvs remove -f file.txt\ncvs commit\n\nHow do I restore the file?\n" }, { "from": "gpt", "value": "If you've removed a file from a CVS branch and committed that change, you can restore the file from the previo...
I have huge 3D arrays of numbers in my .NET application. I need to convert them to a 1D array to pass it to a COM library. Is there a way to convert the array without making a copy of all the data? I can do the conversion like this, but then I use twice the ammount of memory which is an issue in my application: doubl...
In .NET, if you want to convert a 3D array to a 1D array without creating a copy of the data, you will need to utilize a technique called "array flattening" combined with a wrapper that allows you to access the underlying data in a contiguous manner. However, since the actual memory layout for a multi-dimensional array...
9,272
[ { "from": "human", "value": "I have huge 3D arrays of numbers in my .NET application. I need to convert them to a 1D array to pass it to a COM library. Is there a way to convert the array without making a copy of all the data?\nI can do the conversion like this, but then I use twice the ammount of memory wh...
My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible? If it's not, how would you do it with POST? Just out of curiosity. Cheers!
It can be challenging to implement a secure login system without support for the POST method, which is typically used for submitting sensitive information like usernames and passwords. However, there are some alternative approaches you could consider, while also understanding that none of them are as secure as using a ...
5,721
[ { "from": "human", "value": "My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?\nIf it's not, how would you do it with POST? Just out of curiosity.\nChe...
Is there any way to generate project docs during automated builds? I'd like to have a single set of source files (HTML?) with the user manual, and from them generate: PDF document CHM help HTML version of the help The content would be basically the same in all three formats. Currently I'm using msbuild and CCNET, b...
Yes, you can definitely generate project documentation in multiple formats during automated builds, and it can be done using various tools and frameworks. Here are some suggestions for achieving your goal of generating HTML, PDF, and CHM help files from a single set of source files: ### 1. Use of Documentation Generat...
9,006
[ { "from": "human", "value": "Is there any way to generate project docs during automated builds? \nI'd like to have a single set of source files (HTML?) with the user manual, and from them generate:\n\nPDF document\nCHM help \nHTML version of the help\n\nThe content would be basically the same in all three f...
If you were running a news site that created a list of 10 top news stories, and you wanted to make tweaks to your algorithm and see if people liked the new top story mix better, how would you approach this? Simple Click logging in the DB associated with the post entry? A/B testing where you would show one version of ...
If I were running a news site and wanted to evaluate tweaks to the algorithm that determines the top news stories, I would employ a combination of click logging and A/B testing to gather data on user engagement and preferences. Here’s how I would approach this: ### 1. A/B Testing **Setup:** - Divide the audience into...
8,296
[ { "from": "human", "value": "If you were running a news site that created a list of 10 top news stories, and you wanted to make tweaks to your algorithm and see if people liked the new top story mix better, how would you approach this? \nSimple Click logging in the DB associated with the post entry? \nA/B t...
I've written a simple SessionItem management class to handle all those pesky null checks and insert a default value if none exists. Here is my GetItem method: public static T GetItem<T>(string key, Func<T> defaultValue) { if (HttpContext.Current.Session[key] == null) { HttpContext.Current.Session[key] ...
You can pass an inline method for the `Func<T>` parameter directly by using a lambda expression. This allows you to define what the default value should be right at the call site of the `GetItem<T>` method. Here's an example of how you could use it in practice: ```csharp // Example: Using GetItem to retrieve an intege...
13,010
[ { "from": "human", "value": "I've written a simple SessionItem management class to handle all those pesky null checks and insert a default value if none exists. Here is my GetItem method:\npublic static T GetItem<T>(string key, Func<T> defaultValue)\n{\n if (HttpContext.Current.Session[key] == null)\n ...
I'm working on a Silverlight application where I want to take advantage of the Microsoft ASP.NET AJAX Client library. I'm calling the library using the HTML Bridge that is part of Silverlight 2. Silverlight got great support for passing types between JavaScript and Managed Code, but now I've bumped against a problem. M...
The issue you are experiencing seems to stem from the way that the ASP.NET AJAX Client library is validating the parameters being passed from Silverlight to JavaScript. The specific error message indicates that the validation logic is mistaking your object for a function, which typically happens when the type is not co...
9,756
[ { "from": "human", "value": "I'm working on a Silverlight application where I want to take advantage of the Microsoft ASP.NET AJAX Client library. I'm calling the library using the HTML Bridge that is part of Silverlight 2. Silverlight got great support for passing types between JavaScript and Managed Code,...
I have a c# asp.net web app. Breakpoints in the database layer are no longer stopping execution but the breakpoints in the UI layer are still working okay. Can anyone hazard a guess why this might be happening? I've checked all the usual suspects (Debug build is on for all projects) and recompiled all projects in solut...
If breakpoints in the database layer of your ASP.NET web application are not being hit, but breakpoints in the UI layer are working fine, here are several potential causes and solutions to investigate: 1. **Debug Symbols Not Loaded**: Ensure that the debug symbols for your database layer are being loaded correctly. Yo...
8,710
[ { "from": "human", "value": "I have a c# asp.net web app. Breakpoints in the database layer are no longer stopping execution but the breakpoints in the UI layer are still working okay. Can anyone hazard a guess why this might be happening?\nI've checked all the usual suspects (Debug build is on for all proj...
This is an antique problem with VB6 DLL and COM objects but I still face it day to day. What tools or procedures can be used to see which DLL file or version another DLL is referencing? I am referring to compiled DLLs at runtime, not from within VB6 IDE. It's DLL hell.
Dealing with DLL hell, especially in environments like VB6, can be quite frustrating. When one DLL references another, determining the exact file and version being used can be tricky. Here are some tools and procedures that you can use to inspect DLL references at runtime: ### 1. **Dependency Walker (depends.exe)** ...
7,346
[ { "from": "human", "value": "This is an antique problem with VB6 DLL and COM objects but I still face it day to day. What tools or procedures can be used to see which DLL file or version another DLL is referencing?\nI am referring to compiled DLLs at runtime, not from within VB6 IDE.\nIt's DLL hell.\n" },...
I'm trying to convert a VARIANT from VT_DATE to an invariant VT_BSTR. The following code works on Windows XP: VARIANT va; ::VariantInit(&va); // set the variant to VT_DATE SYSTEMTIME st; memset(&st, 0, sizeof(SYSTEMTIME)); st.wYear = 2008; st.wMonth = 9; st.wDay = 22; st.wHour = 12; st.wMinute = 30; DATE date; Syste...
To resolve the issue you're encountering with the `VariantChangeTypeEx` function returning `E_FAIL` on Windows Mobile devices, it's essential to understand that certain functionalities available on desktop versions of Windows may not be supported or work differently on Windows Mobile platforms. Your approach to conver...
9,478
[ { "from": "human", "value": "I'm trying to convert a VARIANT from VT_DATE to an invariant VT_BSTR. The following code works on Windows XP:\nVARIANT va;\n::VariantInit(&va);\n\n// set the variant to VT_DATE\nSYSTEMTIME st;\nmemset(&st, 0, sizeof(SYSTEMTIME));\nst.wYear = 2008;\nst.wMonth = 9;\nst.wDay = 22;...
Here's the situation: I am trying to launch an application, but the location of the .exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like: Process.Start("Sample.xls"); However, I need to pass some command line arguments as well. I couldn't get this to work Process ...
To launch an application with command line arguments while using a file extension that is registered in Windows, you can follow a different approach. When you use `Process.Start` with a registered file type (like `.xls` for Excel), Windows looks for the associated executable based on that file type, but it doesn't pass...
8,597
[ { "from": "human", "value": "Here's the situation: I am trying to launch an application, but the location of the .exe isn't known to me. Now, if the file extension is registered (in Windows), I can do something like:\nProcess.Start(\"Sample.xls\");\n\nHowever, I need to pass some command line arguments as ...
I'm looking for a builder for HQL in Java. I want to get rid of things like: StringBuilder builder = new StringBuilder() .append("select stock from ") .append( Stock.class.getName() ) .append( " as stock where stock.id = ") .append( id ); I'd rather have something like: HqlBuilder builder = new HqlBuil...
It sounds like you're looking for a fluent API to construct HQL queries in a more readable and maintainable way than traditional string concatenation. While there are various libraries that provide query building functionality, a few popular options stand out: ### 1. **JOOQ** Although JOOQ is primarily focused on SQL ...
5,434
[ { "from": "human", "value": "I'm looking for a builder for HQL in Java. I want to get rid of things like:\nStringBuilder builder = new StringBuilder()\n .append(\"select stock from \")\n .append( Stock.class.getName() )\n .append( \" as stock where stock.id = \")\n .append( id );\n\nI'd rather h...
I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently JSUnit works well with JUnit, but it seems to be abandonware and lacks good support for Ajax, debugging, and timeouts. Has anyone had any luck automating (with Ant) a unit testing library such as YUI test, jQuery's QUnit, ...
Certainly! Automating JavaScript unit testing with a build tool like Apache Ant is definitely achievable, especially with modern testing libraries that provide good support for Ajax, debugging, and other features. ### Recommended JavaScript Unit Testing Libraries 1. **QUnit**: This is a powerful, easy-to-use JavaScri...
9,277
[ { "from": "human", "value": "I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently JSUnit works well with JUnit, but it seems to be abandonware and lacks good support for Ajax, debugging, and timeouts.\nHas anyone had any luck automating (with Ant) a unit testing ...
I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are here if you're interested in helping out). My biggest stumbling block so far has been math - how can I learn about algorithms and a...
It's great that you're diving into mathematics as part of your journey into software development! Understanding mathematical concepts can certainly enhance your grasp of algorithms and programming. Below, I'll outline a general dependency tree for the mathematical concepts you might want to learn, with a focus on algor...
2,584
[ { "from": "human", "value": "I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively \"teach myself software development\" from the ground up (the details are here if you're interested in helping out). \nMy biggest stumbling block so far has been m...
in "CSS: The missing manual" the author says that font-size: medium (or other size keywords) sets the font relative to the browser's base font size. But what I'm seeing in FF2 and IE6 is that it sets the font size to what I specified in the .CSS HTML or BODY style (which is much preferred). If it works the latter way,...
The behavior you are observing regarding the `font-size` property in CSS can indeed vary between different browsers and their versions. Here’s a breakdown of how it generally works: 1. **Keywords and Base Font Size**: When you use keywords like `medium`, `small`, `large`, etc., the CSS specification states that these ...
10,927
[ { "from": "human", "value": "in \"CSS: The missing manual\" the author says that font-size: medium (or other size keywords) sets the font relative to the browser's base font size.\nBut what I'm seeing in FF2 and IE6 is that it sets the font size to what I specified in the .CSS HTML or BODY style (which is ...
I am developing a web app that will be hit frequently by mobile browsers. I am wondering if there is a way to get enough information from the browser request to lookup position data (triangulation or GPS) Not from the request directly, of course. A colleague suggested there some carriers supply a unique identifier in t...
When it comes to obtaining geolocation data from mobile browsers, there are several methods you can explore, but it's important to note that there are privacy concerns and limitations to consider. Here's an overview of the options you mentioned and a few additional ones: ### 1. **Geolocation API** The most reliable wa...
10,809
[ { "from": "human", "value": "I am developing a web app that will be hit frequently by mobile browsers. I am wondering if there is a way to get enough information from the browser request to lookup position data (triangulation or GPS) Not from the request directly, of course. A colleague suggested there some...
My development server (CentOS 5) is running Subversion 1.4.2, and I wish to upgrade it to 1.5. I have read in various blogs and documents scattered around the web that this may be done by using RPMForge. I have followed the instructions found on CentOS Wiki, including installing yum-priorities and setting my prioriti...
To upgrade Subversion on your CentOS 5 server using RPMForge or another repository, you can follow these steps. Note that CentOS 5 is quite old, and the packages may not be up-to-date. However, here's how to troubleshoot and attempt to get Subversion upgraded: 1. **Verify RPMForge Installation**: Make sure that the...
9,724
[ { "from": "human", "value": "My development server (CentOS 5) is running Subversion 1.4.2, and I wish to upgrade it to 1.5. I have read in various blogs and documents scattered around the web that this may be done by using RPMForge. I have followed the instructions found on CentOS Wiki, including installi...
I'm using the System.Windows.Forms.WebBrowser, to make a view a-la Visual Studio Start Page. However, it seems the control is catching and handling all exceptions by silently sinking them! No need to tell this is a very unfortunate behaviour. void webBrowserNavigating(object sender, WebBrowserNavigatingEventArgs e) { ...
The `System.Windows.Forms.WebBrowser` control does indeed handle exceptions internally, leading to the behavior you're experiencing where exceptions thrown in its event handlers are caught and ignored. Unfortunately, there is no built-in way to tell the `WebBrowser` control to stop this behavior and propagate exception...
8,900
[ { "from": "human", "value": "I'm using the System.Windows.Forms.WebBrowser, to make a view a-la Visual Studio Start Page. However, it seems the control is catching and handling all exceptions by silently sinking them! No need to tell this is a very unfortunate behaviour.\nvoid webBrowserNavigating(object se...
Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and delete multiscreen blocks of text or write e.g. three large methods out to another file and then delete them for testing purposes in Vim when usi...
When using Vim over a terminal (such as via PuTTY/SSH), selecting and manipulating large blocks of text can indeed be done effectively without a mouse. Below are solutions to help you select and delete multi-screen blocks of text, as well as comment them out. ### Selecting and Deleting Large Blocks of Text 1. **Using...
6,046
[ { "from": "human", "value": "Selecting a large amount of text that extends over many screens in an IDE like Eclipse is fairly easy since you can use the mouse, but what is the best way to e.g. select and delete multiscreen blocks of text or write e.g. three large methods out to another file and then delete ...
I'm building a project from the command line using WinCE platform builder, and I need RTTI to be enabled, so that my project works correctly. I tried setting the option RTTI="YES" in the sources and in the makefile of each dir, and I also tried to add it at the end of CDEFINES, but when I try to build the project, I g...
When building a project using WinCE Platform Builder, the build configuration options, including those related to RTTI (Run-Time Type Information), can be affected by several files and settings. Here’s how you can determine where the `/GR-` (disable RTTI) option is being set: 1. **Check the Platform Builder's `*.pbx...
8,280
[ { "from": "human", "value": "I'm building a project from the command line using WinCE platform builder, and I need RTTI to be enabled, so that my project works correctly. I tried setting the option RTTI=\"YES\" in the sources and in the makefile of each dir, and I also tried to add it at the end of CDEFINE...
I’ve got a brand new Django project. I’ve added one minimal view function to views.py, and one URL pattern to urls.py, passing the view by function reference instead of a string: # urls.py # ------- # coding=utf-8 from django.conf.urls.defaults import * from myapp import views urlpatterns = patterns('', url(r'...
In your Django project, you're using function references for both your URL patterns and when calling `reverse()`, which is a common practice. However, `reverse()` expects you to pass the view name as a string, not as a function reference. ### What's Happening When you use `reverse(views.myview)`, Django tries to find...
12,094
[ { "from": "human", "value": "I’ve got a brand new Django project. I’ve added one minimal view function to views.py, and one URL pattern to urls.py, passing the view by function reference instead of a string:\n# urls.py\n# -------\n\n# coding=utf-8\n\nfrom django.conf.urls.defaults import *\n\nfrom myapp imp...
I am maintaining .net 1.1 and .net 3.5 c# code at once. For this purpose I created two csproject files, one for .net 1.1 and another for .net 3.5. Now, in my source code I am adding new features that are only available in .net 3.5 version, but I also want the code to compile in VS 2003, without the new features. Is the...
In C#, you can achieve conditional compilation using preprocessor directives, but there is no direct equivalent to `_MSC_VER` like in C++. However, you can define your own symbols in each project file to indicate the target framework version. To do this, you can follow these steps: 1. **Define Conditional Compilatio...
10,439
[ { "from": "human", "value": "I am maintaining .net 1.1 and .net 3.5 c# code at once. For this purpose I created two csproject files, one for .net 1.1 and another for .net 3.5.\nNow, in my source code I am adding new features that are only available in .net 3.5 version, but I also want the code to compile in...
Database? Page variables? Enum? I'm looking for opinions here.
Sure! Let's break down the concepts of databases, page variables, and enums, along with some opinions on when to use each of them. ### Databases **Definition**: A database is an organized collection of structured information, typically stored electronically in a computer system. Databases are managed by Database Manag...
7,674
[ { "from": "human", "value": "Database? Page variables? Enum?\nI'm looking for opinions here. \n" }, { "from": "gpt", "value": "Sure! Let's break down the concepts of databases, page variables, and enums, along with some opinions on when to use each of them.\n\n### Databases\n**Definition**: A da...
I have a WebChartControl on my web page. When the chart was generated, an image is being produced and it was shown on the page. Is there a way to get and save this chart as an image output on runtime?
Yes, you can save the chart generated by a `WebChartControl` as an image at runtime. The specific implementation may vary depending on the technology stack you are using (ASP.NET, ASP.NET Core, etc.), but generally, you would follow these steps: ### Steps to Save Chart as an Image 1. **Generate the Chart**: First, en...
7,461
[ { "from": "human", "value": "I have a WebChartControl on my web page. When the chart was generated, an image is being produced and it was shown on the page. \nIs there a way to get and save this chart as an image output on runtime? \n" }, { "from": "gpt", "value": "Yes, you can save the chart ge...
I am looking for a library that will allow me to look up the status of a windows service to verify that the service is started and running. I looked into the Sigar library, but it is GPL and therefor I cannot use it. A Commercial or BSD(ish) license is required as this will be bundled into commercial software.
If you are looking for a library that allows you to check the status of Windows services and is compatible with commercial use, here are some options to consider: 1. **JNA (Java Native Access)**: - **License**: LGPL - JNA provides Java programs easy access to native shared libraries (DLLs on Windows). You can us...
10,217
[ { "from": "human", "value": "I am looking for a library that will allow me to look up the status of a windows service to verify that the service is started and running. I looked into the Sigar library, but it is GPL and therefor I cannot use it. A Commercial or BSD(ish) license is required as this will be...
Flex uses by default UTF-8. I have not fount a way to specify a different encoding/charset on the actionscript WebService class.
In ActionScript, specifically when working with the `WebService` class, you might find that the default character encoding is UTF-8. Unfortunately, ActionScript does not provide a built-in way to specify a different character encoding directly within the `WebService` class. However, there are a few potential workaroun...
11,716
[ { "from": "human", "value": "Flex uses by default UTF-8. I have not fount a way to specify a different encoding/charset on the actionscript WebService class.\n" }, { "from": "gpt", "value": "In ActionScript, specifically when working with the `WebService` class, you might find that the default c...
I have an internal enterprise app that currently consumes 10 different web services. They're consumed via old style "Web References" instead of using WCF. The problem I'm having is trying to work with the other teams in the company who are authoring the services I'm consuming. I found I needed to capture the exact SOAP...
Yes, there are better ways to capture the exact SOAP messages being sent and received without modifying the generated files directly. Here are a few approaches you can consider: 1. **Use a Custom SoapExtension Class**: Instead of modifying the `Reference.cs` file, you can create a custom `SoapExtension` class. This...
8,713
[ { "from": "human", "value": "I have an internal enterprise app that currently consumes 10 different web services. They're consumed via old style \"Web References\" instead of using WCF.\nThe problem I'm having is trying to work with the other teams in the company who are authoring the services I'm consuming...
How do you use gen_udp in Erlang to do multicasting? I know its in the code, there is just no documentation behind it. Sending out data is obvious and simple. I was wondering on how to add memberships. Not only adding memberships at start-up, but adding memberships while running would be useful too.
In Erlang, you can use the `gen_udp` module to work with UDP sockets, including multicast functionality. To use multicast with `gen_udp`, you need to join a multicast group, and you can do this by using the `ip_mreq` option when setting up your socket. You can also manage multicast memberships at runtime by leveraging ...
4,931
[ { "from": "human", "value": "How do you use gen_udp in Erlang to do multicasting? I know its in the code, there is just no documentation behind it. Sending out data is obvious and simple. I was wondering on how to add memberships. Not only adding memberships at start-up, but adding memberships while running...
Working on a somewhat complex page for configuring customers at work. The setup is that there's a main page, which contains various "panels" for various groups of settings. In one case, there's an email address field on the main table and an "export" configuration that controls how emails are sent out. I created a...
Based on your description, it sounds like the null reference exception is occurring because the `ExportInfoID` property is being accessed in a way that doesn't account for the fact that its value may not be set yet. This is especially likely to happen during the page's lifecycle when the binding takes place before the ...
9,863
[ { "from": "human", "value": "Working on a somewhat complex page for configuring customers at work. The setup is that there's a main page, which contains various \"panels\" for various groups of settings. \nIn one case, there's an email address field on the main table and an \"export\" configuration that c...
When I run a particular SQL script in Unix environments, I see a '^M' character at the end of each line of the SQL script as it is echoed to the command line. I don't know on which OS the SQL script was initially created. What is causing this and how do I fix it?
The `^M` character you are seeing in your SQL script is a representation of the carriage return character (`\r`, ASCII 13), which is commonly used in Windows-based systems to indicate the end of a line. Unix-based systems, on the other hand, typically use only the newline character (`\n`, ASCII 10) for line endings. Wh...
10,270
[ { "from": "human", "value": "When I run a particular SQL script in Unix environments, I see a '^M' character at the end of each line of the SQL script as it is echoed to the command line.\nI don't know on which OS the SQL script was initially created.\nWhat is causing this and how do I fix it?\n" }, { ...
I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete. Any suggestions would be much appreciated.
To perform a directory copy without blocking the user interface or making the user aware of the time it takes, you can implement the copy operation as a background task or thread. Here's a general approach that you could take, depending on your development environment (e.g., Python, JavaScript, C#, etc.): ### General ...
4,937
[ { "from": "human", "value": "I need to execute a directory copy upon a user action, but the directories are quite large, so I would like to be able to perform such an action without the user being aware of the time it takes for the copy to complete.\nAny suggestions would be much appreciated.\n" }, { ...
What are the possible causes of premature redo log switching in Oracle other than reaching the specified file size and executing ALTER SYSTEM SWITCH LOGFILE? We have a situation where some (but not all) of our nodes are prematurely switching redo log files before filling up. This happens every 5 - 15 minutes and the si...
Premature redo log switching in Oracle can occur for several reasons beyond reaching the specified file size and manually executing `ALTER SYSTEM SWITCH LOGFILE`. Here are some potential causes to investigate: 1. **Log Buffer Full**: If the log buffer is filled faster than it can be written to the redo log files, this...
9,608
[ { "from": "human", "value": "What are the possible causes of premature redo log switching in Oracle other than reaching the specified file size and executing ALTER SYSTEM SWITCH LOGFILE?\nWe have a situation where some (but not all) of our nodes are prematurely switching redo log files before filling up. Th...
How could I get the Fault Detail sent by a SoapFaultClientException ? I use a WebServiceTemplate as shown below : WebServiceTemplate ws = new WebServiceTemplate(); ws.setMarshaller(client.getMarshaller()); ws.setUnmarshaller(client.getUnMarshaller()); try { MyResponse resp = (MyResponse) = ws.marshalSendAndReceive(...
The `SoapFaultDetail` being `null` in your `SoapFaultClientException` suggests that the `WebServiceTemplate` is not correctly parsing the fault detail from the SOAP response. This can happen for several reasons, such as the SOAP message structure or how the detail element is mapped. Here are a few steps to troubleshoo...
10,256
[ { "from": "human", "value": "How could I get the Fault Detail sent by a SoapFaultClientException ?\nI use a WebServiceTemplate as shown below :\nWebServiceTemplate ws = new WebServiceTemplate();\nws.setMarshaller(client.getMarshaller());\nws.setUnmarshaller(client.getUnMarshaller());\ntry {\n MyResponse ...
I'm using Ruby on Rails for an internal site. Different users of the site have access to a wide variety of data and highly disparate perspectives of the data. Within those different classes of users, there needs to be levels of access. Within the levels of access I need to be able to add features from other classes of ...
Implementing fine-grained access control in a Ruby on Rails application can be achieved through several strategies, allowing you to manage user preferences and features efficiently without complicating your database schema or cluttering your views. Here are some approaches that can help you achieve this: ### 1. Use a ...
5,562
[ { "from": "human", "value": "I'm using Ruby on Rails for an internal site. Different users of the site have access to a wide variety of data and highly disparate perspectives of the data. Within those different classes of users, there needs to be levels of access. Within the levels of access I need to be ab...
I hate case sensitivity in databases, but I'm developing for a client who uses it. How can I turn on this option on my SQL Server, so I can be sure I've gotten the case right in all my queries?
In SQL Server, case sensitivity is determined by the collation setting of the database or the specific columns you are working with. If your client’s database is case-sensitive and you want to ensure that you are adhering to that, you can configure your database or columns to use a case-sensitive collation. Here’s how...
10,529
[ { "from": "human", "value": "I hate case sensitivity in databases, but I'm developing for a client who uses it. How can I turn on this option on my SQL Server, so I can be sure I've gotten the case right in all my queries?\n" }, { "from": "gpt", "value": "In SQL Server, case sensitivity is dete...
Does anyone know much about the Asp.Net webconfig element ? I'm looking at it because I'm implementing an MS Ajax updatepanel in an existing site, and after doing some looking around, on the web I'm not finding a lot of info about it. And to avoid the flood of replies telling me how inefficient the update panel is, a...
The `web.config` file in an ASP.NET application is crucial for configuring various settings, including session state, authentication, and performance-related settings such as compression and caching. When using an UpdatePanel in ASP.NET AJAX, understanding how to optimize performance through these settings can be helpf...
8,470
[ { "from": "human", "value": "Does anyone know much about the Asp.Net webconfig element ?\nI'm looking at it because I'm implementing an MS Ajax updatepanel in an existing site, \nand after doing some looking around, on the web I'm not finding a lot of info about it. \nAnd to avoid the flood of replies telli...
Are there any tools that will spider an asp.net website and create a static site?
Yes, there are several tools that can help you spider an ASP.NET website and create a static site. Here are some options you might consider: 1. **HTTrack**: This is a free tool that allows you to download an entire website from the internet to a local directory. It can effectively spider and crawl an ASP.NET site, cap...
12,012
[ { "from": "human", "value": "Are there any tools that will spider an asp.net website and create a static site?\n" }, { "from": "gpt", "value": "Yes, there are several tools that can help you spider an ASP.NET website and create a static site. Here are some options you might consider:\n\n1. **HTT...
What's the best way to shut down the computer from a C# program? I've found a few methods that work - I'll post them below - but none of them are very elegant. I'm looking for something that's simpler and natively .net.
In C#, shutting down a computer isn't directly supported by a native .NET method in a straightforward manner. However, you can achieve it by utilizing P/Invoke to call native Windows API functions. Below is a simple and elegant way to do this using the `ExitWindowsEx` function. ### Example Code: ```csharp using Syste...
10,966
[ { "from": "human", "value": "What's the best way to shut down the computer from a C# program?\nI've found a few methods that work - I'll post them below - but none of them are very elegant. I'm looking for something that's simpler and natively .net.\n" }, { "from": "gpt", "value": "In C#, shutti...
When using vxWorks as a development platform, we can't write our application with the standard main() function. Why can't we have a main function?
In VxWorks, the traditional `main()` function found in standard C applications is not used because VxWorks is a real-time operating system (RTOS) designed for embedded systems. Here are some reasons why the typical `main()` function isn't employed in VxWorks: 1. **Multitasking Environment**: VxWorks is a multitasking ...
11,309
[ { "from": "human", "value": "When using vxWorks as a development platform, we can't write our application with the standard main() function. Why can't we have a main function?\n" }, { "from": "gpt", "value": "In VxWorks, the traditional `main()` function found in standard C applications is not ...
Most text editors have a navigation pane that lets you see all the files you currently have open. Or a pane that lets you browse a file directory. How do I do this in Emacs?
In Emacs, you can access various features that allow you to navigate through open files and browse directories. Here are some of the common ways to achieve this: ### 1. **Using the Buffer List** To see all the buffers (open files) you have in Emacs, you can use the following command: - **`C-x C-b`**: This key combin...
10,755
[ { "from": "human", "value": "Most text editors have a navigation pane that lets you see all the files you currently have open. Or a pane that lets you browse a file directory.\nHow do I do this in Emacs?\n" }, { "from": "gpt", "value": "In Emacs, you can access various features that allow you t...
Is there any Excel report framework available? We need to export some of the reports into Excel format. Our application is java application hence anything supporting java would be great. I have tried Apache POI API, however that is not good enough. Any framework based on Windows API would be better.
If you're looking for a Java-based solution that can generate Excel reports, and Apache POI isn't meeting your needs, there are several other libraries and frameworks you might consider. Here are a few options: 1. **JExcelAPI**: This library allows you to read, write, and modify Excel spreadsheets in Java. However, it...
10,376
[ { "from": "human", "value": "Is there any Excel report framework available? We need to export some of the reports into Excel format. Our application is java application hence anything supporting java would be great. I have tried Apache POI API, however that is not good enough. Any framework based on Windows...
What do you think of Quagga compared to XORP as a dynamic software routing engine? What are the technical merits of each engine comparatively? Additionally, what do most people think of them from a programming view. Who has manipulated networks using these enginers? I was wondering from an OSPF, routing, BGP protocol u...
Quagga and XORP are both software routing platforms that implement a variety of routing protocols, including OSPF (Open Shortest Path First) and BGP (Border Gateway Protocol). They are used for dynamic routing in network environments, but they have some differences in design, architecture, and user base. ### Technical...
6,266
[ { "from": "human", "value": "What do you think of Quagga compared to XORP as a dynamic software routing engine? What are the technical merits of each engine comparatively? Additionally, what do most people think of them from a programming view. Who has manipulated networks using these enginers? I was wonder...
Name of the option tells something but what Visual Studio/compiler really do and what are the real consequences? Edit: If you search google you can find this address, but that is not really I am looking for. I wonder the real things happening. For example why do the loops get less time, etc.
To understand the implications of compiler options in Visual Studio (or any compiler), it’s essential to grasp what happens during the compilation process, how the compiler optimizes code, and how those optimizations affect runtime performance. Below are some common compiler options and their real-world consequences, f...
8,275
[ { "from": "human", "value": "Name of the option tells something but what Visual Studio/compiler really do and what are the real consequences?\nEdit: If you search google you can find this address, but that is not really I am looking for. I wonder the real things happening. For example why do the loops get l...
How do you find the phone numbers in 50,000 HTML pages? Jeff Attwood posted 5 Questions for programmers applying for jobs: In an effort to make life simpler for phone screeners, I've put together this list of Five Essential Questions that you need to ask during an SDE screen. They won't guarantee that your can...
To find phone numbers in 50,000 HTML pages, you can use a scripting language like Python, which is particularly effective for text processing tasks such as parsing HTML and using regular expressions. Below is a step-by-step outline of how to approach this task: ### Step 1: Collect HTML Files Assuming you have the HTM...
7,182
[ { "from": "human", "value": "How do you find the phone numbers in 50,000 HTML pages?\n\nJeff Attwood posted 5 Questions for programmers applying for jobs:\nIn an effort to make life simpler for phone screeners, I've put together\n this list of Five Essential Questions\n that you need to ask during an SDE\...
this should be simple...could someone provide me a simple code sample that has an aspx page hosting both a silverlight app (consisting of, say a button) and an iframe (pointing to, say stackoverflow.com). The silverlight app and iframe could be in separate div's, the same div, whatever. Everything I've tried so far le...
Certainly! Let's combine your Silverlight application and an iframe in a simple ASPX page. From your description, it sounds like you've already got a Silverlight control set up, but the presence of the iframe is causing issues with rendering. Here is a sample code snippet that includes both a Silverlight application a...
9,789
[ { "from": "human", "value": "this should be simple...could someone provide me a simple code sample that has an aspx page hosting both a silverlight app (consisting of, say a button) and an iframe (pointing to, say stackoverflow.com). The silverlight app and iframe could be in separate div's, the same div, w...
I have a dictionary of 200,000 items (the keys are strings and the values are integers). What is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)? a={ 'keyC':1, 'keyB':2, 'keyA':1 } b = a.items() b.sort( key=lambda a:a[0]) b.sort( key=lambda a:a[1], revers...
To sort a dictionary by descending values and then by ascending keys in Python, you can make use of the `sorted()` function with a custom sorting key. The key function will return a tuple where the first element is the negation of the value (for descending sort), and the second element is the key itself (for ascending ...
13,322
[ { "from": "human", "value": "I have a dictionary of 200,000 items (the keys are strings and the values are integers).\nWhat is the best/most pythonic way to print the items sorted by descending value then ascending key (i.e. a 2 key sort)?\n a={ 'keyC':1, 'keyB':2, 'keyA':1 }\nb = a.items()\nb.sort( key=lam...
I use ssh-agent with password-protected keys on Linux. Every time I log into a certain machine, I do this: eval `ssh-agent` && ssh-add This works well enough, but every time I log in and do this, I create another ssh-agent. Once in a while, I will do a killall ssh-agent to reap them. Is there a simple way to reuse the...
Yes, you can reuse the same `ssh-agent` across different sessions by storing the `SSH_AUTH_SOCK` and `SSH_AGENT_PID` environment variables. Here's how you can do this: 1. **Start the ssh-agent**: The first time you log into your machine, you can start the `ssh-agent` and save its environment variables in your shell's ...
10,054
[ { "from": "human", "value": "I use ssh-agent with password-protected keys on Linux. Every time I log into a certain machine, I do this:\neval `ssh-agent` && ssh-add\n\nThis works well enough, but every time I log in and do this, I create another ssh-agent. Once in a while, I will do a killall ssh-agent to r...
In a WinForms 2.0 C# application, what is the typical method used for saving and restoring form position and size in an application? Related, is it possible to add new User scoped application settings AT RUNTIME? I totally see how to add settings at design time, that's not a problem. But what if I want to create one at...
In WinForms applications, managing the size and position of forms can be accomplished using various approaches. The .NET framework provides a structured way to handle user settings, but it also has some limitations regarding dynamic settings management. ### Saving and Restoring Form Position and Size A typical method...
8,741
[ { "from": "human", "value": "In a WinForms 2.0 C# application, what is the typical method used for saving and restoring form position and size in an application?\nRelated, is it possible to add new User scoped application settings AT RUNTIME? I totally see how to add settings at design time, that's not a pr...
I'm working on an existing report and I would like to test it with the database. The problem is that the catalog set during the initial report creation no longer exists. I just need to change the catalog parameter to a new database. The report is using a stored proc for its data. It looks like if try and remove the...
To change the catalog parameter for your report without losing the existing fields or data bindings in your report designer, you can follow these general steps. The specific steps may vary depending on the report designer you're using (e.g., SQL Server Reporting Services (SSRS), Crystal Reports, etc.), but the concept ...
10,710
[ { "from": "human", "value": "I'm working on an existing report and I would like to test it with the database. The problem is that the catalog set during the initial report creation no longer exists. I just need to change the catalog parameter to a new database. The report is using a stored proc for its d...
I need to be able to quickly convert an image (inside a rails controller) so that the hosting company using managing our application can quickly test at any time to ensure that rmagick is not only successfully installed, but can be called throgh the rails stiack, what is the quickest clean code I can use to do this?
To quickly test if RMagick is installed and functioning properly within a Rails controller, you can create a simple action that generates an image using RMagick. This will allow you to verify that RMagick is working correctly and can be called through your Rails stack. Here's a straightforward implementation in your R...
11,433
[ { "from": "human", "value": "I need to be able to quickly convert an image (inside a rails controller) so that the hosting company using managing our application can quickly test at any time to ensure that rmagick is not only successfully installed, but can be called throgh the rails stiack, what is the qui...
What is the shortcut key for Run to cursor in Visual Studio 2008?
In Visual Studio 2008, the shortcut key for "Run to Cursor" is **Ctrl + F10**. This command allows you to execute your code up to the point where the cursor is currently located in the code editor.
14,495
[ { "from": "human", "value": "What is the shortcut key for Run to cursor in Visual Studio 2008?\n" }, { "from": "gpt", "value": "In Visual Studio 2008, the shortcut key for \"Run to Cursor\" is **Ctrl + F10**. This command allows you to execute your code up to the point where the cursor is curren...
Alright, so I'm working on an application which will use a Linux back-end running PostgreSQL to serve up images to a Windows box with the front end written in C#.NET, though the front-end should hardly matter. My question is: What is the best way to deal with storing images in Postgres? The images are around 4-6 meg...
When it comes to storing images in PostgreSQL, you have a couple of options, and the choice largely depends on the size of the images, the performance requirements of your application, and your specific use case. Here are the primary methods you can consider: ### 1. Storing Images as Bytea You can store images directl...
11,078
[ { "from": "human", "value": "Alright, so I'm working on an application which will use a Linux back-end running PostgreSQL to serve up images to a Windows box with the front end written in C#.NET, though the front-end should hardly matter. My question is:\n\nWhat is the best way to deal with storing images ...
For my C# app, I don't want to always prompt for elevation on application start, but if they choose an output path that is UAC protected then I need to request elevation. So, how do I check if a path is UAC protected and then how do I request elevation mid-execution?
In a C# application, if you want to check whether a given path is in a User Account Control (UAC) protected area (like `C:\Program Files`, `C:\Windows`, etc.), you can compare the path against known protected directories. However, a more accurate approach is to try writing to that path and handle any exceptions that ar...
6,038
[ { "from": "human", "value": "For my C# app, I don't want to always prompt for elevation on application start, but if they choose an output path that is UAC protected then I need to request elevation.\nSo, how do I check if a path is UAC protected and then how do I request elevation mid-execution?\n" }, ...
In the Delphi IDE, you can hold control and click on a method to jump to its definition. In VS2008, you have to right-click and select "Go To Definition". I use this function quite often, so I'd really like to get VS to behave like Delphi in this regard - its so much quicker to ctrl+click. I don't think there's a way t...
It's great to hear that you found a solution using AutoHotkey to emulate the Ctrl+Click behavior in Visual Studio 2008! For others who might be looking for similar functionality or a different approach, here are a couple of alternative suggestions: 1. **Use of Extensions**: While Visual Studio 2008 is quite old and do...
12,444
[ { "from": "human", "value": "In the Delphi IDE, you can hold control and click on a method to jump to its definition. In VS2008, you have to right-click and select \"Go To Definition\".\nI use this function quite often, so I'd really like to get VS to behave like Delphi in this regard - its so much quicker ...
I'm getting a JS error on displaying a page: Nothing concrete is specified but the line where it seems to be thrown. When looking into the source code of the page, I see the error is thrown inside the following script, but I can't understand why! It's only about loading images! <SCRIPT language=JavaScript> <!-- fun...
The error message you're encountering, "The object doesn't accept this property or method," usually indicates that there is a problem with how the method or property is being accessed or called. In your case, the error occurs when executing the `newImage` function. Here are a few potential issues and troubleshooting s...
9,814
[ { "from": "human", "value": "I'm getting a JS error on displaying a page: Nothing concrete is specified but the line where it seems to be thrown. When looking into the source code of the page, I see the error is thrown inside the following script, but I can't understand why! It's only about loading images!\...
In a recent question on stubbing, many answers suggested C# interfaces or delegates for implementing stubs, but one answer suggested using conditional compilation, retaining static binding in the production code. This answer was modded -2 at the time of reading, so at least 2 people really thought this was a wrong ans...
Using conditional compilation for unit test stubs can be a controversial approach, and it's essential to understand both its advantages and drawbacks. Let's break down the implications of the example you've provided and the general considerations surrounding conditional compilation versus dependency injection. ### Con...
8,992
[ { "from": "human", "value": "In a recent question on stubbing, many answers suggested C# interfaces or delegates for implementing stubs, but one answer suggested using conditional compilation, retaining static binding in the production code. This answer was modded -2 at the time of reading, so at least 2 p...
There are hundreds of shopping cart solutions available for every platform, and all hosting plans come with several already installed. As a developer I understand that most of these are fairly similar from a user perspective. But which ones are built with the developer in mind? For example, which ones have a decent AP...
When looking for shopping cart solutions that prioritize developer experience, consider the following platforms that are known for their robust APIs, modular architectures, and well-designed templating systems: ### 1. **Shopify** - **API**: Shopify offers a well-documented RESTful and GraphQL API, which allows develop...
7,840
[ { "from": "human", "value": "There are hundreds of shopping cart solutions available for every platform, and all hosting plans come with several already installed. As a developer I understand that most of these are fairly similar from a user perspective. \nBut which ones are built with the developer in mind...
I'm looking to add a numeric up / down control to a .Net StatusStrip. Unfortunately, it isn't listed as an option in the UI designer. Is there a way to do this?
Yes, while the `NumericUpDown` control isn't directly available in the UI designer for a `StatusStrip`, you can still add it programmatically. Here’s how you can do it: 1. Create a `ToolStripControlHost` that wraps the `NumericUpDown` control. 2. Add the `ToolStripControlHost` to the `StatusStrip`. Here's a step-by-s...
10,029
[ { "from": "human", "value": "I'm looking to add a numeric up / down control to a .Net StatusStrip. Unfortunately, it isn't listed as an option in the UI designer. Is there a way to do this? \n" }, { "from": "gpt", "value": "Yes, while the `NumericUpDown` control isn't directly available in the...
Here's a scenario I'm sure you're all familiar with. You have a fairly "hands off" customer, who really doesn't want to get too involved in the decision making despite your best efforts. An experienced development team spend hours discussing the pros and cons of a particular approach to a problem and come up with an...
Your scenario is a classic challenge in the world of project management and client relations, particularly in the context of software development. Here are some strategies to address such situations more effectively: 1. **Set Clear Expectations from the Start**: Establish a mutual understanding at the beginning of the...
7,213
[ { "from": "human", "value": "Here's a scenario I'm sure you're all familiar with. \n\nYou have a fairly \"hands off\" customer, who really doesn't want to get too involved in the decision making despite your best efforts. \nAn experienced development team spend hours discussing the pros and cons of a partic...
My understanding of the Git pack file format is something like: Where the table is 32-bits wide, and the first three 32-bit words are the pack file header. The last row of 32 bits are the first 4 bytes of an entry. As I understand it, the size of the entry is specified by consecutive bytes with the MSB set, followed...
The Git pack file format is indeed structured in a specific way, and understanding the encoding of data within it, particularly the representation of object entries, is key to working with these files. Let's clarify how the entries in a Git pack file are laid out, focusing on your question about the MSB (Most Significa...
8,054
[ { "from": "human", "value": "My understanding of the Git pack file format is something like:\n\nWhere the table is 32-bits wide, and the first three 32-bit words are the pack file header. The last row of 32 bits are the first 4 bytes of an entry. As I understand it, the size of the entry is specified by c...
I understand that some countries have laws regarding website accessibility. In general, what are the minimum requirements that a website must meet to be accessible, regardless of country? Or, in lieu of minimum requirements, what are some specific things that websites should have to make the accessible?
Website accessibility is essential for ensuring that individuals with disabilities can effectively use and interact with online content. While specific laws and guidelines may vary by country, there are generally accepted standards and practices that serve as the minimum requirements for making a website accessible. On...
7,101
[ { "from": "human", "value": "I understand that some countries have laws regarding website accessibility. In general, what are the minimum requirements that a website must meet to be accessible, regardless of country? Or, in lieu of minimum requirements, what are some specific things that websites should hav...
Given this class class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } I want to find the private item _bar that I will mark with a attribute. Is that possible? I have done this with properties wher...
Yes, it's certainly possible to find private fields and access their attributes using reflection in C#. To access a private field, you will need to use the `BindingFlags` to specify that you want to look for non-public members. For your case, you would typically use the following flags: - `BindingFlags.Instance` - to...
9,145
[ { "from": "human", "value": "Given this class\nclass Foo\n{\n // Want to find _bar with reflection\n [SomeAttribute]\n private string _bar;\n\n public string BigBar\n {\n get { return this._bar; }\n }\n}\n\nI want to find the private item _bar that I will mark with a attribute. Is ...
I have a Website that is really slow and "feels" really bad when using it. The server is fine, it's a clientside issue, I assume because too much JavaScript or Image Requests, but since it's not my own Website, I wonder if there is a way to show and profile the Page from within IE. In Firefox, I would use Firebug, Y!Sl...
If you're looking to profile a website in Internet Explorer (IE), there are several built-in tools and third-party solutions that can help you analyze performance, JavaScript execution, and network requests. Here are some options: ### Built-in Tools in Internet Explorer 1. **Developer Tools**: - You can access the...
10,421
[ { "from": "human", "value": "I have a Website that is really slow and \"feels\" really bad when using it. The server is fine, it's a clientside issue, I assume because too much JavaScript or Image Requests, but since it's not my own Website, I wonder if there is a way to show and profile the Page from withi...
Is it correct to link a static library (.lib) compiled with VS 2005 with a program which is compiled with VS 2008? Both library and my program are written in C++. This program is run on Windows Mobile 6 Professional emulator. This seems to work, there are no linking errors. However the program crashes during startup be...
Linking a static library (.lib) compiled with one version of Visual Studio (VS 2005) to a program compiled with a different version (VS 2008) can lead to compatibility issues, especially in C++. This is primarily due to differences in the compiler, runtime libraries, and ABI (Application Binary Interface) across differ...
10,467
[ { "from": "human", "value": "Is it correct to link a static library (.lib) compiled with VS 2005 with a program which is compiled with VS 2008? Both library and my program are written in C++. This program is run on Windows Mobile 6 Professional emulator.\nThis seems to work, there are no linking errors. How...
The 'click sound' in question is actually a system wide preference, so I only want it to be disabled when my application has focus and then re-enable when the application closes/loses focus. Originally, I wanted to ask this question here on stackoverflow, but I was not yet in the beta. So, after googling for the answer...
Your approach to controlling the web browser navigating click sound based on your application's focus state is creative. However, there are a few considerations and improvements that could enhance its robustness and user experience. Here's a breakdown: ### Key Considerations 1. **Crash Handling**: As you've already i...
5,202
[ { "from": "human", "value": "The 'click sound' in question is actually a system wide preference, so I only want it to be disabled when my application has focus and then re-enable when the application closes/loses focus.\nOriginally, I wanted to ask this question here on stackoverflow, but I was not yet in t...
Yes XML is human readable but so is comma delimited text and properties files. XML is bloated, hard to parse, hard to modify in code, plus a ton of other problems that I can think about with it. My questions is what are XML's most attractive qualities that has made it so popular????
XML (eXtensible Markup Language) has gained popularity for several reasons, despite some of its downsides. Here are some of the most attractive qualities of XML: 1. **Self-Descriptive Structure**: XML allows users to define their own tags, making the data self-descriptive. This flexibility means that it can represent ...
9,971
[ { "from": "human", "value": "Yes XML is human readable but so is comma delimited text and properties files.\nXML is bloated, hard to parse, hard to modify in code, plus a ton of other problems that I can think about with it. \nMy questions is what are XML's most attractive qualities that has made it so pop...
How do I move an active directory group to another organizational unit using Powershell? ie. I would like to move the group "IT Department" from: (CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca) to: (CN=IT Department, OU=Temporarily Moved Groups, DC=Company,DC=ca)
You can move an Active Directory group from one Organizational Unit (OU) to another using PowerShell with the Active Directory module. The `Move-ADObject` cmdlet is used for this purpose. Here's how you can do it for your specific example: 1. **Open PowerShell with Administrative Privileges**: Make sure you are runni...
8,873
[ { "from": "human", "value": "How do I move an active directory group to another organizational unit using Powershell?\nie.\nI would like to move the group \"IT Department\" from:\n (CN=IT Department, OU=Technology Department, OU=Departments,DC=Company,DC=ca)\n\nto:\n (CN=IT Department, OU=Temporarily Move...
I am using VS 2008 with SP1 and the IE 8 beta 2. Whenever I start a new Web site or when I double-click an ASPX in the solution explorer, VS insists on attempting to the display the ASPX page in a free-standing IE browser instance. The address is the local file path to the ASPX it's trying to load and an error that say...
It seems like you're encountering an issue with Visual Studio 2008 not correctly launching the ASPX pages in the local development server (IIS Express or IIS) and instead trying to open them as local files in Internet Explorer. Here are some steps you can take to troubleshoot and resolve this issue: 1. **Check Web Pro...
8,920
[ { "from": "human", "value": "I am using VS 2008 with SP1 and the IE 8 beta 2. Whenever I start a new Web site or when I double-click an ASPX in the solution explorer, VS insists on attempting to the display the ASPX page in a free-standing IE browser instance. The address is the local file path to the ASPX ...
I have a bowling web application that allows pretty detailed frame-by-frame information entry. One thing it allows is tracking which pins were knocked down on each ball. To display this information, I make it look like a rack of pins: o o o o o o o o o o Images are used to represent the pins. So, for the back ...
It sounds like you've encountered a classic issue with rendering in Internet Explorer Mobile, especially when dealing with non-standard behavior in table layouts and inline elements. Your approach to using a transparent GIF as a spacer is a pragmatic solution, even if it feels a bit hacky. Here are a few additional tho...
9,936
[ { "from": "human", "value": "I have a bowling web application that allows pretty detailed frame-by-frame information entry. One thing it allows is tracking which pins were knocked down on each ball. To display this information, I make it look like a rack of pins:\no o o o\n o o o\n o o\n o\nImages are ...
Many of the parameters for interacting with the Office Object model in VSTO require object parameters that are passed by reference, even when the notional type of the parameter is an int or string. I suppose that this mechanism is used so that code can modify the parameter, although I can't figure out why these need t...
When working with the Office Object Model in Visual Studio Tools for Office (VSTO), you'll often encounter a design where parameters that you might expect to be passed by value (such as `int` or `string`) are instead required to be passed as `object` by reference (using `ref`). This can indeed seem cumbersome, but ther...
8,329
[ { "from": "human", "value": "Many of the parameters for interacting with the Office Object model in VSTO require object parameters that are passed by reference, even when the notional type of the parameter is an int or string.\n\nI suppose that this mechanism is used so that code can modify the parameter, a...
So I'm taking the Discrete Math course from MIT's OpenCourseWare and I'm wondering... I see the connection between relations and graphs but not enough to "own" it. I've implemented a simple state machine in SQL as well so I grok graphs pretty well, just not the more rigorous study of how relations and sets compeltely a...
It's great to hear that you're diving into Discrete Mathematics and exploring the connections between relations, sets, and graph theory! Understanding these concepts is fundamental to many areas of computer science, including data structures, algorithms, and more specialized fields like databases and automata theory. ...
7,693
[ { "from": "human", "value": "So I'm taking the Discrete Math course from MIT's OpenCourseWare and I'm wondering... I see the connection between relations and graphs but not enough to \"own\" it. I've implemented a simple state machine in SQL as well so I grok graphs pretty well, just not the more rigorous s...
I've been aware of Steve Yegge's advice to swap Ctrl and Caps Lock for a while now, although I don't use Emacs. I've just tried swapping them over as an experiment and I'm finding it difficult to adjust. There are several shortcuts that are second nature to me now and I hadn't realised quite how ingrained they are in h...
Swapping the Ctrl and Caps Lock keys can be a bit of an adjustment, especially if you've been using the standard layout for a long time. Here are some insights, tips, and thoughts to help you navigate this transition: ### Adjustment Period 1. **Initial Learning Curve**: It's normal to experience difficulty at first. Y...
11,051
[ { "from": "human", "value": "I've been aware of Steve Yegge's advice to swap Ctrl and Caps Lock for a while now, although I don't use Emacs. I've just tried swapping them over as an experiment and I'm finding it difficult to adjust. There are several shortcuts that are second nature to me now and I hadn't r...
I am trying to find out if it's possible to build a complete IVR application by cobbling together parts from open source projects. Is anyone using a non-commercial VoiceXML implementation to build speech-enabled systems?
Yes, it is indeed possible to build a complete IVR (Interactive Voice Response) application using open-source components, including non-commercial VoiceXML implementations. There are several open-source projects and frameworks that can help you create speech-enabled systems. Here are a few options you might consider: ...
10,102
[ { "from": "human", "value": "I am trying to find out if it's possible to build a complete IVR application by cobbling together parts from open source projects. Is anyone using a non-commercial VoiceXML implementation to build speech-enabled systems?\n" }, { "from": "gpt", "value": "Yes, it is i...
I'm about to create a web application that requires a lot of different web forms where the user needs to be able to input a lot of different types of information. What I mean is that one of those forms may require some text input fields, some integer input fields, some decimal input fields, some date input fields, some...
For creating web forms with various input types dynamically, you have several options in JavaScript that can help you generate forms without manually creating HTML elements for each field. Here are a few libraries and frameworks you might consider: ### 1. **Formik (React)** If you are using React for your web applicat...
7,856
[ { "from": "human", "value": "I'm about to create a web application that requires a lot of different web forms where the user needs to be able to input a lot of different types of information. What I mean is that one of those forms may require some text input fields, some integer input fields, some decimal i...
Today I stumbled about a Problem which seems to be a bug in the Zend-Framework. Given the following route: <test> <route>citytest/:city</route> <defaults> <controller>result</controller> <action>test</action> </defaults> <reqs> <city>.+</city> </reqs> </test> and three Urls:...
The issue you're experiencing with the Zend Framework 1.0 routing is related to the use of the `u` (UTF-8) modifier in the regular expression for your route. This modifier is intended to handle UTF-8 character encodings, which can indeed introduce some unexpected behaviors, especially if your URLs contain special chara...
10,382
[ { "from": "human", "value": "Today I stumbled about a Problem which seems to be a bug in the Zend-Framework. Given the following route:\n<test>\n <route>citytest/:city</route>\n <defaults>\n <controller>result</controller>\n <action>test</action>\n </defaults>\n <reqs>\n <ci...
What's the name of the circled UI element here? And how do I access it using keyboard shortcuts? Sometimes it's nearly impossible to get the mouse to focus on it. catch (ItemNotFoundException e) { }
The circled UI element you're referring to is likely a "button" or possibly a "text field" depending on the context of your UI design. However, without seeing the actual UI element you're referencing, I can only provide general guidance. To access UI elements using keyboard shortcuts, here are some common methods: 1....
9,935
[ { "from": "human", "value": "What's the name of the circled UI element here? And how do I access it using keyboard shortcuts? Sometimes it's nearly impossible to get the mouse to focus on it.\ncatch (ItemNotFoundException e)\n{\n\n}\n\n" }, { "from": "gpt", "value": "The circled UI element you...
I'd like to be able to see what registry keys are used for. A book on the registry would be fine as well. Info on Windows Vista changes would be great!
Certainly! Understanding the Windows Registry is crucial for system administration and troubleshooting. The Windows Registry is a hierarchical database that stores low-level settings for the operating system and for applications that opt to use the Registry. Here’s an overview of the keys commonly used and some resourc...
9,449
[ { "from": "human", "value": "I'd like to be able to see what registry keys are used for. A book on the registry would be fine as well. Info on Windows Vista changes would be great!\n" }, { "from": "gpt", "value": "Certainly! Understanding the Windows Registry is crucial for system administration...
Is there a way via System.Reflection, System.Diagnostics or other to get a reference to the actual instance that is calling a static method without passing it in to the method itself? For example, something along these lines class A { public void DoSomething() { StaticClass.ExecuteMethod(); } } cla...
In C#, when you're dealing with static methods, there is no direct way to access the instance of a class that called the static method without explicitly passing that instance as a parameter. The reason for this is that static methods belong to the type itself, rather than to any specific instance of that type. Consequ...
9,131
[ { "from": "human", "value": "Is there a way via System.Reflection, System.Diagnostics or other to get a reference to the actual instance that is calling a static method without passing it in to the method itself?\nFor example, something along these lines\nclass A\n{\n public void DoSomething()\n {\n ...
My developers are waging a civil war. In one camp, they've embraced Hibernate and Spring. In the other camp, they've denounced frameworks - they're considering Hibernate though. The question is: Are there any nasty surprises, weaknesses or pit-falls that newbie Hibernate-Spring converts are likely to stumble on? PS: W...
Transitioning to a new framework like Hibernate and Spring can bring many benefits, but there are also potential pitfalls that developers should be aware of, especially if they are used to a simpler or more custom DAO library. Here are some of the nasty surprises, weaknesses, and pitfalls that newbie Hibernate-Spring c...
7,850
[ { "from": "human", "value": "My developers are waging a civil war. In one camp, they've embraced Hibernate and Spring. In the other camp, they've denounced frameworks - they're considering Hibernate though.\nThe question is: Are there any nasty surprises, weaknesses or pit-falls that newbie Hibernate-Spring...
There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It's not clear what, exactly, they're describing. For example, the "official" (?) web site for Linux kernel asynchronous I/O support here says that sockets don't work, but the "...
POSIX Asynchronous I/O (AIO) is a standard that provides a mechanism for performing I/O operations asynchronously. Below are the answers to your specific questions: ### Purpose of POSIX AIO 1. **General Purpose**: The primary purpose of POSIX AIO is to enable applications to perform I/O operations (reading and writin...
6,595
[ { "from": "human", "value": "There are pages scattered around the web that describe POSIX AIO facilities in varying amounts of detail. None of them are terribly recent. It's not clear what, exactly, they're describing. For example, the \"official\" (?) web site for Linux kernel asynchronous I/O support h...
I was surprised to find today that I couldn't track down any simple way to write the contents of an InputStream to an OutputStream in Java. Obviously, the byte buffer code isn't difficult to write, but I suspect I'm just missing something which would make my life easier (and the code clearer). So, given an InputStream ...
You're right that the standard way of copying data from an `InputStream` to an `OutputStream` can be a bit verbose. However, in Java 7 and later, you can use the `Files` class to simplify the task of copying streams. Here's how you can do it using `java.nio.file.Files`: ### Using Files.copy() If your input and output...
8,837
[ { "from": "human", "value": "I was surprised to find today that I couldn't track down any simple way to write the contents of an InputStream to an OutputStream in Java. Obviously, the byte buffer code isn't difficult to write, but I suspect I'm just missing something which would make my life easier (and the...
public class Test { public static void main(String[] args) { } } class Outer { void aMethod() { class MethodLocalInner { void bMethod() { System.out.println("Inside method-local bMethod"); } } } } Can someone tell me how to print the message fro...
To print the message from the `bMethod` in the `MethodLocalInner` class, you need to create an instance of `MethodLocalInner` inside the `aMethod` and then call `bMethod` on that instance. However, since `MethodLocalInner` is a local class, its scope is limited to the `aMethod`, which means you cannot access it from ou...
12,284
[ { "from": "human", "value": "public class Test {\n public static void main(String[] args) {\n\n }\n}\n\nclass Outer {\n void aMethod() {\n class MethodLocalInner {\n void bMethod() {\n System.out.println(\"Inside method-local bMethod\");\n }\n }\n ...
Are there any easy, smart ways to keep your client and server-side validation-rules synchronized? On the client side we have JavaScript, maybe some kind of framework like jQuery or YUI. On the server-side we have ASP.NET WebForms or ASP.NET MVC. What is validated are things like: Correct e-mail-addresses Correct home-...
Keeping client-side and server-side validation rules synchronized is a common challenge in web development. However, there are several strategies and tools you can use to achieve this in a smart and easy way. ### 1. Use a Shared Validation Library One effective approach is to use a shared library that can be used for...
9,978
[ { "from": "human", "value": "Are there any easy, smart ways to keep your client and server-side validation-rules synchronized?\nOn the client side we have JavaScript, maybe some kind of framework like jQuery or YUI.\nOn the server-side we have ASP.NET WebForms or ASP.NET MVC.\nWhat is validated are things l...
Have you determined a maximum number of characters allowed in FCKEditor? I seem to have hit a wall. It will display the text to be edited, but changes don't get posted back to the server - only the original text gets posted back to the server. I am assuming that the changed text is not copied back to the hidden input...
FCKEditor, like many web-based editors, may face limitations when handling large amounts of text, especially as text size increases. There are several aspects to consider that could contribute to the issue you're experiencing: 1. **Browser Limitations**: Some browsers have limitations on the size of data that can be h...
11,265
[ { "from": "human", "value": "Have you determined a maximum number of characters allowed in FCKEditor?\nI seem to have hit a wall. It will display the text to be edited, but changes don't get posted back to the server - only the original text gets posted back to the server. I am assuming that the changed t...
What number of classes do you think is ideal per one namespace "branch"? At which point would one decide to break one namespace into multiple ones? Let's not discuss the logical grouping of classes (assume they are logically grouped properly), I am, at this point, focused on the maintainable vs. not maintainable number...
Determining the ideal number of classes per namespace (or package) can depend on various factors, including the size of the project, the team's structure, and the complexity of the classes themselves. However, there are some general guidelines to consider regarding maintainability: ### Ideal Class Count - **Small to M...
11,784
[ { "from": "human", "value": "What number of classes do you think is ideal per one namespace \"branch\"? At which point would one decide to break one namespace into multiple ones? Let's not discuss the logical grouping of classes (assume they are logically grouped properly), I am, at this point, focused on t...
The question of whether P=NP is perhaps the most famous in all of Computer Science. What does it mean? And why is it so interesting? Oh, and for extra credit, please post a proof of the statement's truth or falsehood. :)
The P vs. NP problem is one of the most significant open problems in computer science, and it relates to the efficiency of algorithms for solving certain classes of problems. ### Definitions: 1. **P (Polynomial Time)**: This class consists of decision problems (problems with a yes/no answer) for which there exists an ...
10,458
[ { "from": "human", "value": "The question of whether P=NP is perhaps the most famous in all of Computer Science. What does it mean? And why is it so interesting?\nOh, and for extra credit, please post a proof of the statement's truth or falsehood. :)\n" }, { "from": "gpt", "value": "The P vs. NP...
I tend to use SQLite when doing Django development, but on a live server something more robust is often needed (MySQL/PostgreSQL, for example). Invariably, there are other changes to make to the Django settings as well: different logging locations / intensities, media paths, etc. How do you manage all these changes to ...
To manage different settings for development and production environments in Django, you can adopt several strategies to simplify and automate the deployment process. Here are some common approaches: ### 1. Separate Settings Modules Create separate settings files for development and production: - **Folder Structure:*...
7,134
[ { "from": "human", "value": "I tend to use SQLite when doing Django\ndevelopment, but on a live server something more robust is\noften needed (MySQL/PostgreSQL, for example).\nInvariably, there are other changes to make to the Django\nsettings as well: different logging locations / intensities,\nmedia paths...
I'm building an install using VS 2003. The install has an Excel workbook and two Access databases. I need to force the Access files to load regardless of the create/mod date of the existing databases on the user's computer. I currently use ORCA to force in a Version number on the two files, but would like to find a sim...
To ensure that your Access databases are always installed and that the installation will not skip them based on their existing version or modification dates, you can take a couple of different approaches: ### 1. Use a Custom Action in the MSI Instead of manually editing the MSI with ORCA, consider creating a custom a...
10,047
[ { "from": "human", "value": "I'm building an install using VS 2003. The install has an Excel workbook and two Access databases. I need to force the Access files to load regardless of the create/mod date of the existing databases on the user's computer. I currently use ORCA to force in a Version number on th...
Now that it's clear what a metaclass is, there is an associated concept that I use all the time without knowing what it really means. I suppose everybody made once a mistake with parenthesis, resulting in an "object is not callable" exception. What's more, using __init__ and __new__ lead to wonder what this bloody __...
Certainly! Let's break down the concepts of `__call__`, `__init__`, and `__new__` in Python, focusing particularly on what `__call__` does, and provide examples for clarity. ### What is `__call__`? In Python, the `__call__` magic method allows an instance of a class to be called as if it were a function. When you def...
10,168
[ { "from": "human", "value": "Now that it's clear what a metaclass is, there is an associated concept that I use all the time without knowing what it really means. \nI suppose everybody made once a mistake with parenthesis, resulting in an \"object is not callable\" exception. What's more, using __init__ an...
Here's my issue: I need to close a process, already running, from a C# program. The problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never have a main window. The other requirement that I have is ...
To gracefully close an application that does not have a main window handle (like a minimized process), you can use the Windows API to send a close message to the process. This method allows you to signal the process to close without terminating it abruptly. Here's how you can do it using P/Invoke in C#: 1. **Define t...
8,426
[ { "from": "human", "value": "Here's my issue: I need to close a process, already running, from a C# program.\nThe problem is that the process now runs as an icon (minimized to taskbar), and unless the user opens it at least once (which will never happen on unattended machines), it'll never \nhave a main win...
I have a DataSet which I get a DataTable from that I am being passed back from a function call. It has 15-20 columns, however I only want 10 columns of the data. Is there a way to remove those columns that I don't want, copy the DataTable to another that has only the columns defined that I want or is it just better to ...
Yes, there are several ways to achieve what you want with a `DataTable` in C#. You can either create a new `DataTable` with only the columns you need and then copy the data into it, or you can iterate through the rows and only write out the values you need. Here’s a brief overview of both methods: ### Method 1: Create...
5,921
[ { "from": "human", "value": "I have a DataSet which I get a DataTable from that I am being passed back from a function call. It has 15-20 columns, however I only want 10 columns of the data.\nIs there a way to remove those columns that I don't want, copy the DataTable to another that has only the columns de...
I'd like to build a real quick and dirty administrative backend for a Ruby on Rails application I have been attached to at the last minute. I've looked at activescaffold and streamlined and think they are both very attractive and they should be simple to get running, but I don't quite understand how to set up either on...
To create an admin-specific interface in a Ruby on Rails application using either ActiveScaffold or Streamlined, without affecting the existing player resources, you can set up a separate namespace or a new controller for the admin functionality. Here's how you can do that for both libraries: ### Step 1: Create an Adm...
8,034
[ { "from": "human", "value": "I'd like to build a real quick and dirty administrative backend for a Ruby on Rails application I have been attached to at the last minute. I've looked at activescaffold and streamlined and think they are both very attractive and they should be simple to get running, but I don't...