instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
The question sort of says it all. Whether it's for code testing purposes, or you're modeling a real-world process, or you're trying to impress a loved one, what are some algorithms that folks use to generate interesting time series data? Are there any good resources out there with a consolidated list? No constraints on...
Generating interesting time series data can be a fun and informative exercise for various purposes, including code testing, simulations, and learning. Here’s a list of algorithms and methods you can use to generate interesting time series data, along with simple code samples in Python. ### 1. **Random Walk** A simple...
5,637
[ { "from": "human", "value": "The question sort of says it all.\nWhether it's for code testing purposes, or you're modeling a real-world process, or you're trying to impress a loved one, what are some algorithms that folks use to generate interesting time series data? Are there any good resources out there w...
Using the GamerServices component for XNA to access Xbox/GfW Live for networking purposes requires developers and players each to have a US$100/year subscription to Microsoft's Creators Club. That's not much of an issue for Xbox360 XNA projects as you need the subscription anyway to be able to put your game on the 360....
Using the GamerServices component in XNA does indeed involve costs that can be prohibitive for many developers, especially for PC games where the subscription isn’t tied to any console publishing needs. If you’re looking for alternatives to GamerServices that allow you to create multiplayer experiences or access player...
8,662
[ { "from": "human", "value": "Using the GamerServices component for XNA to access Xbox/GfW Live for networking purposes requires developers and players each to have a US$100/year subscription to Microsoft's Creators Club. That's not much of an issue for Xbox360 XNA projects as you need the subscription anywa...
Ive been smashing my head with this for a while. I have 2 completely identical .wmv files encoded with wmv3 codec. I put them both through ffmpeg with the following command: /usr/bin/ffmpeg -i file.wmv -ar 44100 -ab 64k -qscale 9 -s 512x384 -f flv file.flv One file converts just fine, and gives me the following output...
The issue you are encountering arises from the fact that the second file (`bad3.wmv`) contains audio in an unsupported format. The audio codec identified in the failed conversion output is `0x0162`, which does not have a corresponding decoder in FFmpeg in your version. This is likely the root cause of the "Unsupported ...
6,218
[ { "from": "human", "value": "Ive been smashing my head with this for a while. I have 2 completely identical .wmv files encoded with wmv3 codec. I put them both through ffmpeg with the following command:\n/usr/bin/ffmpeg -i file.wmv -ar 44100 -ab 64k -qscale 9 -s 512x384 -f flv file.flv\n\nOne file converts ...
Take the following snippet: List<int> distances = new List<int>(); Was the redundancy intended by the language designers? If so, why?
The line of code you provided: ```csharp List<int> distances = new List<int>(); ``` is a standard declaration in C# that uses generics. In this case, `List<int>` is a generic collection that stores integers. The redundancy you might be referring to is the explicit type specification (`int`) both in the list declarati...
10,527
[ { "from": "human", "value": "Take the following snippet:\nList<int> distances = new List<int>();\n\nWas the redundancy intended by the language designers? If so, why?\n" }, { "from": "gpt", "value": "The line of code you provided:\n\n```csharp\nList<int> distances = new List<int>();\n```\n\nis a...
I wanted to show the users Name Address (see www.ipchicken.com), but the only thing I can find is the IP Address. I tried a reverse lookup, but didn't work either: IPAddress ip = IPAddress.Parse(this.lblIp.Text); string hostName = Dns.GetHostByAddress(ip).HostName; this.lblHost.Text = hostName; But HostName is the sam...
It looks like you're trying to obtain the user's geographic location (such as name and address) based on their IP address. However, the approach you're taking with DNS lookups will only give you the hostname associated with that IP address, which is often not very useful for identifying user location. To get the geog...
7,210
[ { "from": "human", "value": "I wanted to show the users Name Address (see www.ipchicken.com), but the only thing I can find is the IP Address. I tried a reverse lookup, but didn't work either:\nIPAddress ip = IPAddress.Parse(this.lblIp.Text);\nstring hostName = Dns.GetHostByAddress(ip).HostName;\nthis.lblHo...
now i need to insert some data from the sqlserver into a word,i know how to use bookmark and the office interop api do that but it's slow to call the word process do that and it's coupling between the bookmark define and the code , is it possible to do this without word process start?if not are there any template e...
Inserting data from SQL Server into a Word document can indeed be done using bookmarks and the Office Interop API, but as you've pointed out, it can be slow and tightly coupled with the document structure. If you're looking for alternatives that don't involve starting the Word process or if you want a more decoupled ap...
8,138
[ { "from": "human", "value": "now i need to insert some data from the sqlserver into a word,i know how to use bookmark and the office interop api do that but it's slow to call the word process do that and it's coupling between the bookmark define and the code , is it possible to do this without word proc...
Is there a pattern that is good to use when saving and loading different file formats? For example, I have a complicated class hierarchy for the document, but I want to support a few different file formats. I thought about the Strategy pattern, but I'm not convinced because of the need to access every part of the objec...
When dealing with multiple file formats and a complicated class hierarchy, it's important to establish a clear and maintainable way of handling serialization and deserialization (saving and loading) of your objects. Here are a few design patterns and approaches you can consider: ### 1. **Visitor Pattern** The Visitor ...
6,124
[ { "from": "human", "value": "Is there a pattern that is good to use when saving and loading different file formats?\nFor example, I have a complicated class hierarchy for the document, but I want to support a few different file formats.\nI thought about the Strategy pattern, but I'm not convinced because of...
Should I use a dedicated network channel between the database and the application server? ...or... Connecting both in the switch along with all other computer nodes makes no diference at all? The matter is performance!
When considering whether to use a dedicated network channel between your database and application server, there are several performance-related factors to take into account: ### Advantages of a Dedicated Network Channel 1. **Reduced Latency**: A dedicated channel can minimize latency by ensuring that the database and...
5,863
[ { "from": "human", "value": "Should I use a dedicated network channel between the database and the application server?\n...or... \nConnecting both in the switch along with all other computer nodes makes no diference at all?\nThe matter is performance!\n" }, { "from": "gpt", "value": "When consid...
I'm running some JUnit tests on my applications. Every test has a for loop calling respective method 10000 times. The tested methods produce a lot of log. These logs are also automatically collected by JUnit as test output. This situation takes to OutOfMemoryError because the string buffer where JUnit keeps the output...
If you want to prevent JUnit from capturing the standard output (including logs) during your tests, you can use a few different approaches depending on how your logging is configured and how your tests are set up. Here are some options: ### 1. Disable Logging During Tests If you're using a logging framework (like Log...
8,188
[ { "from": "human", "value": "I'm running some JUnit tests on my applications. Every test has a for loop calling respective method 10000 times.\nThe tested methods produce a lot of log. \nThese logs are also automatically collected by JUnit as test output.\nThis situation takes to OutOfMemoryError because th...
I have defined an interface in C++, i.e. a class containing only pure virtual functions. I want to explicitly forbid users of the interface to delete the object through a pointer to the interface, so I declared a protected and non-virtual destructor for the interface, something like: class ITest{ public: virtual vo...
The warning from the GNU compiler regarding the combination of virtual functions and a non-virtual destructor is important to consider, even if you've designed your interface to prevent deletion via a pointer to that interface. Let’s break down the reasons behind the warning and the implications of your design. ### 1....
10,416
[ { "from": "human", "value": "I have defined an interface in C++, i.e. a class containing only pure virtual functions.\nI want to explicitly forbid users of the interface to delete the object through a pointer to the interface, so I declared a protected and non-virtual destructor for the interface, something...
Here's a quick question I've been banging my head against today. I'm trying to convert a .Net dataset into an XML stream, transform it with an xsl file in memory, then output the result to a new XML file. Here's the current solution: string transformXML = @"pathToXslDocument"; XmlDocument originalXml ...
From your description, it seems you're having trouble with how the `XmlReader` is being created and the subsequent transformation process. Let's address the issues step-by-step and also explore a more efficient way to convert a DataSet to XML, transform it with XSLT, and then save it. ### Issues Identified 1. **Buffe...
5,158
[ { "from": "human", "value": "Here's a quick question I've been banging my head against today.\nI'm trying to convert a .Net dataset into an XML stream, transform it with an xsl file in memory, then output the result to a new XML file. \nHere's the current solution:\n string transformXML = @\"pathToXs...
By default data extracted by the GROUP BY clause is ordered as ascending. How to change it to descending.
In SQL, the order of the result set returned by a `GROUP BY` clause is not guaranteed unless you explicitly specify an `ORDER BY` clause. To change the order to descending, you would add an `ORDER BY` clause after your `GROUP BY`. Here is the syntax: ```sql SELECT column1, aggregate_function(column2) FROM table_name ...
11,558
[ { "from": "human", "value": "By default data extracted by the GROUP BY clause is ordered as ascending.\nHow to change it to descending.\n" }, { "from": "gpt", "value": "In SQL, the order of the result set returned by a `GROUP BY` clause is not guaranteed unless you explicitly specify an `ORDER B...
I'm teaching a kid programming, and am introducing some basic artificial intelligence concepts at the moment. To begin with we're going to implement a tic-tac-toe game that searches the entire game tree and as such plays perfectly. Once we finish that I want to apply the same concepts to a game that has too many positi...
It's great that you're introducing programming and AI concepts to a kid through games! Dots and Boxes is a good choice, but as you noted, its early-game scoring can be a bit tricky since many positions will seem neutral. Here are a few alternative games that involve strategic thinking and can lend themselves well to h...
8,496
[ { "from": "human", "value": "I'm teaching a kid programming, and am introducing some basic artificial intelligence concepts at the moment. To begin with we're going to implement a tic-tac-toe game that searches the entire game tree and as such plays perfectly. Once we finish that I want to apply the same co...
I want to compose the results of two Linq Expressions. They exist in the form Expression<Func<T, bool>> So the two that I want to compose are essentially delegates on a parameter (of type T) that both return a boolean. The result I would like composed would be the logical evaluation of the booleans. I would probably i...
To compose two `Expression<Func<T, bool>>` expressions into one that combines their logic (for example, using a logical AND), you can create an extension method that combines the expressions using a parameterized expression. Here's a step-by-step implementation: 1. Define the extension method that will allow you to co...
7,080
[ { "from": "human", "value": "I want to compose the results of two Linq Expressions. They exist in the form\nExpression<Func<T, bool>>\n\nSo the two that I want to compose are essentially delegates on a parameter (of type T) that both return a boolean. The result I would like composed would be the logical ev...
Does anyone have any idea how to track the signal strength of a bluetooth connection perferably in C#? I was thinking using a WMI query but couldn't track down the WMI class encapsulating the connection. The idea is when I leave my machine with my cellphone in pocket the bluetooth signal weakens and my machine locks an...
Tracking the Bluetooth signal strength in C# can be done, but it typically requires access to the Bluetooth stack on Windows, and unfortunately, Windows Management Instrumentation (WMI) does not provide direct access to Bluetooth signal strength metrics. Instead, you may want to use the Windows.Devices.Bluetooth namesp...
6,294
[ { "from": "human", "value": "Does anyone have any idea how to track the signal strength of a bluetooth connection perferably in C#?\nI was thinking using a WMI query but couldn't track down the WMI class encapsulating the connection.\nThe idea is when I leave my machine with my cellphone in pocket the bluet...
What tools are people using for testing SQL Server databases? By this I mean all parts of the database: configuration tables column type stored procedures constraints Most likely, there is not one tool to do it all.
You're correct that testing SQL Server databases involves multiple aspects, and there isn't a single tool that covers everything comprehensively. However, various tools can be employed to perform different types of testing and validation on SQL Server databases. Below is a list of some popular tools and frameworks, cat...
1,371
[ { "from": "human", "value": "What tools are people using for testing SQL Server databases?\nBy this I mean all parts of the database:\n\nconfiguration\ntables\ncolumn type\nstored procedures\nconstraints\n\nMost likely, there is not one tool to do it all.\n" }, { "from": "gpt", "value": "You're ...
We have a medium sized .js file that we include in our web framework that I am porting over to SharePoint. However, I'm not sure how to go about this or what the best practice is. This is for a framework solution that will be used by other client projects, so it's best for it to be self contained and deploy-able, rathe...
Porting a JavaScript file to SharePoint, particularly when aiming for a self-contained and deployable framework solution, can be approached in a few different ways. Using embedded resources and a ScriptManager is one method, but there are several considerations and best practices that might suit your needs better. Her...
7,645
[ { "from": "human", "value": "We have a medium sized .js file that we include in our web framework that I am porting over to SharePoint. However, I'm not sure how to go about this or what the best practice is. This is for a framework solution that will be used by other client projects, so it's best for it to...
I'm looking for secure ways to pass data between a client running Flash and a server. The data in question will be generated BY the Flash app, which in this case is your score after finishing a game. I want to verify the data is untampered on the server. What are some good methods of getting this done? One simple wa...
To create a secure communication mechanism between a Flash client and a server, especially for sensitive data like game scores, it's important to implement multiple layers of security to make tampering difficult. Here are some strategies to consider: 1. **Public Key Cryptography**: - Use a public-private key pair f...
4,940
[ { "from": "human", "value": "I'm looking for secure ways to pass data between a client running Flash and a server. The data in question will be generated BY the Flash app, which in this case is your score after finishing a game. I want to verify the data is untampered on the server. What are some good me...
I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError: >>> import tempfile, shutil >>> f = tempfile.TemporaryFile(mode ='w+t') >>> f.wri...
The issue you're encountering is due to the way `tempfile.TemporaryFile` works. When you create a temporary file using `tempfile.TemporaryFile`, it is opened in binary mode, and you cannot access the file by its name directly for reading/writing after it has been created. In your code, you're trying to use `shutil.cop...
10,351
[ { "from": "human", "value": "I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError:\n>>> import tempfile, shutil\n>>> f = te...
I am wondering any efficient way to hide our Silverlight code. I know there are some obfuscators available but it looks like people can hack that too. Anybody have any success on this front?
Hiding or obfuscating Silverlight code can be challenging, especially since Silverlight is a deprecated technology and is not widely used anymore. However, here are some strategies to consider for protecting your Silverlight applications: 1. **Obfuscation**: While you mentioned you're aware of obfuscators, using a goo...
9,188
[ { "from": "human", "value": "I am wondering any efficient way to hide our Silverlight code. I know there are some obfuscators available but it looks like people can hack that too. Anybody have any success on this front?\n" }, { "from": "gpt", "value": "Hiding or obfuscating Silverlight code can ...
Caveat: I'm relatively new to coding as well as TextMate, so apologies if there is an obvious answer I'm missing here. I do a lot of HTML/CSS markup, there are certain patterns that I use a lot, for example, forms, navigation menus etc. What I would like is a way to store those patterns and insert them quickly when I n...
Absolutely! TextMate provides a couple of convenient ways to store and insert snippets of code quickly. Here are a couple of methods you can use to manage your HTML/CSS patterns: ### 1. Using Snippets **Creating Snippets:** 1. Open TextMate. 2. Go to `Bundles` in the menu bar, then choose `Edit Bundles...`. 3. In th...
10,194
[ { "from": "human", "value": "Caveat: I'm relatively new to coding as well as TextMate, so apologies if there is an obvious answer I'm missing here.\nI do a lot of HTML/CSS markup, there are certain patterns that I use a lot, for example, forms, navigation menus etc. What I would like is a way to store those...
I have a DSS service I created (For Microsoft Robotics Studio). I then followed the documentation to make it a compact framework service and created a deployment package. I then deploy it to a CE 6 device... Does a MSRS service work on CE 6? The documentation talks about CE 5. What should I see if I run it? I expect to...
It sounds like you've been through quite a bit of troubleshooting with your DSS service deployment on Windows CE (CE 5 and CE 6). Here are some insights regarding your issues and observations: 1. **MSRS Compatibility**: Microsoft Robotics Studio (MSRS) services are indeed designed to run on Windows CE 5, and while doc...
8,473
[ { "from": "human", "value": "I have a DSS service I created (For Microsoft Robotics Studio). I then followed the documentation to make it a compact framework service and created a deployment package. I then deploy it to a CE 6 device...\nDoes a MSRS service work on CE 6? The documentation talks about CE 5.\...
I seem to make this mistake every time I set up a new development box. Is there a way to make sure you don't have to manually assign rights for the ASPNET user? I usually install .Net then IIS, then Visual Studio but it seems I still have to manually assign rights to the ASPNET user to get everything running correctly....
When setting up a new development environment for ASP.NET applications, it's important to follow the correct installation order and configuration steps to avoid having to manually adjust permissions for the ASPNET user or the application pool identity. ### Recommended Installation Order 1. **Install .NET Framework/SD...
6,847
[ { "from": "human", "value": "I seem to make this mistake every time I set up a new development box. Is there a way to make sure you don't have to manually assign rights for the ASPNET user? I usually install .Net then IIS, then Visual Studio but it seems I still have to manually assign rights to the ASPNET ...
I have a CollapsiblePanelExtender that will not collapse. I have "collapsed" set to true and all the ControlID set correctly. I try to collapse and it goes through the animation but then expands almost instantly. This is in an User Control with the following structure. <asp:UpdatePanel ID="UpdatePanel1" runat="serve...
If your `CollapsiblePanelExtender` is not collapsing as expected and expands almost instantly after the animation, there are a few possible reasons for this behavior. Here are some common issues and potential solutions: 1. **Check for JavaScript Errors**: Make sure there are no JavaScript errors on the page. Use your ...
6,313
[ { "from": "human", "value": "I have a CollapsiblePanelExtender that will not collapse. I have \"collapsed\" set to true and all the ControlID set correctly. I try to collapse and it goes through the animation but then expands almost instantly. This is in an User Control with the following structure.\n<as...
Basically, I've written an API to www.thetvdb.com in Python. The current code can be found here. It grabs data from the API as requested, and has to store the data somehow, and make it available by doing: print tvdbinstance[1][23]['episodename'] # get the name of episode 23 of season 1 What is the "best" way to abstra...
Based on your description, it sounds like you've put a lot of thought into how to structure your API client for `www.thetvdb.com`. You seem to be facing a common design challenge when it comes to balancing functionality, elegance, and usability. Here are some considerations and potential solutions to improve your curr...
4,775
[ { "from": "human", "value": "Basically, I've written an API to www.thetvdb.com in Python. The current code can be found here.\nIt grabs data from the API as requested, and has to store the data somehow, and make it available by doing:\nprint tvdbinstance[1][23]['episodename'] # get the name of episode 23 of...
I have some strings of xxh:yym format where xx is hours and yy is minutes like "05h:30m". What is an elegant way to convert a string of this type to TimeSpan?
You can convert a string in the "xxh:yym" format to a `TimeSpan` in C# by parsing the string and extracting the hours and minutes. Here’s an elegant way to do this using regular expressions or string manipulation: ### Using Regular Expressions ```csharp using System; using System.Text.RegularExpressions; public clas...
5,911
[ { "from": "human", "value": "I have some strings of xxh:yym format where xx is hours and yy is minutes like \"05h:30m\". What is an elegant way to convert a string of this type to TimeSpan?\n" }, { "from": "gpt", "value": "You can convert a string in the \"xxh:yym\" format to a `TimeSpan` in C# ...
I need to know how much space occupies all the databases inside an SQL Server 2000. I did some research but could not found any script to help me out.
To find out how much space all the databases occupy in SQL Server 2000, you can use the system views to retrieve the size information for each database. You can run the following script in SQL Server Management Studio or a similar SQL client connected to your SQL Server 2000 instance. Here's a script that will give yo...
4,787
[ { "from": "human", "value": "I need to know how much space occupies all the databases inside an SQL Server 2000. I did some research but could not found any script to help me out.\n" }, { "from": "gpt", "value": "To find out how much space all the databases occupy in SQL Server 2000, you can use...
When I create a socket using accept() and make a FILE out of it using fdopen(), what do I have to do to clean everything up? Do I need to do fclose() on the FILE, shutdown() and close() on the socket, or only the shutdown() and or close() or fclose()? If I don't do fclose(), do I have to free() the FILE pointer manuall...
When you're working with sockets and the C standard library's FILE streams, it’s important to manage the resources properly to avoid leaks and ensure that the underlying socket is closed correctly. Here are the steps you need to follow when you create a socket using `accept()` and then create a `FILE` stream from it u...
8,498
[ { "from": "human", "value": "When I create a socket using accept() and make a FILE out of it using fdopen(), what do I have to do to clean everything up? Do I need to do fclose() on the FILE, shutdown() and close() on the socket, or only the shutdown() and or close() or fclose()? If I don't do fclose(), do ...
I've been tasked with maintaining an application originally written in VB6. It has since been imported into VB .Net and to say the least the code is anything but Object Oriented. The code is riddled with classes which contain nothing more than Public Shared attributes(variables) and methods(functions), the result of wh...
Transitioning from a non-object-oriented (OO) approach to a more structured OO design can be a complex task, especially when maintaining legacy applications. However, by encapsulating functionality and data related to projects, you can progressively refactor your code while implementing the required update strategy. He...
4,592
[ { "from": "human", "value": "I've been tasked with maintaining an application originally written in VB6. It has since been imported into VB .Net and to say the least the code is anything but Object Oriented. The code is riddled with classes which contain nothing more than Public Shared attributes(variables)...
I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache. I'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with passivation activated. Thanks
When migrating your Hibernate application from EHCache to JBoss TreeCache, there are indeed some differences in how caching configurations are handled, especially regarding disk storage and size limitations. ### EHCache Configuration In EHCache, `maxElementsOnDisk` is a straightforward setting to limit the maximum nu...
7,717
[ { "from": "human", "value": "I'm migrating a Hibernate application's cache from EHCache to JBoss TreeCache.\nI'm trying to find how to configure the equivalent to maxElementsOnDisk to limit the cache size on disk, but I couldn't find anything similar to configure in a FileCacheLoader with passivation activa...
There are a couple of different .NET XSLT functions that I see used in the out of the box SharePoint web parts (RSS Viewer and Data View web part). <xsl:stylesheet xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime" ...
In SharePoint, particularly in the context of using XSLT with web parts, there are several custom extension functions that are available for use. The most common namespaces you mentioned, `ddwrt` (Data View Runtime) and `rssaggwrt` (RSS Aggregator Runtime), provide various functions to assist with data manipulation and...
7,254
[ { "from": "human", "value": "There are a couple of different .NET XSLT functions that I see used in the out of the box SharePoint web parts (RSS Viewer and Data View web part).\n<xsl:stylesheet\n xmlns:ddwrt=\"http://schemas.microsoft.com/WebParts/v2/DataView/runtime\" \n xmlns:rssaggwrt=\"http://sch...
What are the typical average bytes-per-character rates for different unicode encodings in different languages? E.g. if I wanted the smallest number of bytes to encode some english text, then on average UTF-8 would be 1-byte per character and UTF-16 would be 2 so I'd pick UTF-8. If I wanted some Korean text, then UTF-16...
The storage requirements of different Unicode encodings (like UTF-8, UTF-16, and UTF-32) vary significantly based on the language and the specific characters used. Here’s a general breakdown of average bytes-per-character rates for common Unicode encodings across various languages: ### 1. **English Text** - **UTF-8**:...
7,719
[ { "from": "human", "value": "What are the typical average bytes-per-character rates for different unicode encodings in different languages?\nE.g. if I wanted the smallest number of bytes to encode some english text, then on average UTF-8 would be 1-byte per character and UTF-16 would be 2 so I'd pick UTF-8....
I have a variety of time-series data stored on a more-or-less georeferenced grid, e.g. one value per 0.2 degrees of latitude and longitude. Currently the data are stored in text files, so at day-of-year 251 you might see: 251 12.76 12.55 12.55 12.34 [etc., 200 more values...] 13.02 12.95 12.70 12.40 [etc., 200 more v...
It sounds like you have a complex set of requirements for your time-series georeferenced data, and you are looking for a more efficient and robust solution than the current text file format. Here are several approaches you might consider, leveraging modern data storage and management technologies: ### 1. **Use a Time ...
5,497
[ { "from": "human", "value": "I have a variety of time-series data stored on a more-or-less georeferenced grid, e.g. one value per 0.2 degrees of latitude and longitude. Currently the data are stored in text files, so at day-of-year 251 you might see:\n251\n 12.76 12.55 12.55 12.34 [etc., 200 more values...]...
The market is flooded with VPS (virtual private server) hosting options. It seems everyone and their mother has a overloaded server in his/her closet. Enterprise options always seem priced insanely high, which make the ones that are cheap and claim enterprise level seem shaky. What do you look for in a quality VPS pr...
When evaluating a Virtual Private Server (VPS) provider, there are several key factors to consider to ensure you choose a reliable and high-quality service. Here’s a comprehensive list of what to look for and how to verify their credibility: ### Key Factors to Consider: 1. **Performance:** - **CPU and RAM:** Look ...
7,847
[ { "from": "human", "value": "The market is flooded with VPS (virtual private server) hosting options. It seems everyone and their mother has a overloaded server in his/her closet. Enterprise options always seem priced insanely high, which make the ones that are cheap and claim enterprise level seem shaky....
I have an IList that contains items ( parent first ), they need to be added to a Diagram Document in the reverse order so that the parent is added last, drawn on top so that it is the first thing to be selected by the user. What's the best way to do it? Something better/more elegant than what I am doing currently which...
To reverse the order of items in an `IList` and add them to a Diagram Document such that the parent item is added last (therefore drawn on top), you can achieve this in a more elegant way by using LINQ (Language Integrated Query) in C#. This approach enhances readability and reduces the amount of code you have to write...
9,866
[ { "from": "human", "value": "I have an IList that contains items ( parent first ), they need to be added to a Diagram Document in the reverse order so that the parent is added last, drawn on top so that it is the first thing to be selected by the user.\nWhat's the best way to do it? Something better/more el...
I'm not really asking about how programmers learn how to program. More about specific technologies. If I wanted to learn Hibernate, how do I know what I should know prior to Hibernate? Should I learn JPA before, during or after Hibernate? Is there a better solution to Hibernate? (And I'm not really looking for inf...
You're touching on a common challenge many developers face when trying to navigate the vast landscape of technologies. Here’s a structured approach to consider when learning a specific technology like Hibernate and understanding its context within the broader ecosystem: ### 1. Understand the Basics Before diving into...
9,127
[ { "from": "human", "value": "I'm not really asking about how programmers learn how to program. More about specific technologies. If I wanted to learn Hibernate, how do I know what I should know prior to Hibernate? Should I learn JPA before, during or after Hibernate? Is there a better solution to Hibern...
I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default "actions" text in the table (ie. "edit", "delete", "show") with icons using CSS. I have also added a couple of custom actions with action_link.add ("move" and "copy"). For clarity, I would like to have a tooltip...
To add tooltips to your icons in ActiveScaffold, you'll want to use the `title` attribute instead of `alt` for the `<img>` tags representing your icons. The `alt` attribute is used for alternative text when the image cannot be displayed, while the `title` attribute is what browsers typically use for tooltips. Here's h...
7,380
[ { "from": "human", "value": "I am using ActiveScaffold in a Ruby on Rails app, and to save space in the table I have replaced the default \"actions\" text in the table (ie. \"edit\", \"delete\", \"show\") with icons using CSS. I have also added a couple of custom actions with action_link.add (\"move\" and \...
I really enjoyed Jeff's post on Spartan Programming. I agree that code like that is a joy to read. Unfortunately, I'm not so sure it would necessarily be a joy to work with. For years I have read about and adhered to the "one-expression-per-line" practice. I have fought the good fight and held my ground when many progr...
It's great to see that you've put thought into your coding practices and how they impact debugging and production support. The debate around coding styles is often subjective and context-dependent, and there are certainly valid arguments on both sides. ### One Expression per Line Your advocacy for the "one expression...
7,819
[ { "from": "human", "value": "I really enjoyed Jeff's post on Spartan Programming. I agree that code like that is a joy to read. Unfortunately, I'm not so sure it would necessarily be a joy to work with.\nFor years I have read about and adhered to the \"one-expression-per-line\" practice. I have fought the g...
Besides full-text indexing and using LIKE keyword, what are other tools to build search functionality on top of MS SQL? This question is particularly for searching records, not files.
When building search functionality on top of Microsoft SQL Server for searching records, aside from full-text indexing and using the `LIKE` keyword, there are several other approaches and tools you can consider: 1. **Stored Procedures and User-defined Functions**: You can create stored procedures or user-defined funct...
8,459
[ { "from": "human", "value": "Besides full-text indexing and using LIKE keyword, what are other tools to build search functionality on top of MS SQL? This question is particularly for searching records, not files.\n" }, { "from": "gpt", "value": "When building search functionality on top of Micr...
I'm trying to attach an instance of UIScrollbar component to a dynamic text field inside of an instance of a class that is being made after some XML is loaded. The scroll bar component is getting properly attached, as the size of the slider varies depending on the amount of content in the text field, however, it won't ...
It looks like you're on the right track in attaching the `UIScrollBar` to your dynamic text field. However, there are a few important considerations when setting up a scroll bar that may be causing the scrolling issue you're facing. Below are some suggestions that you can apply to help resolve the problem: ### 1. Set ...
5,847
[ { "from": "human", "value": "I'm trying to attach an instance of UIScrollbar component to a dynamic text field inside of an instance of a class that is being made after some XML is loaded. The scroll bar component is getting properly attached, as the size of the slider varies depending on the amount of cont...
When I iterate over the values or keys are they going to correlate? Will the second key map to the second value?
Yes, in a Python dictionary, the order of keys and values corresponds to each other, meaning that when you iterate over the keys and values, the second key will map to the second value. As of Python 3.7, dictionaries maintain the insertion order, so when you iterate over the keys using `dict.keys()` and the values us...
11,164
[ { "from": "human", "value": "When I iterate over the values or keys are they going to correlate? Will the second key map to the second value?\n" }, { "from": "gpt", "value": "Yes, in a Python dictionary, the order of keys and values corresponds to each other, meaning that when you iterate over ...
In a silverlight application, I want to access the page the silverlight .xap file from an HTTP subdomain, but have the web services access a different subdomain for sensitive information over HTTPS. I set up clientaccesspolicy.xml at the root of the subdomain and it lets the silverlight app access its services over htt...
You're encountering a common issue related to cross-domain policy and the restrictions browsers impose on mixed content (HTTP and HTTPS). Here are some key points to consider: 1. **Cross-Domain Policies**: Silverlight applications (and other rich internet applications) need to have appropriate cross-domain policies in...
9,453
[ { "from": "human", "value": "In a silverlight application, I want to access the page the silverlight .xap file from an HTTP subdomain, but have the web services access a different subdomain for sensitive information over HTTPS.\nI set up clientaccesspolicy.xml at the root of the subdomain and it lets the si...
And on top of that, are there cases where one has to use the global assembly cache or where one cannot use it?
The Global Assembly Cache (GAC) is a machine-wide store used to hold assemblies specifically designated to be shared by several applications on the system. Here are some cases where you might have to use the GAC, and some scenarios where it is not appropriate or not required. ### Cases Where You May Need to Use the GA...
3,690
[ { "from": "human", "value": "And on top of that, are there cases where one has to use the global assembly cache or where one cannot use it?\n" }, { "from": "gpt", "value": "The Global Assembly Cache (GAC) is a machine-wide store used to hold assemblies specifically designated to be shared by sev...
What is the point of type definition on method parameters on Caché Object (from Intersystems) since after it's pre-compiled to the .int format, it removes any typing information, thus making no difference at all?
In InterSystems Caché, type definitions for method parameters serve several important purposes, even if they are removed during the compilation process to .int format: 1. **Static Type Checking**: Before compilation, the type definitions allow for static type checking. This means that the compiler can verify that the ...
8,839
[ { "from": "human", "value": "What is the point of type definition on method parameters on Caché Object (from Intersystems) since after it's pre-compiled to the .int format, it removes any typing information, thus making no difference at all?\n" }, { "from": "gpt", "value": "In InterSystems Caché...
Does anyone use Phing to deploy PHP applications, and if so how do you use it? We currently have a hand-written "setup" script that we run whenever we deploy a new instance of our project. We just check out from SVN and run it. It sets some basic configuration variables, installs or reloads the database, and generates ...
Phing is a PHP project build system based on Apache Ant, designed to automate the build and deployment processes. While you can certainly use it to replicate what your current setup script does, Phing offers several advanced features and use cases that can enhance your deployment process, improve maintainability, and p...
2,821
[ { "from": "human", "value": "Does anyone use Phing to deploy PHP applications, and if so how do you use it? We currently have a hand-written \"setup\" script that we run whenever we deploy a new instance of our project. We just check out from SVN and run it. It sets some basic configuration variables, insta...
There are lots of widgets provided by sites that are effectively bits of JavaScript that generate HTML through DOM manipulation or document.write(). Rather than slow the browser down even more with additional requests and trust yet another provider to be fast, reliable and not change the widget output, I want to execut...
If you're looking to execute JavaScript to generate rendered HTML and save that output without relying on external widgets, you have several effective methods to achieve this. Here are some options you might consider, each with its pros and cons: ### 1. **Headless Browsers** Headless browsers like Puppeteer (for Chrom...
8,196
[ { "from": "human", "value": "There are lots of widgets provided by sites that are effectively bits of JavaScript that generate HTML through DOM manipulation or document.write(). Rather than slow the browser down even more with additional requests and trust yet another provider to be fast, reliable and not c...
Is there a way to comment out markup in an .ASPX page so that it isn't delivered to the client? I have tried the standard comments <!-- --> but this just gets delivered as a comment and doesn't prevent the control from rendering.
In ASP.NET Web Forms (.aspx), if you want to prevent a control or markup from being rendered to the client entirely, the standard HTML comment tags (`<!-- -->`) will not work since they will simply be sent to the client as HTML comments. Instead, you can use the `Visible` property of server controls to hide them from ...
10,297
[ { "from": "human", "value": "Is there a way to comment out markup in an .ASPX page so that it isn't delivered to the client? I have tried the standard comments <!-- --> but this just gets delivered as a comment and doesn't prevent the control from rendering. \n" }, { "from": "gpt", "value": "In ...
This may be a no-brainer for the WPF cognoscenti, but I'd like to know if there's a simple way to put text on the WPF ProgressBar. To me, an empty progress bar looks naked. That's screen real estate that could carry a message about what is in progress, or even just add numbers to the representation. Now, WPF is all abo...
In WPF, the `ProgressBar` does not have a built-in way to display text directly on it, but you can achieve this by using a `Grid` or a `Canvas` as a container. You can overlay a `TextBlock` on top of the `ProgressBar`. Below is a straightforward approach using a `Grid`, which is a very common layout container in WPF. ...
7,780
[ { "from": "human", "value": "This may be a no-brainer for the WPF cognoscenti, but I'd like to know if there's a simple way to put text on the WPF ProgressBar. To me, an empty progress bar looks naked. That's screen real estate that could carry a message about what is in progress, or even just add numbers t...
BITS, the Windows background intelligent transfer service. Looks like there are a few C# wrappers around that manage the interop to BITS, does anybody have any opinions on the best one?
When it comes to managing interop with the Windows Background Intelligent Transfer Service (BITS) in C#, there are a few libraries and wrappers available. While opinions may vary depending on individual needs and experiences, here are some popular options along with their pros and cons: 1. **Microsoft BITS Managed API...
9,778
[ { "from": "human", "value": "BITS, the Windows background intelligent transfer service.\nLooks like there are a few C# wrappers around that manage the interop to BITS, does anybody have any opinions on the best one?\n" }, { "from": "gpt", "value": "When it comes to managing interop with the Wind...
We have a set of applications that basically display a bunch of bitmaps and text, then allow user to press "buttons" (certain bitmaps) that cause actions to occur. We currently have these implemented using DirectX and a bunch of code to place the bitmaps and handle the button-presses. But we'd like to have the followi...
Based on your requirements for an application framework that allows for bitmap display, button interactions, layout editing, animations, and video overlays while also being portable to Linux, here are some options you might consider: ### 1. **SDL (Simple DirectMedia Layer)** - **Overview**: SDL is a cross-platform dev...
5,237
[ { "from": "human", "value": "We have a set of applications that basically display a bunch of bitmaps and text, then allow user to press \"buttons\" (certain bitmaps) that cause actions to occur.\nWe currently have these implemented using DirectX and a bunch of code to place the bitmaps and handle the button...
Using the debugger in Netbeans 6.1, I'd like to step into a method of the JSF library (specifically method saveSerializedView of class StateManager), but I cannot figure out how to specify through the IDE the location of the source code for the JSF library. I'm even having trouble determining which jar file or files Ne...
To debug the JSF library, especially when wanting to step into a specific method like `saveSerializedView` in the `StateManager` class, you'll need to ensure that you have the source code for the JSF implementation you're using. Here’s how you can set this up in NetBeans 6.1: ### Step 1: Identify the JSF Library 1. **...
7,936
[ { "from": "human", "value": "Using the debugger in Netbeans 6.1, I'd like to step into a method of the JSF library (specifically method saveSerializedView of class StateManager), but I cannot figure out how to specify through the IDE the location of the source code for the JSF library. I'm even having troub...
Below is my current char* to hex string function. I wrote it as an exercise in bit manipulation. It takes ~7ms on a AMD Athlon MP 2800+ to hexify a 10 million byte array. Is there any trick or other way that I am missing? How can I make this faster? Compiled with -O3 in g++ static const char _hex2asciiU_value[256][2] =...
To optimize your `char_to_hex` function further, there are several strategies you can employ. You've already made some good improvements, but here are a few additional suggestions: 1. **Inline the ASCII conversion**: Instead of using a 256-entry table for conversion, you can convert the numbers to hexadecimal directly...
6,213
[ { "from": "human", "value": "Below is my current char* to hex string function. I wrote it as an exercise in bit manipulation. It takes ~7ms on a AMD Athlon MP 2800+ to hexify a 10 million byte array. Is there any trick or other way that I am missing?\nHow can I make this faster?\nCompiled with -O3 in g++\ns...
How do you ensure, that you can checkout the code into Eclipse or NetBeans and work there with it? Edit: If you not checking in ide-related files, you have to reconfigure buildpath, includes and all this stuff, each time you checkout the project. I don't know, if ant (especially an ant buildfile which is created/export...
To ensure that you can checkout code into IDEs like Eclipse or NetBeans and work with it without having to reconfigure your environment each time, you can follow these best practices: ### 1. **Use a Common Build Tool** Using a common build tool like Maven or Gradle can significantly ease the management of dependencie...
7,137
[ { "from": "human", "value": "How do you ensure, that you can checkout the code into Eclipse or NetBeans and work there with it?\nEdit: If you not checking in ide-related files, you have to reconfigure buildpath, includes and all this stuff, each time you checkout the project. I don't know, if ant (especiall...
I've created a forum, and we're implementing an apc and memcache caching solution to save the database some work. I started implementing the cache layer with keys like "Categories::getAll", and if I had user-specific data, I'd append the keys with stuff like the user ID, so you'd get "User::getFavoriteThreads|1471". Wh...
Caching can certainly complicate things, especially when you want to ensure data consistency across various scenarios like pagination. The challenge you are facing with invalidating cache entries after a new thread is posted is common in scenarios involving paginated results. Here are some strategies to consider for h...
7,731
[ { "from": "human", "value": "I've created a forum, and we're implementing an apc and memcache caching solution to save the database some work.\nI started implementing the cache layer with keys like \"Categories::getAll\", and if I had user-specific data, I'd append the keys with stuff like the user ID, so y...
I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes. How can I achieve something similar to array_map or array_walk with objects?
To format or transform every string member of an object using a callback function, you can use reflection to inspect the object's properties dynamically. In PHP, you can achieve this by following these steps: 1. Use the ReflectionClass to introspect the object. 2. Retrieve all properties of the object. 3. Check if the...
9,556
[ { "from": "human", "value": "I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes.\nHow can I achieve something similar to array_map or array_walk with ...
Is it possible to close an InfoPath form programmatically? I know that it can be configured as a form rule / action but I want to close the form via code.
Yes, it is possible to programmatically close an InfoPath form using code, but the method you use will depend on whether you are working within an InfoPath form code-behind (using C# or VB.NET) or using a different approach. Here's how you can achieve this in both scenarios: ### Using Code-Behind (C# or VB.NET) If ...
10,619
[ { "from": "human", "value": "Is it possible to close an InfoPath form programmatically? I know that it can be configured as a form rule / action but I want to close the form via code.\n" }, { "from": "gpt", "value": "Yes, it is possible to programmatically close an InfoPath form using code, but...
I have a two tables joined with a join table - this is just pseudo code: Library Book LibraryBooks What I need to do is if i have the id of a library, i want to get all the libraries that all the books that this library has are in. So if i have Library 1, and Library 1 has books A and B in them, and books A and B are ...
To retrieve all libraries that contain any books from a specific library in Rails, you can utilize ActiveRecord associations effectively. Given your structure, you would want to first ensure that your associations are set up properly. Assuming you have the following model relationships: ```ruby class Library < Applica...
8,658
[ { "from": "human", "value": "I have a two tables joined with a join table - this is just pseudo code:\nLibrary\nBook\nLibraryBooks\n\nWhat I need to do is if i have the id of a library, i want to get all the libraries that all the books that this library has are in.\nSo if i have Library 1, and Library 1 ha...
I don't want to take the time to learn Obj-C. I've spent 7+ years doing web application programming. Shouldn't there be a way to use the WebView and just write the whole app in javascript, pulling the files right from the resources of the project?
Yes, you can indeed use a WebView to develop an iOS application with a significant portion of your code written in JavaScript, leveraging your existing web development skills. There are a few options that allow you to create iOS apps primarily using web technologies: ### 1. **WebView Approach** You can use `WKWebView`...
7,015
[ { "from": "human", "value": "I don't want to take the time to learn Obj-C. I've spent 7+ years doing web application programming. Shouldn't there be a way to use the WebView and just write the whole app in javascript, pulling the files right from the resources of the project?\n" }, { "from": "gpt", ...
I am trying to automate functional testing of a server using a realistic frequency distribution of requests. (sort of load testing, sort of simulation) I've chosen the Weibull distribution as it "sort of" matches the distribution I've observed (ramps up quickly, drops off quickly but not instantly) I use this distribut...
Your approach to generating a frequency distribution of requests using the Weibull distribution is on the right track, but there are some improvements and optimizations you can make to enhance clarity, efficiency, and correctness. Here's a more structured way to implement it: ### Suggested Improvements 1. **Use NumPy...
5,367
[ { "from": "human", "value": "I am trying to automate functional testing of a server using a realistic frequency distribution of requests. (sort of load testing, sort of simulation)\nI've chosen the Weibull distribution as it \"sort of\" matches the distribution I've observed (ramps up quickly, drops off qui...
I need to implement a wavetable synthesizer in an ARM Cortex-M3 core. I'm looking for any code or tools to help me get started. I'm aware of this AVR implementation. I actually converted it to a PIC a while back. Now I am looking for something similar, but a little better sounding. ANSI C code would be great. Any code ...
Implementing a wavetable synthesizer on an ARM Cortex-M3 core can be a rewarding project. Below, I’ll outline some key components you might consider as you build your synthesizer, along with some code snippets and suggestions to help you get started. ### Basic Structure of Wavetable Synthesizer 1. **Wavetable Definit...
7,998
[ { "from": "human", "value": "I need to implement a wavetable synthesizer in an ARM Cortex-M3 core. I'm looking for any code or tools to help me get started.\nI'm aware of this AVR implementation. I actually converted it to a PIC a while back. Now I am looking for something similar, but a little better sound...
I recently heard of WSDL.Exe, but I am not sure where to find this program. Does anyone know where I can find or download it?
WSDL.exe is a tool provided by Microsoft as part of the .NET Framework SDK. It is used to generate code from a WSDL (Web Services Description Language) file, allowing you to create client-side proxies for web services. To find and use WSDL.exe, follow these steps: 1. **Install the .NET Framework**: Make sure you have...
9,828
[ { "from": "human", "value": "I recently heard of WSDL.Exe, but I am not sure where to find this program.\nDoes anyone know where I can find or download it?\n" }, { "from": "gpt", "value": "WSDL.exe is a tool provided by Microsoft as part of the .NET Framework SDK. It is used to generate code fro...
The scenario is this We have two applications A and B, both which are running in separate database (Oracle 9i ) transactions Application A - inserts some data into the database, then calls Application B Application B - inserts some data into the database, related (via foreign keys) to A's data. Returns an "ID" to Appli...
The scenario you've described highlights a common challenge in managing distributed transactions across multiple applications, particularly when those applications must coordinate actions that depend on each other's outputs. Since you are constrained to using Oracle 9i and cannot utilize the XA transaction management f...
5,480
[ { "from": "human", "value": "The scenario is this\nWe have two applications A and B, both which are running in separate database (Oracle 9i ) transactions\nApplication A - inserts some data into the database, then calls Application B\nApplication B - inserts some data into the database, related (via foreign...
Can you provide a good example of rule definition language written in C#. Java guys have JESS, is there anything good for C#?
Yes, there are several rule engines and rule definition languages (RDL) available for C#. One well-known option is **NRules**, which is a rules engine for .NET that is inspired by the principles of Rete algorithms, similar to JESS in the Java ecosystem. NRules allows you to define rules in a fluent interface style. H...
7,572
[ { "from": "human", "value": "Can you provide a good example of rule definition language written in C#.\nJava guys have JESS, is there anything good for C#?\n" }, { "from": "gpt", "value": "Yes, there are several rule engines and rule definition languages (RDL) available for C#. One well-known op...
I am using mysql++ in order to connect to a MySQL database to perform a bunch of data queries. Due to the fact that the tables I am reading from are constantly being written to, and that I need a consistent view of the data, I lock the tables first. However, MySQL has no concept of 'NOWAIT' in its lock query, thus if t...
In MySQL, when you issue a `LOCK TABLES` command, the call blocks until the lock can be obtained if the tables are already locked by another session. Unfortunately, this behavior cannot be interrupted directly by the `SIGALRM` signal because the `mysql_query` function is a blocking call and does not check for signals u...
7,291
[ { "from": "human", "value": "I am using mysql++ in order to connect to a MySQL database to perform a bunch of data queries. Due to the fact that the tables I am reading from are constantly being written to, and that I need a consistent view of the data, I lock the tables first. However, MySQL has no concept...
A checklist for improving execution time between .NET code and SQL Server. Anything from the basic to weird solutions is appreciated. Code: Change default timeout in command and connection by avgbody. Use stored procedure calls instead of inline sql statement by avgbody. Look for blocking/locking using Activity monitor...
Here's a comprehensive checklist for improving execution time between .NET code and SQL Server, organized into categories for easier reference: ### .NET Code Optimization 1. **Change Default Timeout** - Set appropriate command and connection timeouts based on average execution times. 2. **Use Stored Procedures*...
5,073
[ { "from": "human", "value": "A checklist for improving execution time between .NET code and SQL Server.\nAnything from the basic to weird solutions is appreciated.\nCode:\nChange default timeout in command and connection by avgbody.\nUse stored procedure calls instead of inline sql statement by avgbody.\nLo...
I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that. It starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the job themselves. And a huge lot of stuff in between, like web.py, Pyroxide...
When considering server-side scripting with Python, there are a wide variety of frameworks and approaches to choose from, each with its own set of pros and cons. Below, I’ll outline some of the more popular options and their respective trade-offs: ### 1. **CGI (Common Gateway Interface)** **Pros:** - Simple to unders...
6,744
[ { "from": "human", "value": "I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that.\nIt starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the job themselves. And a huge lot ...
I am making a game in C++ and am having problems with my derived class. I have a base class called GameScreen which has a vitrual void draw() function with no statements. I also have a derived class called MenuScreen which also has a virtual void draw() function and a derived class from MenuScreen called TestMenu whi...
The issue you're experiencing stems from the way you are using the iterator to access the elements of the `gsScreens` list. If you're defining your list of `GameScreen` objects as follows: ```cpp std::list<GameScreen*> gsScreens; // List of pointers to GameScreen ``` Then in your `Draw()` function, you should be dere...
7,557
[ { "from": "human", "value": "I am making a game in C++ and am having problems with my derived class. I have a base class called GameScreen which has a vitrual void draw() function with no statements. I also have a derived class called MenuScreen which also has a virtual void draw() function and a derived ...
We make heavy use of Velocity in our web application. While it is easy to debug the Java side of things and ensure the Velocity Context is populated correctly, it would be extremely valuable to be able to step through the parsing of the VTL on the merge step, set breakpoints, etc. Are there any tools or IDEs/IDE plug...
Debugging Velocity Template Language (VTL) can indeed be a bit challenging since it typically involves string processing rather than traditional programming constructs. While there aren't many dedicated IDE tools specifically for VTL, you can use a combination of existing tools and techniques to make the debugging proc...
6,816
[ { "from": "human", "value": "We make heavy use of Velocity in our web application. While it is easy to debug the Java side of things and ensure the Velocity Context is populated correctly, it would be extremely valuable to be able to step through the parsing of the VTL on the merge step, set breakpoints, e...
In IntelliJ when editing Java files CTRL+LEFTCLICK on an identifier takes me to where that identifier is defined. For some reason it doesn't work when editing Ruby code. Any ideas?
In IntelliJ IDEA, the ability to navigate to the definition of an identifier using `Ctrl + Left Click` is usually available for all supported languages, including Ruby. If this functionality is not working when editing Ruby files, here are a few steps to troubleshoot and resolve the issue: 1. **Check Plugin Installati...
9,355
[ { "from": "human", "value": "In IntelliJ when editing Java files CTRL+LEFTCLICK on an identifier takes me to where that identifier is defined. For some reason it doesn't work when editing Ruby code. Any ideas?\n" }, { "from": "gpt", "value": "In IntelliJ IDEA, the ability to navigate to the def...
I am looking for an enhancement to JSON that will also serialize methods. I have an object that acts as a collection of objects, and would like to serialize the methods of the collection object as well. So far I've located ClassyJSON. Any thoughts?
ClassyJSON is an interesting approach to enhancing JSON serialization, allowing not just the serialization of data properties but also methods. However, it's important to consider the implications and potential complexities that come with serializing methods. ### Considerations for Serializing Methods 1. **Context an...
7,895
[ { "from": "human", "value": "I am looking for an enhancement to JSON that will also serialize methods. I have an object that acts as a collection of objects, and would like to serialize the methods of the collection object as well. So far I've located ClassyJSON. Any thoughts?\n" }, { "from": "gp...
Is there a way to iterate (through foreach preferably) over a collection using reflection? I'm iterating over the properties in an object using reflection, and when the program gets to a type that is a collection, I'd like it to iterate over the contents of the collection and be able to access the objects in the colle...
Yes, you can use reflection to iterate over a collection in C#. When you encounter a property that is a collection, you can use the `IEnumerable` interface and invoke `GetEnumerator` to retrieve the items in the collection. Here’s how you can implement this: 1. Use reflection to get the properties of the object. 2. C...
6,918
[ { "from": "human", "value": "Is there a way to iterate (through foreach preferably) over a collection using reflection? I'm iterating over the properties in an object using reflection, and when the program gets to a type that is a collection, I'd like it to iterate over the contents of the collection and b...
What are the key strengths of ASP.NET Webforms (2.0-3.5)? I'm not looking for comparisons to other frameworks, I'm just am looking for feedback on ASP.NET as it stands today.
ASP.NET Web Forms (versions 2.0 to 3.5) offers several key strengths that contributed to its popularity during its time. Here are some notable advantages: 1. **Rapid Development**: ASP.NET Web Forms facilitated rapid application development (RAD) by providing a robust set of controls and a rich drag-and-drop designer ...
7,703
[ { "from": "human", "value": "What are the key strengths of ASP.NET Webforms (2.0-3.5)? I'm not looking for comparisons to other frameworks, I'm just am looking for feedback on ASP.NET as it stands today.\n" }, { "from": "gpt", "value": "ASP.NET Web Forms (versions 2.0 to 3.5) offers several key ...
I'm using the javax.sound.sampled package in a radio data mode decoding program. To use the program the user feeds audio from their radio receiver into their PC's line input. The user is also required to use their mixer program to select the line in as the recording input. The trouble is some users don't know how to do...
In Java, particularly with the `javax.sound.sampled` package, there isn't a direct way to detect which audio input device is currently being used for recording, nor can you programmatically change the system settings to select a different input device like "Line In". The `javax.sound.sampled` API provides a means to li...
8,395
[ { "from": "human", "value": "I'm using the javax.sound.sampled package in a radio data mode decoding program. To use the program the user feeds audio from their radio receiver into their PC's line input. The user is also required to use their mixer program to select the line in as the recording input. The t...
I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but is there anything characteristic about a software architecture for a system written in a functional programming...
Functional programming (FP) introduces unique characteristics to software architecture that distinguish it from more traditional object-oriented or service-oriented architectures. Here are some key features and principles that often emerge in FP-based architectures: ### 1. **Immutability and State Management** - **Imm...
5,396
[ { "from": "human", "value": "I'm familiar with object-oriented architecture, including use of design patterns and class diagrams for visualization, and I know of service-oriented architecture with its contracts and protocol bindings, but is there anything characteristic about a software architecture for a s...
I know it happens sometime before Load, but during what event exactly?
It seems like you're referring to a specific event in a story, game, or series. However, I need more context to provide a precise answer. If you can clarify what you mean by "Load" and what universe or story you are referring to, I'd be happy to help!
13,564
[ { "from": "human", "value": "I know it happens sometime before Load, but during what event exactly?\n" }, { "from": "gpt", "value": "It seems like you're referring to a specific event in a story, game, or series. However, I need more context to provide a precise answer. If you can clarify what y...
I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain to separate code trees: one for the Air version and one for the Flex/SWF version?
You can generally use the same base application and source code to create an AIR version from your existing Flex 2 application. Adobe AIR is designed to work with ActionScript and MXML in a similar way to how Flex does, so you can leverage most of your existing code. Here are some considerations: 1. **File System Acc...
10,363
[ { "from": "human", "value": "I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain to separate code trees: one for the Air version ...
I'd like to add a drop-down list to a Windows application. It will have two choices, neither of which are editable. What's the best control to use? Is it a combo box with the editing property set to No? I'm using Visual Studio 2008.
In a Windows application, if you want to create a drop-down list with two choices that are not editable, the best control to use is a **ComboBox** set to a style that doesn't allow editing. In Visual Studio 2008, you can achieve this by setting the `DropDownStyle` property of the ComboBox to `DropDownList`. Here's ho...
9,996
[ { "from": "human", "value": "I'd like to add a drop-down list to a Windows application. It will have two choices, neither of which are editable. What's the best control to use? Is it a combo box with the editing property set to No?\nI'm using Visual Studio 2008.\n" }, { "from": "gpt", "value"...
Are there any good, cross platform (SBCL and CLISP at the very least) easy to install GUI libraries?
Yes, there are several cross-platform GUI libraries for Common Lisp that you can use with SBCL, CLISP, and other implementations. Here are some of the popular options: 1. **LispWorks GUI**: LispWorks provides a comprehensive GUI toolkit. It is a commercial product but offers a free edition that is quite capable for pe...
8,532
[ { "from": "human", "value": "Are there any good, cross platform (SBCL and CLISP at the very least) easy to install GUI libraries?\n" }, { "from": "gpt", "value": "Yes, there are several cross-platform GUI libraries for Common Lisp that you can use with SBCL, CLISP, and other implementations. Her...
We recently debugged a strange bug. A solution was found, but the solution is not entirely satisfactory. We use IntSmarty to localize our website, and store the localized strings in a database using our own wrapper. In its destructor, IntSmarty saves any new strings that it might have, resulting in a database call. We...
It sounds like you're dealing with a tricky situation related to the order of destruction and connection management in your application. Here are a few strategies you might consider to handle the connection lifecycle more effectively without relying on persistent connections or changing the MySQL server configuration: ...
5,419
[ { "from": "human", "value": "We recently debugged a strange bug. A solution was found, but the solution is not entirely satisfactory. \nWe use IntSmarty to localize our website, and store the localized strings in a database using our own wrapper. In its destructor, IntSmarty saves any new strings that it mi...
Does anyone know of a good way to display hierarchical data with columns? It has to be virtualizing, as it must be able to handle several million records. It should also be multi-select, most treeview controls are not. Winforms preferred, but will ElementHost WPF if necessary.
Displaying hierarchical data efficiently, especially when dealing with millions of records, can be challenging. Here are some options you can consider for your WinForms or WPF application: ### 1. **WinForms with VirtualMode DataGridView** You can use a `DataGridView` in `VirtualMode` to simulate a hierarchical struct...
3,584
[ { "from": "human", "value": "Does anyone know of a good way to display hierarchical data with columns?\nIt has to be virtualizing, as it must be able to handle several million records. \nIt should also be multi-select, most treeview controls are not. \nWinforms preferred, but will ElementHost WPF if nece...
I have an application that reads a database and outputs alerts to any dependencies that are not being met. My thinking on this issue is "Give the minimum information that points the user to the issue." I have been told by a co-worker that I should be as verbose as possible, printing out the values of the database fie...
When it comes to designing alert messages for an application, especially in the context of reading from a database and outputting alerts about dependencies, it's essential to strike a balance between being informative and overwhelming the user with unnecessary detail. Here are some thoughts on how to approach this issu...
10,183
[ { "from": "human", "value": "I have an application that reads a database and outputs alerts to any dependencies that are not being met. My thinking on this issue is \"Give the minimum information that points the user to the issue.\" I have been told by a co-worker that I should be as verbose as possible, ...
I am trying to implement a software Null Modem. Any suggestion how to create virtual COM Ports? Looking for tips, strategy, known techniques, etc..
Creating a software Null Modem to emulate virtual COM ports can be an interesting project. Below are various tips, strategies, and techniques that you can use to implement this functionality: ### 1. Understand Serial Communication and Null Modem Concept - **Serial Communication Basics**: Familiarize yourself with the ...
5,780
[ { "from": "human", "value": "I am trying to implement a software Null Modem.\nAny suggestion how to create virtual COM Ports?\nLooking for tips, strategy, known techniques, etc..\n" }, { "from": "gpt", "value": "Creating a software Null Modem to emulate virtual COM ports can be an interesting pr...
Is there any way to find out if a file is a directory? I have the file name in a variable. In Perl I can do this: if(-d $var) { print "it's a directory\n" }
Yes, you can check if a file is a directory in various programming languages, including Perl, Python, and Bash. Since you've provided an example in Perl, here's how to do it in other common languages as well: ### Perl As you've already mentioned: ```perl if (-d $var) { print "it's a directory\n"; } ``` ### Python...
10,369
[ { "from": "human", "value": "Is there any way to find out if a file is a directory?\nI have the file name in a variable. In Perl I can do this:\nif(-d $var) { print \"it's a directory\\n\" }\n\n" }, { "from": "gpt", "value": "Yes, you can check if a file is a directory in various programming lan...
I'm trying to read a .doc file into a database so that I can index it's contents. Is there an easy way for PHP on Linux to read .doc files? Failing that is it possible to convert .doc files to rtf, pdf or some other 'open' format that is easy to read? Note, I am not interested in .docx files.
Reading .doc files (the older binary Microsoft Word format) can be a bit tricky, but there are a few libraries and tools in PHP and Linux that can help you. If you're open to converting .doc files to a more manageable format, that can also be a viable solution. Here are a few methods for both options: ### Option 1: Re...
6,309
[ { "from": "human", "value": "I'm trying to read a .doc file into a database so that I can index it's contents. Is there an easy way for PHP on Linux to read .doc files? Failing that is it possible to convert .doc files to rtf, pdf or some other 'open' format that is easy to read?\nNote, I am not interested ...
I am receiving the expcetion CGI::Session::CookieStore::TamperedWithCookie after changing the config.action_controller.session.secret setting on an app (as part of preparation to full deployment. Am I right in assuming that changing the secret while testers have cookies set is the cause of this, and what other cause c...
Yes, you are correct in your assumption. The exception `CGI::Session::CookieStore::TamperedWithCookie` typically arises when the cookie stored on the client's browser does not match what the server expects. This can occur for several reasons, most commonly: 1. **Changing the Session Secret**: As you noted, when you ch...
8,798
[ { "from": "human", "value": "I am receiving the expcetion CGI::Session::CookieStore::TamperedWithCookie after changing the config.action_controller.session.secret setting on an app (as part of preparation to full deployment. \nAm I right in assuming that changing the secret while testers have cookies set is...
You can use SelectFolder() to get a folder or GetOpenFolderitem(filter as string) to get files but can you select either a folder or file? ( or for that matter selecting multiple files )
In typical programming environments and frameworks, functions to select folders and files are generally provided separately, and there isn't a built-in function to select both a folder and a file (or multiple files) simultaneously. However, it depends on the specific language or environment you are using. For example...
7,849
[ { "from": "human", "value": "You can use \nSelectFolder() to get a folder\nor \nGetOpenFolderitem(filter as string) to get files\nbut can you select either a folder or file? ( or for that matter selecting multiple files )\n" }, { "from": "gpt", "value": "In typical programming environments and f...
During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but what is it?
If you are referring to a method of displaying all changes at once during a complicated update in a version control system like Git, you can use the `git diff` command to show all changes. For instance, you can run: ```bash git diff ``` This command will show you all the changes that have not yet been staged. If you...
11,372
[ { "from": "human", "value": "During a complicated update I might prefer to display all the changes at once. I know there is a method that allows me to do this, but what is it?\n" }, { "from": "gpt", "value": "If you are referring to a method of displaying all changes at once during a complicated...
I'm working on the creation of an ActiveX EXE using VB6, and the only example I got is all written in Delphi. Reading the example code, I noticed there are some functions whose signatures are followed by the safecall keyword. Here's an example: function AddSymbol(ASymbol: OleVariant): WordBool; safecall; What is the ...
In Delphi, the `safecall` keyword is used in the declaration of methods in interfaces to indicate that the method adheres to a specific calling convention. The primary purpose of the `safecall` convention is to provide better error handling and exception safety when calling methods from COM clients. Here are the key p...
9,269
[ { "from": "human", "value": "I'm working on the creation of an ActiveX EXE using VB6, and the only example I got is all written in Delphi.\nReading the example code, I noticed there are some functions whose signatures are followed by the safecall keyword. Here's an example:\nfunction AddSymbol(ASymbol: Ole...
I'm looking for a tool like Atlassian's FishEye. The alternatives I've found so far (like StatCVS, ViewCVS or Bonsai) are either lacking in features or are quite a pain to install and maintain. So before staying with one of these tools, I'd like to be sure I did not miss any other good, easy to install, open-source (pr...
If you are looking for alternatives to Atlassian's FishEye for viewing CVS repositories, here are some options you might consider: 1. **GitWeb/GitLab**: While not CVS-specific, if you’re open to migrating your repository to Git, both GitWeb and GitLab provide powerful web-based interfaces for version control and are r...
8,763
[ { "from": "human", "value": "I'm looking for a tool like Atlassian's FishEye. The alternatives I've found so far (like StatCVS, ViewCVS or Bonsai) are either lacking in features or are quite a pain to install and maintain. So before staying with one of these tools, I'd like to be sure I did not miss any oth...
In JavaScript, using the Prototype library, the following functional construction is possible: var words = ["aqueous", "strength", "hated", "sesquicentennial", "area"]; words.pluck('length'); //-> [7, 8, 5, 16, 4] Note that this example code is equivalent to words.map( function(word) { return word.length; } ); I wond...
In F#, there isn't a built-in `List.pluck` function like in the Prototype library in JavaScript, but you can achieve similar functionality using a combination of F# features. However, you cannot directly use property names as strings like you do in JavaScript. A common approach is to create a generic pluck function t...
9,723
[ { "from": "human", "value": "In JavaScript, using the Prototype library, the following functional construction is possible:\nvar words = [\"aqueous\", \"strength\", \"hated\", \"sesquicentennial\", \"area\"];\nwords.pluck('length');\n//-> [7, 8, 5, 16, 4]\n\nNote that this example code is equivalent to\nwor...
I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id. On the Panel: MyPanel.DefaultButton = SearchButton.ID On the Control: Me...
It sounds like you're running into a cross-browser compatibility issue with your ASP.NET server control when trying to use the "Enter" key to trigger the search functionality. The fact that it works in Internet Explorer and Safari but not in Firefox suggests that there might be some JavaScript or ASP.NET lifecycle issu...
4,804
[ { "from": "human", "value": "I am building a server control that will search our db and return results. The server control is contains an ASP:Panel. I have set the default button on the panel equal to my button id and have set the form default button equal to my button id.\nOn the Panel:\n MyPanel.Default...
At my job we make & sell websites. Usually we install our .NET C# based site on a customer's server and maintain and support it remotely. However, every once in a while, for bigger development works and just to make things simpler (and faster!), we will copy the site to a local server. This is great, but has one pain -...
For your requirements, especially considering that you want to integrate the version control system into an IIS environment as a virtual directory without needing complex configurations or additional installations, I would recommend looking into **Git** combined with a simple web-based interface such as **Gogs** or **G...
9,178
[ { "from": "human", "value": "At my job we make & sell websites. Usually we install our .NET C# based site on a customer's server and maintain and support it remotely. However, every once in a while, for bigger development works and just to make things simpler (and faster!), we will copy the site to a local ...
In Visual Basic 6, when I attempt to access Project > References, it throws an error: Error accessing system registry I am: Logged in as the local computer administrator running Windows XP Professional and I can execute regedt32.exe and access all the registry keys just fine. VB6 was installed as the local admi...
The "Error accessing system registry" error in Visual Basic 6 can occur for several reasons, even if you are logged in as an administrator. Here are some steps you can take to troubleshoot and potentially resolve the issue: 1. **Run Visual Basic 6 as Administrator**: - Right-click the VB6 shortcut or executable and...
9,354
[ { "from": "human", "value": "In Visual Basic 6, when I attempt to access Project > References, it throws an error:\n\nError accessing system registry\n\nI am:\n\nLogged in as the local computer administrator \nrunning Windows XP Professional and \nI can execute regedt32.exe and access all the registry keys ...
Is there any library (or even better, web service) available which can convert from a latitude/longitude into a time zone?
Yes, there are several libraries and web services available that can convert latitude and longitude coordinates into time zones. Here are some popular options: ### Web Services 1. **Google Maps Time Zone API**: - Google offers a Time Zone API that can return the time zone for a given latitude and longitude. -...
6,919
[ { "from": "human", "value": "Is there any library (or even better, web service) available which can convert from a latitude/longitude into a time zone?\n" }, { "from": "gpt", "value": "Yes, there are several libraries and web services available that can convert latitude and longitude coordinates...
How do you run Emacs in Windows? What is the best flavor of Emacs to use in Windows, and where can I download it? And where is the .emacs file located?
To run Emacs on Windows, you can follow these steps: ### Downloading Emacs for Windows 1. **Best Flavor**: The most popular version of Emacs for Windows is the official GNU Emacs, which comes with a native installer that works well on the Windows platform. You may also find distributions like **Spacemacs** (which is ...
6,503
[ { "from": "human", "value": "How do you run Emacs in Windows?\nWhat is the best flavor of Emacs to use in Windows, and where can I download it? And where is the .emacs file located?\n" }, { "from": "gpt", "value": "To run Emacs on Windows, you can follow these steps:\n\n### Downloading Emacs for...
I have a div with id="a" that may have any number of classes attached to it, from several groups. Each group has a specific prefix. In the javascript, I don't know which class from the group is on the div. I want to be able to clear all classes with a given prefix and then add a new one. If I want to remove all of the ...
To achieve the goal of removing all classes that start with a specific prefix (like "bg") from an element and then adding a new class, you can use jQuery to manipulate the class list of the element. Here's how you can do it: 1. Select the element using jQuery. 2. Get all the current classes on the element. 3. Filter t...
8,971
[ { "from": "human", "value": "I have a div with id=\"a\" that may have any number of classes attached to it, from several groups. Each group has a specific prefix. In the javascript, I don't know which class from the group is on the div. I want to be able to clear all classes with a given prefix and then add...
I'm trying to identify differences between a base case and supplied case. Looking for a library to tell me similarity in percentage or something like that. For Example: I've 10 different HTML pages. * All of them are 404 responses with only one 2 lines of random code (such as time or quote of the day). Now when I supp...
To measure the similarity between HTML pages in .NET, you have a few options ranging from text similarity algorithms to specialized libraries. Here are some recommendations: ### 1. **Text Comparison Libraries** - **FuzzyStrings**: This is a simple .NET library that can calculate string similarity using various algori...
8,204
[ { "from": "human", "value": "I'm trying to identify differences between a base case and supplied case. Looking for a library to tell me similarity in percentage or something like that.\nFor Example:\nI've 10 different HTML pages. \n* All of them are 404 responses with only one 2 lines of random code (such a...
Most mature C++ projects seem to have an own reflection and attribute system, i.e for defining attributes which can be accessed by string and are automatically serializable. At least many C++ projects I participated in seemed to reinvent the wheel. Do you know any good open source libraries for C++ which support reflec...
Indeed, C++ does not have built-in reflection capabilities like some other languages (e.g., Java or C#). However, there are several open-source libraries that attempt to provide these features, including reflection, attributes, serialization, and event handling for attribute changes. Here are some libraries that you ma...
6,668
[ { "from": "human", "value": "Most mature C++ projects seem to have an own reflection and attribute system, i.e for defining attributes which can be accessed by string and are automatically serializable. At least many C++ projects I participated in seemed to reinvent the wheel.\nDo you know any good open sou...
I want to install PowerShell to 600 Window XP computers, and use it as the main processing shell. For example, for replacing batch scripts, VB scripts, and some other little programs. The installation process is not a problem. Some issues I think I'm going to come across are: Changing permissions to allow PowerShell t...
Using PowerShell as the main processing shell on Windows XP computers presents some unique challenges, especially given the limitations and security configurations inherent to that operating system. Below are suggestions for the issues you've mentioned: ### 1. Changing Permissions to Allow PowerShell to Run Scripts B...
7,668
[ { "from": "human", "value": "I want to install PowerShell to 600 Window XP computers, and use it as the main processing shell. For example, for replacing batch scripts, VB scripts, and some other little programs. The installation process is not a problem. Some issues I think I'm going to come across are:\n\...
I realize that CHAR is recommended if all my values are fixed-width. But, so what? Why not just pick VARCHAR for all text fields just to be safe.
Choosing between `CHAR` and `VARCHAR` depends on the specific use case, and while it's tempting to opt for `VARCHAR` for all text fields due to its flexibility, there are several reasons why `CHAR` can be beneficial in certain scenarios, particularly with fixed-width values. Here are a few considerations: ### 1. **Per...
8,780
[ { "from": "human", "value": "I realize that CHAR is recommended if all my values are fixed-width. But, so what? Why not just pick VARCHAR for all text fields just to be safe.\n" }, { "from": "gpt", "value": "Choosing between `CHAR` and `VARCHAR` depends on the specific use case, and while it's t...