instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Does anyone know if it is possible to detect whether the browser has closed the connection during the execution of a long PHP script, when using apache and mod_php? For example, in Java, the HttpOutputStream will throw an exception if one attempts to write to it after the browser has closed it -- Or will respond negati...
In PHP, especially when using Apache and mod_php, there is no direct built-in way to detect if a browser has closed the connection during the execution of a long-running script. However, you can implement some strategies to check if the connection is still open. ### 1. `connection_aborted()` PHP provides a function ca...
4,000
[ { "from": "human", "value": "Does anyone know if it is possible to detect whether the browser has closed the connection during the execution of a long PHP script, when using apache and mod_php?\nFor example, in Java, the HttpOutputStream will throw an exception if one attempts to write to it after the brows...
I currently use AnkhSVN to integrate subversion into Visual Studio. Is there any reason I should switch to VisualSVN? AnkhSVN is free (in more than one sense of the word) while VisualSVN costs $50. So right there unless I'm missing some great feature of VisualSVN I don't see any reason to switch.
When considering a switch from AnkhSVN to VisualSVN for Subversion integration in Visual Studio, there are a few factors to weigh: ### 1. **Cost** - As you mentioned, AnkhSVN is free, while VisualSVN costs $50. If budget is a concern and AnkhSVN meets your needs, this is a significant factor. ### 2. **Features and...
4,960
[ { "from": "human", "value": "I currently use AnkhSVN to integrate subversion into Visual Studio. Is there any reason I should switch to VisualSVN?\nAnkhSVN is free (in more than one sense of the word) while VisualSVN costs $50. So right there unless I'm missing some great feature of VisualSVN I don't see an...
I have an array of mouse points, a stroke width, and a softness. I can draw soft circles and soft lines. Which algorithm should I use for drawing my array of points? I want crossed lines to look nice as well as end points.
To draw soft circles and soft lines while handling crossed lines gracefully, you may want to consider a combination of techniques. A popular approach is to use a method based on **perlin noise** or **bezier curves** for the smoothness and softness of the lines, coupled with the following algorithms: ### 1. **Soft Circ...
3,853
[ { "from": "human", "value": "I have an array of mouse points, a stroke width, and a softness. I can draw soft circles and soft lines. Which algorithm should I use for drawing my array of points? I want crossed lines to look nice as well as end points. \n" }, { "from": "gpt", "value": "To draw so...
What is the Java equivalent of PHP's $_POST? After searching the web for an hour, I'm still nowhere closer.
In Java, especially when using servlets, you can access data sent via HTTP POST requests similarly to how you would use `$_POST` in PHP. In Java servlets, this data can be retrieved using the `HttpServletRequest` object. Here’s a basic example of how to handle a POST request in a Java servlet: ### Step 1: Create a Se...
2,435
[ { "from": "human", "value": "What is the Java equivalent of PHP's $_POST? After searching the web for an hour, I'm still nowhere closer.\n" }, { "from": "gpt", "value": "In Java, especially when using servlets, you can access data sent via HTTP POST requests similarly to how you would use `$_POS...
Is there an effective tool to convert C# code to Java code?
Yes, there are several tools that can help convert C# code to Java code, although the effectiveness of these tools can vary based on the complexity of the code being converted. Here are a few options you might consider: 1. **Sharpen**: This is an Eclipse plugin that can translate C# code into Java. It may not handle a...
4,913
[ { "from": "human", "value": "Is there an effective tool to convert C# code to Java code?\n" }, { "from": "gpt", "value": "Yes, there are several tools that can help convert C# code to Java code, although the effectiveness of these tools can vary based on the complexity of the code being converte...
When compiling from source, I never know which configure flags to use to optimize the compilation for my environment. Assume the following hardware/OS: Single Core, 2 GHz Intel 512MB Ram Debian 4 I usually just go with ./configure --prefix=/usr/local Should I be doing anything else?
When compiling software from source, using `./configure --prefix=/usr/local` is a good starting point. However, to optimize for your specific hardware and operating system, you can add additional flags that tailor the compilation process to your environment, especially given your hardware constraints (single-core CPU a...
3,815
[ { "from": "human", "value": "When compiling from source, I never know which configure flags to use to optimize the compilation for my environment. Assume the following hardware/OS:\n\nSingle Core, 2 GHz Intel\n512MB Ram\nDebian 4\n\nI usually just go with \n./configure --prefix=/usr/local\nShould I be doing...
I'm mainly a C# developer, but I'm currently working on a project in Python. How can I represent the equivalent of an Enum in Python?
In Python, you can represent an enumeration (enum) using the `enum` module, which was introduced in Python 3.4. This module provides a way to create enumerations, which are a set of symbolic names bound to unique, constant values. Here's how you can create and use an enum in Python: 1. **Import the Enum class** from t...
4,346
[ { "from": "human", "value": "I'm mainly a C# developer, but I'm currently working on a project in Python.\nHow can I represent the equivalent of an Enum in Python? \n" }, { "from": "gpt", "value": "In Python, you can represent an enumeration (enum) using the `enum` module, which was introduced ...
The MediaElement doesn't support rounded corners (radiusx, radiusy). Should I use a VideoBrush on a Rectangle with rounded corners?
Yes, using a `VideoBrush` on a `Rectangle` with rounded corners is a common workaround for achieving rounded corners in media playback when the `MediaElement` does not support them directly. Here’s how you can implement it: 1. **Create a `Rectangle` with rounded corners**: You can define a `Rectangle` with a `RadiusX...
4,263
[ { "from": "human", "value": "The MediaElement doesn't support rounded corners (radiusx, radiusy). Should I use a VideoBrush on a Rectangle with rounded corners?\n" }, { "from": "gpt", "value": "Yes, using a `VideoBrush` on a `Rectangle` with rounded corners is a common workaround for achieving r...
Instead of writing my ASP.NET C# applications in Visual Studio, I used my favorite text editor UltraEdit32. Is there any way I can implement MVC without the use of VS?
Yes, you can absolutely implement MVC (Model-View-Controller) applications in ASP.NET without using Visual Studio. While Visual Studio provides a rich IDE that simplifies many tasks, you can use any text editor, including UltraEdit32, along with the .NET CLI (Command-Line Interface) to create and manage your ASP.NET MV...
1,316
[ { "from": "human", "value": "Instead of writing my ASP.NET C# applications in Visual Studio, I used my favorite text editor UltraEdit32.\nIs there any way I can implement MVC without the use of VS?\n" }, { "from": "gpt", "value": "Yes, you can absolutely implement MVC (Model-View-Controller) app...
I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when connecting to the server using SQL Management Studio?
To connect to a Microsoft SQL Server 2005 instance that is listening on a port other than the default port 1433 using SQL Server Management Studio (SSMS), you can specify the port number in the server name field in the following format: ``` <ServerName>,<PortNumber> ``` For example, if your SQL Server instance is loc...
5,693
[ { "from": "human", "value": "I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when connecting to the server using SQL Management Studio?\n" }, { "from": "gpt", "value": "To connect to a Microsoft SQL Server 2005 instance ...
I am currently in the process of creating my own blog and I have got to marking up the comments, but what is the best way to mark it up? The information I need to present is: Persons Name Gravatar Icon Comment Date The Comment PS: I'm only interested in semantic HTML markup.
When creating a blog comment section using semantic HTML, it is important to structure your markup in a way that accurately represents the content while remaining accessible. Here’s a recommended approach for marking up comments using HTML5 semantic elements: ```html <article class="comment"> <header> <div...
2,466
[ { "from": "human", "value": "I am currently in the process of creating my own blog and I have got to marking up the comments, but what is the best way to mark it up?\nThe information I need to present is:\n\nPersons Name\nGravatar Icon\nComment Date\nThe Comment\n\nPS: I'm only interested in semantic HTML m...
I am aware of Capistrano, but it is a bit too heavyweight for me. Personally, I set up two Mercurial repositories, one on the production server and another on my local dev machine. Regularly, when a new feature is ready, I push changes from repository on my local machine to repository on the server, then update on the ...
Your current method of using Mercurial repositories for code deployment is straightforward and works for syncing files, but as you've noted, it doesn't address database migrations or updates. To manage database changes effectively, you can adopt a strategy that combines version control for your code with a database mig...
4,062
[ { "from": "human", "value": "I am aware of Capistrano, but it is a bit too heavyweight for me. Personally, I set up two Mercurial repositories, one on the production server and another on my local dev machine. Regularly, when a new feature is ready, I push changes from repository on my local machine to repo...
std::vector<int> ints; // ... fill ints with random values for(std::vector<int>::iterator it = ints.begin(); it != ints.end(); ) { if(*it < 10) { *it = ints.back(); ints.pop_back(); continue; } it++; } This code is not working because when pop_back() is called, it is invalidat...
In C++, the `std::vector` class provides a dynamic array that can grow and shrink in size. The iterator's validity can be affected by several operations, including adding or removing elements. ### Iterator Invalidation For `std::vector`, the following operations may invalidate iterators: 1. **Insertion operations** ...
3,501
[ { "from": "human", "value": "std::vector<int> ints;\n\n// ... fill ints with random values\n\nfor(std::vector<int>::iterator it = ints.begin(); it != ints.end(); )\n{\n if(*it < 10)\n {\n *it = ints.back();\n ints.pop_back();\n continue;\n }\n it++;\n}\n\nThis code is not wo...
Why are unsigned integers not CLS compliant? I am starting to think the type specification is just for performance and not for correctness.
Unsigned integers are not considered Common Language Specification (CLS) compliant primarily because the CLS is designed to ensure that different .NET languages can interact with each other seamlessly. The CLS provides a set of rules and guidelines that all CLS-compliant languages must adhere to, allowing for consisten...
4,880
[ { "from": "human", "value": "Why are unsigned integers not CLS compliant?\nI am starting to think the type specification is just for performance and not for correctness.\n" }, { "from": "gpt", "value": "Unsigned integers are not considered Common Language Specification (CLS) compliant primarily ...
Dictionaries unlike lists are not ordered (and do not have the 'sort' attribute). Therefore, you can not rely on getting the items in the same order when first added. What is the easiest way to loop through a dictionary containing strings as the key value and retrieving them in ascending order by key? For example, you...
To loop through a dictionary and retrieve its items in ascending order by key, you can use the `sorted()` function along with a for loop. Here’s how you can do it: ```python d = {'b': 'this is b', 'a': 'this is a', 'c': 'this is c'} # Sort the dictionary by keys and print the associated values for key in sorted(d.key...
7,004
[ { "from": "human", "value": "Dictionaries unlike lists are not ordered (and do not have the 'sort' attribute). Therefore, you can not rely on getting the items in the same order when first added. \nWhat is the easiest way to loop through a dictionary containing strings as the key value and retrieving them i...
Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing Func<T, bool> vs. Predicate<T> I would imagine there is no difference as both take a generic parameter and return bool?
In C#, both `Func<T, bool>` and `Predicate<T>` are delegates that can be used to represent methods that take an argument of type `T` and return a boolean value. Here's a brief overview of each: - **Func<T, bool>**: This is a generic delegate that can represent any method with a single parameter of type `T` and a retur...
4,950
[ { "from": "human", "value": "Haven't fired up reflector to look at the difference but would one expect to see the exact same compiled code when comparing Func<T, bool> vs. Predicate<T> \nI would imagine there is no difference as both take a generic parameter and return bool?\n" }, { "from": "gpt", ...
Is there an incantation of mysqldump or a similar tool that will produce a piece of SQL2003 code to create and fill the same databases in an arbitrary SQL2003 compliant RDBMS? (The one I'm trying right now is MonetDB)
While `mysqldump` is specifically designed for MySQL, there isn't a direct equivalent that generates SQL code compliant with SQL:2003 for arbitrary RDBMS systems like MonetDB. However, there are some approaches you can take to achieve your goal: ### 1. **Using `mysqldump` with Modifications** You can use `mysqldump` t...
4,923
[ { "from": "human", "value": "Is there an incantation of mysqldump or a similar tool that will produce a piece of SQL2003 code to create and fill the same databases in an arbitrary SQL2003 compliant RDBMS? \n(The one I'm trying right now is MonetDB)\n" }, { "from": "gpt", "value": "While `mysqldu...
Is there any UI library that can be to build both a text user interface (ncurses) and graphical user interface (GTK? QT?) from the same source? I know that debconf can be used with various frontends, I would like to build something similar but programmable.
Yes, there are several UI libraries and frameworks that allow you to create applications that can have both a text user interface (TUI) using something like ncurses and a graphical user interface (GUI) using libraries like GTK or Qt, all from the same source code. Here are a few options: 1. **Dear ImGui**: While prima...
1,320
[ { "from": "human", "value": "Is there any UI library that can be to build both a text user interface (ncurses) and graphical user interface (GTK? QT?) from the same source?\nI know that debconf can be used with various frontends, I would like to build something similar but programmable.\n" }, { "fro...
Is there something special about Safari for Windows and AJAX? In other words: Are there some common pitfalls I should keep in mind?
Safari for Windows has not been actively maintained since 2012, and it lacks many of the updates and features found in modern browsers. If you're developing web applications using AJAX (Asynchronous JavaScript and XML), there are several pitfalls and considerations to keep in mind when targeting Safari for Windows: 1....
4,611
[ { "from": "human", "value": "Is there something special about Safari for Windows and AJAX?\nIn other words: Are there some common pitfalls I should keep in mind?\n" }, { "from": "gpt", "value": "Safari for Windows has not been actively maintained since 2012, and it lacks many of the updates and ...
Browse to a webpage with hyperlinks using IE (I am using IE7) Once on the page, enlarge the fonts using ctl + mouse wheel. Now when you try to hover over the hyperlinks, they are laterally displaced to the right. To click on the link, i have to move the mouse to the right till the cursor turns into a hand. Anyone ha...
The issue you're experiencing with Internet Explorer 7 (IE7) is not uncommon, especially with older versions of web browsers. Here are some possible explanations and solutions: ### Possible Causes 1. **Rendering Issues**: Older browsers like IE7 have rendering engines that may not fully support modern web standards. ...
4,620
[ { "from": "human", "value": "Browse to a webpage with hyperlinks using IE (I am using IE7) Once on the page, enlarge the fonts using ctl + mouse wheel. Now when you try to hover over the hyperlinks, they are laterally displaced to the right. To click on the link, i have to move the mouse to the right till...
Linq To SQL or Entity framework both integrate nicely with SQL Server 2005. The SQL Server 2008 spec sheet promises even better integration - but I can't see it. What are some examples of what you can do Linq-wise when talking to a 2008 server that you can't when talking to SQL Server 2005?
While LINQ to SQL and Entity Framework both provide powerful ways to work with data, the improvements in SQL Server 2008 do enhance some capabilities, especially when leveraging new features of the database. Here are some examples of what you can do with LINQ when working with SQL Server 2008 that either weren't possib...
3,283
[ { "from": "human", "value": "Linq To SQL or Entity framework both integrate nicely with SQL Server 2005.\nThe SQL Server 2008 spec sheet promises even better integration - but I can't see it.\nWhat are some examples of what you can do Linq-wise when talking to a 2008 server that you can't when talking to SQ...
Knowing an exception code, is there a way to find out more about what the actual exception that was thrown means? My exception in question: 0x64487347 Exception address: 0x1 The call stack shows no information. I'm reviewing a .dmp of a crash and not actually debugging in Visual Studio.
Yes, you can find out more about what an exception code means by using a few different approaches, even if you’re not in a live debugging session with Visual Studio. The exception code you've encountered is `0x64487347`, which is not a standard Windows exception code. Here's how you can proceed to analyze it further: ...
3,023
[ { "from": "human", "value": "Knowing an exception code, is there a way to find out more about what the actual exception that was thrown means?\nMy exception in question:\n0x64487347\nException address: 0x1\nThe call stack shows no information.\nI'm reviewing a .dmp of a crash and not actually debugging in V...
Whenever I use a macro in Visual Studio I get an annoying tip balloon in the system tray and an accompanying "pop" sound. It says: Visual Studio .NET macros To stop the macro from running, double-click the spinning cassette. Click here to not show this balloon again. I have trouble clicking the balloon because my m...
In Visual Studio, the notification balloon that appears when a macro is running can be quite disruptive, especially when the macro executes quickly. Fortunately, you can disable this notification through the Visual Studio settings. Here’s how to do it: 1. **Open Visual Studio**: Launch your Visual Studio IDE. 2. **Na...
6,370
[ { "from": "human", "value": "Whenever I use a macro in Visual Studio I get an annoying tip balloon in the system tray and an accompanying \"pop\" sound. It says:\n\nVisual Studio .NET macros\nTo stop the macro from running, double-click the spinning cassette.\n Click here to not show this balloon again.\n\...
If I had 20 directories under trunk/ with lots of files in each and only needed 3 of those directories, would it be possible to do a Subversion checkout with only those 3 directories under trunk?
Yes, it is possible to perform a Subversion (SVN) checkout for only specific directories under a trunk by using a sparse checkout. In SVN, you can specify which directories or files you want to include in your checkout. Here's how you can do it: 1. **Perform a Sparse Checkout**: Use the `--depth` option along with the...
6,132
[ { "from": "human", "value": "If I had 20 directories under trunk/ with lots of files in each and only needed 3 of those directories, would it be possible to do a Subversion checkout with only those 3 directories under trunk?\n" }, { "from": "gpt", "value": "Yes, it is possible to perform a Subve...
I have an XML document with a DTD, and would love to be able to access the XML model, something like this: title = Thing.Items[0].Title Is there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML? Thanks!
In Ruby, you can indeed work with XML and DTDs, but generating a structured object model that directly reflects the hierarchy of your XML document based on the DTD isn't straightforward with standard libraries like REXML alone. However, you have a few options to achieve something similar. ### Using REXML While you me...
1,702
[ { "from": "human", "value": "I have an XML document with a DTD, and would love to be able to access the XML model, something like this:\ntitle = Thing.Items[0].Title\n\nIs there a way, in Ruby, to generate this kind of object model based on a DTD? Or am I stuck using REXML?\nThanks!\n" }, { "from": ...
Is there any way to get the ID of the element that fires an event? I'm thinking something like: $(document).ready(function() { $("a").click(function() { var test = caller.id; alert(test.val()); }); }); <script type="text/javascript" src="starterkit/jquery.js"></script> <form class="item" id="aaa">...
To get the ID of the form that contains the element that triggered the event, you can use the `closest` method to traverse the DOM and find the nearest parent form element. Here’s how you can modify your jQuery code to achieve this: ```javascript $(document).ready(function() { $("a").click(function(event) { // P...
5,141
[ { "from": "human", "value": "Is there any way to get the ID of the element that fires an event?\nI'm thinking something like:\n\n\n$(document).ready(function() {\r\n $(\"a\").click(function() {\r\n var test = caller.id;\r\n alert(test.val());\r\n });\r\n});\n<script type=\"text/javascript\" src=\"st...
What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)? Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing library.
There are several libraries and frameworks in various programming languages that aim to provide an Erlang-style concurrency model, focusing on lightweight processes, message passing, and pattern matching. Here are some notable ones: 1. **Elixir**: - **Erlang VM (BEAM)**: Elixir is built on the Erlang VM and inherit...
4,836
[ { "from": "human", "value": "What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)?\nNote: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing l...
I'm trying to bind the following shortcut: Ctrl + W to close tabs How can you customize VS to add/change shortcuts? Also, what are the most useful shortcuts you guys have found?
To customize keyboard shortcuts in Visual Studio, you can follow these steps: ### Customizing Shortcuts in Visual Studio 1. **Open the Options Menu**: - Go to `Tools` in the menu bar. - Select `Options` from the dropdown menu. 2. **Navigate to Keyboard Settings**: - In the Options dialog, expand the `Enviro...
5,119
[ { "from": "human", "value": "I'm trying to bind the following shortcut: Ctrl + W to close tabs\nHow can you customize VS to add/change shortcuts? Also, what are the most useful shortcuts you guys have found?\n" }, { "from": "gpt", "value": "To customize keyboard shortcuts in Visual Studio, you ...
What is the single most effective practice to prevent arithmetic overflow and underflow? Some examples that come to mind are: testing based on valid input ranges validation using formal methods use of invariants detection at runtime using language features or libraries (this does not prevent it)
The single most effective practice to prevent arithmetic overflow and underflow is **using appropriate data types with a focus on numerical range and precision**. This encompasses choosing data types that can accommodate the expected range of values in your calculations. For example: 1. **Select Larger Data Types**: ...
4,994
[ { "from": "human", "value": "What is the single most effective practice to prevent arithmetic overflow and underflow?\nSome examples that come to mind are:\n\ntesting based on valid input ranges\nvalidation using formal methods\nuse of invariants\ndetection at runtime using language features or libraries (t...
I am writing a batch script in order to beautify JavaScript code. It needs to work on both Windows and Linux. How can I beautify JavaScript code using the command line tools?
To beautify JavaScript code using command line tools in a way that works on both Windows and Linux, you can use a JavaScript beautifier library like `js-beautify`. This tool can be installed via npm (Node Package Manager), which is a part of the Node.js environment. Here's a step-by-step guide on how to set it up: ##...
2,465
[ { "from": "human", "value": "I am writing a batch script in order to beautify JavaScript code. It needs to work on both Windows and Linux. \nHow can I beautify JavaScript code using the command line tools? \n" }, { "from": "gpt", "value": "To beautify JavaScript code using command line tools in ...
I found this on the IBM support site: ProblemA JAAS LoginContext could not be created due to the unexpected exception. User responseThe problem could be due to a configuration error. but I have no other indication and can't determine the final reason for this error. Any suggestions?
When you encounter the error "A JAAS LoginContext could not be created due to the unexpected exception," there are several areas you can investigate to troubleshoot the issue. Here are some suggestions to help you identify and resolve the problem: 1. **Check JAAS Configuration File**: - Ensure that your JAAS config...
1,911
[ { "from": "human", "value": "I found this on the IBM support site:\n\nProblemA JAAS LoginContext could not be created due to the unexpected exception. \nUser responseThe problem could be due to a configuration error. \n\nbut I have no other indication and can't determine the final reason for this error. \nA...
I'm working with Subversion based on Windows and would like to write an easy utility in .NET for working with the Apache password file. I understand that it uses a function referred to as MD5Crypt, but I can't seem to find a description of the algorithm beyond that at some point it uses MD5 to create a hash. Can someo...
MD5Crypt is a password hashing algorithm that is commonly used for storing passwords in various applications, including Apache's HTTP server. It enhances the standard MD5 hashing algorithm to provide better security for password storage. Below is a description of the MD5Crypt algorithm and the format of the password li...
3,616
[ { "from": "human", "value": "I'm working with Subversion based on Windows and would like to write an easy utility in .NET for working with the Apache password file. I understand that it uses a function referred to as MD5Crypt, but I can't seem to find a description of the algorithm beyond that at some poin...
Anything thats as good and as stable and as feature-rich as gigaspaces?
Gigaspaces is known for its in-memory data grid capabilities, offering features like high availability, scalability, and real-time data processing. If you're looking for alternatives that are similarly feature-rich and stable, here are a few options to consider: 1. **Apache Ignite**: This is an open-source in-memory c...
3,221
[ { "from": "human", "value": "Anything thats as good and as stable and as feature-rich as gigaspaces?\n" }, { "from": "gpt", "value": "Gigaspaces is known for its in-memory data grid capabilities, offering features like high availability, scalability, and real-time data processing. If you're look...
Is there a Regular Expression that can detect SQL in a string? Does anyone have a sample of something that they have used before to share?
While it is theoretically possible to use regular expressions (regex) to detect SQL statements in a string, it's important to note that SQL syntax is complex and can vary significantly between different database systems. Regex may not be the most reliable method for accurately detecting SQL, but it can be useful for so...
1,276
[ { "from": "human", "value": "Is there a Regular Expression that can detect SQL in a string? Does anyone have a sample of something that they have used before to share?\n" }, { "from": "gpt", "value": "While it is theoretically possible to use regular expressions (regex) to detect SQL statements ...
Where are some good sources of information on binary file layout structures? If I wanted to pull in a BTrieve index file, parse MP3 headers, etc. Where does one get reliable information?
When dealing with binary file formats like BTrieve index files and MP3 headers, having access to reliable documentation and resources is crucial for parsing them correctly. Here are some sources you can explore: ### General Resources on Binary File Formats: 1. **File Format Specifications**: - Many file formats hav...
2,223
[ { "from": "human", "value": "Where are some good sources of information on binary file layout structures?\nIf I wanted to pull in a BTrieve index file, parse MP3 headers, etc. Where does one get reliable information?\n" }, { "from": "gpt", "value": "When dealing with binary file formats like BTr...
Html Textarea elements only wrap when they reach a space or tab character. This is fine, until the user types a looooooooooooooooooooooong enough word. I'm looking for a way to strictly enforce line breaks (eg.: even if it results in "loooooooooooo \n ooooooooooong"). The best I've found is to add a zero-width unicode...
To enforce line breaks in a `<textarea>` element when a long word is typed, you can use JavaScript to listen for the input event and manipulate the text to add line breaks at specified intervals. Here’s a simple approach that limits the length of words and adds line breaks: ```html <!DOCTYPE html> <html lang="en"> <he...
3,691
[ { "from": "human", "value": "Html Textarea elements only wrap when they reach a space or tab character. This is fine, until the user types a looooooooooooooooooooooong enough word. I'm looking for a way to strictly enforce line breaks (eg.: even if it results in \"loooooooooooo \\n ooooooooooong\").\n\nThe ...
How do you automatically set the focus to a textbox when a web page loads? Is there an HTML tag to do it or does it have to be done via Javascript?
To automatically set the focus to a textbox when a web page loads, you can use either HTML or JavaScript. ### Using HTML HTML provides a way to automatically focus on an input element by using the `autofocus` attribute. Here’s how you can do it: ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-...
4,270
[ { "from": "human", "value": "How do you automatically set the focus to a textbox when a web page loads?\nIs there an HTML tag to do it or does it have to be done via Javascript?\n" }, { "from": "gpt", "value": "To automatically set the focus to a textbox when a web page loads, you can use either...
For data types such as std::set and std::map where lookup occurs in logarithmic time, is the implementation required to maintain the begin and end iterators? Does accessing begin and end imply a lookup that could occur in logarithmic time? I have always assumed that begin and end always occur in constant time, however ...
The C++ Standard Library's `std::set` and `std::map` are typically implemented as balanced binary search trees (like Red-Black trees), and your assumptions about the performance characteristics of their iterators are generally correct. ### Constant Time for `begin()` and `end()` 1. **Iterator Accessibility**: Both `b...
3,622
[ { "from": "human", "value": "For data types such as std::set and std::map where lookup occurs in logarithmic time, is the implementation required to maintain the begin and end iterators? Does accessing begin and end imply a lookup that could occur in logarithmic time?\nI have always assumed that begin and e...
I get the following error when running my Visual Studio 2008 ASP.NET project (start without Debugging) on my XP Professional box: System.Web.HttpException: The current identity (machinename\ASPNET) does not have write access to 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'. How can I resolve ...
The error you are encountering indicates that the ASP.NET process does not have sufficient permissions to write to the temporary files directory used by ASP.NET. This issue often arises when the ASP.NET application is running under the identity `machinename\ASPNET`, which is the default identity for ASP.NET application...
3,805
[ { "from": "human", "value": "I get the following error when running my Visual Studio 2008 ASP.NET project (start without Debugging) on my XP Professional box:\nSystem.Web.HttpException: The current identity (machinename\\ASPNET) does not have write access to 'C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.5072...
I want to use the Web Browser control within an mono application, but when I do get the error "libgluezilla not found. To have webbrowser support, you need libgluezilla installed." Installing the Intrepid Deb causes any application that references the web browser control to crash on startup with : 'Thread (nil) may ha...
It sounds like you are trying to use the Web Browser control in a Mono application and are facing issues related to the `libgluezilla` library and related crashes. Here's a step-by-step approach to troubleshoot and potentially resolve the problem: ### 1. Verify Mono Installation Make sure you have the latest version o...
3,210
[ { "from": "human", "value": "I want to use the Web Browser control within an mono application, but when I do get the error \"libgluezilla not found. To have webbrowser support, you need libgluezilla installed.\" Installing the Intrepid Deb causes any application that references the web browser control to c...
Is .NET 3.5 SP1 Required on the server to use Dynamic Data? It looks like it generates a lot of code and therefore wouldn't require anything special on the server side. I ask because I would like to use it but the shared hosting provider my client is using only have 3.5 installed and not 3.5 SP1.
To use ASP.NET Dynamic Data, it is indeed recommended to have .NET Framework 3.5 SP1 installed on the server. Dynamic Data is a feature that builds on top of the existing ASP.NET framework and utilizes additional enhancements made in SP1, including improvements to data controls, routing, and other features that enhance...
6,066
[ { "from": "human", "value": "Is .NET 3.5 SP1 Required on the server to use Dynamic Data?\nIt looks like it generates a lot of code and therefore wouldn't require anything special on the server side. I ask because I would like to use it but the shared hosting provider my client is using only have 3.5 install...
I remember Sun's slogan so vividly... "Write Once, Run Anywhere". The idea being that since programs are compiled into standard byte codes, any device with a Java Virtual Machine could run it. Over the years, Java seems to have made it onto many platforms/devices. Is this the intention or was it ever the intention of ...
The slogan "Write Once, Run Anywhere" (WORA) indeed captures one of the key goals of Java, which is platform independence through the use of the Java Virtual Machine (JVM). This allows Java applications to run on any device that has a compatible JVM. .NET, on the other hand, initially had a different vision focused pr...
3,922
[ { "from": "human", "value": "I remember Sun's slogan so vividly... \"Write Once, Run Anywhere\". The idea being that since programs are compiled into standard byte codes, any device with a Java Virtual Machine could run it. Over the years, Java seems to have made it onto many platforms/devices. \nIs this th...
Let's say I have the following HTML: <table id="foo"> <th class="sortasc">Header</th> </table> <table id="bar"> <th class="sortasc">Header</th> </table> I know that I can do the following to get all of the th elements that have class="sortasc" $$('th.sortasc').each() However that gives me the th elements from bo...
To select only the `<th>` elements with the class `sortasc` that are children of a specific table (in this case, the table with the ID `foo`), you can use a more specific selector. You can do this by combining the table ID with the class selector. Here's how you can do it: ```javascript $$('#foo th.sortasc').each(func...
6,998
[ { "from": "human", "value": "Let's say I have the following HTML:\n<table id=\"foo\">\n <th class=\"sortasc\">Header</th>\n</table>\n\n<table id=\"bar\">\n <th class=\"sortasc\">Header</th>\n</table>\n\nI know that I can do the following to get all of the th elements that have class=\"sortasc\"\n$$('th.so...
I am looking for a good JavaScript library for parsing XML data. It should be much easier to use than the built-in XML DOM parsers bundled with the browsers. I got spoiled a bit working with JSON and am looking forward to something on similar lines for XML.
If you're looking for a JavaScript library that simplifies XML parsing and is easier to use than the built-in XML DOM parsers, here are a few popular options: 1. **xml2js**: - `xml2js` is a widely used library that converts XML to JavaScript objects, making it easy to work with the data. - It allows you to defin...
3,461
[ { "from": "human", "value": "I am looking for a good JavaScript library for parsing XML data. It should be much easier to use than the built-in XML DOM parsers bundled with the browsers.\nI got spoiled a bit working with JSON and am looking forward to something on similar lines for XML.\n" }, { "fro...
Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality. I've been using it for a while (with a simple PInvoke, will post code later). I'm looking to see if there's a better and/or more robust way. Thanks.
Using JD Edwards XML Interop can be a powerful way to integrate with JD Edwards applications, but it can also present challenges depending on the specific requirements of your project. While your current approach with PInvoke can work, there are a few alternative strategies you might consider for better robustness and ...
4,488
[ { "from": "human", "value": "Wondering if anybody out there has any success in using the JDEdwards XMLInterop functionality. I've been using it for a while (with a simple PInvoke, will post code later). I'm looking to see if there's a better and/or more robust way.\nThanks.\n" }, { "from": "gpt", ...
I am considering buying an Apple MacBook Pro. Are there any pitfalls developing C#/.NET code in a virtual machine running on a Mac? Also, is it better to run Vista or XP Pro for this purpose?
When developing C#/.NET code on a Mac using a virtual machine (VM), there are several factors to consider: ### Potential Pitfalls 1. **Performance**: Running a VM can be resource-intensive. Ensure your Mac has sufficient RAM and CPU resources to run both macOS and the VM smoothly. Otherwise, performance may suffer, l...
1,694
[ { "from": "human", "value": "I am considering buying an Apple MacBook Pro. Are there any pitfalls developing C#/.NET code in a virtual machine running on a Mac?\nAlso, is it better to run Vista or XP Pro for this purpose?\n" }, { "from": "gpt", "value": "When developing C#/.NET code on a Mac usi...
Looking for a string to pass to String#matches(String) that will match IPv4, and another to match IPv6.
To match IPv4 and IPv6 addresses using regular expressions with the `String#matches(String)` method in Java, you can use the following regex patterns: ### IPv4 Regex An IPv4 address consists of four decimal numbers separated by dots, where each number ranges from 0 to 255. The regex pattern for matching a valid IPv4 a...
821
[ { "from": "human", "value": "Looking for a string to pass to String#matches(String) that will match IPv4, and another to match IPv6.\n" }, { "from": "gpt", "value": "To match IPv4 and IPv6 addresses using regular expressions with the `String#matches(String)` method in Java, you can use the follo...
I'm interested to get a free, WYSIWYG HTML editor that is compatible with Django template. Any ideas? Thanks LainMH. But I afraid fckeditor is used in web app, for the purpose of editing HTML. What I want is an editor that allows me to write HTML that is Django compatible. Hope this clarifies the issue.
If you're looking for a free WYSIWYG HTML editor that is compatible with Django templates and allows you to write HTML in a Django-friendly way, here are a few options you can consider: 1. **TinyMCE**: - TinyMCE is a popular WYSIWYG HTML editor that can be easily integrated with Django. It provides a user-friendly ...
2,937
[ { "from": "human", "value": "I'm interested to get a free, WYSIWYG HTML editor that is compatible with Django template. Any ideas?\n\nThanks LainMH.\nBut I afraid fckeditor is used in web app, for the purpose of editing\n HTML. What I want is an editor that allows me to write HTML that is\n Django compati...
Just looking for the first step basic solution here that keeps the honest people out. Thanks, Mike
Hi Mike, It seems like you're looking for a basic solution or a first step to address a particular issue, possibly related to security or access control. To better assist you, could you clarify what specific problem you're trying to solve and the context? For instance, are you looking to restrict access to a physical ...
7,477
[ { "from": "human", "value": "Just looking for the first step basic solution here that keeps the honest people out.\nThanks,\nMike\n" }, { "from": "gpt", "value": "Hi Mike,\n\nIt seems like you're looking for a basic solution or a first step to address a particular issue, possibly related to secu...
I'm using XPath in .NET to parse an XML document, along the lines of: XmlNodeList lotsOStuff = doc.SelectNodes("//stuff"); foreach (XmlNode stuff in lotsOStuff) { XmlNode stuffChild = stuff.SelectSingleNode("//stuffChild"); // ... etc } The issue is that the XPath Query for stuffChild is always returning the ch...
You're correct in your observation. In your current XPath query for `stuffChild`, you are using a double slash (`//`), which searches from the root of the document rather than relative to the current context node (i.e., the individual `stuff` node in your loop). When you use `//stuffChild`, it looks for any `stuffChil...
6,290
[ { "from": "human", "value": "I'm using XPath in .NET to parse an XML document, along the lines of:\nXmlNodeList lotsOStuff = doc.SelectNodes(\"//stuff\");\n\nforeach (XmlNode stuff in lotsOStuff) {\n XmlNode stuffChild = stuff.SelectSingleNode(\"//stuffChild\");\n // ... etc\n}\n\nThe issue is that the ...
I need to figure out the hard drive name for a solaris box and it is not clear to me what the device name is. On linux, it would be something like /dev/hda or /dev/sda, but on solaris I am getting a bit lost in the partitions and what the device is called. I think that entries like /dev/rdsk/c0t0d0s0 are the partitio...
In Solaris, the naming convention for disk devices is slightly different from that of Linux. You're correct that entries like `/dev/rdsk/c0t0d0s0` refer to specific partitions on a disk, where `c0` is the controller number, `t0` is the target (or SCSI ID), `d0` is the device number, and `s0` refers to the partition (sl...
4,155
[ { "from": "human", "value": "I need to figure out the hard drive name for a solaris box and it is not clear to me what the device name is. On linux, it would be something like /dev/hda or /dev/sda, but on solaris I am getting a bit lost in the partitions and what the device is called. I think that entries...
I'm using SQL Server 2000 to print out some values from a table using PRINT. With most non-string data, I can cast to nvarchar to be able to print it, but binary values attempt to convert using the bit representation of characters. For example: DECLARE @binvalue binary(4) SET @binvalue = 0x12345678 PRINT CAST(@binval...
In SQL Server, directly converting binary data to a string format can be a bit tricky, especially with binary data types like `binary` or `varbinary`. As you have found, using `CAST` to `nvarchar` will not yield the desired result for binary values because it tries to interpret the binary data as characters. To format...
4,946
[ { "from": "human", "value": "I'm using SQL Server 2000 to print out some values from a table using PRINT. With most non-string data, I can cast to nvarchar to be able to print it, but binary values attempt to convert using the bit representation of characters. For example:\nDECLARE @binvalue binary(4)\nSE...
Have you guys had any experiences (positive or negative) by placing your source code/solution on a network drive for Visual Studio 2005 or 2008? Please note I am not referring to placing your actual source control system on that drive, but rather your working folder. Thanks
Placing your working folder for a Visual Studio 2005 or 2008 project on a network drive can have both positive and negative experiences, and these largely depend on your specific network environment, the size of your project, and the team dynamics. Here are some considerations: ### Positive Experiences: 1. **Centrali...
3,141
[ { "from": "human", "value": "Have you guys had any experiences (positive or negative) by placing your source code/solution on a network drive for Visual Studio 2005 or 2008? Please note I am not referring to placing your actual source control system on that drive, but rather your working folder.\nThanks\n"...
What's the best (halting) algorithm for determining if a linked list has a cycle in it? [Edit] Analysis of asymptotic complexity for both time and space would be sweet so answers can be compared better. [Edit] Original question was not addressing nodes with outdegree > 1, but there's some talk about it. That question i...
To determine if a linked list has a cycle, the most commonly used and efficient algorithm is Floyd’s Cycle-Finding Algorithm, also known as the Tortoise and Hare algorithm. This algorithm is particularly effective for singly linked lists and operates using two pointers that traverse the list at different speeds. ### A...
4,234
[ { "from": "human", "value": "What's the best (halting) algorithm for determining if a linked list has a cycle in it?\n[Edit] Analysis of asymptotic complexity for both time and space would be sweet so answers can be compared better.\n[Edit] Original question was not addressing nodes with outdegree > 1, but ...
I got this error today when trying to open a Visual Studio 2008 project in Visual Studio 2005: The imported project "C:\Microsoft.CSharp.targets" was not found.
The error message you encountered indicates that the Visual Studio 2008 project is using a target file (`Microsoft.CSharp.targets`) that is not available in Visual Studio 2005. This typically happens because newer versions of Visual Studio introduced changes and improvements that are not backward-compatible with earlie...
3,491
[ { "from": "human", "value": "I got this error today when trying to open a Visual Studio 2008 project in Visual Studio 2005:\n\nThe imported project \"C:\\Microsoft.CSharp.targets\" was not found.\n\n" }, { "from": "gpt", "value": "The error message you encountered indicates that the Visual Studi...
Has anyone found a way to get around this? Or a better technique to conglomerate logging from multiple web servers reliably? Any ideas on good log4net log file analysis tools too (plain text not XML) - apart from good 'ol grep of course :)
When it comes to aggregating logs from multiple web servers reliably, there are several strategies and tools that you might consider. Here are a few approaches: ### Log Aggregation Solutions 1. **Centralized Logging Services**: Use centralized logging services such as: - **ELK Stack (Elasticsearch, Logstash, Kiban...
3,867
[ { "from": "human", "value": "Has anyone found a way to get around this? Or a better technique to conglomerate logging from multiple web servers reliably?\nAny ideas on good log4net log file analysis tools too (plain text not XML) - apart from good 'ol grep of course :)\n" }, { "from": "gpt", "va...
In an application that I'm writing I have some code like this: NSWorkspace* ws = [NSWorkspace sharedWorkspace]; NSString* myurl = @"http://www.somewebsite.com/method?a=%d"; NSURL* url = [NSURL URLWithString:myurl]; [ws openURL:url]; The main difference being that myurl comes from somewhere outside my control. Note t...
Yes, you need to properly encode the URL string before using it to create an `NSURL` object. The placeholder `%d` in your URL indicates that it expects a value to be inserted, but since the URL string is constructed with a format placeholder, you need to actually format the string before passing it to `NSURL`. In addi...
4,539
[ { "from": "human", "value": "In an application that I'm writing I have some code like this:\nNSWorkspace* ws = [NSWorkspace sharedWorkspace];\nNSString* myurl = @\"http://www.somewebsite.com/method?a=%d\";\n\nNSURL* url = [NSURL URLWithString:myurl];\n\n[ws openURL:url];\n\nThe main difference being that my...
Using core jQuery, how do you remove all the options of a select box, then add one option and select it? My select box is the following. <Select id="mySelect" size="9"> </Select> EDIT: The following code was helpful with chaining. However, (in Internet Explorer) .val('whatever') did not select the option that was adde...
It's great to hear that you are making progress! To achieve the desired functionality using jQuery, you can follow this approach to remove all options from a `<select>` box, add a new option, and select it: Here's the final jQuery code that will accomplish this task: ```javascript $('#mySelect').empty() // Remove all...
3,692
[ { "from": "human", "value": "Using core jQuery, how do you remove all the options of a select box, then add one option and select it?\nMy select box is the following.\n<Select id=\"mySelect\" size=\"9\"> </Select>\n\nEDIT: The following code was helpful with chaining. However, (in Internet Explorer) .val('w...
I've been using Destop.open() to launch a .pdf viewer on Windows machines, both Vista and XP, and most of them work just fine. However, on one XP machine the call does not work, simply returning without throwing any exceptions, and the viewer does not launch. On that machine the file association is properly set up as...
Yes, this is a somewhat common issue, especially on older Windows systems like XP. Here are a few things you can check or try to resolve the issue with `Desktop.open()` not launching the PDF viewer on that particular machine: 1. **File Association**: Even though double-clicking the PDF works, you might want to double-...
4,187
[ { "from": "human", "value": "I've been using Destop.open() to launch a .pdf viewer on Windows machines, both Vista and XP, and most of them work just fine. However, on one XP machine the call does not work, simply returning without throwing any exceptions, and the viewer does not launch. On that machine t...
I'm going to start a new project - rewriting an existing system (PHP + SQL Server) from scratch because of some very serious limitations by design. We have some quite good knowledge of SQL Server (currently we're using SQL Server 2000 in existing system) and we would like to employ its newer version (2008 I guess) in o...
Using Java with Microsoft SQL Server (especially versions like 2008) is a feasible and common solution for many projects. Both jTDS and Microsoft's JDBC driver are popular choices, each with its own advantages and considerations. Here’s an overview of your proposed stack, along with some potential limitations and consi...
1,527
[ { "from": "human", "value": "I'm going to start a new project - rewriting an existing system (PHP + SQL Server) from scratch because of some very serious limitations by design.\nWe have some quite good knowledge of SQL Server (currently we're using SQL Server 2000 in existing system) and we would like to em...
I have a .NET application, which is using an open source C++ compression library for compressing images. We are accessing the C++ library via managed C++. I'm seeing heap corruption during compression. A call to _CrtIsValidHeapPointer is finding an error on a call to free() when cleaning up after compression. Are th...
Heap corruption can indeed be tricky to diagnose, especially when you are dealing with a mix of managed and unmanaged code. Here are some tools and strategies you can use to help identify the root cause of the issue: ### Tools for Diagnosing Heap Corruption 1. **Valgrind**: If you can run your application on a Linux ...
2,330
[ { "from": "human", "value": "I have a .NET application, which is using an open source C++ compression library for compressing images. We are accessing the C++ library via managed C++. I'm seeing heap corruption during compression. A call to _CrtIsValidHeapPointer is finding an error on a call to free() w...
We have a simple [spring-hibernate] application (console app) where in we have set the classpath in manifest file of the executable JAR file. And the app connects to the database using jTDS JDBC Driver, Everything works as expected on Windows machine and JDK 1.6, but on Linux, the app is unable to find the driver, We ...
The issue you are experiencing where your Spring-Hibernate application works on Windows but not on Linux when executed via `java -jar` could be due to a number of factors. Here are some suggestions and potential fixes to help you troubleshoot and resolve the problem: ### 1. Check the Classpath in the Manifest Make su...
2,920
[ { "from": "human", "value": "We have a simple [spring-hibernate] application (console app) where in we have set the classpath in manifest file of the executable JAR file. And the app connects to the database using jTDS JDBC Driver, Everything works as expected on Windows machine and JDK 1.6, but on Linux, t...
There is a lot of information out there on object-relational mappers and how to best avoid impedance mismatch, all of which seem to be moot points if one were to use an object database. My question is why isn't this used more frequently? Is it because of performance reasons or because object databases cause your data...
Object databases (ODB) indeed offer certain advantages over relational databases (RDB), particularly when it comes to minimizing impedance mismatch between the application's object model and the database structure. However, there are several reasons why object databases have not become more mainstream, despite their be...
3,112
[ { "from": "human", "value": "There is a lot of information out there on object-relational mappers and how to best avoid impedance mismatch, all of which seem to be moot points if one were to use an object database. My question is why isn't this used more frequently? Is it because of performance reasons or...
I was just working on fixing up exception handling in a .NET 2.0 app, and I stumbled onto some weird issue with Application.ThreadException. What I want is to be able to catch all exceptions from events behind GUI elements (e.g. button_Click, etc.). I then want to filter these exceptions on 'fatality', e.g. with some t...
In .NET, when handling exceptions in the context of GUI applications, it's important to note that the `ThreadException` event provides you with the innermost exception as you’ve already discovered. Unfortunately, there isn't a built-in way to get the entire exception chain directly from the `ThreadExceptionEventArgs`, ...
3,000
[ { "from": "human", "value": "I was just working on fixing up exception handling in a .NET 2.0 app, and I stumbled onto some weird issue with Application.ThreadException.\nWhat I want is to be able to catch all exceptions from events behind GUI elements (e.g. button_Click, etc.). I then want to filter these ...
Does anybody recommend a design pattern for taking a binary data file, parsing parts of it into objects and storing the resultant data into a database? I think a similar pattern could be used for taking an XML or tab-delimited file and parse it into their representative objects. A common data structure would include:...
Your use case for parsing different file formats and transforming them into objects, followed by storing those objects in a database, is a classic scenario that can benefit from several design patterns. Below, I outline a suitable architectural design that incorporates various design patterns to achieve the goal effect...
2,708
[ { "from": "human", "value": "Does anybody recommend a design pattern for taking a binary data file, parsing parts of it into objects and storing the resultant data into a database? \nI think a similar pattern could be used for taking an XML or tab-delimited file and parse it into their representative objec...
The problem: Loading an excel spreadsheet template. Using the Save command with a different filename and then quitting the interop object. This ends up saving the original template file. Not the result that is liked. public void saveAndExit(string filename) { excelApplication.Save(filename); excelAppl...
The issue you're facing is likely due to how the Excel Interop library handles the loading and saving of templates. When you open a template file and call the `Save` method, it attempts to save the original file (the template) rather than the newly created instance of the workbook based on that template. To properly sa...
4,067
[ { "from": "human", "value": "The problem: Loading an excel spreadsheet template. Using the Save command with a different filename and then quitting the interop object. This ends up saving the original template file. Not the result that is liked.\npublic void saveAndExit(string filename)\n{ \n ex...
I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can "collect entropy" from the machine, whatever. On Linux/etc we have a drand48() which generates 48 random bits. I'd like a similar function/class for C++ or C# which can generate...
If you're looking for a robust and performant random number generator (RNG) in C++ or C# that is not based on `rand()` or `System.Random`, there are several options you can consider. Below are some suggestions along with links to implementations. ### C++ 1. **Mersenne Twister**: The Mersenne Twister (specifically ...
2,757
[ { "from": "human", "value": "I'm looking for a performant, reasonably robust RNG using no special hardware. It can use mathematical methods (Mersenne Twister, etc), it can \"collect entropy\" from the machine, whatever. On Linux/etc we have a drand48() which generates 48 random bits. I'd like a similar func...
I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much. The mail created by the mailto action has the syntax: subject: undefin...
Yes, you can definitely use JavaScript to create a mailto link that formats the subject and body as you've described. The `mailto` action allows you to specify both a subject and a body in the email. Here's a simple example of how you can achieve this in a client-side web page using JavaScript. ### HTML Structure You ...
132
[ { "from": "human", "value": "I want to create a client side mail creator web page. I know the problems of using the mailto action in an html form (not standard, no default mail appication set on the client). But the web page isn't very important, and they don't care very much.\nThe mail created by the mailt...
I used the jQuery Form plugin for asynchronous form submission. For forms that contain files, it copies the form to a hidden iframe, submits it, and copies back the iframe's contents. The problem is that I can't figure out how to find what HTTP status code was returned by the server. For example, if the server returns ...
When using the jQuery Form Plugin to submit a form with files via an iframe, you're correct that you don't have direct access to the HTTP status code from the server in the way that you do with an AJAX request. The hidden iframe method abstracts away many of the details of the request and response. Here’s a way you ca...
3,547
[ { "from": "human", "value": "I used the jQuery Form plugin for asynchronous form submission. For forms that contain files, it copies the form to a hidden iframe, submits it, and copies back the iframe's contents. The problem is that I can't figure out how to find what HTTP status code was returned by the se...
Choosing the correct lifecycle and methodology isn't as easy as it was before when there weren't so many methodologies, this days a new one emerges every day. I've found that most projects require a certain level of evolution and that each project is different from the rest. That way, extreme programming works with for...
Creating a comprehensive list of project experiences, especially with the myriad of methodologies available, is an excellent way to identify patterns and better understand which approaches work best in various contexts. Below, I've compiled a table of fictional project experiences that may mirror real-world scenarios b...
2,691
[ { "from": "human", "value": "Choosing the correct lifecycle and methodology isn't as easy as it was before when there weren't so many methodologies, this days a new one emerges every day.\nI've found that most projects require a certain level of evolution and that each project is different from the rest. Th...
I've created a simple desktop application in C# 3.0 to learn some C#, wpf and .Net 3.5. My application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database. My first iteration of this app is ugly as hell and I'm in the process of refa...
Architecting a desktop database application in C# (especially with WPF) involves various design considerations to create a maintainable, scalable, and user-friendly application. Here are some best practices and architectural patterns that you might find useful: ### 1. **Layered Architecture:** - **Presentation Laye...
3,433
[ { "from": "human", "value": "I've created a simple desktop application in C# 3.0 to learn some C#, wpf and .Net 3.5.\nMy application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database.\nMy first iteration of this app is ...
what I'm after is something I can feed a number into and it will return the highest order bit. I'm sure there's a simple way. Below is an example output (left is the input) 1 -> 1 2 -> 2 3 -> 2 4 -> 4 5 -> 4 6 -> 4 7 -> 4 8 -> 8 9 -> 8 ... 63 -> 32
To find the highest order bit of a given number, you can use the following approach in various programming languages. The highest order bit of a number is the largest power of 2 that is less than or equal to that number. Here's a simple Python function that accomplishes this: ```python def highest_order_bit(n): ...
6,026
[ { "from": "human", "value": "what I'm after is something I can feed a number into and it will return the highest order bit. I'm sure there's a simple way. Below is an example output (left is the input)\n1 -> 1\n2 -> 2\n3 -> 2\n4 -> 4\n5 -> 4\n6 -> 4\n7 -> 4\n8 -> 8\n9 -> 8\n...\n63 -> 32\n" }, { "...
I've got some Japanese in the ALT attribute, but the tooltip is showing me the ugly block characters in the tooltip. The rest of the content on the page renders correctly. So far, it seems to be limited to the tooltips.
It sounds like you're experiencing an issue with the character encoding or font rendering specifically for the tooltips in your web application. Here are several steps you can take to troubleshoot and resolve the problem: 1. **Check Character Encoding**: Ensure that your HTML document is using the correct character...
2,736
[ { "from": "human", "value": "I've got some Japanese in the ALT attribute, but the tooltip is showing me the ugly block characters in the tooltip. The rest of the content on the page renders correctly. So far, it seems to be limited to the tooltips.\n" }, { "from": "gpt", "value": "It sounds li...
I have a shell script that executes a number of commands. How do I make the shell script exit if any of the commands exit with a non-zero exit code?
To ensure that your shell script exits if any command within it returns a non-zero exit code, you can use the `set -e` command at the beginning of your script. This instructs the shell to immediately exit if any command fails (i.e., returns a non-zero exit status). Here’s a simple example of how to implement this in y...
6,376
[ { "from": "human", "value": "I have a shell script that executes a number of commands. How do I make the shell script exit if any of the commands exit with a non-zero exit code?\n" }, { "from": "gpt", "value": "To ensure that your shell script exits if any command within it returns a non-zero ex...
I need to learn ADO.NET to build applications based on MS Office. I have read a good deal about ADO.NET in the MSDN Library, but everything seems rather messy to me. What are the basics one must figure out when using ADO.NET? I think a few key words will suffice to let me organize my learning.
Certainly! Here are some key concepts and terms that can help you organize your learning about ADO.NET: 1. **Connection**: Establishes a connection to a database (e.g., `SqlConnection` for SQL Server). 2. **Command**: Used to execute SQL queries and commands against the database (e.g., `SqlCommand`). 3. **DataReader...
4,724
[ { "from": "human", "value": "I need to learn ADO.NET to build applications based on MS Office. I have read a good deal about ADO.NET in the MSDN Library, but everything seems rather messy to me.\nWhat are the basics one must figure out when using ADO.NET? I think a few key words will suffice to let me organ...
Using regular expressions, what is the simplest way to fetch a websites HTML and find the value inside this tag (or any attribute's value for that matter): <html> <head> [snip] <meta name="generator" value="thevalue i'm looking for" /> [snip]
To extract the value of the `value` attribute from the `<meta>` tag with `name="generator"` using regular expressions in a programming language like Python, you can use the following approach. Here is a sample code snippet demonstrating how to do this: ```python import re html_content = ''' <html> <head> [snip] ...
4,473
[ { "from": "human", "value": "Using regular expressions, what is the simplest way to fetch a websites HTML and find the value inside this tag (or any attribute's value for that matter):\n<html>\n <head>\n [snip]\n <meta name=\"generator\" value=\"thevalue i'm looking for\" />\n [snip]\n\n" }, { "...
On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine.
Certainly! The algorithm you're referring to is known as the "gravity" ranking algorithm, and it's often used in platforms like Stack Overflow to rank items (such as questions, answers, or posts) based on their age and popularity. The general idea is to give more weight to recent interactions while gradually diminishin...
2,982
[ { "from": "human", "value": "On SO 18 Joel mentioned an algorithm that would rank items based on their age and popularity and it's based on gravity. Could someone post this? C# would be lovely, but really any language (well, I can't do LISP) would be fine. \n" }, { "from": "gpt", "value": "Cer...
I want to open a TCP client socket in Python. Do I have to go through all the low-level BSD create-socket-handle / connect-socket stuff or is there a simpler one-line way?
In Python, you can open a TCP client socket using the `socket` module with a few simple lines of code. While there isn't a one-liner that encompasses the entire socket creation and connection process, you can streamline it into just a couple of lines. Here's a concise example: ```python import socket # Create a TCP/I...
5,087
[ { "from": "human", "value": "I want to open a TCP client socket in Python. Do I have to go through all the low-level BSD create-socket-handle / connect-socket stuff or is there a simpler one-line way?\n" }, { "from": "gpt", "value": "In Python, you can open a TCP client socket using the `socket`...
Has anyone had any success running two different web servers -- such as Apache and CherryPy -- alongside each other on the same machine? I am experimenting with other web servers right now, and I'd like to see if I can do my experiments while keeping my other sites up and running. You could say that this isn't so muc...
Running two different web servers (like Apache and CherryPy) on the same machine and having them listen on the same port (e.g., port 80) for different domains is not straightforward due to the way TCP/IP works. When a server is bound to a specific port, that port can only be occupied by one service at a time. ### Opti...
3,943
[ { "from": "human", "value": "Has anyone had any success running two different web servers -- such as Apache and CherryPy -- alongside each other on the same machine? I am experimenting with other web servers right now, and I'd like to see if I can do my experiments while keeping my other sites up and runni...
I know there are at least 10 different ways to structure project in version control. I'm curious what some methods being used are and which ones work for you. I've worked with SVN, TFS, and currently/unfortunately VSS. I've seen version control implemented very poorly and just OK, but never great. Just to get the bal...
There are indeed numerous ways to structure projects in version control systems, each with its own advantages and disadvantages. Below are some common strategies for structuring projects in version control, along with considerations for each method. These methods can generally be applied across various version control ...
1,904
[ { "from": "human", "value": "I know there are at least 10 different ways to structure project in version control. I'm curious what some methods being used are and which ones work for you. I've worked with SVN, TFS, and currently/unfortunately VSS. I've seen version control implemented very poorly and just...
What is the minimum I need to add to a .NET 2.0 WebSite's web.config to make it .NET 3.5? Visual Studio adds all the config sections and script handlers, but if you aren't using those are they are really necessary? Is there a command line tool to "upgrade" a .NET 2.0 web.config to 3.5?
To upgrade a .NET 2.0 WebSite's `web.config` to .NET 3.5, the minimal changes you need to make are fairly straightforward. Generally, .NET 3.5 is backward compatible with 2.0, so the changes are not extensive. However, there are a few additions that are typically recommended for using the newer features of .NET 3.5 eff...
2,964
[ { "from": "human", "value": "What is the minimum I need to add to a .NET 2.0 WebSite's web.config to make it .NET 3.5? \nVisual Studio adds all the config sections and script handlers, but if you aren't using those are they are really necessary?\nIs there a command line tool to \"upgrade\" a .NET 2.0 web.co...
Test Driven Development has been the rage in the .NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?
Behavior Driven Development (BDD) is a software development approach that extends Test Driven Development (TDD) by emphasizing collaboration between developers, testers, and non-technical stakeholders (such as business analysts or product owners). Here are the key aspects and differences between TDD and BDD: ### TDD (...
2,361
[ { "from": "human", "value": "Test Driven Development has been the rage in the .NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?\n" }, { "from": "gpt", "value": "Behavior Driven Development (B...
"Build Page" is one of the items you can add to your toolbar to compile just the ASPX page or ASCX control you are working on. Is there a keyboard shortcut for it?
In Visual Studio, you can use the keyboard shortcut **Ctrl + Shift + B** to build your entire solution, but if you specifically want to build just the current ASPX page or ASCX control, there isn't a built-in keyboard shortcut directly for that action. However, you can assign a keyboard shortcut to the "Build Page" co...
6,716
[ { "from": "human", "value": "\"Build Page\" is one of the items you can add to your toolbar to compile just the ASPX page or ASCX control you are working on. Is there a keyboard shortcut for it?\n" }, { "from": "gpt", "value": "In Visual Studio, you can use the keyboard shortcut **Ctrl + Shift ...
If I open a solution in Visual Studio 2008 and run a unit test then VS creates a new .vsmdi file in the Solution Items folder and gives it the next number available e.g. My Solution2.vsmdi. Any idea why VS is doing this and how I can get it to stop doing this?
The behavior you're experiencing in Visual Studio 2008, where a new .vsmdi (Visual Studio Test Metadata Interface) file is created each time you run a unit test, typically occurs due to the way Visual Studio manages test configurations. Here are some possible reasons for this behavior and steps to mitigate or stop it: ...
1,656
[ { "from": "human", "value": "If I open a solution in Visual Studio 2008 and run a unit test then VS creates a new .vsmdi file in the Solution Items folder and gives it the next number available e.g. My Solution2.vsmdi.\nAny idea why VS is doing this and how I can get it to stop doing this?\n" }, { "...
Do you know where I could find some useful third party (free) code snippets for VS 2008?
Yes, there are several online resources where you can find free code snippets for Visual Studio 2008. Here are some suggestions: 1. **CodeProject**: This website hosts a wide variety of code snippets, articles, and tutorials for different programming languages and frameworks. You can search for specific topics relevan...
4,928
[ { "from": "human", "value": "Do you know where I could find some useful third party (free) code snippets for VS 2008?\n" }, { "from": "gpt", "value": "Yes, there are several online resources where you can find free code snippets for Visual Studio 2008. Here are some suggestions:\n\n1. **CodeProj...
Which databases does Adobe Flash support, if any?
Adobe Flash itself does not directly support any specific databases. However, it can interact with databases through server-side technologies. Typically, Flash applications communicate with databases via web services or server-side scripts (such as PHP, ASP.NET, or Node.js) that handle database interactions. In this a...
6,556
[ { "from": "human", "value": "Which databases does Adobe Flash support, if any?\n" }, { "from": "gpt", "value": "Adobe Flash itself does not directly support any specific databases. However, it can interact with databases through server-side technologies. Typically, Flash applications communicate...
How do I create a branch in subversion that is deeper' than just the 'branches' directory? I have the standard trunk, tags and branches structure and I want to create a branch that is several directories deeper than the 'branches' tag. Using the standard svn move method, it gives me a folder not found error. I also tri...
In Subversion (SVN), creating a branch deeper than just the `branches` directory involves a couple of steps, especially when the target directories do not already exist. Here’s how to create a branch at the desired location (`branches/version_1/project/subproject`): ### Step-by-Step Instructions 1. **Create the Direc...
4,537
[ { "from": "human", "value": "How do I create a branch in subversion that is deeper' than just the 'branches' directory?\nI have the standard trunk, tags and branches structure and I want to create a branch that is several directories deeper than the 'branches' tag.\nUsing the standard svn move method, it gi...
In php, I often need to map a variable using an array ... but I can not seem to be able to do this in a one liner. c.f. example: // the following results in an error: echo array('a','b','c')[$key]; // this works, using an unnecessary variable: $variable = array('a','b','c'); echo $variable[$key]; This is a minor prob...
In PHP, you can achieve what you want in a one-liner using the null coalescing operator (`??`). This operator allows you to attempt to access an array with a fallback in case the index doesn't exist. Here is how you can do it: ```php echo array('a', 'b', 'c')[$key] ?? ''; ``` In this example, if `$key` is out of boun...
6,331
[ { "from": "human", "value": "In php, I often need to map a variable using an array ... but I can not seem to be able to do this in a one liner. c.f. example:\n// the following results in an error:\necho array('a','b','c')[$key];\n\n// this works, using an unnecessary variable:\n$variable = array('a','b','c'...
I want to enable an user to be able to communicate with other users through a site. I know that ASP.net is stateless, but what can I use for this synced communication? Java servlets?
To enable real-time communication between users on your website, there are several approaches you can take beyond traditional HTTP-based communication, especially given the stateless nature of ASP.NET. Here are a few options to consider: ### 1. **SignalR (for ASP.NET)**: If you are working with ASP.NET, one of the bes...
4,238
[ { "from": "human", "value": "I want to enable an user to be able to communicate with other users through a site. I know that ASP.net is stateless, but what can I use for this synced communication? Java servlets?\n" }, { "from": "gpt", "value": "To enable real-time communication between users on ...
How would I get the here and and here to be on the right, on the same lines as the lorem ipsums? See the following: Lorem Ipsum etc........here blah....................... blah blah.................. blah....................... lorem ipsums.......and here
To align "here" and "and here" to the right on the same lines as the "lorem ipsums" text, you can use a few different methods depending on the context in which you are formatting the text. Here are a few common approaches for HTML/CSS, plain text, and word processing software: ### HTML/CSS Approach If you're working ...
3,832
[ { "from": "human", "value": "How would I get the here and and here to be on the right, on the same lines as the lorem ipsums? See the following:\nLorem Ipsum etc........here \nblah....................... \nblah blah.................. \nblah....................... \nlorem ipsums.......and here\n\n" }, ...
Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? We have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are having issues transferring licenses of Hummingbird HostExplorer to In...
There are a few open-source and free terminal emulators that can emulate IBM 3151 terminals or provide similar functionality, although direct emulation may not be guaranteed. Here are some options you can consider: 1. **PuTTY**: While primarily an SSH and telnet client, PuTTY has support for a variety of terminal emul...
5,574
[ { "from": "human", "value": "Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? \nWe have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are having issues transferring ...
So I have a database schema like this: Users UserId RoleUserXRef RoleUserId RoleId UserId Roles RoleId Name With foreign keys defined between User & RoleUserXRef and RoleUserXRef & Role. Basically, I have a one to many relationship between users and roles. How would I model this in dbml, such that the...
To model your database schema in DBML (Database Markup Language), you will want to define the relationships between the `Users`, `RoleUserXRef`, and `Roles` tables clearly. In DBML, you can define tables and their relationships using the `Table`, `Ref`, and `Enum` constructs. Here's how you could structure your DBML ...
3,310
[ { "from": "human", "value": "So I have a database schema like this:\nUsers\n UserId\nRoleUserXRef\n RoleUserId\n RoleId\n UserId\nRoles\n RoleId\n Name\nWith foreign keys defined between User & RoleUserXRef and RoleUserXRef & Role. Basically, I have a one to many relationship between users and r...
Is it possible to upload a file from a client's computer to the server through a web service? The client can be running anything from a native desktop app to a thin ajax client.
Yes, it is absolutely possible to upload a file from a client's computer to a server through a web service. This can be achieved in different environments, whether the client is a native desktop application or a thin AJAX client running in a web browser. ### 1. **AJAX Client (Web Browser)** For a web-based client, yo...
2,808
[ { "from": "human", "value": "Is it possible to upload a file from a client's computer to the server through a web service? The client can be running anything from a native desktop app to a thin ajax client.\n" }, { "from": "gpt", "value": "Yes, it is absolutely possible to upload a file from a c...
Is there an equivalent operator to Haskell's list difference operator \\ in F#?
In F#, there isn't a direct equivalent to Haskell's list difference operator (`\\`), but you can achieve the same functionality using functions from the List module or by using LINQ. In Haskell, the list difference operator removes all elements from the first list that are present in the second list. You can replicate...
5,242
[ { "from": "human", "value": "Is there an equivalent operator to Haskell's list difference operator \\\\ in F#?\n" }, { "from": "gpt", "value": "In F#, there isn't a direct equivalent to Haskell's list difference operator (`\\\\`), but you can achieve the same functionality using functions from t...
What's the best way to allow a user to browse for a file in C#?
In C#, the most common way to allow a user to browse for a file is to use the `OpenFileDialog` class, which is part of the `System.Windows.Forms` namespace. This class provides a dialog that lets users select a file from the file system. Here's a simple example of how to use `OpenFileDialog` in a Windows Forms applica...
3,083
[ { "from": "human", "value": "What's the best way to allow a user to browse for a file in C#?\n" }, { "from": "gpt", "value": "In C#, the most common way to allow a user to browse for a file is to use the `OpenFileDialog` class, which is part of the `System.Windows.Forms` namespace. This class pr...
I've been studying the Google authentication API (AuthSub)... My question is, how do I get the user's account information (at least their Gmail address) after the authentication has passed? Because currently, all I get back from the authentication process is a token granting me access to which ever Google service I h...
To retrieve a user's account information, including their Gmail address, after successful authentication with Google's OAuth 2.0, you can use the **Google People API**. This API provides access to the user's profile information, including their email address. Here's a step-by-step guide on how to achieve this: 1. **S...
3,529
[ { "from": "human", "value": "I've been studying the Google authentication API (AuthSub)... My question is, how do I get the user's account information (at least their Gmail address) after the authentication has passed? \nBecause currently, all I get back from the authentication process is a token granting ...
I know this is pretty exotic, but I want to deploy a Ruby web application (not Rails, but Rack based, so it plugs into most Ruby servers just fine) using JRuby. Google and friends give me a few success stories, but mostly rails related and if not, no details on the deployment are provided. The framework I'm using is Ra...
Deploying a Ruby web application, particularly one that's Rack-based like Ramaze, using JRuby can indeed be a bit more complex than traditional Ruby deployment. However, it can also provide some advantages, such as leveraging the JVM's performance and scalability. Here’s a step-by-step guide to help you get started wit...
2,427
[ { "from": "human", "value": "I know this is pretty exotic, but I want to deploy a Ruby web application (not Rails, but Rack based, so it plugs into most Ruby servers just fine) using JRuby. Google and friends give me a few success stories, but mostly rails related and if not, no details on the deployment ar...
What is the best way to use SQL Server 2008 as a development database, but ensure that the database is compatible with SQL Server 2005?
When using SQL Server 2008 as a development database while ensuring compatibility with SQL Server 2005, you need to consider several key factors. Here are the best practices to achieve this: 1. **Set Compatibility Level**: When you create or upgrade your database in SQL Server 2008, make sure to set its compatibility ...
4,081
[ { "from": "human", "value": "What is the best way to use SQL Server 2008 as a development database, but ensure that the database is compatible with SQL Server 2005?\n" }, { "from": "gpt", "value": "When using SQL Server 2008 as a development database while ensuring compatibility with SQL Server ...
Is there any visible progress? Is it now just an academic exercise? Do you believe Perl will continue to evolve with or without Perl 6 or will soon be forgotten?
Perl has indeed shown some visible progress over the years, particularly with the continued development of Perl 5. The language has seen regular updates, with version 5.32 released in 2020 and 5.34 in 2021, among others. These updates have focused on performance improvements, new features, and bug fixes, suggesting tha...
6,001
[ { "from": "human", "value": "Is there any visible progress? Is it now just an academic exercise? Do you believe Perl will continue to evolve with or without Perl 6 or will soon be forgotten?\n" }, { "from": "gpt", "value": "Perl has indeed shown some visible progress over the years, particular...
I am trying to inherit from my generated datacontext in LinqToSQL - something like this public class myContext : dbDataContext { public System.Data.Linq.Table<User>() Users { return (from x in base.Users() where x.DeletedOn.HasValue == false select x); } } But my Linq statement returns IQueryable which cannot cas...
In LINQ to SQL, a `Table<T>` represents a collection of entities of type `T`, and it doesn't support the operations that return a filtered `IQueryable<T>` directly on its own. If you want to filter out records (e.g., users marked as deleted) from the `Users` table whenever it's accessed, a better approach would be to u...
4,889
[ { "from": "human", "value": "I am trying to inherit from my generated datacontext in LinqToSQL - something like this \npublic class myContext : dbDataContext {\n public System.Data.Linq.Table<User>() Users {\n return (from x in base.Users() where x.DeletedOn.HasValue == false select x);\n }\n}\n\nBut my Li...