instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I asked a question about Currying and closures were mentioned. What is a closure? How does it relate to currying?
A **closure** is a fundamental concept in programming, particularly in languages that support first-class functions, such as JavaScript, Python, and others. A closure is a function that retains access to its lexical scope, even when the function is executed outside that scope. This means that the function remembers the...
2,698
[ { "from": "human", "value": "I asked a question about Currying and closures were mentioned.\nWhat is a closure? How does it relate to currying?\n" }, { "from": "gpt", "value": "A **closure** is a fundamental concept in programming, particularly in languages that support first-class functions, su...
I'm looking for a good 3D Mesh library Should be able to read popular formats (OFF, OBJ...) Should support both half-edge structure and a triangle soup Should be tolerant to faults and illegal meshes. Basic geometric operations - intersections, normal calculation, etc' Most importantly - Should not be convoluted with ...
Based on your requirements, here are a few 3D mesh libraries that might fit your needs: ### 1. **Assimp (Open Asset Import Library)** - **Formats Supported:** Assimp supports a wide range of formats including OBJ, OFF, FBX, and more. - **Data Structure:** While it doesn't specifically provide a half-edge structure, yo...
4,630
[ { "from": "human", "value": "I'm looking for a good 3D Mesh library\n\nShould be able to read popular formats (OFF, OBJ...)\nShould support both half-edge structure and a triangle soup\nShould be tolerant to faults and illegal meshes.\nBasic geometric operations - intersections, normal calculation, etc'\nMo...
How can I convert a character to its ASCII code using JavaScript? For example: get 10 from "\n".
You can convert a character to its ASCII code in JavaScript using the `charCodeAt()` method of a string. This method returns the Unicode value (which corresponds to the ASCII value for standard characters) of the character at the specified index. Here's how you can use it to get the ASCII code of the newline character...
9,697
[ { "from": "human", "value": "How can I convert a character to its ASCII code using JavaScript?\nFor example:\n\nget 10 from \"\\n\".\n\n" }, { "from": "gpt", "value": "You can convert a character to its ASCII code in JavaScript using the `charCodeAt()` method of a string. This method returns the...
When working on a project, after the interesting parts are coded, my motivation is severely diminished. What do you do to get over this problem?
It's common to lose motivation after the initial excitement of a project fades. Here are some strategies to help you stay engaged through the less interesting parts: 1. **Set Clear Milestones**: Break the project into smaller, manageable tasks with specific deadlines. Completing these milestones can give you a sense o...
7,835
[ { "from": "human", "value": "When working on a project, after the interesting parts are coded, my motivation is severely diminished. What do you do to get over this problem? \n" }, { "from": "gpt", "value": "It's common to lose motivation after the initial excitement of a project fades. Here are...
I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings. Unfortunately, this means that when I update the service references in the project ...
Updating service references in a WPF application can indeed lead to messy configurations in the `app.config`, particularly when you have to manually adjust settings after the update. Here are a few strategies to handle your situation more gracefully: ### 1. Use a Separate Configuration File Instead of modifying the `a...
5,908
[ { "from": "human", "value": "I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings.\nUnfortunately, this means that when I upd...
What's the most elegant way to select out objects in an array that are unique with respect to one or more attributes? These objects are stored in ActiveRecord so using AR's methods would be fine too.
In Ruby on Rails, when working with ActiveRecord models, you can easily select unique objects based on one or more attributes using a combination of methods. Here are a few elegant ways to do this: ### Using `distinct` with `select` If you want to get unique records from the database based on certain attributes, you ...
7,897
[ { "from": "human", "value": "What's the most elegant way to select out objects in an array that are unique with respect to one or more attributes?\nThese objects are stored in ActiveRecord so using AR's methods would be fine too. \n" }, { "from": "gpt", "value": "In Ruby on Rails, when working w...
I have added some code which compiles cleanly and have just received this Windows error: --------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the application at location 0x00486752. I am a...
The error message you're encountering—"The exception Privileged instruction. (0xc0000096)"—indicates that your application is trying to execute an instruction that is not allowed in the current context, which is often due to attempting to execute data as code or accessing protected memory. Here are a few potential cau...
5,713
[ { "from": "human", "value": "I have added some code which compiles cleanly and have just received this Windows error:\n---------------------------\n(MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error\n---------------------------\nThe exception Privileged instruction.\n\n (0xc0000096) occurred in ...
Say I have several JavaScript includes in a page: <script type="text/javascript" src="/js/script0.js"></script> <script type="text/javascript" src="/js/script1.js"></script> <script type="text/javascript" src="/js/script2.js"></script> <script type="text/javascript" src="/js/script3.js"></script> <script type="text/jav...
Yes, you can check if any of your JavaScript files return a 404 (Not Found) error using a few different methods. Here are some options: ### 1. Using Browser Developer Tools The easiest way is to use the built-in developer tools in your web browser. Here's how to do it: - Open your webpage in a web browser (like Chro...
6,973
[ { "from": "human", "value": "Say I have several JavaScript includes in a page:\n<script type=\"text/javascript\" src=\"/js/script0.js\"></script>\n<script type=\"text/javascript\" src=\"/js/script1.js\"></script>\n<script type=\"text/javascript\" src=\"/js/script2.js\"></script>\n<script type=\"text/javascr...
How do I change font size on the DataGridView?
To change the font size of a `DataGridView` in a WinForms application, you need to set the `Font` property of the `DataGridView`. This will affect the entire grid, including the header and all cells. Here's how you can do it: ### Setting the Font Size Programmatically You can change the font size in the constructor o...
5,785
[ { "from": "human", "value": "How do I change font size on the DataGridView?\n" }, { "from": "gpt", "value": "To change the font size of a `DataGridView` in a WinForms application, you need to set the `Font` property of the `DataGridView`. This will affect the entire grid, including the header an...
I have never "hand-coded" object creation code for SQL Server and foreign key decleration is seemingly different between SQL Server and Postgres. Here is my sql so far: drop table exams; drop table question_bank; drop table anwser_bank; create table exams ( exam_id uniqueidentifier primary key, exam_name varch...
The error message you're encountering indicates that the foreign key declaration in your `question_bank` table is not correctly specified. The foreign key constraint you defined is missing the referencing column. Here’s the correct version of your SQL code: ```sql DROP TABLE IF EXISTS answer_bank; DROP TABLE IF EXIST...
7,316
[ { "from": "human", "value": "I have never \"hand-coded\" object creation code for SQL Server and foreign key decleration is seemingly different between SQL Server and Postgres. Here is my sql so far:\ndrop table exams;\ndrop table question_bank;\ndrop table anwser_bank;\n\ncreate table exams\n(\n exam_id...
I am currently creating a master ddl for our database. Historically we have used backup/restore to version our database, and not maintained any ddl scripts. The schema is quite large. My current thinking: Break script into parts (possibly in separate scripts): table creation add indexes add triggers add constraints...
Creating a master DDL for a large schema can be a significant undertaking, especially when transitioning from a backup/restore approach. Here are some additional suggestions and considerations to help streamline your process: ### Structuring Your DDL Scripts 1. **Modular Scripts**: As you mentioned, breaking down the...
1,910
[ { "from": "human", "value": "I am currently creating a master ddl for our database. Historically we have used backup/restore to version our database, and not maintained any ddl scripts. The schema is quite large.\nMy current thinking:\n\nBreak script into parts (possibly in separate scripts):\n\ntable cre...
Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?
`System.IO.Compression.GZipStream` and `System.IO.Compression.DeflateStream` in .NET are based on the GZip and DEFLATE formats, respectively, but there are some important distinctions to understand regarding compatibility with zlib. 1. **GZipStream**: - The GZip format is a wrapper around the DEFLATE algorithm, whi...
8,367
[ { "from": "human", "value": "Are System.IO.Compression.GZipStream or System.IO.Compression.Deflate compatible with zlib compression?\n" }, { "from": "gpt", "value": "`System.IO.Compression.GZipStream` and `System.IO.Compression.DeflateStream` in .NET are based on the GZip and DEFLATE formats, re...
Can anyone suggest some good browser add-on tools/extensions to help with development? I have firebug installed in Firefox which is great for dealing with CSS, HTML and javascript; any other suggestions? Firebug
Certainly! Besides Firebug, there are many other excellent browser extensions and tools that can significantly enhance your development workflow. Here’s a list of some popular browser add-ons and tools for web development: ### For Firefox: 1. **Web Developer**: A powerful tool that adds a menu and a toolbar with vario...
6,085
[ { "from": "human", "value": "Can anyone suggest some good browser add-on tools/extensions to help with development?\nI have firebug installed in Firefox which is great for dealing with CSS, HTML and javascript; any other suggestions?\nFirebug\n" }, { "from": "gpt", "value": "Certainly! Besides F...
Sorry for the Windows developers out there, this solution is for Macs only. This set of applications accounts for: Usability Testing, Screen Capture (Video and Still), Version Control, Task Lists, Bug Tracking, a Developer IDE, a Web Server, A Blog, Shared Doc Editing on the Web, Team and individual Chat, Email, Databa...
It seems like you've compiled a comprehensive list of software and tools that can be used for various aspects of software development and collaboration, specifically targeting teams that use Macs and aiming to keep costs low. This setup caters to usability testing, version control, task management, bug tracking, and mo...
6,641
[ { "from": "human", "value": "Sorry for the Windows developers out there, this solution is for Macs only.\nThis set of applications accounts for: Usability Testing, Screen Capture (Video and Still), Version Control, Task Lists, Bug Tracking, a Developer IDE, a Web Server, A Blog, Shared Doc Editing on the We...
I am currently writing a simple, timer-based mini app in C# that performs an action n times every k seconds. I am trying to adopt a test-driven development style, so my goal is to unit-test all parts of the app. So, my question is: Is there a good way to unit test a timer-based class? The problem, as I see it, is that ...
Testing timer-based classes can indeed pose challenges, especially regarding execution time and control over timing behavior. Here are several strategies to effectively unit test a timer-based class while maintaining test speed and reliability. ### 1. **Use Dependency Injection and Interfaces** Create an interface for...
3,390
[ { "from": "human", "value": "I am currently writing a simple, timer-based mini app in C# that performs an action n times every k seconds.\nI am trying to adopt a test-driven development style, so my goal is to unit-test all parts of the app.\nSo, my question is: Is there a good way to unit test a timer-base...
Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping many files open as I am working on them, so next time I open the project, it (very slowly) loads up a bunch of files into the editor that I may no...
In Visual Studio 2008, there isn't a direct setting to prevent previously opened files from loading when you open a project. However, you can try a couple of workarounds to manage your workspace more effectively: 1. **Clear Previous Files Before Closing**: Before you close the solution, you can manually close all the ...
6,206
[ { "from": "human", "value": "Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping many files open as I am working on them, so next time I open the project, it (very slowly) loads up a bun...
CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\Documents and Settings\..\App_Data\HelloWorld.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. I've found these links: http://b...
The error message you are encountering indicates that there are permission issues or conflicts preventing the creation of a new database or the attachment of an existing one. Here are some steps to troubleshoot and resolve the issue: 1. **Check SQL Server Permissions**: Ensure that your SQL Server account has the nece...
6,472
[ { "from": "human", "value": "\nCREATE DATABASE permission denied in database 'master'.\n An attempt to attach an auto-named database for file \n C:\\Documents and Settings\\..\\App_Data\\HelloWorld.mdf failed. \n A database with the same name exists, or specified file cannot be\n opened, or it is locate...
I've configured (at least I've tried to configure) Lighty to enable the WebDAV plugin when I go to a certain URL. I don't get any errors, so it seems to be working. How, then, do I configure it to serve my subversion repositories (of which I have many)?
To configure Lighttpd (commonly referred to as Lighty) to serve your Subversion (SVN) repositories over WebDAV, you need to ensure that the WebDAV module is enabled and properly configured to handle requests for your SVN repositories. Below are steps to help you set this up: ### 1. Enable the WebDAV Module Make sure t...
6,057
[ { "from": "human", "value": "I've configured (at least I've tried to configure) Lighty to enable the WebDAV plugin when I go to a certain URL. I don't get any errors, so it seems to be working. How, then, do I configure it to serve my subversion repositories (of which I have many)?\n" }, { "from": "...
As far as I can tell, in spite of the countless millions or billions spent on OOP education, languages, and tools, OOP has not improved developer productivity or software reliability, nor has it reduced development costs. Few people use OOP in any rigorous sense (few people adhere to or understand principles such as LS...
You raise several valid points and criticisms about Object-Oriented Programming (OOP) and its efficacy in software development. It's a complex topic, and while OOP has its advocates, it also has a significant number of detractors. Let’s unpack some of the arguments surrounding OOP and consider the broader context of so...
5,407
[ { "from": "human", "value": "As far as I can tell, in spite of the countless millions or billions spent on OOP education, languages, and tools, OOP has not improved developer productivity or software reliability, nor has it reduced development costs. Few people use OOP in any rigorous sense (few people adhe...
I am working on a project right now that involves receiving a message from another application, formatting the contents of that message, and sending it to a printer. The technology of choice is C# windows service. The output could be called a report, I suppose, but a reporting engine is not necessary. A simple templ...
Printing from a Windows Service can be challenging, particularly when it comes to rendering output and handling multi-page documents without user input. Since you're using .NET Framework 2.0 and looking for free solutions, here are a few suggestions that could help you out: ### 1. **Use Raw Printing with a Print Spool...
1,262
[ { "from": "human", "value": "I am working on a project right now that involves receiving a message from another application, formatting the contents of that message, and sending it to a printer. The technology of choice is C# windows service. The output could be called a report, I suppose, but a reporting...
I'm using visual studio 2008 and ReSharper 4 and it's kind of slow. My machine has 2 GB of RAM, dual core processor and a 7200 rpm hard disk. I know more RAM and a faster hard disk could improve performance, but do you have any tips to improve ReSharper/Visual Studio performance?
Certainly! Improving the performance of Visual Studio 2008 with ReSharper 4 on your machine can be crucial, especially given the limitations of the hardware. Here are several tips that might help you enhance the performance: ### General Visual Studio Tips 1. **Disable Unnecessary Extensions/Add-ins**: Review your Visu...
3,988
[ { "from": "human", "value": "I'm using visual studio 2008 and ReSharper 4 and it's kind of slow. My machine has 2 GB of RAM, dual core processor and a 7200 rpm hard disk. I know more RAM and a faster hard disk could improve performance, but do you have any tips to improve ReSharper/Visual Studio performance...
This might be on the "discussy" side, but I would really like to hear your view on this. Previously I have often written data access classes that handled both reading and writing, which often led to poor naming, like FooIoHandler etc. The rule of thumb that classes that are hard to name probably are poorly designed sug...
Hi Erik, You’ve raised an important and nuanced question that many developers grapple with. The choice between combining reader and writer functionality in a single class versus separating them into distinct classes has implications for both design clarity and maintainability. ### Separation of Concerns 1. **Single ...
6,404
[ { "from": "human", "value": "This might be on the \"discussy\" side, but I would really like to hear your view on this.\nPreviously I have often written data access classes that handled both reading and writing, which often led to poor naming, like FooIoHandler etc. The rule of thumb that classes that are h...
I'm using the GoDiagrams suite which seems to recommend .emf files for node images since they scale better on resizing. Bitmaps get all blurry. Google doesn't show up any good tools that seem to do this... So to reiterate I'm looking for a image converter (preferably free) that converts an image (in one of the common f...
If you're looking for a tool to convert images to EMF (Enhanced Metafile) format, here are some options you can consider for batch conversion: 1. **Inkscape**: - Inkscape is a free and open-source vector graphics editor that supports many formats, including EMF. - You can open your bitmap or JPEG files and expor...
6,286
[ { "from": "human", "value": "I'm using the GoDiagrams suite which seems to recommend .emf files for node images since they scale better on resizing. Bitmaps get all blurry.\nGoogle doesn't show up any good tools that seem to do this... So to reiterate I'm looking for a image converter (preferably free) that...
How are people unit testing their business applications? I've seen a lot of examples of unit testing with "simple to test" examples. Ex. a calculator. How are people unit testing data-heavy applications? How are you putting together your sample data? In many cases, data for one test may not work at all for another test...
Unit testing data-heavy applications can indeed be challenging, particularly when there are many interdependent components, complex data flows, and external systems involved. Below are some strategies and best practices that may help you effectively unit test your business applications: ### 1. **Mocking and Stubbing**...
6,147
[ { "from": "human", "value": "How are people unit testing their business applications? I've seen a lot of examples of unit testing with \"simple to test\" examples. Ex. a calculator. How are people unit testing data-heavy applications? How are you putting together your sample data? In many cases, data for on...
I have a SQL Server 2005 machine with a JDE DB2 set up as a linked server. For some reason the performance of any queries from this box to the db2 box are horrible. For example. The following takes 7 mins to run from Management Studio SELECT * FROM F42119 WHERE SDUPMJ >= 107256 Whereas it takes seconds ...
When experiencing performance issues with queries from SQL Server to a DB2 linked server, especially when the same queries run efficiently in iSeries Navigator, it can often be attributed to configuration settings, network issues, or the way the linked server is set up. Here are several areas to investigate and potenti...
4,884
[ { "from": "human", "value": "I have a SQL Server 2005 machine with a JDE DB2 set up as a linked server.\nFor some reason the performance of any queries from this box to the db2 box are horrible.\nFor example. The following takes 7 mins to run from Management Studio\nSELECT *\nFROM F42119 \nWHERE ...
For a typical business application, should the focus be on client processing via AJAX i.e. pull the data from the server and process it on the client or would you suggest a more classic ASP.Net approach with the server being responsible for handling most of the UI events? I find it hard to come up with a good 'default ...
When deciding on an architecture for a typical business application, both AJAX-based client processing and server-side rendering with ASP.NET have their pros and cons. The choice often depends on various factors such as application complexity, team expertise, and performance requirements. ### AJAX-based Client Process...
4,266
[ { "from": "human", "value": "For a typical business application, should the focus be on client processing via AJAX i.e. pull the data from the server and process it on the client or would you suggest a more classic ASP.Net approach with the server being responsible for handling most of the UI events? I find...
Is it possible to bypass @GeneratedValue for an ID in Hibernate, we have a case where, most of the time we want the ID to be set using GeneratedValue, but in certain cases would like to set the ID manually. Is this possible to do?
Yes, it is possible to bypass `@GeneratedValue` for an ID in Hibernate and manually set the ID in certain cases. You can achieve this by using the following approaches: ### 1. Using `@GenericGenerator` and `@GeneratedValue` You can define a custom generator using `@GenericGenerator` and choose when to set the ID manua...
5,564
[ { "from": "human", "value": "Is it possible to bypass @GeneratedValue for an ID in Hibernate, we have a case where, most of the time we want the ID to be set using GeneratedValue, but in certain cases would like to set the ID manually.\nIs this possible to do?\n" }, { "from": "gpt", "value": "Ye...
How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/ Resharper or Ctrl+Alt+↑/↓ in Eclipse?
In Vim, you can duplicate a whole line using a few different methods. Here are some common ways to do this: ### Method 1: Using Normal Mode 1. Go to the line you want to duplicate. 2. Press `yy` to copy the line (yank). 3. Move the cursor to where you want to paste the duplicated line and press `p` to paste it below ...
8,347
[ { "from": "human", "value": "How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/ Resharper or Ctrl+Alt+↑/↓ in Eclipse?\n" }, { "from": "gpt", "value": "In Vim, you can duplicate a whole line using a few different methods. Here are some common ways to do this:\n\n#...
I'm designing my database and LINQ To SQL ASP.NET web application. Imagine I have two types of pages: normal and root. Some pages are roots. Some pages are not. I have a Page database table and a RootPage database table: Page ---- PK PageId HtmlTitle PageHeading MetaDescription ...
In LINQ to SQL, the use of a discriminator column is a common way to implement Table-Per-Hierarchy (TPH) inheritance. However, there are some specific requirements and considerations regarding how the discriminator column is set up and used. ### Discriminator Column 1. **Non-nullable**: The discriminator column (in y...
6,136
[ { "from": "human", "value": "I'm designing my database and LINQ To SQL ASP.NET web application.\nImagine I have two types of pages: normal and root. Some pages are roots. Some pages are not.\nI have a Page database table and a RootPage database table:\n Page\n ----\n PK PageId\n HtmlTitl...
We have a simple domain model: Contact, TelephoneNumber and ContactRepository. Contact is entity, it has an identity field. TelephoneNumber is typical value object: hasn't any identity and couldn't be loaded separately from the Contact instance. From other side we have web application for manipulating the contacts. 1st...
In scenarios where you have value objects, like `TelephoneNumber`, that do not have their own identity, the best approach is to use a contextually meaningful way to identify these objects within their parent entity (in this case, the `Contact`). Here are some strategies to handle editing of value objects in your web ap...
6,257
[ { "from": "human", "value": "We have a simple domain model: Contact, TelephoneNumber and ContactRepository. Contact is entity, it has an identity field. TelephoneNumber is typical value object: hasn't any identity and couldn't be loaded separately from the Contact instance.\nFrom other side we have web appl...
I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code: LOGO_GIF RCDATA logo.gif Using resource explorer I verified it is in the DLL properly. using the following code always throws an exception, "res...
When working with resources in Delphi, particularly when extracting a resource from a DLL, it's essential to ensure a few key aspects are correctly addressed. Based on your description, the resource appears to be properly defined and confirmed in the DLL, but let's troubleshoot the code to extract the GIF image correct...
5,769
[ { "from": "human", "value": "I am trying to extract a gif image embedded as a resource within my ISAPI dll using WebBroker technology. The resource has been added to the DLL using the following RC code:\nLOGO_GIF RCDATA logo.gif\n\nUsing resource explorer I verified it is in the DLL properly.\nusing the fo...
I've come across a few different applications that monitor my usage while on the computer, but what have you used, and like? whether it be writing down your activities in a composition notbook or install an app that reports silently to a server? what do you like?
While I don’t have personal experiences or preferences, I can certainly provide information about various applications and methods people use for monitoring their computer usage. 1. **Time Tracking Applications**: - **Toggl**: A user-friendly time tracking tool that helps track work hours and activities. It provid...
8,328
[ { "from": "human", "value": "I've come across a few different applications that monitor my usage while on the computer, but what have you used, and like? whether it be writing down your activities in a composition notbook or install an app that reports silently to a server? what do you like?\n" }, { ...
I've just started developing an ExtJS application that I plan to support with a very lightweight JSON PHP service. Other than that, it will be standalone. My question is, what is the best way to organize the files and classes that will inevitably come into existence? Anyone have any experience with large ExtJS projec...
Organizing an ExtJS application effectively is crucial for maintainability, scalability, and collaborative development. Here’s a recommended structure and best practices for organizing your files and classes in a large ExtJS application, particularly one that will integrate with a lightweight JSON PHP service. ### Sug...
2,234
[ { "from": "human", "value": "I've just started developing an ExtJS application that I plan to support with a very lightweight JSON PHP service. Other than that, it will be standalone. My question is, what is the best way to organize the files and classes that will inevitably come into existence? Anyone ha...
By graphing I mean bar charts, pie charts, line graphs, that sort of thing. I've used a couple over the years, but what is your favourite and why? One tool per answer please (to make the voting easier :o)
One of my favorite tools for creating visualizations is **Tableau**. Tableau is highly regarded for its user-friendly interface and powerful capabilities in transforming complex data into interactive and visually appealing graphs and dashboards. It allows users to create a wide range of visualizations, including bar ...
8,574
[ { "from": "human", "value": "By graphing I mean bar charts, pie charts, line graphs, that sort of thing. I've used a couple over the years, but what is your favourite and why?\nOne tool per answer please (to make the voting easier :o)\n" }, { "from": "gpt", "value": "One of my favorite tools fo...
What column names cannot be used when creating an Excel spreadsheet with ADO. I have a statement that creates a page in a spreadsheet: CREATE TABLE [TableName] (Column string, Column2 string); I have found that using a column name of Date or Container will generate an error when the statement is executed. Does anyone ...
When working with Excel through ADO (ActiveX Data Objects) and creating tables, there are certain reserved keywords and special characters that you should avoid using as column names to prevent errors or unexpected behavior. Here are some common reserved words and special considerations for Excel: ### Reserved Words 1...
5,827
[ { "from": "human", "value": "What column names cannot be used when creating an Excel spreadsheet with ADO.\nI have a statement that creates a page in a spreadsheet:\nCREATE TABLE [TableName] (Column string, Column2 string);\n\nI have found that using a column name of Date or Container will generate an error...
Does anyone know of a similar product to Citrix Server that'll run on the Mac OS? Essentially, I'm looking to allow multiple remote users to log in to the same OSX Server at the same time (with full visual desktop, not SSH).
If you are looking for a way to allow multiple remote users to access a macOS Server with full desktop capabilities, here are some alternatives to Citrix Server that you might consider: 1. **Parallels Remote Application Server (RAS)**: Parallels RAS is a comprehensive solution that allows for application and desktop d...
6,622
[ { "from": "human", "value": "Does anyone know of a similar product to Citrix Server that'll run on the Mac OS?\nEssentially, I'm looking to allow multiple remote users to log in to the same OSX Server at the same time (with full visual desktop, not SSH).\n" }, { "from": "gpt", "value": "If you a...
When using MediaWiki's markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this: #Item1 #Item2 However, if I want to add spaces or some other text between those lines, the numbering gets lost. For example, the following will create text t...
In MediaWiki, when you create a numbered list using `#`, the numbering continues sequentially as long as the items are directly connected. When you insert a blank line or any non-list text between the items, the numbering resets. To maintain a numbered list while including additional text or space between items, you ...
6,053
[ { "from": "human", "value": "When using MediaWiki's markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this:\n#Item1\n#Item2\n\nHowever, if I want to add spaces or some other text between those lines, the numbering gets lost. ...
I'm working on a program that will be processing files that could potentially be 100GB or more in size. The files contain sets of variable length records. I've got a first implementation up and running and am now looking towards improving performance, particularly at doing I/O more efficiently since the input file gets...
Choosing between `mmap()` and traditional block reading via `fstream` for processing large files in C++ can depend on several factors, including the characteristics of your workload, the structure of the records, and system specifics. Here are some considerations and rules of thumb that can help you make a decision: #...
4,957
[ { "from": "human", "value": "I'm working on a program that will be processing files that could potentially be 100GB or more in size. The files contain sets of variable length records. I've got a first implementation up and running and am now looking towards improving performance, particularly at doing I/O m...
What I'm talking about here are nested classes. Essentially, I have two classes that I'm modeling. A DownloadManager class and a DownloadThread class. The obvious OOP concept here is composition. However, composition doesn't necessarily mean nesting, right? I have code that looks something like this: class DownloadThre...
You're right in your understanding that composition doesn't necessarily imply nesting; they serve different purposes and can both be valid design choices in object-oriented programming (OOP). Let’s explore the differences and benefits of each approach with respect to your `DownloadManager` and `DownloadThread` classes....
4,829
[ { "from": "human", "value": "What I'm talking about here are nested classes. Essentially, I have two classes that I'm modeling. A DownloadManager class and a DownloadThread class. The obvious OOP concept here is composition. However, composition doesn't necessarily mean nesting, right?\nI have code that loo...
Is there an easy way to tell if a ruby script is already running and then handle it appropriately? For example: I have a script called really_long_script.rb. I have it cronned to run every 5 minutes. When it runs, I want to see if the previous run is still running and then stop the execution of the second script. ...
Certainly! One common approach to handle the situation where you want to prevent multiple instances of a Ruby script from running simultaneously is to use a lock file. The idea is to create a file when the script starts executing and delete it when the script finishes. If the script starts and finds that the lock file ...
5,318
[ { "from": "human", "value": "Is there an easy way to tell if a ruby script is already running and then handle it appropriately? For example: I have a script called really_long_script.rb. I have it cronned to run every 5 minutes. When it runs, I want to see if the previous run is still running and then s...
I have recently run into an issue where I wanted to add a folder to the directory structure of my project that would become the new 'root' directory for the previously housed files. I've been getting help in a related thread but I wanted to put out a more open ended question to see what a best practice might be. Essen...
When restructuring your project to introduce a new root directory, such as an "implementation" directory while adding a "resources" directory for versioned assets, it's essential to do this in a systematic and organized manner. Here’s a step-by-step guide on how to approach this: ### Step 1: Plan Your Structure Decid...
6,084
[ { "from": "human", "value": "I have recently run into an issue where I wanted to add a folder to the directory structure of my project that would become the new 'root' directory for the previously housed files. I've been getting help in a related thread but I wanted to put out a more open ended question to...
I'm developing a website which will be used in the corporate intranet which uses JCIFS and NTLM to automatically authenticate the users without asking them to log on. Everything seems to be working in IE 6, but some users are being prompted for their passwords in IE 7. We've had some success by getting the users to ...
It sounds like you're dealing with a few common issues related to NTLM authentication and Internet Explorer's settings. Here are some suggestions you might try to resolve the issue of users being prompted for their passwords in Internet Explorer 7: 1. **Ensure Correct Domain and URL Settings**: - Make sure that the...
5,278
[ { "from": "human", "value": "I'm developing a website which will be used in the corporate intranet which uses JCIFS and NTLM to automatically authenticate the users without asking them to log on. Everything seems to be working in IE 6, but some users are being prompted for their passwords in IE 7. \nWe've...
I'm running Visual Studio 2008 with the stuff-of-nightmares awful MS test framework. Trouble is that it's sending my CPU to 100% (well 25% on a quad-core). My question is why can't Visual Studio run on more than one core? Surely M$ must have a sufficient handle on threading to get this to work.
Visual Studio 2008 and its associated testing frameworks were primarily designed around the computing architecture and technology available at the time of their release. Here are some key points to consider regarding CPU usage and multi-core support in Visual Studio 2008: 1. **Single-threaded Design**: Many of the com...
6,275
[ { "from": "human", "value": "I'm running Visual Studio 2008 with the stuff-of-nightmares awful MS test framework. Trouble is that it's sending my CPU to 100% (well 25% on a quad-core).\nMy question is why can't Visual Studio run on more than one core? Surely M$ must have a sufficient handle on threading t...
I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?
The Liskov Substitution Principle (LSP) is one of the five SOLID principles of object-oriented design, introduced by Barbara Liskov in 1987. The LSP states that if S is a subtype of T, then objects of type T should be replaceable with objects of type S without altering any of the desirable properties of the program (co...
5,467
[ { "from": "human", "value": "I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?\n" }, { "from": "gpt", "value": "The Liskov Substitution Principle (LSP) is one of the five SOLID princi...
Say I have an ASMX web service, MyService. The service has a method, MyMethod. I could execute MyMethod on the server side as follows: MyService service = new MyService(); service.MyMethod(); I need to do similar, with service and method not known until runtime. I'm assuming that reflection is the way to go about ...
When using reflection to instantiate a type in an ASMX web service, you need to ensure that you are getting the fully qualified name of the type, which includes the namespace and possibly the assembly. The `GetType` method cannot find the type because it is likely that the fully qualified name is not correctly specifie...
3,506
[ { "from": "human", "value": "Say I have an ASMX web service, MyService. The service has a method, MyMethod. I could execute MyMethod on the server side as follows:\nMyService service = new MyService();\nservice.MyMethod();\n\nI need to do similar, with service and method not known until runtime. \nI'm as...
Is there a way when executing a stored procedure in Management Studio to get the data types of the result sets coming back? I'm looking for something like functionality of when you pass a table name to sp_help
In SQL Server Management Studio (SSMS), there isn't a built-in stored procedure like `sp_help` specifically for retrieving the data types of result sets from a stored procedure directly. However, you can use a few different approaches to obtain this information: ### Method 1: Using `SET FMTONLY` You can execute the s...
6,602
[ { "from": "human", "value": "Is there a way when executing a stored procedure in Management Studio to get the data types of the result sets coming back? I'm looking for something like functionality of when you pass a table name to sp_help\n" }, { "from": "gpt", "value": "In SQL Server Management...
When defining a method on a class in Python, it looks something like this: class MyClass(object): def __init__(self, x, y): self.x = x self.y = y But in some other languages, such as C#, you have a reference to the object that the method is bound to with the "this" keyword without declaring it as a...
The requirement to explicitly include `self` as the first parameter in instance methods in Python is indeed a design decision, rather than a consequence of underlying implementation details. Here are several key points that highlight why Python's design uses `self`: 1. **Explicitness**: Python emphasizes readability ...
8,282
[ { "from": "human", "value": "When defining a method on a class in Python, it looks something like this:\nclass MyClass(object):\n def __init__(self, x, y):\n self.x = x\n self.y = y\n\nBut in some other languages, such as C#, you have a reference to the object that the method is bound to wi...
The leaving your wireless network open question reminded me of this. I typically share the root drive on my machines across my network, and tie login authorization to the machines NT ID, so there is at least some form of protection. My question, how easy is it to gain access to these drives for ill good? Is the authori...
Sharing the root drive on your machines across a network can pose significant security risks, even if you are using NT ID for authorization. Here are some factors to consider regarding the security of shared drives and recommendations for enhancing protection: ### 1. **Ease of Access for Unauthorized Users** - **Netwo...
5,767
[ { "from": "human", "value": "The leaving your wireless network open question reminded me of this.\nI typically share the root drive on my machines across my network, and tie login authorization to the machines NT ID, so there is at least some form of protection.\nMy question, how easy is it to gain access t...
I hit this problem all the time. Suppose I am making a command line interface (Java or C#, the problem is the same I think, I will show C# here). I define an interface ICommand I create an abstract base class CommandBase which implements ICommand, to contain common code. I create several implementation classes, each e...
You’ve pointed out a common challenge in object-oriented design, particularly in cases where you want to share static information across derived classes while still conforming to an interface. Let's go through your proposed solutions first, and then I'll suggest some more elegant alternatives. ### Proposed Solutions ...
6,635
[ { "from": "human", "value": "I hit this problem all the time. Suppose I am making a command line interface (Java or C#, the problem is the same I think, I will show C# here).\n\nI define an interface ICommand\nI create an abstract base class CommandBase which implements ICommand, to contain common code.\nI ...
How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once? Any ideas before I go and write my own functions.
In Emacs, you can easily copy a line multiple times using a combination of keyboard shortcuts and commands without having to write your own functions. Here’s a quick method to copy a line 10 times: 1. **Move to the Line**: First, place your cursor anywhere on the line you want to copy. 2. **Copy the Line**: - You ...
5,818
[ { "from": "human", "value": "How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once?\nAny ideas before I go and write my own functions.\n" }, { "from": "gpt", ...
I'm going to be working on some iPhone apps so I've been given a golden ticket to buy a Mac. However the golden ticket isn't worth that much, and I'm thinking iMac. Now, Macs are great, I love 'em and use 'em at home, but I know that the iMac is geared more towards the average consumer than the professional. Is an iMac...
Yes, an iMac is definitely powerful enough for iPhone development using Xcode, especially if you are only running Xcode and a web browser. Apple's development tools, including Xcode, are designed to work well across a range of Mac hardware, and the iMac has sufficient power to handle these tasks efficiently. ### Key C...
5,349
[ { "from": "human", "value": "I'm going to be working on some iPhone apps so I've been given a golden ticket to buy a Mac. However the golden ticket isn't worth that much, and I'm thinking iMac. Now, Macs are great, I love 'em and use 'em at home, but I know that the iMac is geared more towards the average c...
What are some of the advantages of using one over the other?
To provide a meaningful comparison, could you clarify what specific options or items you are referring to? For example, are you comparing different technologies, methodologies, products, or services? Please provide more details so I can give you the best possible information.
10,886
[ { "from": "human", "value": "What are some of the advantages of using one over the other?\n" }, { "from": "gpt", "value": "To provide a meaningful comparison, could you clarify what specific options or items you are referring to? For example, are you comparing different technologies, methodologi...
I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com ads2.sitename.com unfortunatly most of my advertisers want to give me a block of javascript code to use rather than a direct l...
To manage your popup ads using subdomains while allowing advertisers to provide JavaScript code, you can create a PHP script that serves the JavaScript code directly from those subdomains. Here's how you can achieve this: 1. **Create a Dynamic Subdomain Handler**: You can set up a wildcard subdomain to point to a sing...
5,388
[ { "from": "human", "value": "I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com\nads2.sitename.com\nunfortunatly most of my advertisers want to give me a block of ja...
More out of interest than anything else, but can you compile a DirectX app under linux? Obviously there's no official SDK, but I was thinking it might be possible with wine. Presumably wine has an implementation of the DirectX interface in order to run games? Is it possible to link against that? (edit: This is called w...
Yes, it is indeed possible to develop a DirectX application on Linux using Wine, specifically through Winelib, although it comes with certain limitations and complexities. ### Using Winelib Winelib is a part of the Wine project that allows you to compile Windows applications into native Windows binaries while still p...
4,197
[ { "from": "human", "value": "More out of interest than anything else, but can you compile a DirectX app under linux?\nObviously there's no official SDK, but I was thinking it might be possible with wine.\nPresumably wine has an implementation of the DirectX interface in order to run games? Is it possible to...
What are the available libraries for creating pretty charts and graphs in a Python application?
There are several libraries available in Python for creating visually appealing charts and graphs. Here are some of the most popular ones: 1. **Matplotlib**: - A foundational library for creating static, animated, and interactive visualizations in Python. - Highly customizable, though it may require more code to...
3,939
[ { "from": "human", "value": "What are the available libraries for creating pretty charts and graphs in a Python application?\n" }, { "from": "gpt", "value": "There are several libraries available in Python for creating visually appealing charts and graphs. Here are some of the most popular ones:...
If I open a file in Design View (web form), I get intellisense for my display code, but not my script code.. If I open with source code editor I, occasionally, get intellisense within the script tags. Anyone know how to get intellisense working all of the time for all of my code? Been living with this one for a lon...
It sounds like you're having issues with IntelliSense in a web development environment, possibly in an IDE like Visual Studio. Here are some steps you can take to ensure that IntelliSense works more consistently for both your display (HTML) and script (JavaScript) code: ### General Tips for Enabling IntelliSense 1. *...
4,562
[ { "from": "human", "value": "If I open a file in Design View (web form), I get intellisense for my display code, but not my script code.. If I open with source code editor I, occasionally, get intellisense within the script tags. \nAnyone know how to get intellisense working all of the time for all of my c...
I'm trying to use the Optiflag package in my Ruby code and whenever I try to do the necessary require optiflag.rb, my program fails with the standard no such file to load -- optiflag message. I added the directory with that library to my $PATH variable, but it's still not working. Any ideas?
It sounds like you're trying to use the Optiflag gem in your Ruby program, but you're encountering an issue when attempting to require it. The error message "no such file to load -- optiflag" indicates that Ruby is unable to find the Optiflag library. Here are some steps to help troubleshoot and resolve the issue: 1....
6,477
[ { "from": "human", "value": "I'm trying to use the Optiflag package in my Ruby code and whenever I try to do the necessary require optiflag.rb, my program fails with the standard no such file to load -- optiflag message. I added the directory with that library to my $PATH variable, but it's still not workin...
In my web app, I submit some form fields with jQuery's $.getJSON() method. I am having some problems with the encoding. The character-set of my app is charset=ISO-8859-1, but I think these fields are submitted with UTF-8. How I can set encoding used in $.getJSON calls?
When using jQuery's `$.getJSON()` method, it doesn't directly allow you to specify the character encoding for the request. The encoding used for the request is determined by the browser and the server's configurations. However, you can ensure that data is sent and received in the correct encoding by setting the appropr...
5,360
[ { "from": "human", "value": "In my web app, I submit some form fields with jQuery's $.getJSON() method. I am having some problems with the encoding. The character-set of my app is charset=ISO-8859-1, but I think these fields are submitted with UTF-8. \nHow I can set encoding used in $.getJSON calls? \n" }...
I want to define something like this in php: $EL = "\n<br />\n"; and then use that variable as an "endline" marker all over my site, like this: echo "Blah blah blah{$EL}"; How do I define $EL once (in only 1 file), include it on every page on my site, and not have to reference it using the (strangely backwards) globa...
To achieve this in PHP, you can define your variable in a configuration file and include that file in every page of your site. Here's how you can do it step by step: ### Step 1: Create a Configuration File Create a file named `config.php` (or any name you prefer) in a common location, such as the root directory of yo...
5,623
[ { "from": "human", "value": "I want to define something like this in php:\n$EL = \"\\n<br />\\n\";\n\nand then use that variable as an \"endline\" marker all over my site, like this:\necho \"Blah blah blah{$EL}\";\n\nHow do I define $EL once (in only 1 file), include it on every page on my site, and not hav...
For example: me$ FOO="BAR * BAR" me$ echo $FOO BAR file1 file2 file3 file4 BAR and using the \ escape character: me$ FOO="BAR \* BAR" me$ echo $FOO BAR \* BAR I'm obviously doing something stupid. How do I get the output BAR * BAR?
The issue you're encountering is due to the way the shell interprets asterisks (`*`) as wildcard characters, which expand to match filenames in the current directory. To store an asterisk in a variable and then display it without it being interpreted as a wildcard, you can do the following: 1. Use single quotes to ass...
8,986
[ { "from": "human", "value": "For example:\nme$ FOO=\"BAR * BAR\"\nme$ echo $FOO\nBAR file1 file2 file3 file4 BAR\n\nand using the \\ escape character:\nme$ FOO=\"BAR \\* BAR\"\nme$ echo $FOO\nBAR \\* BAR\n\nI'm obviously doing something stupid.\nHow do I get the output BAR * BAR?\n" }, { "from": "gp...
What is the best way to make a Delphi application (Delphi 2007 for Win32) go completely full screen, removing the application border and covering the Windows Taskbar? I am looking for something similar to what Internet Explorer (IE) does when you hit F11. I wish this to be a run time option for the user not a design ti...
To create a full-screen effect in a Delphi 2007 Win32 application, you need to set the form's border style to `bsNone`, maximize the form, and potentially adjust its position to ensure it covers the entire screen, including the taskbar. Here's a step-by-step guide to achieve that: 1. **Set the Form's Border Style:** ...
2,748
[ { "from": "human", "value": "What is the best way to make a Delphi application (Delphi 2007 for Win32) go completely full screen, removing the application border and covering the Windows Taskbar?\nI am looking for something similar to what Internet Explorer (IE) does when you hit F11.\nI wish this to be a r...
Let's say I have this code: if (md5($_POST[$foo['bar']]) == $somemd5) { doSomethingWith(md5($_POST[$foo['bar']]); } I could shorten that down by doing: $value = md5($_POST[$foo['bar']]; if ($value == $somemd5) { doSomethingWith($value); } But is there any pre-set variable that contains the first or second conditi...
In PHP, there is no pre-set variable that directly represents the condition of an `if` statement. The conditions in an `if` statement are evaluated at runtime, and you cannot access their values in a way that would automatically assign them to a variable. However, you can store the result of your condition in a variab...
7,771
[ { "from": "human", "value": "Let's say I have this code:\nif (md5($_POST[$foo['bar']]) == $somemd5) {\n doSomethingWith(md5($_POST[$foo['bar']]);\n}\n\nI could shorten that down by doing:\n$value = md5($_POST[$foo['bar']];\nif ($value == $somemd5) {\n doSomethingWith($value);\n}\n\nBut is there any pre-se...
Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path "C:\foo" and a subdirectory "bar". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method for this in .NET, or do I need to handle this myself?
Yes, in .NET, you can use the `Path.Combine` method from the `System.IO` namespace to join paths in a similar way to PowerShell's `Join-Path`. The `Path.Combine` method takes care of adding the appropriate directory separators based on the platform you are on. Here is an example of how to use `Path.Combine`: ```cshar...
9,221
[ { "from": "human", "value": "Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path \"C:\\foo\" and a subdirectory \"bar\". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method for this in .NET, or d...
I want: all links which not contained filename (not .html, .jpg, .png, .css) redirect with state 301 to directory, for example: http://mysite.com/article -> http://mysite.com/article/ But http://mysite.com/article/article-15.html not redirects. What regulat expression I must write to .htaccess for adding slash to virtu...
To achieve the desired behavior of redirecting URLs without a filename (i.e., those that do not end with .html, .jpg, .png, .css) to include a trailing slash, you can use a combination of RewriteCond and RewriteRule directives in your `.htaccess` file. Here’s how you can write the rules: ```apache RewriteEngine On #...
7,289
[ { "from": "human", "value": "I want:\nall links which not contained filename (not .html, .jpg, .png, .css) redirect with state 301 to directory, for example: http://mysite.com/article -> http://mysite.com/article/\nBut http://mysite.com/article/article-15.html not redirects.\nWhat regulat expression I must ...
I have been making a little toy web application in C# along the lines of Rob Connery's Asp.net MVC storefront. I find that I have a repository interface, call it IFooRepository, with methods, say IQueryable<Foo> GetFoo(); void PersistFoo(Foo foo); And I have three implementations of this: ISqlFooRepository, IFileFooRe...
You can achieve this by using the concept of **Parameterized Tests**. The Microsoft testing framework (MSTest) does not support parameterized tests directly as some other frameworks do, but you can use a combination of test class inheritance and the `DataRow` attribute to create a clean solution. Here's how you can imp...
6,233
[ { "from": "human", "value": "I have been making a little toy web application in C# along the lines of Rob Connery's Asp.net MVC storefront.\nI find that I have a repository interface, call it IFooRepository, with methods, say\nIQueryable<Foo> GetFoo();\nvoid PersistFoo(Foo foo);\n\nAnd I have three implemen...
Is there a way to detect, from within the finally clause, that an exception is in the process of being thrown? See the example below: try { // code that may or may not throw an exception } finally { SomeCleanupFunctionThatThrows(); // if currently executing an exception, exit the program, // otherwise ...
In Java, when you're within a `finally` block, it's not directly possible to check whether an exception is currently being thrown from the `try` block. However, you can work around this limitation by using a flag. You can use a boolean variable to track whether an exception occurred in the `try` block. Here's how you ...
6,966
[ { "from": "human", "value": "Is there a way to detect, from within the finally clause, that an exception is in the process of being thrown?\nSee the example below:\n\ntry {\n // code that may or may not throw an exception\n} finally {\n SomeCleanupFunctionThatThrows();\n // if currently executing a...
What are the best Java example sites? I'm looking for places that you go when you have a specific question and you want a little Java code snippet to solve it with.
There are several excellent resources where you can find Java code snippets, examples, and answers to specific questions. Here are some of the best sites: 1. **Stack Overflow**: - [Stack Overflow](https://stackoverflow.com/questions/tagged/java) is a community-driven Q&A site where you can ask specific questions a...
5,885
[ { "from": "human", "value": "What are the best Java example sites? I'm looking for places that you go when you have a specific question and you want a little Java code snippet to solve it with.\n" }, { "from": "gpt", "value": "There are several excellent resources where you can find Java code sn...
I just get the beach ball all day long (it's been doing nothing for hours). It's not taking CPU, not reading from disk, not using the network. I'm using Java 1.6 on Mac OS X 10.5.4. It worked once, now even restarts of the computer won't help. Activity Monitor says it's "(Not Responding)". Only thing that I can do is k...
It sounds like you're experiencing a frustrating issue with your Java application on Mac OS X 10.5.4. The "(Not Responding)" status usually indicates that the application is stuck in some way, possibly waiting for a resource or experiencing a deadlock. ### Troubleshooting Suggestions: 1. **Check for Java Updates**: S...
4,519
[ { "from": "human", "value": "I just get the beach ball all day long (it's been doing nothing for hours). It's not taking CPU, not reading from disk, not using the network.\nI'm using Java 1.6 on Mac OS X 10.5.4. It worked once, now even restarts of the computer won't help. Activity Monitor says it's \"(Not ...
Ok, so i'm working on a regular expression to search out all the header information in a site. I've compiled the regular expression: regex = re.compile(r''' <h[0-9]>\s? (<a[ ]href="[A-Za-z0-9.]*">)?\s? [A-Za-z0-9.,:'"=/?;\s]*\s? [A-Za-z0-9.,:'"=/?;\s]? ''', re.X) When i run this in python reg ex. test...
The issue you're encountering stems from how the `re.findall` function behaves in Python when used with capturing groups in regular expressions. In your regex, the portion `(<a href="[A-Za-z0-9.]*">)?` is a capturing group. When you use `re.findall`, it returns a list of the captured groups, which is why you're only se...
6,048
[ { "from": "human", "value": "Ok, so i'm working on a regular expression to search out all the header information in a site.\nI've compiled the regular expression:\nregex = re.compile(r'''\n <h[0-9]>\\s?\n (<a[ ]href=\"[A-Za-z0-9.]*\">)?\\s?\n [A-Za-z0-9.,:'\"=/?;\\s]*\\s?\n [A-Za-z0-9.,:'\"=/?;\...
One of the things I'd like to do in my browser-based application is allow the user to select some text (not in a <textarea>, just plain ol' text!), and have my application pop up a small toolbar that then can interact with the next (in my case, add annotations). I've found a lot of stuff on google that seems to be focu...
To achieve the functionality of selecting text in a browser and showing a toolbar for annotations, you can use the `window.getSelection()` method, which is widely supported across modern browsers, including Firefox, Chrome, Safari, and even Internet Explorer (though for older versions of IE, you may need a different ap...
5,216
[ { "from": "human", "value": "One of the things I'd like to do in my browser-based application is allow the user to select some text (not in a <textarea>, just plain ol' text!), and have my application pop up a small toolbar that then can interact with the next (in my case, add annotations).\nI've found a lo...
New version of Management Studio (i.e. the one that ships with SQL Server 2008) finally has a Transact-SQL IntelliSense feature. However, out-of-the-box it only works with SQL Server 2008 instances. Is there some workaround for this?
Yes, there are workarounds to enable IntelliSense in SQL Server Management Studio (SSMS) for instances of SQL Server prior to 2008. While the built-in IntelliSense features of SSMS 2008 and later are primarily designed to work with SQL Server 2008 and newer, there are several approaches you can try: 1. **Use the Compa...
6,509
[ { "from": "human", "value": "New version of Management Studio (i.e. the one that ships with SQL Server 2008) finally has a Transact-SQL IntelliSense feature. However, out-of-the-box it only works with SQL Server 2008 instances.\nIs there some workaround for this?\n" }, { "from": "gpt", "value": ...
I have a column containing the strings 'Operator (1)' and so on until 'Operator (600)' so far. I want to get them numerically ordered and I've come up with select colname from table order by cast(replace(replace(colname,'Operator (',''),')','') as int) which is very very ugly. Better suggestions?
Your current approach to extracting and ordering the numbers from the strings in your SQL query is functional, but it can indeed be streamlined for better readability. Here are a couple of suggestions to improve the clarity of your SQL query. ### Option 1: Using Regular Expression (if supported) If your SQL database ...
6,775
[ { "from": "human", "value": "I have a column containing the strings 'Operator (1)' and so on until 'Operator (600)' so far.\nI want to get them numerically ordered and I've come up with\nselect colname from table order by \ncast(replace(replace(colname,'Operator (',''),')','') as int)\n\nwhich is very very ...
What is the best way to programmatically send an SMS text message? Are there any free Web Service based SMS gateways? I know that if I happen to know the user's carrier (Sprint, AT&T, etc), I can send an SMS by emailing an address based on phone number + carrier. I would like a good solution that does not require me to...
To programmatically send an SMS text message, you have several options, both free and paid. Below, I'll cover the various methods, including how to send SMS without knowing the user's carrier and how SMS gateways operate. ### 1. Programmatic SMS Sending Options #### a. **Email to SMS Gateway** You can send SMS messag...
5,214
[ { "from": "human", "value": "What is the best way to programmatically send an SMS text message?\nAre there any free Web Service based SMS gateways?\nI know that if I happen to know the user's carrier (Sprint, AT&T, etc), I can send an SMS by emailing an address based on phone number + carrier. I would like ...
I have several old 3.5in floppy disks that I would like to backup. My attempts to create an image of the disks have failed. I tried using the UNIX utility dd_rescue, but when the kernel tries to open (/dev/fd0) I get a kernel error, floppy0: probe failed... I would like an image because some of the floppies are usin...
Backing up old 3.5-inch floppy disks can be challenging, especially when dealing with non-standard file systems like LIF. Here are some suggestions to help you successfully create disk images without losing data: 1. **Check Hardware Compatibility**: Ensure that your floppy disk drive is properly connected and recogniz...
6,217
[ { "from": "human", "value": "I have several old 3.5in floppy disks that I would like to backup. My attempts to create an image of the disks have failed. I tried using the UNIX utility dd_rescue, but when the kernel tries to open (/dev/fd0) I get a kernel error,\nfloppy0: probe failed...\n\nI would like an...
I am trying to create an XML file based on data fields from a table, and I want to have the nodes named based on the value in a field from the table. The problem is that sometimes values entered in that column contain spaces and other characters not allowed in Node names. Does anyone have any code that will cleanup a p...
To create valid XML node names from strings that may contain spaces or other invalid characters, you can write a function in VB.NET (or C#) that cleans up the string and replaces invalid characters with a placeholder. You can then reverse this process to retrieve the original string. Below is an example in both VB.NET ...
4,456
[ { "from": "human", "value": "I am trying to create an XML file based on data fields from a table, and I want to have the nodes named based on the value in a field from the table. The problem is that sometimes values entered in that column contain spaces and other characters not allowed in Node names.\nDoes ...
I have a Property Grid in C#, loading up a 'PropertyAdapter' object (a basic wrapper around one of my objects displaying relevant properties with the appropriate tags) I have a TypeConverter on one of the properties (DataType, that returns an enumeration of possible values) as I want to limit the values available to th...
The issue you're encountering stems from how the Property Grid and the TypeConverter handle the conversion between the displayed value (the string representation of the enum) and the actual enum type when a value is selected from the dropdown. When you use the drop-down to select a value, the Property Grid tries to co...
7,642
[ { "from": "human", "value": "I have a Property Grid in C#, loading up a 'PropertyAdapter' object (a basic wrapper around one of my objects displaying relevant properties with the appropriate tags)\nI have a TypeConverter on one of the properties (DataType, that returns an enumeration of possible values) as ...
How can I have SQL repeat some set-based operation an arbitrary number of times without looping? How can I have SQL perform an operation against a range of numbers? I'm basically looking for a way to do a set-based for loop. I know I can just create a small table with integers in it, say from 1 to 1000 and then use it ...
In SQL, especially in T-SQL (used with Microsoft SQL Server), you can perform set-based operations without explicit looping constructs by leveraging Common Table Expressions (CTEs) or by using system views and recursive queries. Below are a few methods to achieve set-based operations for a range of numbers without loop...
5,436
[ { "from": "human", "value": "How can I have SQL repeat some set-based operation an arbitrary number of times without looping? How can I have SQL perform an operation against a range of numbers? I'm basically looking for a way to do a set-based for loop.\nI know I can just create a small table with integers ...
What are the most user-friendly color combinations for Web 2.0 websites, such as background, button colors, etc.?
Creating a user-friendly color palette for Web 2.0 websites is crucial for enhancing user experience, readability, and aesthetic appeal. Here are some effective color combinations that are popular and user-friendly, along with their typical applications: ### 1. **Blue and White** - **Background:** White or light gray ...
1,705
[ { "from": "human", "value": "What are the most user-friendly color combinations for Web 2.0 websites, such as background, button colors, etc.? \n" }, { "from": "gpt", "value": "Creating a user-friendly color palette for Web 2.0 websites is crucial for enhancing user experience, readability, and ...
We use SAX to parse XML because it does not require the entire XML document to be read into memory in order to parse a single value. I read many articles that insisted SAX can only be used to parse/decode XML and not create it. Is this true?
Yes, it is true that SAX (Simple API for XML) is primarily designed for parsing XML, not for creating it. SAX is an event-driven model for reading XML documents; it processes the document as it reads it, triggering events (such as the start or end of an element) that can be handled by the application. This makes it eff...
9,303
[ { "from": "human", "value": "We use SAX to parse XML because it does not require the entire XML document to be read into memory in order to parse a single value. I read many articles that insisted SAX can only be used to parse/decode XML and not create it. Is this true?\n" }, { "from": "gpt", "v...
I'll take away the obvious one here: mic and webcam support. Other than that, if you ran the Silverlight team, what would your highest priority be for Silverlight v.Next? Disclaimer: If we get some good responses, I'll pass them along to folks I know on the Silverlight team. UPDATE: The best place to report Silverlight...
If I were running the Silverlight team and looking to prioritize features for Silverlight v.Next beyond mic and webcam support, my focus would be on the following areas: 1. **Improved Performance and Optimizations**: Enhancing the runtime performance, reducing load times, and optimizing memory usage would be critical ...
3,999
[ { "from": "human", "value": "I'll take away the obvious one here: mic and webcam support. Other than that, if you ran the Silverlight team, what would your highest priority be for Silverlight v.Next?\nDisclaimer: If we get some good responses, I'll pass them along to folks I know on the Silverlight team.\nU...
This seemed like an easy thing to do. I just wanted to pop up a text window and display two columns of data -- a description on the left side and a corresponding value displayed on the right side. I haven't worked with Forms much so I just grabbed the first control that seemed appropriate, a TextBox. I thought using ta...
It seems you're trying to display a two-column layout in a TextBox control, but you've encountered issues with alignment due to tab characters and the way text measurement works with complex fonts. Instead of using a TextBox, consider using a `ListView` control, which is more suited for displaying tabular data. A ListV...
6,235
[ { "from": "human", "value": "This seemed like an easy thing to do. I just wanted to pop up a text window and display two columns of data -- a description on the left side and a corresponding value displayed on the right side. I haven't worked with Forms much so I just grabbed the first control that seemed a...
Does anyone have experiences in providing a custom MvcRouteHandler? In my application I'd like to implement a globalization-pattern like http://mydomain/en/about or http://mydomain/de/about. As for persistance, I'd like to have a cookie read as soon as a request arrives and if there is a language setting in this cooki...
Implementing a custom `MvcRouteHandler` to handle globalization patterns in ASP.NET MVC is a good way to achieve what you're looking for. Here's a high-level overview of how you can accomplish this: ### Step 1: Create a Custom Route Handler You need to create a class that derives from `MvcRouteHandler` and override t...
4,898
[ { "from": "human", "value": "Does anyone have experiences in providing a custom MvcRouteHandler? In my application I'd like to implement a globalization-pattern like http://mydomain/en/about or http://mydomain/de/about. \nAs for persistance, I'd like to have a cookie read as soon as a request arrives and if...
I am writing a perl script to parse a mysql database schema and create C++ classes when necessary. My question is a pretty easy one, but us something I haven't really done before and don't know common practice. Any object of any of classes created will need to have "get" methods to populate this information. So my q...
Your questions about how to design your C++ classes, especially when interacting with a MySQL database, touch on several common practices in object-oriented programming. Let's address both of your questions one at a time. ### Question 1: Constructor Data Population 1. **Should you call all of the "get" methods in the...
3,550
[ { "from": "human", "value": "I am writing a perl script to parse a mysql database schema and create C++ classes when necessary. My question is a pretty easy one, but us something I haven't really done before and don't know common practice. Any object of any of classes created will need to have \"get\" met...
This is something that I think would be very useful. Basically, I'd like there to be a way to edit Python source programmatically without requiring human intervention. There are a couple of things I would like to do with this: Edit the configuration of Python apps that use source modules for configuration. Set up a ...
There are indeed existing methods and libraries in Python that can help you programmatically edit Python source files without requiring human intervention. Here are a few approaches you can consider: ### 1. **Using Abstract Syntax Trees (AST)** Python's `ast` module allows you to parse Python source code into an Abst...
2,970
[ { "from": "human", "value": "This is something that I think would be very useful. Basically, I'd like there to be a way to edit Python source programmatically without requiring human intervention. There are a couple of things I would like to do with this:\n\nEdit the configuration of Python apps that use ...
Are there any VNC Libraries for Java, I need to build a JSP/Servlet based VNC server, to allow user to share their desktops with helpdesk. I've seen jVNC, but i'd like to build it myself, for a University project. In particular, I'm looking for Java Libraries that I can use inside another servlet based application. Unf...
Building a VNC server in Java for a JSP/Servlet-based application is an ambitious project! While there are limited mature libraries directly for VNC in Java, you can explore a few options that might help you with your implementation. 1. **jVNC**: You mentioned jVNC, which is one of the existing libraries you might lo...
6,634
[ { "from": "human", "value": "Are there any VNC Libraries for Java, I need to build a JSP/Servlet based VNC server, to allow user to share their desktops with helpdesk. I've seen jVNC, but i'd like to build it myself, for a University project.\nIn particular, I'm looking for Java Libraries that I can use ins...
How do you clear the IRB console screen?
In the Interactive Ruby (IRB) console, you can clear the screen by using the following command: ```ruby system('clear') # For Unix/Linux/macOS ``` or ```ruby system('cls') # For Windows ``` Alternatively, if you want a quick way to clear the screen without typing those commands, you can also use: ```ruby Ctrl + ...
10,474
[ { "from": "human", "value": "How do you clear the IRB console screen?\n" }, { "from": "gpt", "value": "In the Interactive Ruby (IRB) console, you can clear the screen by using the following command:\n\n```ruby\nsystem('clear') # For Unix/Linux/macOS\n```\n\nor\n\n```ruby\nsystem('cls') # For W...
If you have a JSF <h:commandLink> (which uses the onclick event of an <a> to submit the current form), how do you execute JavaScript (such as asking for delete confirmation) prior to the action being performed?
To execute JavaScript before performing an action in a JSF `<h:commandLink>`, you can use the `onclick` attribute to add your JavaScript code for confirmation. If the confirmation is denied, you can return `false` to prevent the form from being submitted. Here's how you can do it: ```xml <h:commandLink value="Delete"...
9,994
[ { "from": "human", "value": "If you have a JSF <h:commandLink> (which uses the onclick event of an <a> to submit the current form), how do you execute JavaScript (such as asking for delete confirmation) prior to the action being performed?\n" }, { "from": "gpt", "value": "To execute JavaScript b...
I've noticed that some sites (usually banks) suppress the ability to paste text into text fields. How is this done? I know that JavaScript can be used to swallow the keyboard shortcut for paste, but what about the right-click menu item?
Websites, including banks, may prevent pasting into text fields for security and usability reasons. This can be achieved through various methods in JavaScript and HTML. Here’s how they typically implement these restrictions: ### 1. **Keyboard Event Handling** To prevent pasting using keyboard shortcuts (like `Ctrl + V...
6,215
[ { "from": "human", "value": "I've noticed that some sites (usually banks) suppress the ability to paste text into text fields. How is this done? I know that JavaScript can be used to swallow the keyboard shortcut for paste, but what about the right-click menu item?\n" }, { "from": "gpt", "value"...
We're looking at moving from a check-out/edit/check-in style of version control system to Subversion, and during the evaluation we discovered that when you perform an Update action in TortoiseSVN (and presumably in any Subversion client?), if changes in the repository that need to be applied to files that you've been e...
Your concerns about silent merges in Subversion (SVN) are quite valid, especially in collaborative environments where code logic can be affected by changes made by multiple developers. Here’s how you can manage the risks associated with automatic merging in TortoiseSVN: 1. **Understand How Updates Work**: When you per...
5,393
[ { "from": "human", "value": "We're looking at moving from a check-out/edit/check-in style of version control system to Subversion, and during the evaluation we discovered that when you perform an Update action in TortoiseSVN (and presumably in any Subversion client?), if changes in the repository that need ...
I've heard people referring to this table and was not sure what it was about.
It seems like you're referring to a specific table, but I don't have the context to determine which table you're mentioning. Could you provide more details about the table? For example, is it a data table, a summary of information, a scientific table, or something else? Any additional information will help me assist yo...
10,802
[ { "from": "human", "value": "I've heard people referring to this table and was not sure what it was about.\n" }, { "from": "gpt", "value": "It seems like you're referring to a specific table, but I don't have the context to determine which table you're mentioning. Could you provide more details ...
We have an Excel 2002/XP based application that interacts with SQL 2000/5 to process fairly complex actuarial calculations. The application performs its function well, but it's difficult to manage. We're trying to create a "controller" application or service that can manage and monitor these various instances of Excel ...
Creating a controller application to manage multiple instances of Excel from a .NET application involves several steps. You can use the Interop services to interact with Excel, but you should also manage the complexity that comes with it, such as handling multiple instances, ensuring resources are properly released, an...
5,850
[ { "from": "human", "value": "We have an Excel 2002/XP based application that interacts with SQL 2000/5 to process fairly complex actuarial calculations. The application performs its function well, but it's difficult to manage.\nWe're trying to create a \"controller\" application or service that can manage a...
We have a NET app that gets installed to the Program Files folder. The app itself writes some files and creates some directories to its app folder. But when a normal windows user tries to use our application it crashes because that user does not have permission to write to app folder. Is there any folder in both WinXP...
In Windows XP and Windows Vista, the approach to user permissions differs somewhat. However, there are directories that generally provide write access to all users by default. 1. **Common Application Data Folder**: - **Path**: `C:\ProgramData` (for Windows Vista and later) and `C:\Documents and Settings\All Users\...
7,384
[ { "from": "human", "value": "We have a NET app that gets installed to the Program Files folder. \nThe app itself writes some files and creates some directories to its app folder.\nBut when a normal windows user tries to use our application it crashes because that user does not have permission to write to ap...
I'm working on some production software, using C# on the .NET framework. I really would like to be able to use LINQ on the project. I believe it requires .NET version 3.5 (correct me if I'm wrong). This application is a commercial software app, required to run on a client's work PC. Is it reasonable to assume they have...
You are correct that LINQ (Language Integrated Query) was introduced in .NET Framework 3.5. As for whether you can reasonably assume that your clients have .NET 3.5 installed or would be willing to upgrade to a later version, there are several factors to consider: 1. **Default Installation**: As of Windows 7 and later...
6,779
[ { "from": "human", "value": "I'm working on some production software, using C# on the .NET framework. I really would like to be able to use LINQ on the project. I believe it requires .NET version 3.5 (correct me if I'm wrong). This application is a commercial software app, required to run on a client's work...
My application uses 2.0. At some point in the future I may want to start using newer features added in later framework versions. Should I wait until then? Or are there advantages to updating to the latest .NET 3.5 now? I suppose by the time I am ready for next spring's release 4.0 will be out. Perhaps I should stic...
When deciding whether to upgrade from .NET Framework 2.0 to 3.5 now or wait until the release of .NET 4.0, there are several factors to consider: ### Advantages of Upgrading to .NET 3.5 Now: 1. **New Features**: .NET 3.5 introduced a number of significant enhancements over 2.0, including Language Integrated Query (LI...
6,972
[ { "from": "human", "value": "My application uses 2.0. At some point in the future I may want to start using newer features added in later framework versions. Should I wait until then? Or are there advantages to updating to the latest .NET 3.5 now?\nI suppose by the time I am ready for next spring's relea...
I'm looking for a wiki that I can use to track requirements for a project, but we would like to be able to export the wiki (with formatting) to Microsoft Word. Does anyone know of a wiki that does this?
There are several wiki platforms that allow you to manage project requirements and can export content to Microsoft Word with formatting. Here are a few options: 1. **Confluence**: This is a popular collaboration tool from Atlassian. Confluence allows you to create pages for project requirements, and it has an export f...
7,815
[ { "from": "human", "value": "I'm looking for a wiki that I can use to track requirements for a project, but we would like to be able to export the wiki (with formatting) to Microsoft Word. Does anyone know of a wiki that does this?\n" }, { "from": "gpt", "value": "There are several wiki platfor...
I am looking to write some C# code for linux/windows/mac/any other platform, and am looking for best practices for portable code. Project mono has some great porting resources. What are the best practices for portable C#?
Writing portable C# code that can run on multiple platforms (Linux, Windows, macOS, etc.) involves several best practices to ensure compatibility and maintainability. Here are some key considerations: ### 1. Use .NET Standard or .NET 5/6+ - **Target .NET Standard:** If you're building libraries, consider targeting .N...
4,705
[ { "from": "human", "value": "I am looking to write some C# code for linux/windows/mac/any other platform, and am looking for best practices for portable code.\nProject mono has some great porting resources.\nWhat are the best practices for portable C#?\n" }, { "from": "gpt", "value": "Writing po...
Is there a maintained package I can use to retrieve and set MP3 ID3 metadata using Python?
Yes, there are several maintained packages in Python that you can use to retrieve and set ID3 metadata for MP3 files. One of the most popular and widely used packages is `mutagen`. It is a pure Python package that supports reading and writing various audio metadata formats, including ID3 for MP3 files. ### Installatio...
5,593
[ { "from": "human", "value": "Is there a maintained package I can use to retrieve and set MP3 ID3 metadata using Python?\n" }, { "from": "gpt", "value": "Yes, there are several maintained packages in Python that you can use to retrieve and set ID3 metadata for MP3 files. One of the most popular a...
Jeff covered this a while back on his blog in terms of 32 bit Vista. Does the same 32 bit 4 GB memory cap that applies in 32 bit Vista apply to 32 bit Ubuntu? Are there any 32 bit operating systems that have creatively solved this problem?
Yes, the 32-bit memory limitation that affects Windows Vista—where a 32-bit operating system can typically access up to 4 GB of RAM, but often less due to reserved addresses and hardware requirements—also applies to 32-bit Ubuntu and other 32-bit operating systems. The theoretical limit for a 32-bit address space is 4 ...
7,694
[ { "from": "human", "value": "Jeff covered this a while back on his blog in terms of 32 bit Vista.\nDoes the same 32 bit 4 GB memory cap that applies in 32 bit Vista apply to 32 bit Ubuntu? Are there any 32 bit operating systems that have creatively solved this problem?\n" }, { "from": "gpt", "va...
I want to implement an "automatic update" system for a windows application. Right now I'm semi-manually creating an "appcast" which my program checks, and notifies the user that a new version is available. (I'm using NSIS for my installers). Is there software that I can use that will handle the "automatic" part of t...
Implementing an automatic update system for a Windows application can enhance the user experience by ensuring they always have the latest version. While you are currently using NSIS for installer creation and a semi-manual appcast system, there are various tools and libraries available that can help automate this proce...
4,754
[ { "from": "human", "value": "I want to implement an \"automatic update\" system for a windows application. \nRight now I'm semi-manually creating an \"appcast\" which my program checks, and notifies the user that a new version is available. (I'm using\n NSIS for my installers).\nIs there software that I ca...
I'm looking for a simple way to encrypt my soap communication in my C# Web-Service. I was looking into WSE 3.0 but it seems Microsoft dropped support for it, and therefore it's not straightforward to use. It seems WCF could've been an option but I prefer not to upgrade from .NET 2.0 . Any simple, straightforward encryp...
Encrypting SOAP messages for communication in a C# web service can be a challenge, especially if you're restricted to .NET Framework 2.0, as modern libraries and frameworks like WCF are not available in that environment. However, there are still some strategies you can employ to achieve encryption without relying on WS...
604
[ { "from": "human", "value": "I'm looking for a simple way to encrypt my soap communication in my C# Web-Service.\nI was looking into WSE 3.0 but it seems Microsoft dropped support for it, and therefore it's not straightforward to use.\nIt seems WCF could've been an option but I prefer not to upgrade from .N...