instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I'm looking for books and resource to teach myself linear algebra to be used in 3D graphics programming. I prefer practical approaches to teaching over theoretical (even though math is what, 99.99% theory?) ones, so the dream resource for me would be a book that tackles linear algebra as it's used with 3D graphics prog...
It's great that you're looking to learn linear algebra in a practical context for 3D graphics programming! Here are several books and resources that focus on the application of linear algebra in graphics, often with a hands-on, practical approach: ### Books 1. **"Linear Algebra for 3D Graphics" by Eric Lengyel** -...
21,864
[ { "from": "human", "value": "I'm looking for books and resource to teach myself linear algebra to be used in 3D graphics programming. I prefer practical approaches to teaching over theoretical (even though math is what, 99.99% theory?) ones, so the dream resource for me would be a book that tackles linear a...
Anyone know of any good MSBuild tasks that will execute a PowerShell script and pass it different parameters? I was able to find B# .NET Blog: Invoking PowerShell scripts from MSBuild, but I'm hoping for something that is a little more polished. If I can't find anything I will of course just go ahead and polish my own ...
If you're looking for polished MSBuild tasks to execute PowerShell scripts with parameters, there are a few options and approaches you might consider: ### 1. **Using the built-in `Exec` Task** While not specifically a PowerShell task, you can use the built-in `Exec` task in MSBuild to call a PowerShell script directl...
19,977
[ { "from": "human", "value": "Anyone know of any good MSBuild tasks that will execute a PowerShell script and pass it different parameters?\nI was able to find B# .NET Blog: Invoking PowerShell scripts from MSBuild, but I'm hoping for something that is a little more polished.\nIf I can't find anything I will...
I would like to know what is the difference between initializing a static member inline as in: class Foo { private static Bar bar_ = new Bar(); } or initializing it inside the static constructor as in: class Foo { static Foo() { bar_ = new Bar(); } private static Bar bar_; }
The two approaches you've shown for initializing a static member in a class are indeed different, and they have specific implications related to initialization timing, performance, and clarity. Here's a breakdown of each method: ### 1. Inline Initialization ```csharp class Foo { private static Bar bar_ = new Bar()...
24,879
[ { "from": "human", "value": "I would like to know what is the difference between initializing a static member inline as in:\nclass Foo\n{\n private static Bar bar_ = new Bar();\n}\n\nor initializing it inside the static constructor as in:\nclass Foo\n{\n static Foo()\n {\n bar_ = new Bar();\...
Trying to update some gems on a Windows machine and I continually get this error output for gems that do not have pre-compiled binaries: Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=...
When you're trying to compile Ruby gems with native extensions on Windows, you'll need to ensure that the Ruby development environment is properly set up to work with MinGW (or any other compiler you are using). Here's how to set the appropriate configuration options for RubyGems so that the extconf.rb file can find th...
19,193
[ { "from": "human", "value": "Trying to update some gems on a Windows machine and I continually get this error output for gems that do not have pre-compiled binaries:\nProvided configuration options:\n\n --with-opt-dir\n --without-opt-dir\n --with-opt-include\n --without-opt-include=${opt-dir}/in...
Finding out what's selected in real browsers is as simple as: var range = { start: textbox.selectionStart, end: textbox.selectionEnd } But IE, as usual, doesn't understand. What's the best cross-browser way to do this?
To get the selected text range in a cross-browser way, including support for older versions of Internet Explorer, you can use the following method. It checks if the browser is Internet Explorer and retrieves the selection accordingly, while also handling other modern browsers. Here's a cross-browser solution that cove...
24,590
[ { "from": "human", "value": "Finding out what's selected in real browsers is as simple as:\nvar range = {\n start: textbox.selectionStart,\n end: textbox.selectionEnd\n}\n\nBut IE, as usual, doesn't understand. What's the best cross-browser way to do this?\n" }, { "from": "gpt", "value": "To g...
Even nowadays I often see underscores in Java variables and methods. An example are member variables (like "m_count" or "_count"). As far as I remember, to use underscores in these cases is called bad style by Sun. The only place they should be used is in constants (like in "public final static int IS_OKAY = 1;"), beca...
The use of underscores in Java variable and method names has been a topic of debate among developers, and opinions on this matter can vary based on personal preference, team standards, and specific coding conventions. ### Reasons Some Consider Underscores Bad Style: 1. **Java Naming Conventions**: The official Java c...
24,834
[ { "from": "human", "value": "Even nowadays I often see underscores in Java variables and methods. An example are member variables (like \"m_count\" or \"_count\"). As far as I remember, to use underscores in these cases is called bad style by Sun.\nThe only place they should be used is in constants (like in...
In XEmacs this is done by the calling the function char-to-ucs on a character. GNU Emacs does not seem to have this function. In GNU Emacs, characters seem to be ordinary integers. Running C-x = on a latin character reveals that the Emacs codepoint is different from the Unicode codepoint for the corresponding charac...
In GNU Emacs, while it is true that characters are represented as ordinary integers, you can still find their Unicode codepoints using the function `get-char-code-property` along with the `unicode-category` property. To find the Unicode codepoint of the character at the point, you can use the following command: ```el...
26,447
[ { "from": "human", "value": "In XEmacs this is done by the calling the function char-to-ucs on a character. GNU Emacs does not seem to have this function. In GNU Emacs, characters seem to be ordinary integers. Running C-x = on a latin character reveals that the Emacs codepoint is different from the Unico...
I've written a WCF Service hosted by a Windows Service and it needs to listen on a known TCP/IP port. From what range can I safely allocate a port for use within my organization? That port will be embedded in the config files for the service and the clients that are consuming the service.
When selecting a TCP/IP port for your WCF service, it's important to choose from the range of ports that are not reserved or well-known. The Internet Assigned Numbers Authority (IANA) has defined the following ranges for ports: 1. **Well-Known Ports (0 to 1023)**: These ports are reserved for specific services and pro...
26,231
[ { "from": "human", "value": "I've written a WCF Service hosted by a Windows Service and it needs to listen on a known TCP/IP port. From what range can I safely allocate a port for use within my organization? That port will be embedded in the config files for the service and the clients that are consuming ...
I have a C++ library and a C++ application trying to use functions and classes exported from the library. The library builds fine and the application compiles but fails to link. The errors I get follow this form: app-source-file.cpp:(.text+0x2fdb): undefined reference to `lib-namespace::GetStatusStr(int)' Classes in ...
The linker error you are experiencing indicates that while your application can find the class symbols, it can't find the free function symbols from the shared library. Given that you're using `nm` and confirming that the function is "U" (undefined) in your shared library, it suggests that the function is either not be...
21,571
[ { "from": "human", "value": "I have a C++ library and a C++ application trying to use functions and classes exported from the library. The library builds fine and the application compiles but fails to link. The errors I get follow this form:\n\napp-source-file.cpp:(.text+0x2fdb): undefined reference to `lib...
Suppose I have an M-file that calculates, for exampleת d=a+b+c (The values on a, b, c were given earlier). What command should I use in order to produce an output M-file showing the result of this sum?
To create an output M-file that shows the result of the calculation \( d = a + b + c \), you can use the following steps in MATLAB: 1. **Create the M-file**: Open MATLAB and create a new script or M-file. You can do this by clicking on "New Script" in the MATLAB toolbar. 2. **Write the Code**: In the new M-file, you ...
24,601
[ { "from": "human", "value": "Suppose I have an M-file that calculates, for exampleת d=a+b+c (The values on a, b, c were given earlier). \nWhat command should I use in order to produce an output M-file showing the result of this sum?\n" }, { "from": "gpt", "value": "To create an output M-file t...
What is the command to match brackets in Emacs (the equivalent of the % command in Vim)?
In Emacs, the command to match brackets is `C-M-f` to move forward to the matching parenthesis, and `C-M-b` to move backward to the matching parenthesis. This is equivalent to the `%` command in Vim. You can also use the command `show-paren-mode` to highlight matching parentheses when the cursor is on one. To enable ...
28,206
[ { "from": "human", "value": "What is the command to match brackets in Emacs (the equivalent of the % command in Vim)?\n" }, { "from": "gpt", "value": "In Emacs, the command to match brackets is `C-M-f` to move forward to the matching parenthesis, and `C-M-b` to move backward to the matching pare...
I have the following SQL-statement: SELECT DISTINCT name FROM log WHERE NOT name = '' AND name LIKE '%.EDIT%'; It works fine on Postgres (returns all different names from log, which aren't empty and contain the string '.EDIT'). But on Oracle this statement doesn't work. Any idea why?
The SQL statement you provided is designed to return distinct names from the `log` table where the name is not empty and contains the substring `.EDIT`. However, Oracle SQL has some differences in handling string comparisons and patterns compared to PostgreSQL. Here are a couple of things to consider: 1. **Empty Stri...
27,703
[ { "from": "human", "value": "I have the following SQL-statement:\nSELECT DISTINCT name FROM log WHERE NOT name = '' AND name LIKE '%.EDIT%';\n\nIt works fine on Postgres (returns all different names from log, which aren't empty and contain the string '.EDIT'). But on Oracle this statement doesn't work. Any ...
What's the difference between: class Child(SomeBaseClass): def __init__(self): super(Child, self).__init__() and: class Child(SomeBaseClass): def __init__(self): SomeBaseClass.__init__(self) I've seen super being used quite a lot in classes with only single inheritance. I can see why you'd use...
The difference between using `super()` and directly calling the base class's `__init__` method (i.e., `SomeBaseClass.__init__(self)`) in a class that inherits from a single base class can be subtle but important in certain contexts. Here are some key points that outline the differences and advantages of using `super()...
21,767
[ { "from": "human", "value": "What's the difference between:\nclass Child(SomeBaseClass):\n def __init__(self):\n super(Child, self).__init__()\n\nand:\nclass Child(SomeBaseClass):\n def __init__(self):\n SomeBaseClass.__init__(self)\n\nI've seen super being used quite a lot in classes wi...
I am trying to read an XML-file from another server. However the the company that's hosting me seems to have turned of the file_get_contents function from retrieving files for files from other servers (and their support is not very bright and it takes forever for them to answer). So I need a work around in some way. Th...
If `file_get_contents()` is disabled for fetching files from other servers, you can use the cURL library as an alternative to retrieve data from the remote server. Here's how you can modify your code to use cURL instead: ```php $url = urldecode($object_list_url); // Initialize a cURL session $ch = curl_init($url); /...
24,983
[ { "from": "human", "value": "I am trying to read an XML-file from another server. However the the company that's hosting me seems to have turned of the file_get_contents function from retrieving files for files from other servers (and their support is not very bright and it takes forever for them to answer)...
Specifically, I have a model that has a field like this pub_date = models.DateField("date published") I want to be able to easily grab the object with the most recent pub_date. What is the easiest/best way to do this? Would something like the following do what I want? Edition.objects.order_by('pub_date')[:-1]
To retrieve the object with the most recent `pub_date`, your current query using `Edition.objects.order_by('pub_date')[:-1]` won't work as intended. This query actually retrieves all the objects except the last one, which is not what you want. Instead, you should order the queryset in descending order and take the fir...
25,925
[ { "from": "human", "value": "Specifically, I have a model that has a field like this\npub_date = models.DateField(\"date published\")\n\nI want to be able to easily grab the object with the most recent pub_date. What is the easiest/best way to do this?\nWould something like the following do what I want?\nEd...
I want to do some basic filtering on a file. Read it, do processing, write it back. I'm not looking for "golfing", but want the simplest and most elegant method to achieve this. I came up with: from __future__ import with_statement filename = "..." # or sys.argv... with open(filename) as f: new_txt = # ...some t...
Your current approach using the `with` statement is indeed a good way to handle file I/O in Python, as it ensures that the file is properly closed after its suite finishes. However, there are a few enhancements you can consider for better clarity and efficiency. Below is a refined version of your code, which addresses ...
23,923
[ { "from": "human", "value": "I want to do some basic filtering on a file. Read it, do processing, write it back. \nI'm not looking for \"golfing\", but want the simplest and most elegant method to achieve this. I came up with:\nfrom __future__ import with_statement\n\nfilename = \"...\" # or sys.argv...\n\n...
Where can I find a free, very quick, and reliable implementation of FFT in C#? That can be used in a product? Or are there any restrictions?
For a free, quick, and reliable implementation of the Fast Fourier Transform (FFT) in C#, you have a few good options that you can use in a product. Here are some libraries you can consider: 1. **Math.NET Numerics**: - **Description**: Math.NET Numerics is a popular library for numerical computations in .NET, which...
20,342
[ { "from": "human", "value": "Where can I find a free, very quick, and reliable implementation of FFT in C#?\nThat can be used in a product? Or are there any restrictions?\n" }, { "from": "gpt", "value": "For a free, quick, and reliable implementation of the Fast Fourier Transform (FFT) in C#, yo...
How to get the path of the current csproject? Let's say I have a csproject name MyProj.csproj, inside there is a class that wants to know what is the file path of this csproj, any idea on how to do this? thanks.
In a C# project, you can determine the path of the current `.csproj` file programmatically. However, since the `.csproj` file is not loaded at runtime, you cannot directly access it from the code within the classes of your project. Instead, you can use a workaround that relies on the structure of your project and the l...
22,311
[ { "from": "human", "value": "How to get the path of the current csproject?\nLet's say I have a csproject name MyProj.csproj, inside there is a class that wants to know what is the file path of this csproj, any idea on how to do this? thanks.\n" }, { "from": "gpt", "value": "In a C# project, you ...
Currently I'm trying to erase a sequence of iterators from a set, however GCC's standard library seems to be broken because std::set::erase(iterator) should return the an iterator (next iterator), however in GCC it returns void (which is standard?) Anyways I want to write: myIter = mySet.erase(myIter); But GCC doesn't...
In C++, the behavior of `std::set::erase(iterator)` is defined by the C++ Standard Library, and according to the C++11 and later standards, the `erase` function that takes an iterator does indeed return `void`. The confusion might arise from the fact that the overload of `erase` that takes a key does return the number ...
23,794
[ { "from": "human", "value": "Currently I'm trying to erase a sequence of iterators from a set, however GCC's standard library seems to be broken because std::set::erase(iterator) should return the an iterator (next iterator), however in GCC it returns void (which is standard?)\nAnyways I want to write:\nmyI...
Is there an easy way of programmatically checking if a serial COM port is already open/being used? Normally I would use: try { // open port } catch (Exception ex) { // handle the exception } However, I would like to programatically check so I can attempt to use another COM port or some such.
Yes, you can check if a COM port is available for opening programmatically without needing to directly try to open it and catch an exception. Below are a few different approaches you might consider: ### 1. Using `SerialPort.GetPortNames`: You can use `System.IO.Ports.SerialPort.GetPortNames()` to get a list of availa...
19,474
[ { "from": "human", "value": "Is there an easy way of programmatically checking if a serial COM port is already open/being used?\nNormally I would use:\ntry\n{\n // open port\n}\ncatch (Exception ex)\n{\n // handle the exception\n}\n\nHowever, I would like to programatically check so I can attempt to u...
Can a WinForms app compiled for "Any CPU" be configured to run as "x86" on a 64-bit server without recompiling the app? Specifically, I'm looking for an app.config setting or Control Panel applet to accomplish this end. All the customer's clients are x86, but the server is x64, and we like to install the WinForms app o...
In .NET, applications compiled with the "Any CPU" option can run as either x86 or x64 depending on the platform they are executed on. However, when run on a 64-bit system, an "Any CPU" application will run as a 64-bit process by default. There isn't a configuration option in the `app.config` or any Control Panel applet...
25,765
[ { "from": "human", "value": "Can a WinForms app compiled for \"Any CPU\" be configured to run as \"x86\" on a 64-bit server without recompiling the app? Specifically, I'm looking for an app.config setting or Control Panel applet to accomplish this end. All the customer's clients are x86, but the server is x...
Is it possible to use SQL Server 2008 CROSS APPLY with LINQ-2-SQL? Example SQL: select d.dateCol, tvf.descr, tvf.value from dateTable d cross apply tvFunction(d.dt, 'anotherParam') tvf where d.category='someCat' CROSS APPLY enables using values from a table (dateTable in the example) as parameters to a tablevalue fun...
In LINQ to SQL, there is no direct equivalent for the SQL Server `CROSS APPLY`. However, you can achieve similar functionality using LINQ's method syntax or query syntax in combination with `SelectMany`. Here's how you can mimic the behavior of `CROSS APPLY` using LINQ to SQL: ### Example LINQ to SQL Representation S...
21,223
[ { "from": "human", "value": "Is it possible to use SQL Server 2008 CROSS APPLY with LINQ-2-SQL? \nExample SQL:\nselect d.dateCol, tvf.descr, tvf.value\nfrom dateTable d\ncross apply tvFunction(d.dt, 'anotherParam') tvf\nwhere d.category='someCat'\n\nCROSS APPLY enables using values from a table (dateTable i...
A client asked me if I knew anything about the HOME development method. I, together with wikipedia and acronymfinder, drew a complete blank. Has anyone here heard about a development method called HOME?
It seems that there isn't a widely recognized development method known as "HOME" in the context of project management, software development, or other common development methodologies. It's possible that "HOME" could refer to a specific framework or approach within a particular organization or niche field that isn’t bro...
27,700
[ { "from": "human", "value": "A client asked me if I knew anything about the HOME development method. I, together with wikipedia and acronymfinder, drew a complete blank.\nHas anyone here heard about a development method called HOME?\n" }, { "from": "gpt", "value": "It seems that there isn't a wi...
I'm a Java developer looking to learn some C#/ASP.NET. One thing I've never liked about .NET from the get-go was that it didn't have support for MVC. But now it does! So I was wondering if anybody knew where to get started learning C# MVC. Also, do you need the non-free version of developer-studio to do this?
Welcome to the world of C#/ASP.NET! It's great to hear that you're interested in learning about ASP.NET MVC. Here are some recommendations to get you started: ### Getting Started with C#/ASP.NET MVC 1. **Official Documentation**: The Microsoft documentation is an excellent place to start. They have comprehensive guid...
20,519
[ { "from": "human", "value": "I'm a Java developer looking to learn some C#/ASP.NET. One thing I've never liked about .NET from the get-go was that it didn't have support for MVC. But now it does! So I was wondering if anybody knew where to get started learning C# MVC. \nAlso, do you need the non-free ver...
the following latex input: \rule{1cm}{1cm}\\ \rule{1cm}{1cm} leaves a gap of about .35mm between the boxes. what is the length that defines this gap?
The gap you're observing between the two `\rule{1cm}{1cm}` commands in LaTeX is due to the default behavior of the `\\` command, which introduces a line break along with some vertical spacing. Specifically, the space is added by the `\baselineskip` parameter, which is determined by the current font size and settings. ...
25,575
[ { "from": "human", "value": "the following latex input:\n\\rule{1cm}{1cm}\\\\\n\\rule{1cm}{1cm}\n\nleaves a gap of about .35mm between the boxes. what is the length that defines this gap?\n" }, { "from": "gpt", "value": "The gap you're observing between the two `\\rule{1cm}{1cm}` commands in LaT...
How can I find out the size of a file I opened with an application written in C? I would like to know the size because I want to put the content of the loaded file into a string, which I allocate using malloc(). Just writing malloc(10000*sizeof(char)); is IMHO a bad idea.
To find out the size of a file in a C application, you can use the `fseek` and `ftell` functions from the standard I/O library. Here's how you can do this step-by-step: 1. Open the file using `fopen()`. 2. Use `fseek()` to move the file pointer to the end of the file. 3. Use `ftell()` to get the current position of th...
24,549
[ { "from": "human", "value": "How can I find out the size of a file I opened with an application written in C?\nI would like to know the size because I want to put the content of the loaded file into a string, which I allocate using malloc().\nJust writing malloc(10000*sizeof(char)); is IMHO a bad idea.\n" ...
I am considering building an application that is a blend of a dynamic language (python or ruby) and compiled language and need some help getting convincing myself that this is a good idea. My thought are that I can use a dynamic language to get a lot of code written quickly, and then dropping down to a compiled languag...
Your idea of blending a dynamic language like Python or Ruby with a compiled language such as C or C++ is a well-established approach in software development, often referred to as a "hybrid" model. There are several pros and cons beyond what you've mentioned, along with some best practices and resources that can help y...
20,585
[ { "from": "human", "value": "I am considering building an application that is a blend of a dynamic language (python or ruby) and compiled language and need some help getting convincing myself that this is a good idea.\nMy thought are that I can use a dynamic language to get a lot of code written quickly, an...
I've currently got a set of reports with a number of common functions sitting in code blocks within the .rdl files. This obviously presents a maintainability issue and I as wondering if anyone knew a way for these different reports to share a library of common code? Ideally I'd like to have a .Net Assembly attached to ...
Yes, it is possible to create a library of common functions that can be utilized across multiple SQL Server Reporting Services (SSRS) reports, though the approach may not be straightforward. Here are a few options to achieve this: ### 1. Using .NET Custom Code in SSRS Reports Each SSRS report allows you to embed custo...
17,897
[ { "from": "human", "value": "I've currently got a set of reports with a number of common functions sitting in code blocks within the .rdl files. This obviously presents a maintainability issue and I as wondering if anyone knew a way for these different reports to share a library of common code?\nIdeally I'd...
I've been pulling my hear out over this problem for a few hours yesterday: I've a database on MySQL 4.1.22 server with encoding set to "UTF-8 Unicode (utf8)" (as reported by phpMyAdmin). Tables in this database have default charset set to latin2. But, the web application (CMS Made Simple written in PHP) using it displa...
Hi Matt, It sounds like you're dealing with a tricky character encoding issue that arises due to the mismatched character sets between your MySQL database configurations and the data being used by your web application. Here’s a simplified explanation of how character encoding works in MySQL, as well as steps to help r...
22,119
[ { "from": "human", "value": "I've been pulling my hear out over this problem for a few hours yesterday:\nI've a database on MySQL 4.1.22 server with encoding set to \"UTF-8 Unicode (utf8)\" (as reported by phpMyAdmin). Tables in this database have default charset set to latin2. But, the web application (CMS...
This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together: Firstly: Given an established python project, what are some decent ways to speed it up beyond just plain in-code optimization? Secondly: When writing a program from scratch in python, what are some goo...
To speed up an established Python project beyond in-code optimization, as well as to enhance performance when starting from scratch, consider the following strategies: ### For an Established Python Project 1. **Profiling and Benchmarking**: - **Profile Your Code**: Use profiling tools like `cProfile`, `line_profil...
16,041
[ { "from": "human", "value": "This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together:\n\nFirstly: Given an established python project, what are some decent ways to speed it up beyond just plain in-code optimization?\nSecondly: When writing a progr...
I have a Postgresql database on which I want to do a few cascading deletes. However, the tables aren't set up with the ON DELETE CASCADE rule. Is there any way I can perform a delete and tell Postgresql to cascade it just this once? Something equivalent to DELETE FROM some_table CASCADE; The answers to this older q...
In PostgreSQL, there is no direct equivalent to `DELETE FROM some_table CASCADE;` that allows you to specify cascading deletes for a one-time operation without having the `ON DELETE CASCADE` rule defined in your foreign key constraints. However, there are a few approaches you can consider to achieve similar results: ...
21,910
[ { "from": "human", "value": "I have a Postgresql database on which I want to do a few cascading deletes. However, the tables aren't set up with the ON DELETE CASCADE rule. Is there any way I can perform a delete and tell Postgresql to cascade it just this once? Something equivalent to\nDELETE FROM some_t...
I am working on a webpage in ASP.Net/C# that uses absolute positioning for a textbox, for several in fact. It was working just fine, until I added some more text boxes. That is, the existing text boxes still positioned correctly, but the new ones did not, despite the fact that I created new styles in the CSS for them j...
It sounds like you've encountered a frustrating issue with absolute positioning in your ASP.NET project. When dealing with absolute positioning in CSS, there are several factors that can affect how elements are positioned on the page. Below are some troubleshooting steps and potential solutions to help you resolve the ...
23,901
[ { "from": "human", "value": "I am working on a webpage in ASP.Net/C# that uses absolute positioning for a textbox, for several in fact. It was working just fine, until I added some more text boxes. That is, the existing text boxes still positioned correctly, but the new ones did not, despite the fact that I...
I've an example (wimobot.org) of a working directshow camera (not based on CameraDialog), but this example doesn't includes preview. I don't know how to implement the direct show filter for the preview, any sample code in C# or Visual Basic .Net? Thanks in advance
To implement a DirectShow filter for previewing a camera feed in a .NET application, you typically interact with the DirectShow API using a library like DirectShow.NET. Here's a simple example in C# showing how you can set up a preview window for a camera feed. Before you start, make sure you have the DirectShow.NET l...
18,270
[ { "from": "human", "value": "I've an example (wimobot.org) of a working directshow camera (not based on CameraDialog), but this example doesn't includes preview. I don't know how to implement the direct show filter for the preview, any sample code in C# or Visual Basic .Net?\nThanks in advance\n" }, { ...
I am asked to work on a piece of code which relies heavily on pthreads. So many calls are made to this library that I know nothing of. I have learnt the basics of pthread and have tried out a few examples like creating joining etc. but dont know the depths of it. I have learnt much of it using http://www.yolinux.com/T...
It's great that you're diving into pthreads and looking for more comprehensive resources! Here are some recommendations for websites and books that cover pthreads in greater depth, including topics like synchronization, mutexes, concurrency, and signal handling: ### Websites 1. **GNU C Library Documentation**: - T...
24,261
[ { "from": "human", "value": "I am asked to work on a piece of code which relies heavily on pthreads. So many calls are made to this library that I know nothing of. I have learnt the basics of pthread and have tried out a few examples like creating joining etc. but dont know the depths of it. \nI have learnt...
One of my developers has started using RegexBuddy for help in interpreting legacy code, which is a usage I fully understand and support. What concerns me is using a regex tool for writing new code. I have actually discouraged its use for new code in my team. Two quotes come to mind: Some people, when confronted wit...
Your concerns about the use of regex tools for writing new code are justified, and you are right to approach this topic thoughtfully. Here's a breakdown of your concerns and some suggestions on how to navigate the situation: ### 1. Complexity of Regex **Concern:** A developer may use a complicated regular expression ...
24,282
[ { "from": "human", "value": "One of my developers has started using RegexBuddy for help in interpreting legacy code, which is a usage I fully understand and support. What concerns me is using a regex tool for writing new code. I have actually discouraged its use for new code in my team. Two quotes come t...
What is the best way to encrypt an URL with parameters in Java?
Encrypting a URL with parameters in Java typically involves several steps. You will need to choose an encryption algorithm, use an appropriate library to handle the encryption, and then implement the logic to encrypt the entire URL or its parameters. Here's a basic approach using AES (Advanced Encryption Standard) for ...
16,171
[ { "from": "human", "value": "What is the best way to encrypt an URL with parameters in Java?\n" }, { "from": "gpt", "value": "Encrypting a URL with parameters in Java typically involves several steps. You will need to choose an encryption algorithm, use an appropriate library to handle the encry...
How can I use HttpWebRequest (.NET, C#) asynchronously?
In .NET, the `HttpWebRequest` class is traditionally used for making web requests, but it is not designed with asynchronous programming in mind. Instead, you might want to use the `HttpClient` class, which is part of the `System.Net.Http` namespace and is optimized for modern asynchronous operations. However, if you ...
19,080
[ { "from": "human", "value": "How can I use HttpWebRequest (.NET, C#) asynchronously?\n" }, { "from": "gpt", "value": "In .NET, the `HttpWebRequest` class is traditionally used for making web requests, but it is not designed with asynchronous programming in mind. Instead, you might want to use th...
The TIBCO EMS user's guide (pg 292) says: The backup server will work indefinitely to either A) become the primary server or B) reconnect to the primary server. It also says clients may receive fail-over notification when the switch is successful (see also TIBCO EMS .NET reference pg 220). I have some questions s...
When dealing with failover scenarios in TIBCO EMS (Enterprise Messaging Service), it's important to understand how the client application responds to server failover and reconnection attempts. Here are the key points concerning your questions: ### 1. Client-Side Errors During Failover/Reconnection During the failover ...
24,055
[ { "from": "human", "value": "The TIBCO EMS user's guide (pg 292) says:\n\nThe backup server will work indefinitely to either A) become the\n primary server or B) reconnect to the primary server. It also says\n clients may receive fail-over notification when the switch is successful (see also TIBCO EMS .NE...
I've seen with Microsoft COM and XPCOM, at least from what I've read and gathered so far, that the implementations of interfaces in a component have to essentially be in the single class that derives all the virtual interfaces. Is this correct? What am I missing? Is there a way to have multiple objects (possibly in sep...
Your understanding of Microsoft COM and XPCOM is mostly correct, but there are more details to consider that may help clarify your goals regarding interface implementations and extension possibilities. ### COM and Interface Implementations In COM, a class typically implements one or more interfaces. These interfaces ...
23,941
[ { "from": "human", "value": "I've seen with Microsoft COM and XPCOM, at least from what I've read and gathered so far, that the implementations of interfaces in a component have to essentially be in the single class that derives all the virtual interfaces. Is this correct? What am I missing?\nIs there a way...
I'd like to run a script to populate my database. I'd like to access it through the Django database API. The only problem is that I don't know what I would need to import to gain access to this. How can this be achieved?
To interact with your database using Django's ORM (Object-Relational Mapping), you need to import the appropriate components from Django. Below is a step-by-step guide on how to create a script to populate your database using Django’s database API. ### Step 1: Set Up Your Django Environment 1. **Ensure you have Djang...
21,404
[ { "from": "human", "value": "I'd like to run a script to populate my database. I'd like to access it through the Django database API.\nThe only problem is that I don't know what I would need to import to gain access to this.\nHow can this be achieved?\n" }, { "from": "gpt", "value": "To interact...
When writing the string "¿" out using System.out.println(new String("¿".getBytes("UTF-8"))); ¿ is written instead of just ¿. WHY? And how do we fix it?
The issue you're encountering is related to how character encoding works in Java, particularly when converting between bytes and strings. ### Explanation: 1. **Character Encoding**: The character "¿" (inverted question mark) has a specific byte representation in UTF-8. When you use `"¿".getBytes("UTF-8")`, it returns...
25,208
[ { "from": "human", "value": "When writing the string \"¿\" out using\nSystem.out.println(new String(\"¿\".getBytes(\"UTF-8\")));\n\n¿ is written instead of just ¿.\nWHY? And how do we fix it?\n" }, { "from": "gpt", "value": "The issue you're encountering is related to how character encoding wor...
Are there any commonly used patterns in Javascript for storing the URL's of endpoints that will be requested in an AJAX application? For example would you create a "Service" class to abstract the URL's away?
Yes, there are several commonly used patterns in JavaScript for managing and storing the URLs of endpoints in an AJAX application. Here are some of the most popular approaches: ### 1. **Service Class Pattern** Creating a "Service" class is a common approach to encapsulate API endpoint URLs and HTTP methods. This not ...
12,552
[ { "from": "human", "value": "Are there any commonly used patterns in Javascript for storing the URL's of endpoints that will be requested in an AJAX application?\nFor example would you create a \"Service\" class to abstract the URL's away?\n" }, { "from": "gpt", "value": "Yes, there are several ...
I am trying to use a class from a C# assembly in vb.net. The class has ambiguous members because vb.net is case insensitive. The class is something like this: public class Foo { public enum FORMAT {ONE, TWO, THREE}; public FORMAT Format { get {...} set {...} } } I try to access the enum: Foo.FORMAT.O...
In VB.NET, since it is case insensitive, having a property and an enum with the same name (in this case, `Format`) can indeed lead to ambiguity issues. Unfortunately, there's no direct way to access the enum `FORMAT` when there's a property called `Format` without some workarounds. However, you can resolve this issue...
25,432
[ { "from": "human", "value": "I am trying to use a class from a C# assembly in vb.net. The class has ambiguous members because vb.net is case insensitive. The class is something like this:\n\npublic class Foo {\n\n public enum FORMAT {ONE, TWO, THREE};\n\n public FORMAT Format {\n get {...}\n set {.....
What are some good ways to catch business logic exceptions or return values from SQL in C#? For instance, upon creating a new user, if the user already exists, the system and the user must be notified. I have used the raise_error() method with a particular state int value, I have used a stored procedure returning int...
Catching business logic exceptions or handling return values from SQL in C# effectively can enhance the robustness of your application. Here are several best practices to consider: ### 1. Use Exceptions for Critical Errors For situations where an error is unexpected and critical (like a failure to connect to the datab...
19,035
[ { "from": "human", "value": "What are some good ways to catch business logic exceptions or return values from SQL in C#? For instance, upon creating a new user, if the user already exists, the system and the user must be notified. I have used the raise_error() method with a particular state int value, I h...
Im creating a report using crystal report in vb.net. The report contained a crosstab which I have 3 data: 1. Dealer - row field 2. Month - column 3. Quantity Sales - summarize field How can I arrange this by ascending order based on the Quantity Sales - summarize field? thanks
To sort the rows of a crosstab in Crystal Reports based on a summarized field such as "Quantity Sales," you typically need to manage the sorting properties of the crosstab itself. However, Crystal Reports does not allow you to directly sort crosstab row totals in the designer, so you need to use a workaround. ### Step...
22,605
[ { "from": "human", "value": "Im creating a report using crystal report in vb.net.\nThe report contained a crosstab which I have 3 data:\n1. Dealer - row field\n2. Month - column\n3. Quantity Sales - summarize field\nHow can I arrange this by ascending order based on the \nQuantity Sales - summarize field?\n...
I've noticed that you can manually recycle an application pool via IIS and that doing so seems to slow down my web app significantly less than making changes to files in App_Code or the web.config file. Is this because recycling the application pool via IIS doesn't force a recompilation of the temporary internet files...
Yes, you are correct in your observations about how recycling an application pool in IIS behaves compared to modifying files in the `App_Code` folder or the `web.config` file. ### Application Pool Recycling When you manually recycle an application pool in IIS, it effectively terminates the current instances of your w...
24,626
[ { "from": "human", "value": "I've noticed that you can manually recycle an application pool via IIS and that doing so seems to slow down my web app significantly less than making changes to files in App_Code or the web.config file. Is this because recycling the application pool via IIS doesn't force a reco...
I am trying to solve the current problem using GPU capabilities: "given a point cloud P and an oriented plane described by a point and a normal (Pp, Np) return the points in the cloud which lye at a distance equal or less than EPSILON from the plane". Talking with a colleague of mine I converged toward the following so...
It sounds like you have a complex task at hand, and using OpenGL for rendering and processing point clouds can be a great choice. I'll do my best to address your questions in a concise manner. ### q1) Do I need to open a window-frame to be able to do such an operation? Yes, generally, you need an OpenGL context, which...
14,019
[ { "from": "human", "value": "I am trying to solve the current problem using GPU capabilities: \"given a point cloud P and an oriented plane described by a point and a normal (Pp, Np) return the points in the cloud which lye at a distance equal or less than EPSILON from the plane\".\nTalking with a colleague...
If I have a maven profile activated by the presence of a property, how can I define another profile that is only activated when the other profile is not activated? e.g. <profile> <activation> <property> <name>myproperty</name> <value>value</value> </pr...
In Maven, you cannot directly check for the absence of a property using the same `<activation>` tag. However, you can achieve the desired behavior by leveraging the concept of an "inverse" activation by checking for the absence of the property using a combination of the `exists` condition and the `value` check. Here’s...
23,635
[ { "from": "human", "value": "If I have a maven profile activated by the presence of a property, how can I define another profile that is only activated when the other profile is not activated?\ne.g.\n <profile>\n <activation>\n <property>\n <name>myproperty</name>\n ...
Note that I am not asking which to choose (MVC or MVP), but rather if one of the two should be used for a web application. I realize that it might be too much work to convert an older application from its current design to a MVC or MVP pattern. However, what about for a new app? It appears these are the most popular ar...
When it comes to designing a new web application, both MVC (Model-View-Controller) and MVP (Model-View-Presenter) are popular architectural patterns that can be beneficial. However, there are a few considerations to keep in mind: ### MVC (Model-View-Controller) **Pros:** - **Separation of Concerns:** MVC promotes a c...
21,361
[ { "from": "human", "value": "Note that I am not asking which to choose (MVC or MVP), but rather if one of the two should be used for a web application.\nI realize that it might be too much work to convert an older application from its current design to a MVC or MVP pattern. However, what about for a new app...
I have to deploy my ASP.NET application into two seperated IIS servers. My application works over HTTPS/TLS. My ASP code has to handle client SSL certificate and it means I can't use simple forward load balancers, because I will never get such certificate from nginx or Apache Load Balancer. As I understand there is no ...
You're correct that handling client SSL certificates adds a layer of complexity when it comes to load balancing your ASP.NET application across multiple IIS servers. In such cases, traditional load balancers (like nginx or Apache) that terminate SSL connections might not work for you since they wouldn't be able to forw...
22,320
[ { "from": "human", "value": "I have to deploy my ASP.NET application into two seperated IIS servers. My application works over HTTPS/TLS. My ASP code has to handle client SSL certificate and it means I can't use simple forward load balancers, because I will never get such certificate from nginx or Apache Lo...
I've got a nice little class built that acts as a cache. Each item has an expiration TimeSpan or DateTime. Each time an attempt to access an item in the cache is made, the item's expiration is checked, and if it's expired, the item is removed from the cache and nothing is returned. That's great for objects that are acc...
Using a background thread to continuously check for expired items in a cache is one approach, but it can be resource-intensive and may not be the most efficient solution. Here are several strategies you could consider for expiring stale items in your cache: ### 1. Lazy Expiration This is the method you are currently u...
18,991
[ { "from": "human", "value": "I've got a nice little class built that acts as a cache. Each item has an expiration TimeSpan or DateTime. Each time an attempt to access an item in the cache is made, the item's expiration is checked, and if it's expired, the item is removed from the cache and nothing is return...
I'm stuck trying to create a dynamic linq extension method that returns a string in JSON format - I'm using System.Linq.Dynamic and Newtonsoft.Json and I can't get the Linq.Dynamic to parse the "cell=new object[]" part. Perhaps too complex? Any ideas? : My Main method: static void Main(string[] args) { NorthwindD...
Creating a dynamic LINQ extension method that constructs a JSON representation from an `IQueryable<T>` can be tricky, especially when it comes to selecting and transforming the data correctly with `System.Linq.Dynamic`. The issue with your current code seems to be related to how you are constructing the select expressi...
18,803
[ { "from": "human", "value": "I'm stuck trying to create a dynamic linq extension method that returns a string in JSON format - I'm using System.Linq.Dynamic and Newtonsoft.Json and I can't get the Linq.Dynamic to parse the \"cell=new object[]\" part. Perhaps too complex? Any ideas? : \nMy Main method:\nsta...
I have a Visual Studio (2008) solution consisting of several projects, not all in the same namespace. When I build the solution, all the DLL files used by the top level project, TopProject, are copied into the TopProject\bin\debug folder. However, the corresponding .pdb files are only copied for some of the other proje...
Visual Studio handles the copying of .pdb files based on how the projects and their references are configured. When you build a solution, Visual Studio determines which .pdb files need to be copied based on the references that are included in the projects. Here are some important points to consider regarding the copyin...
24,524
[ { "from": "human", "value": "I have a Visual Studio (2008) solution consisting of several projects, not all in the same namespace. When I build the solution, all the DLL files used by the top level project, TopProject, are copied into the TopProject\\bin\\debug folder. However, the corresponding .pdb files ...
Lets just say you have a table in Oracle: CREATE TABLE person ( id NUMBER PRIMARY KEY, given_names VARCHAR2(50), surname VARCHAR2(50) ); with these function-based indices: CREATE INDEX idx_person_upper_given_names ON person (UPPER(given_names)); CREATE INDEX idx_person_upper_last_name ON person (UPPER(last_name)...
In Oracle, function-based indexes can only be utilized under certain conditions, and one of those conditions is that the indexed expression cannot contain NULL values. If there are NULL values in the column you're indexing (in this case `last_name`), the optimizer may choose not to use the index, even if you add additi...
24,750
[ { "from": "human", "value": "Lets just say you have a table in Oracle:\nCREATE TABLE person (\n id NUMBER PRIMARY KEY,\n given_names VARCHAR2(50),\n surname VARCHAR2(50)\n);\n\nwith these function-based indices:\nCREATE INDEX idx_person_upper_given_names ON person (UPPER(given_names));\nCREATE INDEX idx_...
My code for sql connection using linq is: var query1 = from u in dc.Usage_Computers where u.DomainUser == s3 select u; // selects all feilds from table GridView1.DataSource = query1; GridView1.DataBind(); I have a field called "Operation" in the table "Domainuser" which has values like "1, 2, 3". ...
You can achieve this by projecting your query results into a new anonymous type (or a custom class) that replaces the `Operation` field with its corresponding string representation. Here's how you can modify your code to map the `Operation` values to meaningful strings before binding them to your GridView: ### Using A...
22,193
[ { "from": "human", "value": "My code for sql connection using linq is:\nvar query1 = from u in dc.Usage_Computers\n where u.DomainUser == s3\n select u; // selects all feilds from table\n\nGridView1.DataSource = query1;\nGridView1.DataBind();\n\nI have a field called \"Operation\" in the t...
My c# program reads an xml file when it loads, my installer installs the program in %program files%\myapp. When I run my program it loads an old xml file and not the one found in its current folder, here is the weird bit, if I rename the myapp folder to myapp2 and rerun the exe the correct xml file loads. I have made n...
What you are experiencing is a common issue related to file caching, user permissions, or potential data access in a different location due to legacy settings. Here are some potential reasons for the behavior you described: 1. **Application Data Folder**: Your application might be saving or reading the XML file from a...
22,599
[ { "from": "human", "value": "My c# program reads an xml file when it loads, my installer installs the program in %program files%\\myapp. When I run my program it loads an old xml file and not the one found in its current folder, here is the weird bit, if I rename the myapp folder to myapp2 and rerun the exe...
I found a list of iPhone supported font here http://daringfireball.net/misc/2007/07/iphone-osx-fonts But I just wanted to confirm that, can we use all this fonts in application, or we are restricted to some class of fonts.
On iOS, you are primarily restricted to using system fonts for your applications unless you include custom fonts in your app bundle. The list you referenced includes fonts that are part of the iOS operating system, and while you can use those fonts in your application, there are some considerations: 1. **System Fonts*...
26,355
[ { "from": "human", "value": "I found a list of iPhone supported font here\nhttp://daringfireball.net/misc/2007/07/iphone-osx-fonts\nBut I just wanted to confirm that, can we use all this fonts in application, or we are restricted to some class of fonts.\n" }, { "from": "gpt", "value": "On iOS, y...
I am tasked with updating a family of web sites that promote scientific conferences that cater to a niche scientific field. The sites are currently written with some modest CSS layout for the shared common page template structure, but the details of each page are a mishmash of <p>, <br>, and &nbsp; to position the con...
Yes, there are several resources that can help you learn CSS in the context of structuring and styling text-heavy, business-oriented web content. Here are some recommendations that focus on practical applications and offer insights into CSS best practices: 1. **CSS-Tricks**: This website offers a variety of articles, ...
22,454
[ { "from": "human", "value": "I am tasked with updating a family of web sites that promote scientific conferences that cater to a niche scientific field. The sites are currently written with some modest CSS layout for the shared common page template structure, but the details of each page are a mishmash of ...
Recently WiFi encryption was brute forced by using the parellel processing power of the modern GPU. What other real-life problems do you think will benefit from similar techniques?
The parallel processing power of modern GPUs can be leveraged for a variety of real-life problems beyond brute-forcing WiFi encryption. Here are several areas where similar techniques can be beneficial: 1. **Scientific Simulations**: Fields such as physics, chemistry, and biology often involve complex simulations (e.g...
20,295
[ { "from": "human", "value": "Recently WiFi encryption was brute forced by using the parellel processing power of the modern GPU. What other real-life problems do you think will benefit from similar techniques?\n" }, { "from": "gpt", "value": "The parallel processing power of modern GPUs can be ...
We recently had a problem where, after a series of commits had occurred, a backend process failed to run. Now, we were good little boys and girls and ran rake test after every check-in but, due to some oddities in Rails' library loading, it only occurred when we ran it directly from Mongrel in production mode. I tracke...
Yes, there is a way to determine where a method is defined at runtime in Ruby, which can help you identify the source of method definitions, especially when dealing with overridden or monkey-patched methods. You can use the `method` method on an instance of the class and then check its source location. Here's how you ...
24,800
[ { "from": "human", "value": "We recently had a problem where, after a series of commits had occurred, a backend process failed to run. Now, we were good little boys and girls and ran rake test after every check-in but, due to some oddities in Rails' library loading, it only occurred when we ran it directly ...
How can I convert a relative path to an absolute path in C on Unix? Is there a convenient system function for this? On Windows there is a GetFullPathName function that does the job, but I didn't find something similar on Unix...
In Unix-based systems, you can convert a relative path to an absolute path using the `realpath` function from the `<stdlib.h>` library. The `realpath` function resolves all symbolic links, relative path components (like `.` and `..`), and produces an absolute path. Here's how you can use `realpath` in your C program: ...
22,786
[ { "from": "human", "value": "How can I convert a relative path to an absolute path in C on Unix?\nIs there a convenient system function for this?\nOn Windows there is a GetFullPathName function that does the job, but I didn't find something similar on Unix...\n" }, { "from": "gpt", "value": "In ...
I have a master page, with a help link in the top menu. This link should contain the a dynamic bookmark from the current page, so that the user scrolls to the help for the page he is currently seeing. <a href="help.aspx#[NameOfCurentPage]">Help</a> How would you implement this?
To create a dynamic bookmark link in your master page's menu that scrolls to the relevant help section based on the current page, you can follow these steps: 1. **Identify the Current Page**: Determine how you will identify the name of the current page. This can often be done using a server-side variable or script. 2...
23,568
[ { "from": "human", "value": "I have a master page, with a help link in the top menu. This link should contain the a dynamic bookmark from the current page, so that the user scrolls to the help for the page he is currently seeing.\n<a href=\"help.aspx#[NameOfCurentPage]\">Help</a>\n\nHow would you implement ...
I'm using Farpoint Spreadsheet for WinForms with C#. How can I disable the "context menu" displayed when right-clicking over a cell that is being edited?
To disable the context menu that appears when right-clicking a cell being edited in Farpoint Spreadsheet for WinForms, you can handle the `CellBeginEdit` event and set the `ContextMenuStrip` property of the cell to `null`. Here's how you can do it in your code: 1. Subscribe to the `CellBeginEdit` event for your `FpSp...
25,281
[ { "from": "human", "value": "I'm using Farpoint Spreadsheet for WinForms with C#. \nHow can I disable the \"context menu\" displayed when right-clicking over a cell that is being edited?\n" }, { "from": "gpt", "value": "To disable the context menu that appears when right-clicking a cell being ed...
I understand that IronPython is an implementation of Python on the .NET platform just like IronRuby is an implementation of Ruby and F# is more or less OCaml. What I can't seem to grasp is whether these languages perform closer to their "ancestors" or closer to something like C# in terms of speed. For example, is Ir...
IronPython is an implementation of Python that runs on the .NET Framework, and it does indeed have some similarities with how C# operates, but there are significant differences in performance characteristics due to the nature of the languages involved. ### Compilation and Execution 1. **Compilation**: IronPython is c...
23,640
[ { "from": "human", "value": "I understand that IronPython is an implementation of Python on the .NET platform just like IronRuby is an implementation of Ruby and F# is more or less OCaml. \nWhat I can't seem to grasp is whether these languages perform closer to their \"ancestors\" or closer to something li...
There is a store procedure that uses FREETEXTTABLE twice on two tables and then merges the results and returns the top 50. The problem is if I do a search on "Women of Brewster", the results returns "Confession of an ex doofus motha" with a rank of 143 from table A and second "Women of Brewster Place" with a rank of 1...
The behavior you're observing in your stored procedure involving the use of `FREETEXTTABLE` might not be directly related to the total counts of results returned by each table. Instead, it’s more about how the `FREETEXTTABLE` function processes and ranks the results based on the search terms you provided. ### Explanat...
22,554
[ { "from": "human", "value": "There is a store procedure that uses FREETEXTTABLE twice on two tables and then merges the results and returns the top 50. \nThe problem is if I do a search on \"Women of Brewster\", the results returns \"Confession of an ex doofus motha\" with a rank of 143 from table A and sec...
I am creating a lightweight editor in C# and would like to know the best method for converting a string into a nicely formatted XML string. I would hope that there's a public method in the C# library like "public bool FormatAsXml(string text, out string formattedXmlText)", but it couldn't be that easy, could it? Very ...
To format an unformatted XML string into a nicely formatted XML string in C#, you can use the `XDocument` and `XmlWriter` classes. There isn’t a built-in method like `FormatAsXml`, but you can create a method that accomplishes this. Below is a sample implementation of the `SomeMethod` that takes an unformatted XML str...
18,673
[ { "from": "human", "value": "I am creating a lightweight editor in C# and would like to know the best method for converting a string into a nicely formatted XML string. I would hope that there's a public method in the C# library like \"public bool FormatAsXml(string text, out string formattedXmlText)\", bu...
I'm trying to grab a div's ID in the code behind (C#) and set some css on it. Can I grab it from the DOM or do I have to use some kind of control? <div id="formSpinner"> <img src="images/spinner.gif" /> <p>Saving...</p> </div>
In ASP.NET, you can't directly manipulate the DOM elements like you would in client-side JavaScript. If you're working in the code-behind file (C#), you'll need to use server-side controls or find a way to access the element you want to manipulate using the ASP.NET server model. Here are two common approaches to set C...
22,973
[ { "from": "human", "value": "I'm trying to grab a div's ID in the code behind (C#) and set some css on it. Can I grab it from the DOM or do I have to use some kind of control?\n<div id=\"formSpinner\">\n <img src=\"images/spinner.gif\" />\n <p>Saving...</p>\n</div>\n\n" }, { "from": "gpt", ...
After much searching, I found the download for the eclipse version of jalopy. Is this compatible with Eclipse 3.4? It's dated 2006. I've copied the extracted folder to my plugins directory and run eclipse -clean, but I can't find anything matching 'jalopy' in preferences. If it's not compatible, are there any (free) a...
The version of Jalopy you're referring to is likely quite outdated, especially if it dates back to 2006. Compatibility with Eclipse 3.4 can be hit or miss, as Eclipse versions have undergone significant changes since then. Here are a few things you can try to troubleshoot: 1. **Check the Installation**: Ensure that ...
24,725
[ { "from": "human", "value": "After much searching, I found the download for the eclipse version of jalopy. Is this compatible with Eclipse 3.4? It's dated 2006.\nI've copied the extracted folder to my plugins directory and run eclipse -clean, but I can't find anything matching 'jalopy' in preferences.\nIf ...
I have a page that contains a form. This page is served with content type text/html;charset=utf-8. I need to submit this form to server using ISO-8859-1 character encoding. Is this possible with Internet Explorer? Setting accept-charset attribute to form element, like this, works for Firefox, Opera etc. but not for IE....
Submitting a form with a specific character encoding in Internet Explorer can be tricky, especially when dealing with the `accept-charset` attribute. While modern browsers usually respect the `accept-charset` attribute, older versions of Internet Explorer may not fully support it. Here are some potential workarounds y...
17,257
[ { "from": "human", "value": "I have a page that contains a form. This page is served with content type text/html;charset=utf-8. I need to submit this form to server using ISO-8859-1 character encoding. Is this possible with Internet Explorer?\nSetting accept-charset attribute to form element, like this, wor...
In Silverlight how can I launch / navigate to another page?
In Silverlight, you can navigate to another page using the `Frame` class, which is typically used for navigation within a Silverlight application. Here's how you can do it: 1. **Add a Frame to Your XAML**: Ensure you have a `Frame` control in your main page or application. If you don’t have a frame yet, you can add on...
24,507
[ { "from": "human", "value": "In Silverlight how can I launch / navigate to another page?\n" }, { "from": "gpt", "value": "In Silverlight, you can navigate to another page using the `Frame` class, which is typically used for navigation within a Silverlight application. Here's how you can do it:\n...
I've used SubSonic in a few POC projects, but nothing large. It's so easy to use, and it's possible to abstract away the fact that it uses the active record pattern (can move it toward a more domain driven approach). Has anyone on here used SubSonic on larger applications, and what kind of performance did you witness? ...
SubSonic is indeed a popular choice for rapid application development, especially for smaller projects and proofs of concept (POCs) due to its simplicity and ease of use. Many developers appreciate its active record pattern, which can speed up development by allowing for quick data manipulation without the overhead of ...
25,412
[ { "from": "human", "value": "I've used SubSonic in a few POC projects, but nothing large. It's so easy to use, and it's possible to abstract away the fact that it uses the active record pattern (can move it toward a more domain driven approach).\nHas anyone on here used SubSonic on larger applications, and ...
We have a system that is used by a few hundred separate customers, at the end of the month the customer likes to generate a report of the activity with his/her clients. These reports are nothing special; they maybe contain a logo, address and a few lines of mathematical data. Currently we use Crystal Reports but that i...
If you're looking for alternatives to Crystal Reports for generating reports from a web application with a focus on PDF generation, there are several options you can consider. Here are a few popular libraries and frameworks: 1. **JasperReports**: - A powerful reporting library that can generate reports in various f...
20,516
[ { "from": "human", "value": "We have a system that is used by a few hundred separate customers, at the end of the month the customer likes to generate a report of the activity with his/her clients. These reports are nothing special; they maybe contain a logo, address and a few lines of mathematical data. Cu...
I've read a lot of people saying that some things shouldn't be written in an object orientated style - as a person learning the OO style coming from a C background, what do they mean by this? What shouldn't be OO, why do some things fit this design better, and how do we know when it's best to do what?
The debate over whether to use Object-Oriented (OO) programming versus other paradigms (like procedural programming, functional programming, etc.) stems from the nature of the problem being solved and the design principles being applied. Here’s a breakdown of when OO is suitable, when it might not be, and how to discer...
17,518
[ { "from": "human", "value": "I've read a lot of people saying that some things shouldn't be written in an object orientated style - as a person learning the OO style coming from a C background, what do they mean by this?\nWhat shouldn't be OO, why do some things fit this design better, and how do we know wh...
I'm new to Delphi, and I've been running some tests to see what object variables and stack variables are initialized to by default: TInstanceVariables = class fBoolean: boolean; // always starts off as false fInteger: integer; // always starts off as zero fObject: TObject; // always starts off as nil end; This i...
In Delphi, the behavior you are experiencing with instance variables and stack (procedure-level) variables is consistent with the language's design, but it’s important to understand the nuances to ensure safe coding practices. ### Instance Variables For instance variables of a class (like your `TInstanceVariables` cl...
24,564
[ { "from": "human", "value": "I'm new to Delphi, and I've been running some tests to see what object variables and stack variables are initialized to by default:\nTInstanceVariables = class\n fBoolean: boolean; // always starts off as false\n fInteger: integer; // always starts off as zero\n fObject: TObj...
I found this: http://www.evolt.org/failover-database-connection-with-php-mysql and similar examples. But is there a better way? I am thinking along the lines of the Automatic Failover Client in the MS SQL Native Client.
Automatic failover mechanisms can be a crucial aspect of building robust database applications, especially when working with critical systems that require high availability. While the article you referenced discusses handling failover in PHP with MySQL, there are certainly more advanced and automated ways to achieve th...
22,159
[ { "from": "human", "value": "I found this:\nhttp://www.evolt.org/failover-database-connection-with-php-mysql\nand similar examples. But is there a better way?\nI am thinking along the lines of the Automatic Failover Client in the MS SQL Native Client.\n" }, { "from": "gpt", "value": "Automatic f...
I love Python because it comes batteries included, and I use built-in functions, a lot, to do the dirty job for me. I have always been using happily the os.path module to deal with file path but recently I ended up with unexpected results on Python 2.5 under Ubuntu linux, while dealing with string that represent window...
The behavior you're experiencing is due to the fact that the `os.path` module in Python does not handle Windows-style paths correctly when you are running on a Unix-like system (like Ubuntu). The `os.path` module is designed to work with the native path format of the operating system it is running on. ### Explanation:...
21,408
[ { "from": "human", "value": "I love Python because it comes batteries included, and I use built-in functions, a lot, to do the dirty job for me.\nI have always been using happily the os.path module to deal with file path but recently I ended up with unexpected results on Python 2.5 under Ubuntu linux, while...
What is the easiest way to find out how much memory an object uses in .NET? Preferably without having to resort to a third party tool. Marshal.SizeOf or the sizeof operator look useful but only work with a restricted range of types. Some related posts: Object Memory Analysis in .NET Does an empty array in .NET use an...
In .NET, determining the exact memory footprint of an object can be a bit complex, primarily because the runtime environment manages memory allocation and garbage collection. However, you can estimate the size of an object using a few methods, and it’s true that `Marshal.SizeOf` and `sizeof` only work with specific typ...
18,621
[ { "from": "human", "value": "What is the easiest way to find out how much memory an object uses in .NET?\nPreferably without having to resort to a third party tool. Marshal.SizeOf or the sizeof operator look useful but only work with a restricted range of types.\nSome related posts:\n\nObject Memory Analys...
We have developed a software system using ActiveX/COM (VB6) technology from microsoft. In the last year, i get more and more interested in automated build processes and SCM at a whole. I intensively searched big parts of the web for information about best practices how to do scm with COM based software systems. The "pr...
Building a reliable automated build system for VB6 and COM-based projects can be challenging due to the unique way that COM handles interfaces and references. However, you can implement several best practices and strategies to help streamline this process. ### Best Practices for Automated Build System with VB6 and COM...
18,540
[ { "from": "human", "value": "We have developed a software system using ActiveX/COM (VB6) technology from microsoft. In the last year, i get more and more interested in automated build processes and SCM at a whole. I intensively searched big parts of the web for information about best practices how to do scm...
Anybody have a slicker way to do this? Seems like it should be easier than this, but I'm having a mental block. Basically I need to remove items from an dictionary and recurse into the values of the items that are also dictionaries. private void RemoveNotPermittedItems(ActionDictionary menu) { var keysToRemove = ...
It looks like you're trying to clean up a nested dictionary by removing entries based on some permission checks, and you're facing some complexity due to the recursion. While your approach is functional, there are indeed ways to make it a bit cleaner and possibly more efficient. Here's a refactored version of your `R...
24,646
[ { "from": "human", "value": "Anybody have a slicker way to do this? Seems like it should be easier than this, but I'm having a mental block. Basically I need to remove items from an dictionary and recurse into the values of the items that are also dictionaries.\nprivate void RemoveNotPermittedItems(Action...
Is there a way to have a default parameter passed to a action in the case where the regex didnt match anything using django? urlpatterns = patterns('',(r'^test/(?P<name>.*)?$','myview.displayName')) #myview.py def displayName(request,name): # write name to response or something I have tried setting the third p...
In Django, when you define a URL pattern with a regex, if the regex does not match anything, the `name` parameter in your view function will not be populated, leading it to be `None`. This means that, even if you try to set a default value in the URL patterns, it won't have any effect. However, you can achieve the de...
23,989
[ { "from": "human", "value": "Is there a way to have a default parameter passed to a action in the case where the regex didnt match anything using django?\n\nurlpatterns = patterns('',(r'^test/(?P<name>.*)?$','myview.displayName'))\n\n#myview.py\ndef displayName(request,name):\n # write name to response...
i sync a database via wcf service to sql ce databases on my clients. however, i don't want the schema generated on the client side to be the same, as the one on the server. is there a way to customize the schema returned to the client syncproviders?
Yes, you can customize the schema returned to client sync providers when using WCF services for database synchronization. The approach generally involves overriding default behavior during the sync process and providing a customized schema to the client. Here's a general approach you can take: ### 1. Use a Custom Syn...
23,557
[ { "from": "human", "value": "i sync a database via wcf service to sql ce databases on my clients.\nhowever, i don't want the schema generated on the client side to be the\nsame, as the one on the server.\nis there a way to customize the schema returned to the client syncproviders?\n" }, { "from": "g...
It seems Scrum and Agile tests/assertions are becoming popular this year. For example, Nokia test for Scrum. I don't think it is a good idea to have such tests at all. What do you think?
The growing popularity of tests and assessments for Scrum and Agile methodologies, such as the Nokia test, reflects a broader trend towards quantifying and ensuring adherence to Agile principles. While there are pros and cons to this approach, it's important to consider several factors: ### Pros: 1. **Standardization*...
24,340
[ { "from": "human", "value": "It seems Scrum and Agile tests/assertions are becoming popular this year. For example, Nokia test for Scrum. I don't think it is a good idea to have such tests at all. What do you think?\n" }, { "from": "gpt", "value": "The growing popularity of tests and assessments...
I'm working on a form that will display links to open different types of reports. This system has different types of users, so the users should only be able to see the links to the types of reports they can access. Currently, the way I have this set up is that I have an ArrayList of LinkLabels, but the problem I'm hav...
To effectively manage your `LinkLabels` in an ArrayList and ensure that each one has its own `LinkClicked` event, you can use a single event handler that differentiates between the links based on their tags or associated data. Here's a simple approach to achieve this: 1. **Define Your LinkLabels**: Create your `LinkLa...
17,093
[ { "from": "human", "value": "I'm working on a form that will display links to open different types of reports. This system has different types of users, so the users should only be able to see the links to the types of reports they can access.\nCurrently, the way I have this set up is that I have an ArrayL...
If I have a control on a page that has its Datasource set to a DataReader, does that control consume the reader at the time the Datasource is set, or does the datareader continue to exist until Databind has been executed? What actually happens under the covers when Databind is executed?
When you set a control's `DataSource` property to a `DataReader`, the `DataReader` does not get consumed immediately at the time of assignment. Instead, the `DataReader` continues to exist until the `DataBind` method is called on the control. ### How It Works 1. **DataSource Assignment**: When you assign the `DataRea...
21,869
[ { "from": "human", "value": "If I have a control on a page that has its Datasource set to a DataReader, does that control consume the reader at the time the Datasource is set, or does the datareader continue to exist until Databind has been executed? \nWhat actually happens under the covers when Databind is...
Is there a command like cat in linux which can return a specified quantity of characters from a file? e.g., I have a text file like: Hello world this is the second line this is the third line And I want something that would return the first 5 characters, which would be "hello". thanks
Yes, you can use the `head` command combined with `cut` or `dd` to achieve this in Linux. Here are a few methods: ### Method 1: Using `head` and `cut` You can use `head` to grab the first line and then `cut` to extract the first 5 characters: ```bash head -c 5 filename.txt ``` ### Method 2: Using `dd` The `dd` com...
26,690
[ { "from": "human", "value": "Is there a command like cat in linux which can return a specified quantity of characters from a file?\ne.g., I have a text file like:\nHello world\nthis is the second line\nthis is the third line\n\nAnd I want something that would return the first 5 characters, which would be \"...
I've been asked to display the 'correct' time on our website which I frankly feel is rather pointless as 'correct' can be interpretted in such a variety of ways. Our current method definately results in an inaccurate time as it uses a server control rendering JavaScript that runs onload using the datetime from the serv...
You're absolutely right to question the concept of "correct" time as it can vary based on context, and achieving an accurate representation of time on a web application can indeed be tricky. Here are some angles and considerations you might want to bring into your discussions with management: ### 1. User Experience vs...
24,963
[ { "from": "human", "value": "I've been asked to display the 'correct' time on our website which I frankly feel is rather pointless as 'correct' can be interpretted in such a variety of ways.\nOur current method definately results in an inaccurate time as it uses a server control rendering JavaScript that ru...
We have a RTE editor based on htmlarea which consists of content with editmode enabled inside an iframe. The question is how to automatically bring the focus into the editor?
To automatically bring the focus into an HTML area editor inside an iframe, you'll need to ensure that you correctly reference the iframe and the editor's content. The focus can usually be set using JavaScript. Here's a step-by-step guide on how to achieve this: ### Steps to Focus the Editor Inside an Iframe 1. **Ide...
18,564
[ { "from": "human", "value": "We have a RTE editor based on htmlarea which consists of content with editmode enabled inside an iframe. The question is how to automatically bring the focus into the editor?\n" }, { "from": "gpt", "value": "To automatically bring the focus into an HTML area editor i...
Ok, there are a million regexes out there for validating an email address, but how about some basic email validation that can be integrated into a TSQL query for Sql Server 2005? I don't want to use a CLR procedure or function. Just straight TSQL. Has anybody tackled this already?
Validating email addresses in T-SQL can be somewhat limited compared to regular expressions in other programming languages. However, you can implement a basic email validation by checking for the presence of the `@` symbol, a dot (`.`) after the `@`, and some other simple conditions. Here’s an example of a simple T-SQ...
23,346
[ { "from": "human", "value": "Ok, there are a million regexes out there for validating an email address, but how about some basic email validation that can be integrated into a TSQL query for Sql Server 2005?\nI don't want to use a CLR procedure or function. Just straight TSQL.\nHas anybody tackled this alr...
In PHP, I am able to use a normal function as a variable without problem, but I haven't figured out how to use a static method. Am I just missing the right syntax, or is this not possible? (EDIT: the first suggested answer does not seem to work. I've extended my example to show the errors returned.) function foo1($a,...
In PHP, static methods can be referenced as variables, but the syntax differs from that of regular functions. For static methods, you can use an array format with the class name or `self` along with the method name. Here's how you can achieve that with your example: ```php function foo1($a, $b) { return $a / $b; }...
23,731
[ { "from": "human", "value": "In PHP, I am able to use a normal function as a variable without problem, but I haven't figured out how to use a static method. Am I just missing the right syntax, or is this not possible?\n(EDIT: the first suggested answer does not seem to work. I've extended my example to sh...
We have a project consisting of multiple subprojects. With each subproject we potentially have some hibernate mapping files but in the end only one actual hibernate session. Those subprojects could be combined in several ways, some depend on each other. My problem is that actually I want to have a SessionFactoryBean wh...
Creating a `SessionFactoryBean` that can dynamically collect Hibernate mapping files from multiple subprojects can be a bit complex, but it is definitely achievable. Below is a conceptual approach and sample code that can help you implement this functionality. ### Step 1: Create a Custom `SessionFactoryBean` You can ...
13,266
[ { "from": "human", "value": "We have a project consisting of multiple subprojects. With each subproject we potentially have some hibernate mapping files but in the end only one actual hibernate session. Those subprojects could be combined in several ways, some depend on each other. My problem is that actual...
I have a website where people can upload documents, and view them later at their convenience. I store the binary info along with the mime type in my db, and later just stream the binary content straight to the browser. This works for for every file type except Office 2007 files. When I try to view the Office 2007 files...
The issue you're encountering with Office 2007 files (like .docx, .xlsx, etc.) often arises from how these files are served by the web server and how the browser handles them. The credential prompts you are seeing typically occur when the server is expecting authentication or when there are issues related to the MIME t...
21,977
[ { "from": "human", "value": "I have a website where people can upload documents, and view them later at their convenience. I store the binary info along with the mime type in my db, and later just stream the binary content straight to the browser.\nThis works for for every file type except Office 2007 files...
If I drag and drop a selection of a webpage from Firefox to HTML-Kit, HTML-Kit asks me whether I want to paste as text or HTML. If I select "text," I get this: Version:0.9 StartHTML:00000147 EndHTML:00000516 StartFragment:00000181 EndFragment:00000480 SourceURL:http://en.wikipedia.org/wiki/Herodotus <html><body> <!--St...
The data format you see in your example is known as CF_HTML (Clipboard Format HTML). It's a specific clipboard format primarily used in Windows for transferring HTML content, including additional metadata like the start and end points of the HTML content. ### Behavior on Different Platforms 1. **OS X**: On macOS, th...
20,380
[ { "from": "human", "value": "If I drag and drop a selection of a webpage from Firefox to HTML-Kit, HTML-Kit asks me whether I want to paste as text or HTML. If I select \"text,\" I get this:\nVersion:0.9\nStartHTML:00000147\nEndHTML:00000516\nStartFragment:00000181\nEndFragment:00000480\nSourceURL:http://en...
I have a legacy application that is written in C# and it displays a very complex treeview with 10 to 20 thousand elements. In the past I encountered a similar problem (but in C++) that i solved with the OWNERDATA capability offered by the Win32 API. Is there a similar mechanism in C#? EDIT: The plan is to optimize the ...
In C#, particularly when working with Windows Forms or WPF, there are ways to manage large data sets in a TreeView efficiently. However, C# does not natively provide an equivalent to the Win32 API's `OWNERDATA` mechanism for TreeView controls. Here are several strategies you can implement to optimize the performance of...
18,504
[ { "from": "human", "value": "I have a legacy application that is written in C# and it displays a very complex treeview with 10 to 20 thousand elements.\nIn the past I encountered a similar problem (but in C++) that i solved with the OWNERDATA capability offered by the Win32 API.\nIs there a similar mechanis...
How do you configure cruiseControl to send out emails that contains the error log whenever a build fails? I've gotten it to send out emails to users when the build fails, but it does not include the actual error that caused the build to fail. I know that if I only configure it to send out emails to the users that hav...
To configure CruiseControl to send out emails containing the error log whenever a build fails, you'll need to ensure that the `includeDetails` attribute is set correctly, and you may want to explore using a different email publisher or adding additional configurations to include the error log explicitly. Here's a basi...
24,313
[ { "from": "human", "value": "How do you configure cruiseControl to send out emails that contains the error log whenever a build fails? I've gotten it to send out emails to users when the build fails, but it does not include the actual error that caused the build to fail. I know that if I only configure it...
I know I can do this foreach (PropertyInfo property in myobject.GetType().GetProperties()) { if (property.DeclaringType.ToString() == myobject.GetType().ToString()) { // only have my object properties here // and not parent of my object properties } } But how can I just get the propertie...
You're on the right track! To retrieve only the properties declared on the specific type of an object (excluding properties inherited from parent classes), you can use the `BindingFlags` enumeration with the `GetProperties` method. Here is the correct usage with `BindingFlags.DeclaredOnly`, which ensures that only pro...
26,878
[ { "from": "human", "value": "I know I can do this \nforeach (PropertyInfo property in myobject.GetType().GetProperties())\n{\n if (property.DeclaringType.ToString() == myobject.GetType().ToString())\n {\n // only have my object properties here\n // and not parent of my object propertie...
In history-books you often have timeline, where events and periods are marked on a line in the correct relative distance to each other. How is it possible to create something similar in LaTeX?
Creating a timeline in LaTeX can be effectively achieved using the `tikz` package, which allows for the creation of graphics programmatically. Below is an example of how to create a simple timeline using TikZ. First, make sure to include the `tikz` package in the preamble of your LaTeX document: ```latex \documentcla...
23,400
[ { "from": "human", "value": "In history-books you often have timeline, where events and periods are marked on a line in the correct relative distance to each other. How is it possible to create something similar in LaTeX?\n" }, { "from": "gpt", "value": "Creating a timeline in LaTeX can be effec...
How can I pass arguments to a constructor in an IOC-framework? I want to do something like: (Trying to be IOC-framework agnostic ;) ) object objectToLogFor = xxx; container.Resolve<ILogging>(objectToLogFor); public class MyLogging : ILogging { public MyLogging(object objectToLogFor){} } It seems that this is not...
In Dependency Injection (DI) and Inversion of Control (IoC) frameworks, the typical use case is to have the container manage the lifecycle of your objects and their dependencies. However, passing custom parameters directly to constructors is not always straightforward, as most IoC containers are designed to resolve dep...
22,211
[ { "from": "human", "value": "How can I pass arguments to a constructor in an IOC-framework?\nI want to do something like: (Trying to be IOC-framework agnostic ;) )\nobject objectToLogFor = xxx;\ncontainer.Resolve<ILogging>(objectToLogFor); \n\npublic class MyLogging : ILogging\n{\n public MyLogging(objec...
How do I change Oracle from port 8080? My Eclipse is using 8080, so I can't use that.
To change the Oracle database listener port from 8080 to another port (for example, 1521, which is commonly used), you will need to follow these steps. Note that this is primarily for the Oracle Listener service that communicates with the database, not specifically for the database itself. Here’s how to do it: ### Ste...
22,977
[ { "from": "human", "value": "How do I change Oracle from port 8080? My Eclipse is using 8080, so I can't use that.\n" }, { "from": "gpt", "value": "To change the Oracle database listener port from 8080 to another port (for example, 1521, which is commonly used), you will need to follow these ste...
I have a simple SQL Server 2005 Reporting Services report with a bar chart. When I print directly from the preview window in Visual Studio everything looks good, but if I export the report to a PDF file and print it then the labels and even some of the vertical lines come out pixelated. How can I increase the resolutio...
To address the issue of pixelation in the PDF export from SQL Server Reporting Services (SSRS), consider the following options: 1. **Use `HumanReadablePDF`**: While you've already mentioned trying this setting, it's worth noting that although it increases the file size, it doesn't always enhance the visual quality of ...
22,123
[ { "from": "human", "value": "I have a simple SQL Server 2005 Reporting Services report with a bar chart. When I print directly from the preview window in Visual Studio everything looks good, but if I export the report to a PDF file and print it then the labels and even some of the vertical lines come out pi...
I need to copy data values from one element to another, but jQuery's clone() method doesn't clone the data. And I can't iterate over the data either: element.data().each because data() is a function and not a jQuery object. It seems I have to keep a separate list of attribute names and reference those but that seems t...
In jQuery, the `clone()` method does not clone the data attributes associated with an element, which can indeed be a limitation when you're trying to copy an element along with its associated data. However, there are ways to achieve your goal, either by iterating over the data or by manually cloning the data after usin...
16,940
[ { "from": "human", "value": "I need to copy data values from one element to another, but jQuery's clone() method doesn't clone the data. And I can't iterate over the data either:\nelement.data().each\n\nbecause data() is a function and not a jQuery object. It seems I have to keep a separate list of attribut...