instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I recently converted a site from asp to CF. Unfortunately, alot of the old users had the "homepage" bookmarked. www.example.com/homepage.asp Is there a sort of catch all way I could redirect any traffic from that page to the current index.cfm? I would normally just delete those files, but the owner(s) wanted to keep ...
To handle the redirection from `homepage.asp` to `index.cfm` while keeping the old ASP files accessible for comparison, you can use an HTTP redirect in your ColdFusion application. One simple way to achieve this is to create a new `homepage.asp` file that performs a server-side redirect to your new `index.cfm` page. H...
27,718
[ { "from": "human", "value": "I recently converted a site from asp to CF. Unfortunately, alot of the old users had the \"homepage\" bookmarked. www.example.com/homepage.asp\nIs there a sort of catch all way I could redirect any traffic from that page to the current index.cfm?\nI would normally just delete ...
Is there a complete list of Google Gears enabled sites? I'm aware of rememberthemilk.com, google docs and google calendar
Google Gears was a technology that allowed web applications to work offline by storing data locally on a user's computer. It was used by various web applications, but support for Google Gears has been largely phased out in favor of more modern technologies like HTML5 and service workers. As a result, there isn't an off...
30,042
[ { "from": "human", "value": "Is there a complete list of Google Gears enabled sites? I'm aware of rememberthemilk.com, google docs and google calendar\n" }, { "from": "gpt", "value": "Google Gears was a technology that allowed web applications to work offline by storing data locally on a user's ...
I'm working on a project in C and it requires memalign(). Really, posix_memalign() would do as well, but darwin/OSX lacks both of them. What is a good solution to shoehorn-in memalign? I don't understand the licensing for posix-C code if I were to rip off memalign.c and put it in my project- I don't want any viral-typ...
If you're working on a C project and you need the functionality of `memalign()` or `posix_memalign()`, but you're on macOS (which doesn't provide these functions), you can create your own implementation of memory alignment. One approach is to write your own `memalign()` function. Here's a basic implementation that mi...
24,467
[ { "from": "human", "value": "I'm working on a project in C and it requires memalign(). Really, posix_memalign() would do as well, but darwin/OSX lacks both of them.\nWhat is a good solution to shoehorn-in memalign? I don't understand the licensing for posix-C code if I were to rip off memalign.c and put it...
I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is Request.UserHostAddress What could be a reason of IP address information losing? All the users are from aro...
If you are consistently seeing only two IP addresses (172.16.16.1 and 172.16.16.248) in your web traffic statistics, it indicates that you are likely receiving traffic from users who are behind a proxy or a network configuration that is masking their real IP addresses. Here are some possible reasons for this behavior: ...
27,803
[ { "from": "human", "value": "I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is\nRequest.UserHostAddress\n\nWhat could be a reason of IP address in...
How do you extract an HD and Bios Unique ID, using python script?
To extract the Hard Drive (HD) and BIOS Unique ID in Python, you can use libraries that allow you to interact with the system hardware. Commonly used libraries for this purpose include `os`, `subprocess`, and `platform`. Below are examples of how to extract both the BIOS and Hard Drive Unique IDs using Python scripts. ...
23,337
[ { "from": "human", "value": "How do you extract an HD and Bios Unique ID, using python script?\n" }, { "from": "gpt", "value": "To extract the Hard Drive (HD) and BIOS Unique ID in Python, you can use libraries that allow you to interact with the system hardware. Commonly used libraries for this...
What are your favourite patterns for writing a controller?
When writing a controller in a web application, certain design patterns and best practices can enhance the maintainability, scalability, and readability of the code. Here are some of the key patterns and practices I recommend: ### 1. **MVC (Model-View-Controller) Pattern** - **Separation of Concerns**: Keep busines...
26,233
[ { "from": "human", "value": "What are your favourite patterns for writing a controller?\n" }, { "from": "gpt", "value": "When writing a controller in a web application, certain design patterns and best practices can enhance the maintainability, scalability, and readability of the code. Here are ...
So I'm looking for a pattern like this: size='0x0' In a log file, but I'm only interested in large sizes (4 digits or more). The following regex works great in EditPadPro (nice tool BTW) size='0x[0-9a-fA-F]{4,} But the same RegEx does not work in awk - seems like the repetition {4,} is messing it up. Same with WinGr...
In `awk`, the syntax for regex is slightly different than in some other tools, particularly when it comes to repetition operators like `{}`. To match a pattern using `awk` that includes repetitions, you can use the following approach: 1. Instead of using `{4,}`, you can use a workaround by specifying the pattern in a ...
28,881
[ { "from": "human", "value": "So I'm looking for a pattern like this:\n\nsize='0x0'\n\nIn a log file, but I'm only interested in large sizes (4 digits or more). The following regex works great in EditPadPro (nice tool BTW)\nsize='0x[0-9a-fA-F]{4,}\n\nBut the same RegEx does not work in awk - seems like the r...
If I spawn a new thread, and then within it I push a new controller onto my UINavigationController, using code like this... (a) not working -(void)myCallbackInThread { // move on... UIApplication* app = [UIApplication sharedApplication]; [app changeView]; } then I find that the view appears, but does not r...
The issue you are encountering relates to the threading model in iOS. UIKit, the framework that manages your app's user interface, is not thread-safe. This means that all updates to the user interface must be made on the main thread. When you spawn a new thread and try to modify the UI directly from that thread (as in ...
29,180
[ { "from": "human", "value": "If I spawn a new thread, and then within it I push a new controller onto my UINavigationController, using code like this...\n(a) not working\n-(void)myCallbackInThread\n{\n // move on...\n UIApplication* app = [UIApplication sharedApplication];\n [app changeView];\n}\n\...
I've been using Git on Windows (msysgit) to track changes for some design work I've been doing. Today I've been working on a different PC (with remote repo brian) and I'm now trying to merge the edits done today back into my regular local version on my laptop. On my laptop, I've used git pull brian master to pull the c...
When you encounter a merge conflict in Git, it means that the changes in the two branches (in your case, the `master` branch from the remote repo on your PC and your local `master` branch) have modifications that Git cannot automatically reconcile. Since you want to keep the version from your remote PC (brian), here’s ...
29,860
[ { "from": "human", "value": "I've been using Git on Windows (msysgit) to track changes for some design work I've been doing.\nToday I've been working on a different PC (with remote repo brian) and I'm now trying to merge the edits done today back into my regular local version on my laptop.\nOn my laptop, I'...
Just wondering if it's possible to screen grab a page you are viewing with a PHP script or javascript? For example, load up a page in an iframe and then save that view as a JPEG? I'm sure it's possible somehow, but are there any known implementations/libraries that help out?
Yes, it is possible to capture a screenshot of a webpage displayed in an iframe using JavaScript, though it's important to note that you cannot directly take a screenshot of an iframe that contains content from a different origin due to the Same-Origin Policy. If the iframe is displaying content from the same origin (s...
27,901
[ { "from": "human", "value": "Just wondering if it's possible to screen grab a page you are viewing with a PHP script or javascript? For example, load up a page in an iframe and then save that view as a JPEG?\nI'm sure it's possible somehow, but are there any known implementations/libraries that help out?\n...
I am trying to access a view inside a splitter from my mainframe. At the moment I have this: CWnd* pView = m_wndSplitter.GetPane( 0, 0 ); However this gets me a pointer to the CWnd not the CMyViewClass object. Can anyone explain to me what I need to do in order to access the view object itself so I can access member fu...
In your case, since `GetPane()` returns a `CWnd*`, you will need to cast that pointer to your specific view class type, `CMyViewClass`. This is essential because `CWnd` is the base class for all Windows in MFC, and you need to access the derived class functionalities. Here’s how you can do it safely with dynamic casti...
29,372
[ { "from": "human", "value": "I am trying to access a view inside a splitter from my mainframe. At the moment I have this:\nCWnd* pView = m_wndSplitter.GetPane( 0, 0 );\nHowever this gets me a pointer to the CWnd not the CMyViewClass object.\nCan anyone explain to me what I need to do in order to access the ...
Let's say I've got two strings in JavaScript: var date1 = '2008-10-03T20:24Z' var date2 = '2008-10-04T12:24Z' How would I come to a result like so: '4 weeks ago' or 'in about 15 minutes' (should support past and future). There are solutions out there for the past diffs, but I've yet to find one with support for futu...
To achieve human-readable time differences in both past and future contexts, you can create a utility function that calculates the difference between two dates and returns a formatted string. This function should account for various time intervals such as years, months, weeks, days, hours, minutes, and seconds. Here's...
24,188
[ { "from": "human", "value": "Let's say I've got two strings in JavaScript:\nvar date1 = '2008-10-03T20:24Z'\nvar date2 = '2008-10-04T12:24Z'\n\nHow would I come to a result like so:\n'4 weeks ago'\n\nor\n'in about 15 minutes'\n\n(should support past and future).\nThere are solutions out there for the past d...
In my program, how can I read the properties set in AssemblyInfo.cs: [assembly: AssemblyTitle("My Product")] [assembly: AssemblyDescription("...")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Radeldudel inc.")] [assembly: AssemblyProduct("My Product")] [assembly: AssemblyCopyright("Copyright @ me ...
In a .NET application, you can access the assembly attributes defined in the `AssemblyInfo.cs` file using reflection. The `Assembly` class provides methods to retrieve the custom attributes, including those defined in `AssemblyInfo.cs`. Here's how you can read these properties in your main program and from component as...
24,487
[ { "from": "human", "value": "In my program, how can I read the properties set in AssemblyInfo.cs:\n[assembly: AssemblyTitle(\"My Product\")]\n[assembly: AssemblyDescription(\"...\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Radeldudel inc.\")]\n[assembly: AssemblyProduct(\"My P...
I am starting new project with SqlServer and Linq to Sql. What data type would be better for surrogate keys in tables: identity or uniqueidentifier ? As I understood, identity is automatically generated on insert, while uniqueidentifier should be generated in code (GUID). Are there any significant performance differe...
When choosing between `IDENTITY` and `UNIQUEIDENTIFIER` (GUID) for surrogate keys in SQL Server, there are several factors to consider, including performance, ease of use, and specific use cases. ### 1. **IDENTITY:** - **Automatic Generation:** The `IDENTITY` property allows the database to automatically generate sequ...
27,122
[ { "from": "human", "value": "I am starting new project with SqlServer and Linq to Sql. \nWhat data type would be better for surrogate keys in tables: identity or uniqueidentifier ?\nAs I understood, identity is automatically generated on insert, while uniqueidentifier should be generated in code (GUID). \nA...
I would like to modify the animation duration and attach a callback to be called when the animation finishes when calling scrollToRowAtIndexPath with animated:YES but I can't find a handle to its animation proxy or any other way to do it. Anyone know if this is possible?
In UIKit, the `scrollToRow(at:at:animated:)` method of `UITableView` does not provide a direct way to modify the animation duration or attach a completion callback for when the animation finishes. However, you can achieve the desired effect by using a workaround with a custom animation. Here's a way to implement this:...
28,630
[ { "from": "human", "value": "I would like to modify the animation duration and attach a callback to be called when the animation finishes when calling scrollToRowAtIndexPath with animated:YES but I can't find a handle to its animation proxy or any other way to do it.\nAnyone know if this is possible?\n" }...
I Have one entity [Project] that contains a collection of other entities [Questions]. I have mapped the relation with a cascade attribute of "all-delete-orphan". In my DB the relation is mapped with a project_id (FK) field on the questions table. this field cannot be null since I don't want a Question without a Project...
The issue you are facing arises because of the way the `all-delete-orphan` cascading operation works in conjunction with the not-null constraint on the `project_id` field in your database. When you call `session.delete(project)`, it attempts to delete the `Project` entity, but because of the `not-null` constraint on th...
28,791
[ { "from": "human", "value": "I Have one entity [Project] that contains a collection of other entities [Questions].\nI have mapped the relation with a cascade attribute of \"all-delete-orphan\".\nIn my DB the relation is mapped with a project_id (FK) field on the questions table. this field cannot be null si...
In the company where I work we have major releases twice every year. Extensive testing (automated and manual) is done the weeks before. The automated tests produce logfiles, the results of the manual tests are written down in test plans (Word documents). As you can imagine this results in a lot of different files to b...
Organizing release tests efficiently is crucial to managing the complexity and volume of testing involved, especially in a biannual release cycle. Here's a comprehensive approach that you could consider, encompassing tools, processes, and team structures: ### 1. Test Management Tools - **Use a Test Management Tool**: ...
20,293
[ { "from": "human", "value": "In the company where I work we have major releases twice every year. Extensive testing (automated and manual) is done the weeks before. \nThe automated tests produce logfiles, the results of the manual tests are written down in test plans (Word documents). As you can imagine thi...
I'll simplify the problem as much as possible: I have an oracle table: row_priority, col1, col2, col3 0, .1, 100, {null} 12, {null}, {null}, 3 24, .2, {null}, {null} Desired result: col1, col2, col3 .2, 100, 3 So according to the priority of the row, it overrides previous row values, if given. I'm attempting to work ...
To achieve the desired result of selecting non-null values based on the row priority while ignoring nulls, you'll need to use the `LAST_VALUE` or `FIRST_VALUE` functions correctly. However, the analytical functions need to be handled differently because they operate over windows of rows, and using the entire table migh...
27,984
[ { "from": "human", "value": "I'll simplify the problem as much as possible:\nI have an oracle table:\nrow_priority, col1, col2, col3\n0, .1, 100, {null}\n12, {null}, {null}, 3\n24, .2, {null}, {null}\n\nDesired result:\ncol1, col2, col3\n.2, 100, 3\n\nSo according to the priority of the row, it overrides pr...
I have an application where I perform hundreds of thousands of calculations. Currently all of our values are Doubles. I am utilizing JFormula engine for most of the calculations, and have noticed the api takes a double parameter, so there is some autoboxing taking place when I pass in a Double. I have read some arti...
When it comes to performance in Java, using primitives (like `double`, `int`, etc.) instead of their wrapper classes (like `Double`, `Integer`, etc.) can lead to significant improvements, especially in scenarios where a large number of calculations are being performed. Here are some reasons and experiences shared by d...
28,443
[ { "from": "human", "value": "I have an application where I perform hundreds of thousands of calculations. Currently all of our values are Doubles. I am utilizing JFormula engine for most of the calculations, and have noticed the api takes a double parameter, so there is some autoboxing taking place when I...
After making some changes in my models (eg. new field in a model and a new model) what is the best way of reflecting these changes to my populated database? PS: I wanted to see many solutions in one place rated. Apparently more solutions are already listed here.
When you make changes to your models in a database-backed application, you generally need to reflect those changes in your actual database schema. Here are several methods to do this, rated by effectiveness, complexity, and use case: ### 1. **Database Migrations** **Rating:** ★★★★★ **Best Use Case:** Recommended for...
25,183
[ { "from": "human", "value": "After making some changes in my models (eg. new field in a model and a new model) what is the best way of reflecting these changes to my populated database? \n\nPS: I wanted to see many solutions in one place rated. Apparently more solutions are already listed here.\n" }, { ...
We currently do a fair amount or dynamic image generation of png's in ASP.NET using the GDI+ classes in .Net with a no major issues. I had hoped to take advantage of many of the new drawing, FormattedText, RenderTargetBitmap, optimization algorithms, etc. in WPF in our ASP.NET application, but apparently this is not su...
Using WPF for dynamic image generation in an ASP.NET application is not straightforward due to the limitations of running WPF in an ASP.NET context. However, there are some potential workarounds and alternatives that you could consider: ### Workarounds 1. **Windows Service for Image Generation**: - Create a Window...
27,927
[ { "from": "human", "value": "We currently do a fair amount or dynamic image generation of png's in ASP.NET using the GDI+ classes in .Net with a no major issues. I had hoped to take advantage of many of the new drawing, FormattedText, RenderTargetBitmap, optimization algorithms, etc. in WPF in our ASP.NET a...
Does anyone have any idea what is wrong with this create statement for mysql? EDIT: now it states the error is near: revised VARCHAR(20), paypal_accept TINYINT, pre_terminat' at line 4 Thanks for the help everyone Still errors after using sql beautifier though CREATE TABLE AUCTIONS ( ARTICLE_NO VARCHAR(20), ...
The issue you are encountering seems to be related to the use of the word `CONDITION`. In MySQL, `CONDITION` is a reserved keyword, and using it as an identifier (like a column name) without any special treatment will lead to syntax errors. You can resolve this issue by either renaming the column to something that is ...
28,278
[ { "from": "human", "value": "Does anyone have any idea what is wrong with this create statement for mysql? \nEDIT: now it states the error is near: revised VARCHAR(20), paypal_accept TINYINT, pre_terminat' at line 4\nThanks for the help everyone\nStill errors after using sql beautifier though\nCREATE TABLE...
Say you've loaded a text file into a string, and you'd like to convert all Unicode escapes into actual Unicode characters inside of the string. Example: "The following is the top half of an integral character in Unicode '\u2320', and this is the lower half '\U2321'."
To convert Unicode escapes in a string to actual Unicode characters in Python, you can use the built-in `unicode_escape` codec. Here's how you can do it: ```python # Original string with Unicode escapes text_with_unicode_escapes = "The following is the top half of an integral character in Unicode '\\u2320', and this i...
19,901
[ { "from": "human", "value": "Say you've loaded a text file into a string, and you'd like to convert all Unicode escapes into actual Unicode characters inside of the string. \nExample:\n\n\"The following is the top half of an integral character in Unicode '\\u2320', and this is the lower half '\\U2321'.\"\n\...
I want to create a string that spans multiple lines to assign to a Label Caption property. How is this done in Delphi?
In Delphi, you can create a multi-line string and assign it to a Label's `Caption` property using either the `#13#10` (or `#10` for just a newline) character sequence to indicate line breaks. Here’s how you can do it: ### Method 1: Using `#13#10` ```delphi Label1.Caption := 'This is line 1' + #13#10 + ...
30,297
[ { "from": "human", "value": "I want to create a string that spans multiple lines to assign to a Label Caption property. How is this done in Delphi?\n" }, { "from": "gpt", "value": "In Delphi, you can create a multi-line string and assign it to a Label's `Caption` property using either the `#13#1...
I have a table that saves some account limits like users. For most rows this value will be an integer. However I will also need to support storing unlimited (infinite) as a value. This might seem silly but is there a common integer value that represents unlimited (infinite)? I'd like to keep storing the values as integ...
In many systems that require an integer representation of a value that signifies "unlimited" or "infinite," a common practice is to use a very large integer value to represent this concept. However, since you want to use a single value consistently, the choice often depends on the context and the range of values you ex...
30,631
[ { "from": "human", "value": "I have a table that saves some account limits like users. For most rows this value will be an integer. However I will also need to support storing unlimited (infinite) as a value. This might seem silly but is there a common integer value that represents unlimited (infinite)? I'd...
I'm pretty sure there should be a more Pythonic way of doing this - but I can't think of one: How can I merge a two-dimensional list into a one-dimensional list? Sort of like zip/map but with more than two iterators. Example - I have the following list: array = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] I want to have result =...
You can achieve this in a more Pythonic way by using the `zip` function in combination with a list comprehension. The `zip` function allows you to iterate over multiple iterables in parallel, which is perfect for your use case where you want to sum corresponding elements from each sub-list in the 2D list. Here's how y...
30,966
[ { "from": "human", "value": "I'm pretty sure there should be a more Pythonic way of doing this - but I can't think of one: How can I merge a two-dimensional list into a one-dimensional list? Sort of like zip/map but with more than two iterators.\nExample - I have the following list:\narray = [[1, 2, 3], [4,...
Visual Studio 2008 doesn't appear to be loading symbols for MFC dlls when I debug my application. This used to work fine in 2005 - ie. when it loaded the dll it said "Symbols loaded" and can then debug it. In 2008 (having upgraded to MFC 9, so they are different libraries) it doesn't say that it's loaded symbols for th...
Debugging issues with MFC DLLs in Visual Studio 2008 can be frustrating, especially when transitioning from a previous version like 2005. Here are several suggestions that may help you resolve the symbol loading issue: ### 1. **Check Symbol Paths** Ensure that Visual Studio is set up to look in the right directories f...
25,983
[ { "from": "human", "value": "Visual Studio 2008 doesn't appear to be loading symbols for MFC dlls when I debug my application. This used to work fine in 2005 - ie. when it loaded the dll it said \"Symbols loaded\" and can then debug it. In 2008 (having upgraded to MFC 9, so they are different libraries) it ...
After using them a while I can't help but feel that the hoops you're forced to jump through when using anonymous classes are not worth it. You end up with final all over the place and no matter what the code is more difficult to read than if you'd used a well named inner class. So what are the advantages of using them?...
You're right that anonymous classes can introduce certain complexities and verbosity, especially when they require the use of `final` or effectively final variables. However, there are specific advantages and scenarios where anonymous classes shine, which may not be immediately apparent. Here are some benefits of using...
29,151
[ { "from": "human", "value": "After using them a while I can't help but feel that the hoops you're forced to jump through when using anonymous classes are not worth it.\nYou end up with final all over the place and no matter what the code is more difficult to read than if you'd used a well named inner class....
I know its possible to get the top terms within a Lucene Index, but is there a way to get the top terms based on a subset of a Lucene index? I.e. What are the top terms in the Index for documents within a certain date range?
Yes, it is possible to retrieve the top terms based on a subset of documents in a Lucene index, such as those within a certain date range. Here’s a general approach on how to achieve that: ### Steps to Retrieve Top Terms in a Date Range from Lucene Index 1. **Create a Query for the Date Range**: You'll first need to ...
19,358
[ { "from": "human", "value": "I know its possible to get the top terms within a Lucene Index, but is there a way to get the top terms based on a subset of a Lucene index?\nI.e. What are the top terms in the Index for documents within a certain date range?\n" }, { "from": "gpt", "value": "Yes, it ...
I have a form that uses jQuery to submit an ajax post and it serializes the form that is sent up. The code looks like this: var form = $("form"); var action = form.attr("action"); var serializedForm = form.serialize(); $.post(action, serializedForm, function(data) { ... }); The problem here is that if a field has tr...
Yes, you can achieve this by using jQuery's `each` method to iterate over the form fields and trim the values before serialization. Instead of manually trimming each field like you showed, you can create a simple function that trims whitespace for all input elements in the form. Here's how you can do it: ```javascript...
26,181
[ { "from": "human", "value": "I have a form that uses jQuery to submit an ajax post and it serializes the form that is sent up. The code looks like this:\nvar form = $(\"form\");\nvar action = form.attr(\"action\");\nvar serializedForm = form.serialize();\n$.post(action, serializedForm, function(data)\n{\n ...
Haven't done ASP.NET development since VS 2003, so I'd like to save some time and learn from other's mistakes. Writing a web services app, but not a WSDL/SOAP/etc. -- more like REST + XML. Which of the many "New Item" options (Web Form, Generic Handler, ASP.NET Handler, etc.) makes the most sense if I want to handle ...
Welcome back to ASP.NET development! Given your requirements for a RESTful web services application that handles different HTTP verbs (GET, POST, PUT, DELETE, etc.) from the same URI, I recommend using **ASP.NET Web API** if you are using a more recent version of ASP.NET (like ASP.NET Core or ASP.NET 4.x). Here's a q...
25,036
[ { "from": "human", "value": "Haven't done ASP.NET development since VS 2003, so I'd like to save some time and learn from other's mistakes.\nWriting a web services app, but not a WSDL/SOAP/etc. -- more like REST + XML. \nWhich of the many \"New Item\" options (Web Form, Generic Handler, ASP.NET Handler, et...
I'm working on a program to do some image wrangling in Python for work. I'm using FreeImagePy because PIL doesn't support multi-page TIFFs. Whenever I try to save a file with it from my program I get this error message (or something similar depending on which way I try to save): Error returned. TIFF FreeImage_Save: ...
The error you are experiencing when using FreeImagePy in your program could be due to a few different reasons, especially since it works fine from IDLE. Here are some steps to troubleshoot and resolve the issue: ### 1. File Path and Permissions Make sure that the file path you are using (`C:/OCRtmp/ocr page`) is acces...
27,115
[ { "from": "human", "value": "I'm working on a program to do some image wrangling in Python for work. I'm using FreeImagePy because PIL doesn't support multi-page TIFFs. Whenever I try to save a file with it from my program I get this error message (or something similar depending on which way I try to save...
I have a Java servlet which generates XML, translates it with an XSLT stylesheet, and then displays the resulting HTML. This is the first time I've worked with XSLT. What's a good way to debug XSLT? I have (or can get) some sample XML files to apply the transform too. But I'm not really even sure of the syntax so somet...
Debugging XSLT can be a bit challenging if you're new to it, but there are several approaches and tools that can help you identify issues and validate your XSLT. Here are some tips on how to effectively debug your XSLT transformations: ### 1. Use an Integrated Development Environment (IDE) Many IDEs come with support...
25,044
[ { "from": "human", "value": "I have a Java servlet which generates XML, translates it with an XSLT stylesheet, and then displays the resulting HTML. This is the first time I've worked with XSLT. What's a good way to debug XSLT? I have (or can get) some sample XML files to apply the transform too. But I'm no...
Because windows is case-insensitive and because SVN is case-sensitive and because VS2005 tends to rename files giving them the lower-case form which messes my repositories' history, I've tried to add the pre-commit hook script from http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/case-insensitive.py. Sure eno...
If you're facing issues with the `case-insensitive.py` hook script for SVN due to the absence of compiled `libsvn` for Windows, there are a couple of alternatives you can consider: ### 1. Use a Different Hook Script Instead of using the `case-insensitive.py` script that relies on `libsvn`, you can implement a simpler...
24,208
[ { "from": "human", "value": "Because windows is case-insensitive and because SVN is case-sensitive and because VS2005 tends to rename files giving them the lower-case form which messes my repositories' history, I've tried to add the pre-commit hook script from http://svn.collab.net/repos/svn/trunk/contrib/h...
I am developing an application that needs to use regini (because of legacy reasons) to insert something into the registry. I have been trying to do this in such a way the the user of the application is not aware of this. I have written the following code: System.Diagnostics.ProcessStartInfo pi = new ProcessStartInfo();...
The issue you're encountering is that the `ProcessStartInfo` settings you are using are not completely preventing the command window from appearing, especially since `regini.exe` is a console application that inherently creates a window when it runs. To prevent the command window from appearing while running `regini.e...
26,798
[ { "from": "human", "value": "I am developing an application that needs to use regini (because of legacy reasons) to insert something into the registry. I have been trying to do this in such a way the the user of the application is not aware of this. I have written the following code:\nSystem.Diagnostics.Pro...
How can I use Cron on Google App Engine?
Google App Engine does not support Cron jobs directly in the same way that traditional servers do, but it does provide a service called the **Cloud Scheduler** which can be used to achieve similar functionality. Here’s how to set up cron-like tasks on Google App Engine using Cloud Scheduler: ### Steps to Use Cloud Sch...
28,105
[ { "from": "human", "value": "How can I use Cron on Google App Engine?\n" }, { "from": "gpt", "value": "Google App Engine does not support Cron jobs directly in the same way that traditional servers do, but it does provide a service called the **Cloud Scheduler** which can be used to achieve simi...
I've got a PHP-based site where we allow users to upload a comma-separated text file of data to be imported by some server side scripts. However, sometimes we need to adjust the column order of the data that is uploaded, and it would be immensely helpful if we could identify the columns in the CSV file before the uploa...
To accomplish your goal of reading only the first line of a large CSV file using ActionScript, you can indeed utilize Flash's `File` and `FileStream` classes. However, Flash has some limitations and browser security restrictions, and running Flash content in a browser is becoming increasingly obsolete due to the deprec...
19,467
[ { "from": "human", "value": "I've got a PHP-based site where we allow users to upload a comma-separated text file of data to be imported by some server side scripts. However, sometimes we need to adjust the column order of the data that is uploaded, and it would be immensely helpful if we could identify the...
I have an executable on Linux that loads libfoo.so.1 (that's a SONAME) as one of its dependencies (via another shared library). It also links to another system library, which, in turn, links to a system version, libfoo.so.2. As a result, both libfoo.so.1 and libfoo.so.2 are loaded during execution, and code that was su...
Loading two different versions of a shared library simultaneously, especially when they are binary incompatible, poses significant challenges in terms of symbol resolution and function calls. However, there are a few approaches you might consider to mitigate the issue, depending on your specific constraints and use cas...
25,868
[ { "from": "human", "value": "I have an executable on Linux that loads libfoo.so.1 (that's a SONAME) as one of its dependencies (via another shared library). It also links to another system library, which, in turn, links to a system version, libfoo.so.2. As a result, both libfoo.so.1 and libfoo.so.2 are load...
I have lots of mp3s on my site that I want my friends to be able to play only- but I don't want them all downloading as soon as the page opens and would prefer them to only start downloading into the buffer if someone wants to play it- is this possible with the embed tag? I can't seem to find anything on Google so I am...
Yes, you can achieve this using the HTML `<audio>` tag, which allows you to embed audio files in a web page without them automatically downloading. This tag provides a user-friendly way for your friends to play audio files without forcing them to download the entire file when the page loads. Here’s how you can use the...
24,000
[ { "from": "human", "value": "I have lots of mp3s on my site that I want my friends to be able to play only- but I don't want them all downloading as soon as the page opens and would prefer them to only start downloading into the buffer if someone wants to play it- is this possible with the embed tag? I can'...
How can you programmatically tell an HTML select to drop down (for example, due to mouseover)?
To programmatically trigger a dropdown for an HTML `<select>` element using JavaScript, you can simulate a mouse event or call the `focus` method on the `<select>`. However, standard JavaScript does not provide a built-in method to programmatically open the dropdown of a `<select>`. Browsers typically restrict this beh...
26,310
[ { "from": "human", "value": "How can you programmatically tell an HTML select to drop down (for example, due to mouseover)?\n" }, { "from": "gpt", "value": "To programmatically trigger a dropdown for an HTML `<select>` element using JavaScript, you can simulate a mouse event or call the `focus` ...
I need to compare 2 strings as equal such as these: Lubeck == Lübeck In JavaScript. Why? Well, I have an auto-completion field that's going out to a Java service using Lucene, where place names are stored naturally (as Lübeck), but also indexed as normalized text, import sun.text.Normalizer; oDoc.setNameLC = Normali...
To accomplish the task of comparing strings while accounting for diacritics (like "Lübeck" and "Lubeck") in JavaScript, you can utilize the `String.prototype.normalize` method, which is part of the ECMAScript Internationalization API. This method helps you normalize Unicode strings and can be used effectively to conver...
25,781
[ { "from": "human", "value": "I need to compare 2 strings as equal such as these:\n\nLubeck == Lübeck\n\nIn JavaScript.\nWhy? Well, I have an auto-completion field that's going out to a Java service using Lucene, where place names are stored naturally (as Lübeck), but also indexed as normalized text, \nimpor...
I installed wxWidgets 2.8.9 on a Windows XP SP2 box and built the library according to the directions and now I'm trying to get the Hello World! tutorial app to build from within Eclipse and I'm just missing something apparently. Any idea how to get Cygwin, Eclipse and wxWidgets to play nice together?
Setting up wxWidgets with Cygwin and Eclipse can be a bit tricky, but with the right steps, you can get it working. Here’s a guide to help you build a simple Hello World! application with wxWidgets in Eclipse on your Windows XP SP2 system. ### Step 1: Ensure Cygwin is Installed Properly Make sure you have Cygwin insta...
22,769
[ { "from": "human", "value": "I installed wxWidgets 2.8.9 on a Windows XP SP2 box and built the library according to the directions and now I'm trying to get the Hello World! tutorial app to build from within Eclipse and I'm just missing something apparently. Any idea how to get Cygwin, Eclipse and wxWidget...
If you develop for ATG Dynamo, how do you structure your modules and dependencies? How do you structure the projects? source directories, JARs configs etc. How do you build and deploy? What tools do you use?
Developing for ATG Dynamo involves a structured approach to organizing modules, managing dependencies, and executing builds and deployments. Here's a general overview of how to structure your projects and the tools typically used: ### Project Structure 1. **Source Directories**: - **src/main/java**: Contains the ...
25,874
[ { "from": "human", "value": "If you develop for ATG Dynamo, how do you structure your modules and dependencies?\nHow do you structure the projects? source directories, JARs configs etc.\nHow do you build and deploy? What tools do you use?\n" }, { "from": "gpt", "value": "Developing for ATG Dynam...
I'm trying to host a python script using an apache web server, but the server tries to run the script instead of just offering it for download. I do not have direct access to server, and adding the line AddType text/plain .py to .htaccess in the root folder does not appear to work, though I could be doing something wr...
If you're trying to serve a Python script as plain text rather than executing it, there are a few steps you can take. Given that you're experiencing issues with the `AddType` directive in your `.htaccess` file, here are some things to consider: 1. **Check Permissions and Overrides**: First, ensure that your `.htaccess...
27,244
[ { "from": "human", "value": "I'm trying to host a python script using an apache web server, but the server tries to run the script instead of just offering it for download.\nI do not have direct access to server, and adding the line\nAddType text/plain .py\n\nto .htaccess in the root folder does not appear ...
I'm interested in finding out what people would consider the most useful data structures to know in programming. What data structure do you find yourself using all the time? Answers to this post should help new programmers interested in finding a useful data structure for their problem. Answers should probably include...
### Data Structure: Hash Table (or Hash Map) **Overview:** A hash table (or hash map) is a data structure that stores key-value pairs and allows for efficient data retrieval based on the key. The keys are processed through a hash function, which determines where the value is stored in the table. This enables average-c...
29,911
[ { "from": "human", "value": "I'm interested in finding out what people would consider the most useful data structures to know in programming. What data structure do you find yourself using all the time? \nAnswers to this post should help new programmers interested in finding a useful data structure for thei...
I'm designing a database for an events management site - there is a table of venues and a table of events. Each event is in a venue (stores the venue's id) and each venue is in a city. It must be possible to search for event by city, should city be a field in the venues table (which could possibly result in duplicate c...
Your question touches on an important aspect of database design: normalization. Let's break down the options you've presented. ### Option 1: City as a Field in the Venues Table In this approach, you would have a `venues` table that includes a `city` column, which can lead to problems such as: - **Data Redundancy**: Y...
28,431
[ { "from": "human", "value": "I'm designing a database for an events management site - there is a table of venues and a table of events. Each event is in a venue (stores the venue's id) and each venue is in a city. It must be possible to search for event by city, should city be a field in the venues table (w...
I have UIWebView within a UIScrollView. Then as I scroll, the web view displays first two pages correctly but does draws only half of the third the page. If I tap on the web view it draws the content or if I call -[UIWebView reload] in -scrollViewDidEndDecelerating, it shows the content. Is there any way I can make th...
The issue you're experiencing with `UIWebView` not rendering properly while scrolling within a `UIScrollView` can often be attributed to the way the rendering of content is being handled in relation to the scroll view's content offset and bounds. Here are several approaches you can try to resolve the rendering issue w...
29,938
[ { "from": "human", "value": "I have UIWebView within a UIScrollView. Then as I scroll, the web view displays first two pages correctly but does draws only half of the third the page. If I tap on the web view it draws the content or if I call -[UIWebView reload] in -scrollViewDidEndDecelerating, it shows the...
I have a database with a table which is full of conditions and error messages for checking another database. I want to run a loop such that each of these conditions is checked against all the tables in the second database and generae a report which gives the errors. Is this possible in ms access. For example, querycrit...
Yes, it is possible to perform this kind of operation in MS Access using VBA (Visual Basic for Applications). You can loop through each of the conditions in your `querycrit` table, then evaluate them against each row in your `records` table, and finally generate a report of errors based on those evaluations. Here's a ...
28,792
[ { "from": "human", "value": "I have a database with a table which is full of conditions and error messages for checking another database.\nI want to run a loop such that each of these conditions is checked against all the tables in the second database and generae a report which gives the errors.\nIs this po...
I have a class which implements UserControl. In .NET 2005, a Dispose method is automatically created in the MyClass.Designer.cs partial class file that looks like this: protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base...
In .NET, the best practice when dealing with generated code files (like `MyClass.Designer.cs`) is to avoid modifying them directly. Instead, you can override the `Dispose` method in your main class file where you implement the user control. This way, you can include your custom disposal logic without the risk of it bei...
29,745
[ { "from": "human", "value": "I have a class which implements UserControl. In .NET 2005, a Dispose method is automatically created in the MyClass.Designer.cs partial class file that looks like this:\n protected override void Dispose(bool disposing)\n {\n if (disposing && (components != null))\n {\n...
What's the accepted way of storing quoted data in XML? For example, for a node, which is correct? (a) <name>Jesse "The Body" Ventura</name> (b) <name>Jesse \"The Body\" Ventura</name> (c) <name>Jesse &quot;The Body&quot; Ventura</name> (d) none of the above (please specify) If (a), what do you do for attributes? If (...
The accepted way to store quoted data in XML is to use character entities for special characters. In your example, the correct way to represent the quoted string in XML would be: (c) `<name>Jesse &quot;The Body&quot; Ventura</name>` This uses the `&quot;` character entity to represent the double quote (`"`). For at...
27,975
[ { "from": "human", "value": "What's the accepted way of storing quoted data in XML?\nFor example, for a node, which is correct?\n\n(a) <name>Jesse \"The Body\" Ventura</name>\n(b) <name>Jesse \\\"The Body\\\" Ventura</name>\n(c) <name>Jesse &quot;The Body&quot; Ventura</name>\n(d) none of the above (please ...
I have a branch in an SVN tree which contains the source to a third party product. I need to update that branch with the latest version. If I check it out and copy the new source over the old source, I can easily add the new files and do a commit. However, I would also like make sure that any files that are the old ver...
Subversion (SVN) doesn't provide a direct command to update a repository from a directory like you might find in some other version control systems. However, you can achieve your goal of synchronizing your branch with the new version of the source by following these steps: ### Step-by-step guide: 1. **Check Out Your ...
27,099
[ { "from": "human", "value": "I have a branch in an SVN tree which contains the source to a third party product. I need to update that branch with the latest version. If I check it out and copy the new source over the old source, I can easily add the new files and do a commit. However, I would also like make...
So I am just starting out developing PHP web applications and have finished setting up my server with the following: Ubuntu Server Apache2 PHP MySQL VSFTPD and all the other goodies... Currently when I edit files, I have two methods to update/upload them to the server. I can use vi on the server to make small change...
It's great to see you diving into PHP web application development! Let's explore your options for editing and uploading files to your server. ### Editing Methods 1. **NetBeans (or any modern IDE)**: - **Pros**: IDEs like NetBeans, Visual Studio Code, or PHPStorm provide powerful features such as syntax highlightin...
27,849
[ { "from": "human", "value": "So I am just starting out developing PHP web applications and have finished setting up my server with the following:\n\nUbuntu Server\nApache2\nPHP\nMySQL\nVSFTPD\nand all the other goodies...\n\nCurrently when I edit files, I have two methods to update/upload them to the server...
I'm new to extending Drupal, though I've done similar kinds of things for other CMSes. Anyone care to share opinions on the best way to access an external API from within Drupal? I need to show things like search results, listings, and listing summaries. In my reading up on Drupal, I think this implies I need to create...
Accessing an external API within Drupal can definitely be achieved, and it's great that you're diving into extending Drupal. Here are some best practices and steps to consider for your implementation: ### 1. **Create a Custom Module** Creating a custom module is the recommended approach. This way, you can encapsulate ...
25,483
[ { "from": "human", "value": "I'm new to extending Drupal, though I've done similar kinds of things for other CMSes. Anyone care to share opinions on the best way to access an external API from within Drupal?\nI need to show things like search results, listings, and listing summaries. In my reading up on Dru...
I have a multi-column text file ( tab delimited ) that I use for localized text in my project. I picked this format since it can easily be edited by anyone in most text editors (and excel too). My makefile processes it into a bunch of defines and binary data for including directly into my app. Do you know if SVN mer...
SVN (Subversion) primarily performs merging based on the concept of whole lines, meaning it treats each line in a text file as a separate entity for the purpose of version control. This line-by-line approach can lead to some issues when multiple contributors make changes to the same line of a file. In your scenario, ...
30,128
[ { "from": "human", "value": "I have a multi-column text file ( tab delimited ) that I use for localized text in my project. \nI picked this format since it can easily be edited by anyone in most text editors (and excel too). \nMy makefile processes it into a bunch of defines and binary data for including di...
We basically have 2 sites ( Java /JSP / Apache Webserver) : something.ca & something.com The .ca is canadian content, and the .com is american content. We need users to be redirected based on the ip addreess. We want US users to get the .com site and Canadian users get the .ca site. What is the best way to do this (a...
To achieve the desired redirection based on the user's IP address for your two sites (`something.ca` for Canadian users and `something.com` for American users), you can implement geolocation-based redirection. This can be accomplished at the web server level (Apache) or through application logic (Java/JSP). Here's how ...
24,348
[ { "from": "human", "value": "We basically have 2 sites ( Java /JSP / Apache Webserver) :\nsomething.ca & something.com \nThe .ca is canadian content, and the .com is american content.\nWe need users to be redirected based on the ip addreess.\nWe want US users to get the .com site and Canadian users get the ...
c# windows forms: How do you create new settings at run time so that they are permanently saved as Settings.Default.-- values?
In a Windows Forms application, if you want to create new settings at runtime and save them permanently so that they can be retrieved later, you need to work with the `Properties.Settings` class, which is part of the application configuration. Here's a step-by-step guide on how to create new settings at runtime and sa...
24,899
[ { "from": "human", "value": "c# windows forms: How do you create new settings at run time so that they are permanently saved as Settings.Default.-- values?\n" }, { "from": "gpt", "value": "In a Windows Forms application, if you want to create new settings at runtime and save them permanently so ...
How do I convert a string to DateTime format? For example, if I had a string like: "24/10/2008" How do I get that into DateTime format ?
To convert a string like "24/10/2008" into a `DateTime` format in various programming languages, you can use the respective date parsing functions available in those languages. Here are examples for a few popular programming languages: ### C# In C#, you can use `DateTime.ParseExact` method specifying the format: ```...
28,472
[ { "from": "human", "value": "How do I convert a string to DateTime format? For example, if I had a string like:\n\"24/10/2008\"\nHow do I get that into DateTime format ?\n" }, { "from": "gpt", "value": "To convert a string like \"24/10/2008\" into a `DateTime` format in various programming langu...
I recently switched my hosting provider and due to the time zone that the server is now in, my code has stopped working. The hosting server reports in Pacific time, However, my code needs to work with GMT as my site is for the UK market. So, all my displays and searches need to be in the format dd/MM/yyyy How can I ac...
When switching to a different time zone, it's important to ensure that your code can handle date and time conversions properly, especially if your users expect dates to be in a specific format and time zone. Here's how you can address the issues you're facing: ### 1. Parse Dates Using the Correct Format The first thi...
28,914
[ { "from": "human", "value": "I recently switched my hosting provider and due to the time zone that the server is now in, my code has stopped working. \nThe hosting server reports in Pacific time, However, my code needs to work with GMT as my site is for the UK market. So, all my displays and searches need t...
I've been teaching myself Objective-C over the past month or so (I'm a Java head) and I've got my brain wrapped around most of it now. One thing that's confusing me at the moment: What's the difference between importing a class via @class vs doing a #import? Is one better than another one, or do I need to use one inst...
Great to hear that you're diving into Objective-C! The difference between using `@class` and `#import` is a nuanced but important aspect of Objective-C's type system and compilation. ### `#import` - **Purpose**: `#import` is a preprocessor directive used to include the contents of a specified file, typically a header...
27,039
[ { "from": "human", "value": "I've been teaching myself Objective-C over the past month or so (I'm a Java head) and I've got my brain wrapped around most of it now. One thing that's confusing me at the moment: What's the difference between importing a class via @class vs doing a #import? \nIs one better than...
I'm trying to use opengl in C#. I have following code which fails with error 2000 ERROR_INVALID_PIXEL_FORMAT First definitions: [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] public static extern IntPtr GetDC(IntPtr hWnd); [StructLayout(LayoutKind.Sequential)] public s...
The issue you are encountering with `ERROR_INVALID_PIXEL_FORMAT` (error code `2000`) when trying to create an OpenGL context in your C# code likely stems from how the `PIXELFORMATDESCRIPTOR` is being initialized and how the pixel format is being set. Below are several potential improvements and debugging steps to help ...
25,664
[ { "from": "human", "value": "I'm trying to use opengl in C#. I have following code which fails with error 2000 ERROR_INVALID_PIXEL_FORMAT\nFirst definitions:\n[DllImport(\"user32.dll\", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]\npublic static extern IntPtr GetDC(IntPtr hWnd);\n\n[S...
I have an install that upgrades a previous version of an app if it exits. I'd like to skip certain actions when the install is upgrade mode. How can I determine if the install is running in upgrade mode vs. first time install mode? I'm using Wise Installer, but I don't think that matters. I'm assuming that Windows Inst...
In Windows Installer, you can determine whether an installation is an upgrade by checking certain properties that are set during the installation process. Specifically, when performing an upgrade, the `REINSTALLMODE` property is set to indicate that the installation is upgrading an existing product. However, to more d...
30,182
[ { "from": "human", "value": "I have an install that upgrades a previous version of an app if it exits. I'd like to skip certain actions when the install is upgrade mode. How can I determine if the install is running in upgrade mode vs. first time install mode?\nI'm using Wise Installer, but I don't think th...
This is something that's been bothering me a while and there just has to be a solution to this. Every time I call ShellExecute to open an external file (be it a document, executable or a URL) this causes a very long lockup in my program before ShellExecute spawns the new process and returns. Does anyone know how to sol...
It sounds like you are encountering a delay when calling `ShellExecute`, which is not uncommon in some scenarios, particularly if the external file type requires some time to be processed before it can be opened. To mitigate this issue, you can consider a few strategies: ### 1. Use `ShellExecuteEx` instead of `ShellEx...
25,928
[ { "from": "human", "value": "This is something that's been bothering me a while and there just has to be a solution to this. Every time I call ShellExecute to open an external file (be it a document, executable or a URL) this causes a very long lockup in my program before ShellExecute spawns the new process...
I am attempting to use Ant's XMLValidate task to validate an XML document against a DTD. The problem is not that it doesn't work, but that it works too well. My DTD contains an xref element with an "@linkend" attribute of type IDREF. Most of these reference IDs outside of the current document. Because of this, my b...
When using the Ant `XMLValidate` task for validating XML against a DTD, it’s common to encounter issues with references such as IDREF attributes pointing to IDs not defined in the document. Unfortunately, the `xmlvalidate` task does not provide a built-in way to ignore such IDREF-related validation errors directly. Th...
14,640
[ { "from": "human", "value": "I am attempting to use Ant's XMLValidate task to validate an XML document against a DTD. The problem is not that it doesn't work, but that it works too well. My DTD contains an xref element with an \"@linkend\" attribute of type IDREF. Most of these reference IDs outside of t...
Does anyone know how to iterate over a generic list if the type of that list isn't known until runtime? For example, assume obj1 is passed into a function as an Object: Dim t As Type = obj1.GetType If t.IsGenericType Then Dim typeParameters() As Type = t.GetGenericArguments() Dim typeParam As Type = typeParamet...
To iterate over a generic list when the type is not known until runtime, you can use reflection in VB.NET. Given that `obj1` is of type `Object`, you first need to ensure it is treated as a generic type that implements `IEnumerable` (or `ICollection` to access the count). Here’s a simple example of how you can achiev...
29,380
[ { "from": "human", "value": "Does anyone know how to iterate over a generic list if the type of that list isn't known until runtime?\nFor example, assume obj1 is passed into a function as an Object:\nDim t As Type = obj1.GetType\nIf t.IsGenericType Then\n Dim typeParameters() As Type = t.GetGenericArgume...
I'm looking at the following code snippet: my @ret = <someMethod> return (undef) if( $DB_ERROR ); return (undef) unless ($#ret >= 0); Does $# just give you a count of elements in a array?
In Perl, the special variable `$#array` gives you the index of the last element in the array `@array`. Since array indices in Perl start from 0, if the array is empty, `$#array` will be `-1`. Therefore, you can use `$#array` to determine whether the array has elements. In the context of your code snippet: ```perl my ...
29,032
[ { "from": "human", "value": "I'm looking at the following code snippet:\nmy @ret = <someMethod>\nreturn (undef) if( $DB_ERROR );\nreturn (undef) unless ($#ret >= 0);\n\nDoes $# just give you a count of elements in a array?\n" }, { "from": "gpt", "value": "In Perl, the special variable `$#array` ...
I have a mission-critical real-time data application that uses a TCP connection between the client and server. In some cases, the connection periodically dies (SocketException). No problem - just reconnect and move on. However, the customers aren't thrilled with these intermittent drops in connectivity. I'd like to kno...
To diagnose connectivity issues in a TCP connection between a client and server, and to provide insights into the connection's health, you can consider the following metrics and approaches: ### 1. TCP Connection Metrics TCP has built-in mechanisms that you can leverage to understand connection health: - **Round Trip ...
26,766
[ { "from": "human", "value": "I have a mission-critical real-time data application that uses a TCP connection between the client and server. In some cases, the connection periodically dies (SocketException). No problem - just reconnect and move on. However, the customers aren't thrilled with these intermitte...
Why would a stored procedure that returns a table with 9 columns, 89 rows using this code take 60 seconds to execute (.NET 1.1) when it takes < 1 second to run in SQL Server Management Studio? It's being run on the local machine so little/no network latency, fast dev machine Dim command As SqlCommand = New SqlCommand(...
There are several factors that can cause a stored procedure to run significantly slower when called from a .NET application compared to running it directly in SQL Server Management Studio (SSMS). Here are some possible reasons and suggestions for troubleshooting: 1. **Parameter Sniffing**: When a stored procedure is e...
26,678
[ { "from": "human", "value": "Why would a stored procedure that returns a table with 9 columns, 89 rows using this code take 60 seconds to execute (.NET 1.1) when it takes < 1 second to run in SQL Server Management Studio? It's being run on the local machine so little/no network latency, fast dev machine\nD...
Is there a way to declare a variable as Nullable in c#? struct MyStruct { int _yer, _ner; public MyStruct() { _yer = Nullable<int>; //This does not work. _ner = 0; } }
In C#, to declare a variable as nullable, you should use the nullable type syntax with a question mark (`?`). However, your example appears to be trying to assign a `Nullable<int>` type incorrectly. Instead, you should declare the variable directly as a nullable type. Here's how you can modify your struct: ```csharp s...
31,105
[ { "from": "human", "value": "Is there a way to declare a variable as Nullable in c#?\nstruct MyStruct { \n int _yer, _ner;\n\n public MyStruct() {\n\n _yer = Nullable<int>; //This does not work.\n _ner = 0;\n }\n}\n\n" }, { "from": "gpt", "value": "In C#, to declare...
I'm writing a small GUI app that contains some "editor" functionality, and something that I'd like to let users open a few sample text files to test things out quickly. The easiest way of doing this would be to package a separate zip with the appropriate sample files, and have them open them manually; I'd like to make ...
For your GUI application, if you want to provide users the ability to load sample text files conveniently without requiring them to manually unzip a package, you have a few good options: ### Option 1: Use Embedded Resources You can include the sample text files as embedded resources in your application. This way, use...
29,375
[ { "from": "human", "value": "I'm writing a small GUI app that contains some \"editor\" functionality, and something that I'd like to let users open a few sample text files to test things out quickly. The easiest way of doing this would be to package a separate zip with the appropriate sample files, and have...
I really like Entity Framework, but there are some key pieces that are a challenge to me. Can anyone tell me how to filter an EntityDataSource on an Association column? EF hides the FK values and instead has an Association property. Given an Entity, Person, with a PersonType association, I would have expected something...
When using Entity Framework with an `EntityDataSource` in ASP.NET, filtering by navigation properties (like your association with `PersonType`) can be a bit tricky. Your approach is close, but you might need to adjust how you structure your filter expression and ensure the navigation property is accessed properly. Her...
28,949
[ { "from": "human", "value": "I really like Entity Framework, but there are some key pieces that are a challenge to me. Can anyone tell me how to filter an EntityDataSource on an Association column? EF hides the FK values and instead has an Association property. Given an Entity, Person, with a PersonType ass...
We had a performance issue with DataGridViews where the redraw was horridly slow and found the solution Here to create a derived type and enable double buffering on the control. (Derived type is necessary since the DoubleBuffered property is protected) It doesn't seem like there's any drawback to having the DoubleBuffe...
Creating a derived class from `DataGridView` and enabling double buffering is a common approach to improve performance when rendering complex or large datasets. By default, `DataGridView` does not use double buffering, which can lead to flickering and slow redraws, especially when the control is resized or updated freq...
26,471
[ { "from": "human", "value": "We had a performance issue with DataGridViews where the redraw was horridly slow and found the solution Here to create a derived type and enable double buffering on the control.\n(Derived type is necessary since the DoubleBuffered property is protected)\nIt doesn't seem like the...
How would you go about creating a random alpha-numeric string that matches a certain regular expression? This is specifically for creating initial passwords that fulfill regular password requirements.
Creating a random alphanumeric string that matches a specific regular expression (regex) involves a few steps. Here’s a general approach you can take: ### Step-by-Step Guide 1. **Define Your Regular Expression**: First, identify the specific rules your password must adhere to. For example: - Must be at least 8 cha...
24,780
[ { "from": "human", "value": "How would you go about creating a random alpha-numeric string that matches a certain regular expression?\nThis is specifically for creating initial passwords that fulfill regular password requirements.\n" }, { "from": "gpt", "value": "Creating a random alphanumeric s...
I'm writing a test for a file parser class. The parse method receives a file name as parameter, and must open it in order to parse it ( duh ). I've writen a test file, that I put into the test/resources directory inside my project directory, and would like to pass this file to test my parse. Since this project is in CV...
To use the `${basedir}` property in your Java test for reading a test file, you'll have to retrieve the base directory programmatically, rather than using it directly in the test code as Maven properties are not available in Java runtime environment. A common approach in Java is to utilize the `Paths` and `Files` cla...
29,795
[ { "from": "human", "value": "I'm writing a test for a file parser class. The parse method receives a file name as parameter, and must open it in order to parse it ( duh ).\nI've writen a test file, that I put into the test/resources directory inside my project directory, and would like to pass this file to ...
I am interested in using Xaml with expression blend for creating user interfaces in an application. However, because of the limitations of the target architecture, I cannot use WPF or C#. So, what I am interested in is in any examples / existing projects or advice from anyone who has experiance of this technology on th...
Using XAML in a "pure" form outside of WPF and without C# backing classes can present some challenges, but it is definitely feasible. Here are the answers to your questions based on the information available up until October 2023: ### 1) Is it possible to use Blend + XAML without the WPF elements, or without C# backin...
24,389
[ { "from": "human", "value": "I am interested in using Xaml with expression blend for creating user interfaces in an application. However, because of the limitations of the target architecture, I cannot use WPF or C#.\nSo, what I am interested in is in any examples / existing projects or advice from anyone w...
Each year at Thanksgiving, my family has drawn names out of a hat to determine who they'll be a "Secret Santa" for the Christmas gift exchange. It's important to our family culture that no one else in the family knows who each other got in order to keep it interesting. The only rule to the selection is that you can't p...
Your proposed protocol is a creative way to ensure some level of secrecy while accommodating the specific needs of your family. However, if you're looking for a more straightforward approach that enhances secrecy and minimizes the risk of someone inadvertently learning their Secret Santa's identity, consider the follow...
28,267
[ { "from": "human", "value": "Each year at Thanksgiving, my family has drawn names out of a hat to determine who they'll be a \"Secret Santa\" for the Christmas gift exchange. It's important to our family culture that no one else in the family knows who each other got in order to keep it interesting. The onl...
For the past 2 years-(ish) I've been using Maven2 for my build/continuous integration solution. I used Ant a bit before that but really didn't get a lot of experience with it. Now I've taken a new job and the team I'm on now uses Ant. What I'm wondering about is this: In Maven we had directory conventions for seper...
Ant does not enforce directory structure conventions like Maven does. However, it's flexible and allows you to define your own directory structure for your projects. That means you can definitely adopt a similar convention to Maven’s `src/main/java` and `src/test/java` layout if that works for your team. While Ant doe...
26,714
[ { "from": "human", "value": "For the past 2 years-(ish) I've been using Maven2 for my build/continuous integration solution. I used Ant a bit before that but really didn't get a lot of experience with it. Now I've taken a new job and the team I'm on now uses Ant. \nWhat I'm wondering about is this:\nIn M...
I have the following two models: class Activity(models.Model): name = models.CharField(max_length=50, help_text='Some help.') entity = models.ForeignKey(CancellationEntity) ... class Cancellation(models.Model): activity = models.ForeignKey(Activity) date = models.DateField(default=datetime.now().d...
To make the `Activity` model aware when a `Cancellation` related to it is saved (either inserted or updated), you can leverage Django's signals, specifically the `post_save` signal. This signal allows you to execute a function after a model's `save()` method is called, making it an excellent way to keep track of change...
23,800
[ { "from": "human", "value": "I have the following two models:\nclass Activity(models.Model):\n name = models.CharField(max_length=50, help_text='Some help.')\n entity = models.ForeignKey(CancellationEntity)\n ...\n\n\nclass Cancellation(models.Model):\n activity = models.ForeignKey(Activity)\n ...
In salesforce.com, I have a workflow that triggers when a new case comment is added via the self-service portal. The workflow rule updates the Case.Status field, which fires another workflow rule on the Case object itself. The end result is an email to the case owner that is notified that a new case comment has been ...
In Salesforce, email templates that are triggered by workflow rules can only access fields from the object that the workflow rule is based on (in your case, the Case object). Unfortunately, you can't directly access related records (like the Case Comment) from the email template, as you would with a formula or a direct...
28,903
[ { "from": "human", "value": "In salesforce.com, I have a workflow that triggers when a new case comment is added via the self-service portal. The workflow rule updates the Case.Status field, which fires another workflow rule on the Case object itself. The end result is an email to the case owner that is n...
As part of our build process we run a database update script as we deploy code to 4 different environments. Further, since the same query will get added to until we drop a release into production it has to be able to run multiple times on a given database. Like this: IF NOT EXISTS (SELECT * FROM sys.tables WHERE objec...
To check for the existence of a schema before creating it in your database update script, you can use a similar approach to how you're checking for the existence of a table. You can query the `sys.schemas` system catalog view. Here is an example of how you can do that: ```sql IF NOT EXISTS (SELECT * FROM sys.schemas W...
32,693
[ { "from": "human", "value": "As part of our build process we run a database update script as we deploy code to 4 different environments. Further, since the same query will get added to until we drop a release into production it has to be able to run multiple times on a given database. Like this:\nIF NOT EX...
I know SQL Injection is one... what are the others...
SQL Injection is a well-known type of security vulnerability, but there are many other types of web application vulnerabilities and attack vectors. Here are some of the most common ones: 1. **Cross-Site Scripting (XSS)**: This occurs when an attacker injects malicious scripts into web pages viewed by other users, allo...
29,359
[ { "from": "human", "value": "I know SQL Injection is one... what are the others...\n" }, { "from": "gpt", "value": "SQL Injection is a well-known type of security vulnerability, but there are many other types of web application vulnerabilities and attack vectors. Here are some of the most common...
In my website, users have the possibility to store links. During typing the internet address into the designated field I would like to display a suggest/autocomplete box similar to Google Suggest or the Chrome Omnibar. Example: User is typing as URL: http://www.sta Suggestions which would be displayed: http://www.stap...
To implement an autocomplete suggestion feature for URL inputs on your website, you can leverage existing libraries and APIs. Here's a general approach using JavaScript, along with some libraries you might find useful: ### Step 1: Use an Autocomplete Library You can use libraries like **jQuery UI Autocomplete** or **...
27,042
[ { "from": "human", "value": "In my website, users have the possibility to store links.\nDuring typing the internet address into the designated field I would like to display a suggest/autocomplete box similar to Google Suggest or the Chrome Omnibar.\nExample:\nUser is typing as URL:\nhttp://www.sta\n\nSugges...
I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance. What is the general practice for this? Real-world-scenario - I have several HTML pages that need client-side form validation. For this I use a jQuery plugin that I includ...
When deciding whether to include scripts inline, in external files, or in a combination of both, consider both performance and maintainability. Here are the general practices, particularly in the context of your real-world scenario with client-side form validation using a jQuery plugin. ### General Best Practices 1. ...
14,094
[ { "from": "human", "value": "I would like to know when I should include external scripts or write them inline with the html code, in terms of performance and ease of maintenance.\nWhat is the general practice for this?\nReal-world-scenario - I have several HTML pages that need client-side form validation. F...
I want to use jQuery with asp.net webfoms. Do I need to get a special toolkit so the .net controls spit out friendly Control ID's? Reason being, I don't want to write javascript referencing my html ID's like control_123_asdfcontrol_234. Has this been addressed in version 3.5? (I remember reading you have to get some ...
When using ASP.NET Web Forms, the framework automatically generates unique IDs for server controls to ensure that each control has a unique identifier on the page. This can lead to complex IDs like `ctl00_ContentPlaceHolder1_TextBox1`, which can make it challenging to work with JavaScript and jQuery, especially if you ...
27,724
[ { "from": "human", "value": "I want to use jQuery with asp.net webfoms. Do I need to get a special toolkit so the .net controls spit out friendly Control ID's?\nReason being, I don't want to write javascript referencing my html ID's like control_123_asdfcontrol_234.\nHas this been addressed in version 3.5?...
Found this article and a similar question was aked on stackoverflow.com as well http://www.codeproject.com/KB/miscctrl/AppControl.aspx I figured a way to communicate between the control and the exe that it is hosting would be to use the link below http://boycook.wordpress.com/2008/07/29/c-win32-messaging-with-sendmessa...
If you're trying to communicate between a host application and a control using `SendMessage` or `PostMessage`, there are a few things you should check and ensure: 1. **Correct Window Handle**: Make sure you are using the correct window handle (HWND) for the destination window (the control or application you are trying...
27,386
[ { "from": "human", "value": "Found this article and a similar question was aked on stackoverflow.com as well\nhttp://www.codeproject.com/KB/miscctrl/AppControl.aspx\nI figured a way to communicate between the control and the exe that it is hosting would be to use the link below\nhttp://boycook.wordpress.com...
The app uses DLLImport to call a legacy unmanaged dll. Let's call this dll Unmanaged.dll for the sake of this question. Unmanaged.dll has dependencies on 5 other legacy dll's. All of the legacy dll's are placed in the WebApp/bin/ directory of my ASP.NET application. When IIS is running in 5.0 isolation mode, the app wo...
It looks like you're facing a complex issue with the interoperation between your ASP.NET application and the legacy unmanaged DLLs. Given the information provided, here are some possible areas to investigate and actions to take: ### 1. **Stack Overflow Diagnosis** The mini-dump you provided indicates a potential stack...
20,394
[ { "from": "human", "value": "The app uses DLLImport to call a legacy unmanaged dll. Let's call this dll Unmanaged.dll for the sake of this question. Unmanaged.dll has dependencies on 5 other legacy dll's. All of the legacy dll's are placed in the WebApp/bin/ directory of my ASP.NET application.\nWhen IIS is...
How many of you already used the Prana Framework for AS3 (Flex/Flash) or heard about it? I have found it very useful but there doesn't seem to be a lot of developers using it... The link is PranaFramework
The Prana Framework for AS3 is indeed a lesser-known framework in the Flex/Flash community. It was designed to provide a clean architecture for developing applications using ActionScript 3, offering features like dependency injection and an MVC pattern that can help structure your code better. Many developers in the ...
32,491
[ { "from": "human", "value": "How many of you already used the Prana Framework for AS3 (Flex/Flash) or heard about it?\nI have found it very useful but there doesn't seem to be a lot of developers using it...\nThe link is PranaFramework\n" }, { "from": "gpt", "value": "The Prana Framework for AS3...
You used to be able to get the package a Delphi component was installed under from the palette. That functionality doesn't seem to be in the lastest versions, though. How can I find which package a component belongs to under D2007 or D2009?
In Delphi 2007 and Delphi 2009, you can find out which package a component belongs to through a couple of methods, even though the direct functionality to see the package from the component palette may not be present. Here are a few ways to identify the package: ### Method 1: Using the Component Inspector 1. **Place t...
28,752
[ { "from": "human", "value": "You used to be able to get the package a Delphi component was installed under from the palette. That functionality doesn't seem to be in the lastest versions, though. How can I find which package a component belongs to under D2007 or D2009?\n" }, { "from": "gpt", "v...
What is the exact use of an Abstract class? Is not possible to do the same things in an ordinary class as it is an an abstract class?
An abstract class is a special type of class in object-oriented programming that serves as a blueprint for other classes. While it is true that you can achieve many of the same outcomes using ordinary classes, abstract classes offer several advantages and specific uses that can enhance your design and implementation. H...
26,930
[ { "from": "human", "value": "What is the exact use of an Abstract class? Is not possible to do the same things in an ordinary class as it is an an abstract class? \n" }, { "from": "gpt", "value": "An abstract class is a special type of class in object-oriented programming that serves as a bluep...
In my Direct3D application, the camera can be moved using the mouse or arrow keys. But if I hard code (0,1,0) as the up direction vector in LookAtLH, the frame goes blank at some orientations of the camera. I just learned the hard way that when looking along the Y-axis, (0,1,0) no longer works as the Up direction (seem...
Yes, you are correct that hard-coding the up direction as `(0, 1, 0)` in your `LookAtLH` function can lead to issues, especially when the camera orientation approaches a situation where the forward vector aligns with the up vector. In those cases, you create a degenerate transformation that cannot be resolved, resultin...
26,963
[ { "from": "human", "value": "In my Direct3D application, the camera can be moved using the mouse or arrow keys. But if I hard code (0,1,0) as the up direction vector in LookAtLH, the frame goes blank at some orientations of the camera.\nI just learned the hard way that when looking along the Y-axis, (0,1,0)...
I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..). 1 - Via Message map: BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd) ... ON_WM_SIZE() .. END_MESSAGE_MAP() 2 - Via afx_message: afx_msg type OnSize(...); They seem to be used interchangea...
In MFC (Microsoft Foundation Class), the way you handle messages like `WM_SIZE` is typically done through a message map mechanism or by declaring a message handler as a member function of the class. Here's a breakdown of the two methods you've mentioned for handling the `WM_SIZE` message: ### 1. Message Map Approach ...
27,880
[ { "from": "human", "value": "I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..).\n1 - Via Message map:\nBEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)\n...\n ON_WM_SIZE()\n..\nEND_MESSAGE_MAP()\n\n2 - Via afx_message:\nafx_msg ty...
I have been looking at metrics for coupling and also look at DSM. One of the tools I've been using looks at coupling between 'modules' with a module being a unit of distribution (in this case a .net assembly). I feel that I should be more interested in looking at coupling between packages (or namespaces) than with u...
Your instincts about focusing on package or namespace coupling over unit of distribution coupling are well-founded, and many software architects and developers would agree with this perspective. Here's a breakdown of your concerns and some considerations: ### Coupling Between Packages/Namespaces 1. **Abstraction and ...
15,304
[ { "from": "human", "value": "I have been looking at metrics for coupling and also look at DSM. \nOne of the tools I've been using looks at coupling between 'modules' with a module being a unit of distribution (in this case a .net assembly). \nI feel that I should be more interested in looking at coupling b...
I am trying to interpret HttpReferer strings in our server logs. It seems like there is quite a high number of empty values. I am wondering how many of these empty values are due to direct hits from people entering our URL directly into a browser and how many might be due to some kind of blocking utility that prevents ...
Interpreting the `HttpReferer` strings in your server logs can indeed provide valuable insights into how users are accessing your website. However, as you've noticed, a significant number of requests may have empty or missing `Referer` values. Here are some insights to help you understand the reasons behind empty `Refe...
28,012
[ { "from": "human", "value": "I am trying to interpret HttpReferer strings in our server logs. It seems like there is quite a high number of empty values.\nI am wondering how many of these empty values are due to direct hits from people entering our URL directly into a browser and how many might be due to so...
Is it possible via code to programmatically (from .NET for example via SQL query) to ask an Access database if it is corrupt or have tables with corrupt rows in it? //Andy
Yes, it is possible to check if a Microsoft Access database is corrupt and to look for corrupt tables or rows programmatically using .NET. However, directly querying for corruption in the database via SQL isn't feasible, as SQL doesn't provide built-in functions for integrity checks. Instead, you can achieve this by u...
25,657
[ { "from": "human", "value": "Is it possible via code to programmatically (from .NET for example via SQL query) to ask an Access database if it is corrupt or have tables with corrupt rows in it?\n//Andy\n" }, { "from": "gpt", "value": "Yes, it is possible to check if a Microsoft Access database i...
I have a dynamic Facelets page that needs to show information from database when the page loads. At this point in the flow, there have not been any form submissions. Every JSF example I can find only shows a form submission with dynamic results on the next page. Every call I make to our database is currently takes plac...
In JSF (JavaServer Faces), you can load data when the page initially loads by using the `@PostConstruct` annotation. This annotation allows you to specify a method that will be called after the bean's construction but before it's ready to be used in the view. This is ideal for loading data from your database that needs...
26,235
[ { "from": "human", "value": "I have a dynamic Facelets page that needs to show information from database when the page loads. At this point in the flow, there have not been any form submissions. Every JSF example I can find only shows a form submission with dynamic results on the next page.\nEvery call I ma...
Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got into the first function? Example: void format_string(char *fmt, ...); void debug_print(int dbg_lvl, char *fmt, ...) { ...
In C, when you're working with functions that accept a variable number of arguments (variadic functions), you typically use the `stdarg.h` library, which provides the macros needed to access those arguments. To forward all the arguments from one variadic function to another, you need to use the same set of macros (`va_...
25,561
[ { "from": "human", "value": "Say I have a C function which takes a variable number of arguments: How can I call another function which expects a variable number of arguments from inside of it, passing all the arguments that got into the first function?\nExample:\nvoid format_string(char *fmt, ...);\n\nvoid ...
I've encountered lately some opinions saying that Object Oriented design/programming should not always be used. Do you know some use-cases that will not benefit from and should not use Object Oriented design? For example: there are some problems (concerns) that will benefit from AOP.
Yes, there are several use-cases and scenarios where Object-Oriented Programming (OOP) may not be the best fit, and alternatives such as Functional Programming (FP), Procedural Programming, or even Aspect-Oriented Programming (AOP) can be more appropriate. Here are some examples: ### 1. **Simple Scripts and Utilities*...
27,227
[ { "from": "human", "value": "I've encountered lately some opinions saying that Object Oriented design/programming should not always be used.\n\nDo you know some use-cases that will not benefit from and should not use Object Oriented design? \n\n\nFor example: there are some problems (concerns) that will ben...
I am currently looking into using Lucene.NET for powering the search functionality on a web application I am working on. However, the search functionality I am implementing not only needs to do full text searches, but also needs to rank the results by proximity to a specified address. Can Lucene.NET handle this requir...
Lucene.NET is a powerful text search library, and while it excels at full-text search and providing relevance ranking based on text content, it doesn't natively support geographic searching out of the box. However, you can still achieve proximity-based search functionality by integrating some additional logic. Here are...
28,251
[ { "from": "human", "value": "I am currently looking into using Lucene.NET for powering the search functionality on a web application I am working on. However, the search functionality I am implementing not only needs to do full text searches, but also needs to rank the results by proximity to a specified a...
Languages like C and even C# (which technically doesn't have a preprocessor) allow you to write code like: #DEFINE DEBUG ... string returnedStr = this.SomeFoo(); #if DEBUG Debug.WriteLine("returned string =" + returnedStr); #endif This is something I like to use in my code as a form of scaffolding, and I'm wonder...
PHP does not have a built-in preprocessor like C or C# that allows you to conditionally include or exclude blocks of code based on defined directives. However, you can achieve similar functionality using PHP’s built-in functionality, such as constants or environment variables, to toggle debug code on and off. ### Usin...
26,321
[ { "from": "human", "value": "Languages like C and even C# (which technically doesn't have a preprocessor) allow you to write code like:\n#DEFINE DEBUG\n...\n\nstring returnedStr = this.SomeFoo();\n#if DEBUG\n Debug.WriteLine(\"returned string =\" + returnedStr);\n#endif\n\nThis is something I like to use...
I'd like to make sure that a thread is moved to a specific CPU core and can never be moved from it by the scheduler. There's a SetThreadAffinityMask() call but there's no GetThreadAffinityMask(). The reason I need this is because high resolution timers will get messed up if the scheduler moves that thread to another CP...
To ensure that a thread in Windows is moved to a specific CPU core and does not get moved by the scheduler, you can use `SetThreadAffinityMask` to set the thread affinity mask, which specifies the CPU cores that the thread is allowed to run on. While there is no `GetThreadAffinityMask` function, you can use `GetProces...
27,391
[ { "from": "human", "value": "I'd like to make sure that a thread is moved to a specific CPU core and can never be moved from it by the scheduler.\nThere's a SetThreadAffinityMask() call but there's no GetThreadAffinityMask().\nThe reason I need this is because high resolution timers will get messed up if th...
Is there a function in Common Lisp that takes a string as an argument and returns a keyword? Example: (keyword "foo") -> :foo
Yes, in Common Lisp, you can convert a string to a keyword using the `make-keyword` function. This function takes a string as an argument and returns a keyword with the same name. Here’s how you can use it: ```lisp (defun string-to-keyword (str) (make-keyword str)) ``` You can use this function like so: ```lisp (...
32,191
[ { "from": "human", "value": "Is there a function in Common Lisp that takes a string as an argument and returns a keyword?\nExample: (keyword \"foo\") -> :foo\n" }, { "from": "gpt", "value": "Yes, in Common Lisp, you can convert a string to a keyword using the `make-keyword` function. This functi...