instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Using the WCF web programming model one can specify an operation contract like so: [OperationContract] [WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = "SomeRequest?qs1={qs1}&qs2={qs2}")] XElement SomeRequest1(string qs1, string qs2); Now if we had to make a contract that accepts an array of parameters wit...
To define an HTTP service that accepts an array of parameters with the same name while using WCF and the `WebGet` attribute, you cannot use the same query parameter name multiple times in the `UriTemplate` because the query string must have unique names. However, there are alternative approaches to achieve this. ### A...
43,502
[ { "from": "human", "value": "Using the WCF web programming model one can specify an operation contract like so:\n[OperationContract]\n[WebGet(ResponseFormat = WebMessageFormat.Xml, UriTemplate = \"SomeRequest?qs1={qs1}&qs2={qs2}\")]\nXElement SomeRequest1(string qs1, string qs2);\n\nNow if we had to make a ...
I was just fooling around with some Domain Specific Language designs for a new project in C/C++ when I thought up this "odd" solution: define DSL(...) MakeCommand(#__VA_ARGS__\ )->Exec()->GetResults() MyResults results = DSL( for p in people do something ); The nice part is this is cor...
Your idea for using a macro-based Domain Specific Language (DSL) in C/C++ is an interesting approach, especially in how it leverages the preprocessor to create a more readable syntax. There are some benefits and drawbacks to this design, as well as some considerations for others who might look into similar methods. Let...
43,257
[ { "from": "human", "value": "I was just fooling around with some Domain Specific Language designs for a new project in C/C++ when I thought up this \"odd\" solution:\n define DSL(...) MakeCommand(#__VA_ARGS__\\\n )->Exec()->GetResults()\n\n MyResults results = DSL( for p in peop...
Given a bitmap image with some blots of solid color on it, what algorithm would you employ to construct polygons in the same shape as the blots? This can be done in multiple steps: a high-resolution polygon could be later cut down by a best fit algorithm. Bonus points if you can tell me how to cut the resulting polygo...
To convert blots of solid color in a bitmap image into polygons, you can follow a series of steps that combine image processing and computational geometry techniques. Here’s a step-by-step outline of the algorithm: ### Step 1: Preprocess the Image 1. **Convert to Grayscale**: If the image is in color, convert it to gr...
44,211
[ { "from": "human", "value": "Given a bitmap image with some blots of solid color on it, what algorithm would you employ to construct polygons in the same shape as the blots?\nThis can be done in multiple steps: a high-resolution polygon could be later cut down by a best fit algorithm. Bonus points if you c...
Does anyone know how you setup new commands to launch an application from the Start->Run box? ie. you can type "firefox", "winword" or "excel" into the Run box and those applications will open even though they're not in the system path, but others won't. For example, with Firefox, there's no files named firefox.* in an...
To set up new commands to launch applications from the Run dialog in Windows, you have a few options, including modifying the system path, using a specific registry key, or creating a shortcut. Here are the methods you can use: ### Method 1: Adding to the System PATH You can add the directory containing your applicat...
42,764
[ { "from": "human", "value": "Does anyone know how you setup new commands to launch an application from the Start->Run box?\nie. you can type \"firefox\", \"winword\" or \"excel\" into the Run box and those applications will open even though they're not in the system path, but others won't. For example, with...
So I'm having a path issue on OS X Leopard. It seems OS X is adding other paths that I'm not stating and it's messing with my path priority. I only have a .bash_login file, I don't have a .bashrc or a .profile file. My .bash_login file is as such: export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" ...
It looks like your issue stems from the way the `PATH` is being constructed in your environment. On OS X, when you start a new terminal session, several configuration files may be read, and the order in which they are read can affect the resulting `PATH`. Here are some key points and steps you can take to resolve your ...
43,793
[ { "from": "human", "value": "So I'm having a path issue on OS X Leopard. It seems OS X is adding other paths that I'm not stating and it's messing with my path priority. I only have a .bash_login file, I don't have a .bashrc or a .profile file. My .bash_login file is as such:\nexport PATH=\"/usr/local/bin:/...
I'm trying to upload an image to my site through a form, however it's much more efficient to (rather than bog down the database) just store the location of the image in the database. I'm having trouble with my form and really don't know where to go: <?=form_open('bro/submit_new');?> //other form data Image: <input ty...
To efficiently handle the image upload and store its location in the database, you need to adjust your controller code to handle the file upload before inserting any data into the database. Here’s how you can do it: 1. **Upload the Image**: Use the CodeIgniter Upload library to manage the file upload. 2. **Check for S...
43,949
[ { "from": "human", "value": "I'm trying to upload an image to my site through a form, however it's much more efficient to (rather than bog down the database) just store the location of the image in the database.\nI'm having trouble with my form and really don't know where to go:\n<?=form_open('bro/submit_ne...
I have a small application, all in one file. I want to convert this into separate smaller files. How do I know how to separate things? What is the invisible margin that code should be separated at? Also, what's the point of header files? Is it to forward declare methods and classes so I can use them in my code before t...
Refactoring a small application into separate files is a good practice to improve code organization, readability, and maintainability. Here are some guidelines on how to separate code and insights into the purpose of header files: ### Guidelines for Separating Code: 1. **Logical Grouping**: - Separate code into fi...
40,084
[ { "from": "human", "value": "I have a small application, all in one file. I want to convert this into separate smaller files. How do I know how to separate things? What is the invisible margin that code should be separated at?\nAlso, what's the point of header files? Is it to forward declare methods and cla...
I am using Lucene to show search results in a web application.I am also custom paging for showing the same. Search results could vary from 5000 to 10000 or more. Can someone please tell me the best strategy for paging and caching the search results?
When dealing with large search results in a web application using Lucene, effective paging and caching strategies are crucial for optimizing performance and user experience. Here are some recommendations for implementing paging and caching: ### 1. **Efficient Paging Strategies:** - **Use of `from` and `size`:** If ...
44,230
[ { "from": "human", "value": "I am using Lucene to show search results in a web application.I am also custom paging for showing the same.\nSearch results could vary from 5000 to 10000 or more.\nCan someone please tell me the best strategy for paging and caching the search results?\n" }, { "from": "gp...
Improving Web Development Using Virtualization
Improving web development using virtualization can provide numerous benefits, including enhanced collaboration, simplified testing, resource optimization, and an overall more efficient development workflow. Here are several strategies and technologies that can be leveraged for this purpose: ### 1. **Local Development ...
43,731
[ { "from": "human", "value": "Improving Web Development Using Virtualization\n" }, { "from": "gpt", "value": "Improving web development using virtualization can provide numerous benefits, including enhanced collaboration, simplified testing, resource optimization, and an overall more efficient de...
I'm using the Accessibility API to detect when a certain application opens windows, closes windows, when the windows are moved or resized, or made main and/or focused. However the client app seems to move a window to front without an Accessibility API notification being fired. How can my application detect when another...
Detecting when another application programmatically brings a window to the front without triggering standard Accessibility notifications can be a challenge. Here are a few strategies you might consider to work around this limitation on OS X 10.4 and 10.5: 1. **Use a Timer or Polling Mechanism**: Since you're finding t...
44,096
[ { "from": "human", "value": "I'm using the Accessibility API to detect when a certain application opens windows, closes windows, when the windows are moved or resized, or made main and/or focused. However the client app seems to move a window to front without an Accessibility API notification being\nfired.\...
Can anyone guide me in the correct way to build a colored bubble/circle programmatically? I can't use images as I need it to be able to be any color depending on user interaction. My thought was maybe to make a white circle image and then overlay a color on top of it. However I am not sure if this would work, or how to...
You can definitely create a colored bubble or circle programmatically without using images. The approach you take can depend on the programming language and the graphics library or framework you are using. Below, I’ll outline methods to create a colored circle using HTML5 Canvas, Python with Tkinter, and a simple SVG m...
43,381
[ { "from": "human", "value": "Can anyone guide me in the correct way to build a colored bubble/circle programmatically?\nI can't use images as I need it to be able to be any color depending on user interaction.\nMy thought was maybe to make a white circle image and then overlay a color on top of it.\nHowever...
Is there an easy way to parse the user's HTTP_ACCEPT_LANGUAGE and set the locale in PHP? I know the Zend framework has a method to do this, but I'd rather not install the whole framework just to use that one bit of functionality. The PEAR I18Nv2 package is in beta and hasn't been changed for almost three years, so I'd ...
You can indeed parse the `HTTP_ACCEPT_LANGUAGE` header to determine the user's preferred language and set the locale in PHP without relying on a full framework. Here's a simple function that you can use to achieve this: ```php function getPreferredLocale($httpAcceptLanguage, $defaultLocale = 'en') { // Explode the...
42,026
[ { "from": "human", "value": "Is there an easy way to parse the user's HTTP_ACCEPT_LANGUAGE and set the locale in PHP?\nI know the Zend framework has a method to do this, but I'd rather not install the whole framework just to use that one bit of functionality.\nThe PEAR I18Nv2 package is in beta and hasn't b...
I often find myself writing simple for loops to perform an operation to many files, for example: for i in `find . | grep ".xml$"`; do bzip2 $i; done It seems a bit depressing that on my 4-core machine only one core is getting used.. is there an easy way I can add parallelism to my shell scripting? EDIT: To introduce a...
To take advantage of multiple CPU cores and introduce parallelism to your shell scripts, you can use a few different approaches. Here are some of the most common ones: ### 1. GNU Parallel The easiest way to parallelize a command in the shell is to use `GNU Parallel`. This tool allows you to run jobs in parallel, auto...
41,048
[ { "from": "human", "value": "I often find myself writing simple for loops to perform an operation to many files, for example:\nfor i in `find . | grep \".xml$\"`; do bzip2 $i; done\n\nIt seems a bit depressing that on my 4-core machine only one core is getting used.. is there an easy way I can add paralleli...
I'm making a web application and I got the design for it from a sub-contracted design company. The design is pretty nice, I like it, but I've stumbled across one thing I'm not sure how to implement nicely. The thing is - they've redesigned the looks of buttons to match the page style. So now I have two images - button ...
Implementing custom button states across different browsers can indeed be a challenge, especially when dealing with older versions of Internet Explorer (IE). However, there are a few ways you can approach this issue without relying heavily on JavaScript. Here are some options: ### 1. Use `:hover` and `:focus` While `...
43,597
[ { "from": "human", "value": "I'm making a web application and I got the design for it from a sub-contracted design company. The design is pretty nice, I like it, but I've stumbled across one thing I'm not sure how to implement nicely.\nThe thing is - they've redesigned the looks of buttons to match the page...
I write financial applications where I constantly battle the decision to use a double vs using a decimal. All of my math works on numbers with no more than 5 decimal places and are not larger than ~100,000. I have a feeling that all of these can be represented as doubles anyways without rounding error, but have never b...
When deciding between `double` and `decimal` for financial applications, it's important to consider both performance and precision requirements. Let's address your questions one by one. ### 1. Speed Advantage of `double` Over `decimal` `double` is typically faster than `decimal` in operations such as addition, subtra...
44,331
[ { "from": "human", "value": "I write financial applications where I constantly battle the decision to use a double vs using a decimal.\nAll of my math works on numbers with no more than 5 decimal places and are not larger than ~100,000. I have a feeling that all of these can be represented as doubles anyway...
I have a windows forms (.net 3.0) project that won't run on my customer's vista computer due to a DEP error. It runs on my vista machine, and in a clean version of vista sp1 in a virtual machine. I am having trouble tracking down ways to make my program DEP, Data Execution Prevention compatible. I really can't do anyth...
Data Execution Prevention (DEP) is a security feature that helps prevent code execution in certain regions of memory. If your application is causing a DEP violation, it may be due to some native code or unmanaged resources that are not handling memory execution properly. Here are some steps and suggestions to help you ...
43,954
[ { "from": "human", "value": "I have a windows forms (.net 3.0) project that won't run on my customer's vista computer due to a DEP error. It runs on my vista machine, and in a clean version of vista sp1 in a virtual machine. I am having trouble tracking down ways to make my program DEP, Data Execution Preve...
The MS source server technology uses an initialization file named srcsrv.ini. One of the values identifies the source server location(s), e.g., MYSERVER=\\machine\foobar The docs leave much unanswered about this value. To start with, I haven't been able to find the significance of the value name, i.e., what's on the l...
The `srcsrv.ini` file is a configuration file used by the Microsoft Source Server technology, which helps developers and debugging tools retrieve source files from a specified server during debugging sessions. The values in this file allow you to define where source code can be retrieved from when dealing with binaries...
45,573
[ { "from": "human", "value": "The MS source server technology uses an initialization file named srcsrv.ini. One of the values identifies the source server location(s), e.g.,\nMYSERVER=\\\\machine\\foobar\n\nThe docs leave much unanswered about this value. To start with, I haven't been able to find the signif...
I have an application the will load usercontrols dynamically depending on the user. You will see in the example below that I am casting each user control via switch/case statements. Is there a better way to do this? Reflection? (I must be able to add an event handler Bind in each control.) override protected void OnI...
You can simplify your user control loading logic by using reflection, which allows you to dynamically invoke methods and access properties of types without needing explicit type checks in a switch/case statement. In this scenario, you can also leverage the `EventInfo` class to attach events dynamically. Below is an exa...
45,273
[ { "from": "human", "value": "I have an application the will load usercontrols dynamically depending on the user. You will see in the example below that I am casting each user control via switch/case statements. Is there a better way to do this? Reflection? (I must be able to add an event handler Bind in e...
Many of us need to deal with user input, search queries, and situations where the input text can potentially contain profanity or undesirable language. Oftentimes this needs to be filtered out. Where can one find a good list of swear words in various languages and dialects? Are there APIs available to sources that con...
Dealing with user input that contains profanity or undesirable language is a common challenge for many applications, especially those that are community-driven or public-facing. Here's a comprehensive guide to help you address this issue effectively. ### Sources for Profanity Lists 1. **Open Source Lists**: - **Gi...
41,524
[ { "from": "human", "value": "Many of us need to deal with user input, search queries, and situations where the input text can potentially contain profanity or undesirable language. Oftentimes this needs to be filtered out.\nWhere can one find a good list of swear words in various languages and dialects? \nA...
I have a set of classes, each one is a different strategy to do the same work. namespace BigCorp.SuperApp { public class BaseClass { } public class ClassA : BaseClass { } public class ClassB : BaseClass { } } The choice of which strategy to use is configurable. I want to configure only the class name 'Cla...
To achieve the desired configuration while using reflection to instantiate classes based on their names, you can construct the full type name by concatenating the namespace with the class name. This approach allows you to keep the configuration simple by only specifying the class name while still using reflection effec...
43,019
[ { "from": "human", "value": "I have a set of classes, each one is a different strategy to do the same work. \nnamespace BigCorp.SuperApp\n{\n public class BaseClass { }\n public class ClassA : BaseClass { }\n public class ClassB : BaseClass { }\n}\n\nThe choice of which strategy to use is configura...
I have three projects. One is a WCF Services Project, one is a WPF Project, and one is a Microsoft Unit Testing Project. I setup the WCF Services project with a data object that looks like this: [DataContract] public enum Priority { Low, Medium, High } [DataContract] public struct TimeInfo { [DataMem...
It seems like you are encountering a common issue related to WCF service configuration and endpoint communication. Here are a few troubleshooting steps and adjustments you might want to consider to resolve the error "The underlying connection was closed: The connection was closed unexpectedly." ### Steps to Troublesho...
41,410
[ { "from": "human", "value": "I have three projects. One is a WCF Services Project, one is a WPF Project, and one is a Microsoft Unit Testing Project. I setup the WCF Services project with a data object that looks like this:\n[DataContract]\npublic enum Priority\n{\n Low,\n Medium,\n High\n}\n\n[D...
I'm using XPath to locate a node (or something close to it) in a template that has non-well-formed HTML about 10 levels deep. (No I didn't write this HTML...but I've been tasked to dig through it.) I seem to be able to retrieve an XPath to the element in question using the XPartner add-on for Firefox; however it onl...
When dealing with non-well-formed HTML, XPath can indeed struggle, as it requires a well-formed XML structure to operate correctly. However, there are several tools and libraries that can help you parse and work with such HTML content, even when it is messy. Here are a few recommendations: ### 1. **Beautiful Soup (Pyt...
43,185
[ { "from": "human", "value": "I'm using XPath to locate a node (or something close to it) in a template that has non-well-formed HTML about 10 levels deep. (No I didn't write this HTML...but I've been tasked to dig through it.) \nI seem to be able to retrieve an XPath to the element in question using the X...
I am working with a large bunch of sources written in Visual C++. The target is dll library. Linkage time consumes several minutes. How this time can be reduced? Library depends on other dlls and libs, which are in the same solution. The first thing which can be done is to split source into several projects, but it is...
Reducing the linkage time for a large Visual C++ project can be a challenging task, especially when you have a substantial amount of code and dependencies. While splitting the code into several projects is indeed one way to reduce linkage time, it can be time-consuming and may not always be practical. Here are some add...
41,145
[ { "from": "human", "value": "I am working with a large bunch of sources written in Visual C++. The target is dll library. Linkage time consumes several minutes. How this time can be reduced?\nLibrary depends on other dlls and libs, which are in the same solution. \nThe first thing which can be done is to sp...
please help me solve the following issues. When I export a report from SQL reports 2005 the image logos are distorted a bit, and the sheets are locked so further editing and sorting is not possible. When I unlock the the frozen cells, to allow sorting and editing, the whole sheets are scrambled due to merged cells us...
Dealing with issues related to exporting reports from SQL Server Reporting Services (SSRS) can be challenging, especially when it comes to images and merged cells. Here are some possible solutions and explanations for your problems: ### 1. Distorted Images during Export **Solution:** - **Check Image Properties:** Ens...
43,813
[ { "from": "human", "value": "please help me solve the following issues. \n\nWhen I export a report from SQL reports 2005 the image logos are distorted a bit, and the sheets are locked so further editing and sorting is not possible.\nWhen I unlock the the frozen cells, to allow sorting and editing, the whole...
I have a PHP web application which uses a MySQL database for object tagging, in which I've used the tag structure accepted as the answer to this SO question. I'd like to implement a tag hierarchy, where each tag can have a unique parent tag. Searches for a parent tag T would then match all descendants of T (i.e. T, tag...
To implement a tag hierarchy effectively in a MySQL database while keeping the design normalized and minimizing the number of queries required to find descendants, you can consider using the **Nested Set Model** or the **Closure Table Model**. Both approaches allow you to efficiently query for hierarchical data, includ...
38,998
[ { "from": "human", "value": "I have a PHP web application which uses a MySQL database for object tagging, in which I've used the tag structure accepted as the answer to this SO question.\nI'd like to implement a tag hierarchy, where each tag can have a unique parent tag. Searches for a parent tag T would th...
I'm trying to print a RDLC file directly without showing Microsoft Report Viewer, I have followed the MSDN's example but now, every time I call the "Render" method of my instance of LocalReport class it throws the "One or more parameters required to run the report have not been specified." exception. Can anyone tell me...
The "One or more parameters required to run the report have not been specified." exception you are encountering typically indicates that the report you are trying to generate requires additional parameters that were not provided in your call to `SetParameters`. To debug this issue and find out what parameters are requi...
44,050
[ { "from": "human", "value": "I'm trying to print a RDLC file directly without showing Microsoft Report Viewer, I have followed the MSDN's example but now, every time I call the \"Render\" method of my instance of LocalReport class it throws the \"One or more parameters required to run the report have not be...
Rails is now making multi-threaded applications possible, but it doesn't sound like it applies in every situation (for instance, if you're using Mongrel, it doesn't sound like this affects you at all). When can you multi-thread your Rails application? This article gives some more information about multi-threading pitfa...
Multi-threading in Rails has evolved significantly, particularly with the introduction of Rails 5 and later versions. Here’s a breakdown of when you can utilize multi-threading in your Rails application, along with some potential pitfalls to be aware of. ### When to Multi-thread Your Rails Application: 1. **Use of Pu...
43,391
[ { "from": "human", "value": "Rails is now making multi-threaded applications possible, but it doesn't sound like it applies in every situation (for instance, if you're using Mongrel, it doesn't sound like this affects you at all).\nWhen can you multi-thread your Rails application?\nThis article gives some m...
I need some help regarding algorithm for randomness. So Problem is. There are 50 events going to happen in 8 hours duration. Events can happen at random times. Now it means in each second there is a chance of event happening is 50/(8*60*60)= .001736. How can I do this with random generation algorithm? I can get random ...
To achieve a random event generation where you want exactly 50 events to occur in an 8-hour period, using a probability-based approach can lead to unexpected results, especially when you're generating events in a loop and continuously checking a small probability. Instead, a better approach would be to directly control...
43,436
[ { "from": "human", "value": "I need some help regarding algorithm for randomness. So Problem is.\nThere are 50 events going to happen in 8 hours duration. Events can happen at random times.\nNow it means in each second there is a chance of event happening is 50/(8*60*60)= .001736.\nHow can I do this with ra...
I have two entities Foo and Bar with a Many to Many relationship between them. Let's say there is no semantic argument for why Foo might be "responsible" for the many to many relationship, but we arbitrarily decide that Foo is responsible for the relation (i.e., in NHibernate we would mark Bar as Inverse) That's all we...
To properly manage the Many-to-Many relationship between `Foo` and `Bar` while maintaining the integrity of your domain model, you can adopt a pattern that encapsulates the relationship without exposing the manipulation of both ends directly. Since you've decided that `Foo` is responsible for managing the relationship,...
43,757
[ { "from": "human", "value": "I have two entities Foo and Bar with a Many to Many relationship between them.\nLet's say there is no semantic argument for why Foo might be \"responsible\" for the many to many relationship, but we arbitrarily decide that Foo is responsible for the relation (i.e., in NHibernate...
In addition to informing the user, we want to collect information for our debugging purposes. Our system is a niche system for only about 1400 customers, and therefore we are not as well-financed as we would hope, so bugs are more common than we would like. We currently have a window that shows the first line of the ...
It sounds like you have a solid foundation for your error handling and reporting system. To enhance your debugging process and gather more useful data, here are additional suggestions for information to collect and consider including in your error reporting: 1. **User Information**: Capture basic user information (if ...
43,386
[ { "from": "human", "value": "In addition to informing the user, we want to collect information for our debugging purposes. Our system is a niche system for only about 1400 customers, and therefore we are not as well-financed as we would hope, so bugs are more common than we would like. We currently have a...
I need to automatically copy files from a linux machine to a windows one every day. I'm looking for something simple and secure like scp, rsync, sftp. Unfortunately, I'm at a loss of how to set this up on the Windows machine. Does anyone know how to do this?
To automatically copy files from a Linux machine to a Windows machine every day using secure methods like `scp` or `rsync`, you can set up an SSH server on your Windows machine and then use a cron job on the Linux machine to perform the file transfer. Here’s how you can do it step by step: ### Step 1: Set Up an SSH Se...
40,405
[ { "from": "human", "value": "I need to automatically copy files from a linux machine to a windows one every day. \nI'm looking for something simple and secure like scp, rsync, sftp. Unfortunately, I'm at a loss of how to set this up on the Windows machine.\nDoes anyone know how to do this?\n" }, { "...
I have a port that is bind()'d to INADDR_ANY. I am receiving datagrams successfully. After receipt, I need to read the IP header to get the source IP address.
To read the IP header of a received datagram, you'll need to use raw sockets. Standard UDP or TCP sockets only allow you to work with the payload and do not expose the IP header. However, with raw sockets, you can capture the entire IP packet, including the headers. Here’s a step-by-step guide on how to do this in C: ...
43,375
[ { "from": "human", "value": "I have a port that is bind()'d to INADDR_ANY. I am receiving datagrams successfully. After receipt, I need to read the IP header to get the source IP address.\n" }, { "from": "gpt", "value": "To read the IP header of a received datagram, you'll need to use raw sock...
I am looking at depency injection, I can see the benefits but I am having problems with the syntax it creates. I have this example public class BusinessProducts { IDataContext _dx; BusinessProducts(IDataContext dx) { _dx = dx; } public List<Product> GetProducts() { return dx.GetProducts();...
You're encountering a common issue with dependency injection (DI) in object-oriented design. It's great that you're recognizing the benefits of DI, but you also want to maintain readability and ease of use in your code. Here are several approaches you might consider: ### 1. **Service Locator Pattern** The Service Loca...
43,871
[ { "from": "human", "value": "I am looking at depency injection, I can see the benefits but I am having problems with the syntax it creates. I have this example\npublic class BusinessProducts\n{\n IDataContext _dx;\n\n BusinessProducts(IDataContext dx)\n {\n _dx = dx;\n }\n\n public List<Produ...
I am working on a background program that will be running for a long time, and I have a external logging program (SmartInspect) that I want to feed with some values periodically, to monitor it in realtime when debugging. I know I can simply fire up multiple programs, like the Task Manager, or IARSN TaskInfo, but I'd li...
To monitor CPU usage in a single-threaded application on Windows or Linux, you can use the following techniques: ### For Windows: 1. **Performance Counters**: You can use the `PerformanceCounter` class in .NET to get the CPU usage of your application. This will give you the CPU usage as a percentage. Here's a simp...
43,270
[ { "from": "human", "value": "I am working on a background program that will be running for a long time, and I have a external logging program (SmartInspect) that I want to feed with some values periodically, to monitor it in realtime when debugging.\nI know I can simply fire up multiple programs, like the T...
I was really looking at the differences between pass by value and how Java allocates objects and what java does to put objects on the stack. Is there anyway to access objects allocated on the heap? What mechanisms does java enforce to guarantee that the right method can access the right data off the heap? It seems lik...
In Java, understanding how objects are managed with respect to memory (stack vs. heap), as well as the access control mechanisms, is crucial to grasping the language's design principles. ### Java Memory Management 1. **Heap vs. Stack**: - **Heap**: This is where all Java objects are allocated. When you create an o...
38,671
[ { "from": "human", "value": "I was really looking at the differences between pass by value and how Java allocates objects and what java does to put objects on the stack.\nIs there anyway to access objects allocated on the heap? What mechanisms does java enforce to guarantee that the right method can access...
I'm opening a new browser window from my site for some of the members. However, some may later close it, or it might have initially failed to open. Is there a snippet of fairly plain Javascript that can be run on each page to confirm if another browser window is open, and if not, to provide a link to re-open it? [clari...
To achieve what you're looking for, you can store a reference to the opened window in the `localStorage` or `sessionStorage`. You can then periodically check if that window is still open by trying to access its properties. If the window has been closed, you can provide a link to reopen it. Here’s a simple implementati...
43,346
[ { "from": "human", "value": "I'm opening a new browser window from my site for some of the members. However, some may later close it, or it might have initially failed to open.\nIs there a snippet of fairly plain Javascript that can be run on each page to confirm if another browser window is open, and if no...
I'm creating a simple API that creates typed classes based on JSON data that has a mandatory 'type' field defined in it. It uses this string to define a new type, add the fields in the JSON object, instantiate it, and then populate the fields on the instance. What I want to be able to do is allow for these types to be...
To implement your requirement of checking if a type by a given name already exists and recycling it if it does, you can use a dictionary to keep track of the dynamically created classes. Here’s an example of how to modify your code to achieve this: ```python # A dictionary to hold the dynamically created classes type_...
46,429
[ { "from": "human", "value": "I'm creating a simple API that creates typed classes based on JSON data that has a mandatory 'type' field defined in it. It uses this string to define a new type, add the fields in the JSON object, instantiate it, and then populate the fields on the instance.\nWhat I want to be...
I want to use JavaScript to control an embedded Windows Media Player, as well as access any properties that the player exposes. I've found a few hacky examples online, but nothing concrete. I really need access to play, pause, stop, seek, fullscreen, etc. I'd also like to have access to any events the player happens t...
To control an embedded Windows Media Player (WMP) using JavaScript, you can use the ActiveX control that allows interaction with the player through scripting. Below is a general guide on how to achieve this, along with some code snippets. ### Steps to Embed Windows Media Player 1. **Embed the Windows Media Player Con...
43,285
[ { "from": "human", "value": "I want to use JavaScript to control an embedded Windows Media Player, as well as access any properties that the player exposes. I've found a few hacky examples online, but nothing concrete. \nI really need access to play, pause, stop, seek, fullscreen, etc. I'd also like to have...
I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. How should I go about learning to use the Windows API with Python?
Learning to use the Windows API with Python can be a rewarding experience, especially if you're interested in building applications that take advantage of Windows-specific features. Here's a structured approach to help you get started: ### 1. Understand the Basics of the Windows API Before diving into Python, it's us...
43,579
[ { "from": "human", "value": "I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. How should I go about learning to use the Windows API with Python?\n" }, { "from": "gpt", "value": "Learning to use the Wi...
Has anyone gotten the jquery plugin jeditable to run properly in a Rails applications. If so, could you share some hints on how to set it up? I'm having some trouble with creating the "submit-url". IIRC, you cannot simply call ruby code from within javascript (please let me be wrong:-). Do you mean RJS??? Isn't that l...
You can definitely use the jEditable plugin with a Rails application, and it's a common challenge to dynamically set the submit URL based on your RESTful routes. Here are the steps and tips to get jEditable working in a Rails app using jQuery: ### 1. Set Up jEditable First, make sure you have included jQuery and jEdi...
43,145
[ { "from": "human", "value": "Has anyone gotten the jquery plugin jeditable to run properly in a Rails applications. If so, could you share some hints on how to set it up? I'm having some trouble with creating the \"submit-url\".\n\nIIRC, you cannot simply call ruby code from within javascript (please let me...
I had a .NET 1.1 project, which I built in NAnt using the following snippet: <property name="Refs.dir" value="Refs" readonly="false"/> <property name="OAIDLLs.dir" value="OAI\bin\ServerDebug"/> <solution solutionfile="OAI\CC.OAI.sln" configuration="ServerDebug" outputdir="${OAIDLLs.dir}"> <assemblyfold...
When migrating from NAnt to MSBuild, particularly with respect to managing assembly dependencies, the concept of "assembly folders" in NAnt does not directly translate to a specific MSBuild concept. Instead, you typically manage dependencies through the project file or by configuring how MSBuild resolves references. T...
46,208
[ { "from": "human", "value": "I had a .NET 1.1 project, which I built in NAnt using the following snippet:\n<property name=\"Refs.dir\" value=\"Refs\" readonly=\"false\"/>\n<property name=\"OAIDLLs.dir\" value=\"OAI\\bin\\ServerDebug\"/>\n\n<solution \n solutionfile=\"OAI\\CC.OAI.sln\" \n configuration=\...
I want to make a page so I can select filters in a "jquery popup", but I don't know how to receive the results. Suppose I have a page with a ListView, and I want to select filters for it (perhaps with multiple selection from a list), so I make a different ASPX and open it using jquery (actually jqModal) via ajax, the u...
To accomplish your goal of filtering a ListView using a jQuery popup (like jqModal), you'll need to follow several steps to set up the popup for filter selection, retrieve the selected filters, and then rebind the ListView based on those filters. Below, I’ll outline a simplified version of the process: ### Step 1: Cre...
38,623
[ { "from": "human", "value": "I want to make a page so I can select filters in a \"jquery popup\", but I don't know how to receive the results.\nSuppose I have a page with a ListView, and I want to select filters for it (perhaps with multiple selection from a list), so I make a different ASPX and open it usi...
I'm going to make a space/trading/combat game that is completely procedurally generated. But, I know that storing all of the details of the whole galaxy in memory is unfeasable. As a result, I've been think that I can use a seed to generate a solar system, and from that solar system, you can use jumpgates to travel to ...
Creating a procedurally generated galaxy using a seed-based system is a fantastic idea and can provide a unique experience for each player while ensuring consistency in the generated content. Here’s a high-level approach to achieving this: ### Step 1: Galaxy Structure 1. **Galaxy Seed**: Start with a single seed numb...
42,258
[ { "from": "human", "value": "I'm going to make a space/trading/combat game that is completely procedurally generated. But, I know that storing all of the details of the whole galaxy in memory is unfeasable. As a result, I've been think that I can use a seed to generate a solar system, and from that solar sy...
i am changing my hardware which currently runs Win XP and i am wondering if i should also upgrade my OS to vista. so my question is, what are the most common issues/advantages you find while developing in VS2008 on Vista. with out taking into consideration WPF. should i keep XP where i have no Problems? or what versio...
Upgrading from Windows XP to Windows Vista for development with Visual Studio 2008 (VS2008) has its own set of advantages and disadvantages. Here’s a rundown of some of the common issues and benefits you might encounter while developing in VS2008 on Vista, excluding WPF considerations. ### Advantages of Using Vista: ...
43,842
[ { "from": "human", "value": "i am changing my hardware which currently runs Win XP and i am wondering if i should also upgrade my OS to vista. so my question is, what are the most common issues/advantages you find while developing in VS2008 on Vista. with out taking into consideration WPF. should i keep XP...
I'm looking for a CMS system to manage a simple and small website. The website will be made with pure HTML and some JavaScript (perhaps prototype library). The reason while I'm looking for a CMS system is, because the customer will have the ability to change the content later by him self, and of course he didn't have a...
For a small website built with HTML and JavaScript, you have several options for content management systems (CMS) that are user-friendly and cater to non-technical users. Here are a few recommendations: 1. **Grav**: - **Type**: Flat-file CMS - **Pros**: Easy to install and configure, doesn't require a database. ...
41,849
[ { "from": "human", "value": "I'm looking for a CMS system to manage a simple and small website. The website will be made with pure HTML and some JavaScript (perhaps prototype library).\nThe reason while I'm looking for a CMS system is, because the customer will have the ability to change the content later b...
I want to dynamically create variables with dynamic names for later use in my transform, but to do this I'd need to dynamically generate XSL and then run it in the same script. This is just a rough pseudo code example of what I'm looking for. <xsl:for-each select="//constants/constant" > <xsl:variable > ...
In XSLT, creating dynamic variables with dynamic names is not straightforward, as XSLT is primarily designed to be declarative, not procedural. Variables in XSLT are immutable and cannot be created or named dynamically at runtime. However, you can achieve a similar result by using key/value pairs and `xsl:key` combin...
44,494
[ { "from": "human", "value": "I want to dynamically create variables with dynamic names for later use in my transform, but to do this I'd need to dynamically generate XSL and then run it in the same script.\nThis is just a rough pseudo code example of what I'm looking for.\n <xsl:for-each select=\"//con...
I'm currently using abcPDF 7 to convert HTML to PDF. This is done via an ASPX page where I override the Render method. Doc theDoc = new Doc(); theDoc.SetInfo(0, "License", m_License ); theDoc.HtmlOptions.Paged = true; theDoc.HtmlOptions.Timeout = 1000000; string callUrl = "http:// my app page"; theDoc.AddImageUrl(call...
It looks like you are experiencing an issue where only the first page of your HTML is rendered into the PDF using abcPDF 7, while subsequent pages are not rendered correctly. This behavior could be caused by a few factors related to how you're handling the document generation and response output. Here are some potentia...
42,613
[ { "from": "human", "value": "I'm currently using abcPDF 7 to convert HTML to PDF. This is done via an ASPX page where I override the Render method.\nDoc theDoc = new Doc();\ntheDoc.SetInfo(0, \"License\", m_License );\ntheDoc.HtmlOptions.Paged = true;\ntheDoc.HtmlOptions.Timeout = 1000000;\n\nstring callUrl...
Are there any known issues with canceling HttpWebRequest HTTP requests? We find that when we cancel 4-5 requests, the next request hangs indefinitely. If there are no known problems with this, then I'm probably doing something wrong... where is a good resource example that shows how this works (a complete solution, not...
When canceling `HttpWebRequest` HTTP requests in .NET, there are a few considerations and common issues that developers may encounter. Here are some potential problems, best practices, and resources to ensure proper handling of HTTP requests, especially when canceling multiple requests. ### Common Issues with Cancelin...
41,508
[ { "from": "human", "value": "Are there any known issues with canceling HttpWebRequest HTTP requests? We find that when we cancel 4-5 requests, the next request hangs indefinitely.\nIf there are no known problems with this, then I'm probably doing something wrong... where is a good resource example that show...
I am adventuring into some AOP and it seems with .NET PostSharp is the way to go. I want to do some simple logging to the db when an exception occurs. However I am finding it difficult to find any real solid examples of using PostSharp beyond the basics. I tried the following: [Serializable] public sealed class LogExc...
It looks like you are on the right track with creating a custom aspect for logging exceptions using PostSharp. The error you are encountering is due to a missing attribute that specifies how your aspect can be applied. In PostSharp, you need to use the `MulticastAttributeUsage` attribute to define the usage of your asp...
44,664
[ { "from": "human", "value": "I am adventuring into some AOP and it seems with .NET PostSharp is the way to go. \nI want to do some simple logging to the db when an exception occurs. However I am finding it difficult to find any real solid examples of using PostSharp beyond the basics. I tried the following:...
I have inherited a project that has class libraries written in VB.NET, some of these have ".settings" files and the others have a ".dll.config" file to store connection strings. What is the difference between these 2 methods? EDIT: In what scenarios would I prefer one over the other?
In VB.NET (and .NET in general), configuration management can be handled in different ways depending on the needs of the application. The two methods you mentioned—`.settings` files and `.dll.config` files—have distinct uses and characteristics. ### `.settings` Files 1. **Purpose**: `.settings` files are typically use...
37,501
[ { "from": "human", "value": "I have inherited a project that has class libraries written in VB.NET, some of these have \".settings\" files and the others have a \".dll.config\" file to store connection strings. What is the difference between these 2 methods?\nEDIT: In what scenarios would I prefer one over ...
I have a very simple table and I can happily query it using LINQ To SQL, but when I do any save/updates the GetChangeSet method on my datacontext is always empty. My code is very simple (concatenated code from various classes): public static EntitiesDataContext EntitiesContext { get { return new Entitie...
It looks like you're trying to insert a new `Price` entity into your database using LINQ to SQL, but the `GetChangeSet` method is returning an empty result. The primary reason for this could be related to how you're managing your data context. Here are a few things to consider that could help resolve the issue: 1. **...
42,582
[ { "from": "human", "value": "I have a very simple table and I can happily query it using LINQ To SQL, but when I do any save/updates the GetChangeSet method on my datacontext is always empty.\nMy code is very simple (concatenated code from various classes):\n public static EntitiesDataContext EntitiesCon...
Now, I realise the initial response to this is likely to be "you can't" or "use analytics", but I'll continue in the hope that someone has more insight than that. Google adwords with "autotagging" appends a "gclid" (presumably "google click id") to link that sends you to the advertised site. It appears in the web log s...
The `gclid` (Google Click Identifier) is a unique identifier that Google generates for each click on an ad through Google Ads. It is primarily used for tracking the performance of ads in Google Analytics and other Google marketing tools. However, the exact format and encoding of the `gclid` is proprietary to Google, an...
44,872
[ { "from": "human", "value": "Now, I realise the initial response to this is likely to be \"you can't\" or \"use analytics\", but I'll continue in the hope that someone has more insight than that.\nGoogle adwords with \"autotagging\" appends a \"gclid\" (presumably \"google click id\") to link that sends you...
I was recently asked an interview question on a hypothetical web based booking system and how I would design the database schema to minimize duplication and maximize flexibility. The use case is that a admin would enter the availability of a property into the system. There could be multiple time period set. For example...
Designing a database schema for a web-based booking system involves careful consideration to avoid duplication, maintain flexibility, and support your application's needs. Your simplified schema is a good starting point, but let's elaborate on it to ensure we can effectively manage the requirements. ### Database Schem...
43,734
[ { "from": "human", "value": "I was recently asked an interview question on a hypothetical web based booking system and how I would design the database schema to minimize duplication and maximize flexibility.\nThe use case is that a admin would enter the availability of a property into the system. There coul...
Let me clear what is state information of a project: Any information that have to remembered or written and then retrieved when one resume its work on a project (for example, on the next morning when arrives at work, or at the evening when start to work on the side project). For example, when you open the project/solu...
It sounds like you are looking for a very specific kind of software that combines project management with detailed logging and note-taking capabilities. Here are a few suggestions that might meet your needs, along with their features: ### 1. **Notion** - **Overview**: Notion is a flexible and customizable tool that...
41,658
[ { "from": "human", "value": "Let me clear what is state information of a project:\n\nAny information that have to remembered or written and then retrieved when one resume its work on a project (for example, on the next morning when arrives at work, or at the evening when start to work on the side project).\...
I am working on a program which manipulates images of different sizes. Many of these manipulations read pixel data from an input and write to a separate output (e.g. blur). This is done on a per-pixel basis. Such image mapulations are very stressful on the CPU. I would like to use multithreading to speed things up. ...
To speed up image manipulation using multithreading in C++, you can consider using a lightweight threading library like `std::thread`, which is part of the C++11 standard library and requires no additional dependencies. Below are the answers to your questions, along with a recommended approach for your application: ##...
40,755
[ { "from": "human", "value": "I am working on a program which manipulates images of different sizes. Many of these manipulations read pixel data from an input and write to a separate output (e.g. blur). This is done on a per-pixel basis.\nSuch image mapulations are very stressful on the CPU. I would like ...
I have a variable that I want to generate a few times in the same function, each time with the same set of constraints. Can I set the constraints once and the just gen it many times? That is, instead of this: var a:uint; gen a keeping {it in [100..120];}; // some code that uses a . . . gen a keeping {it in [100..120]...
Yes, you can definitely simplify your code by setting the constraints once and then generating the variable multiple times. The specifics of how to implement this will depend on the programming language or the system you are using, but I will provide a general outline that you can adapt accordingly. ### General Approa...
46,028
[ { "from": "human", "value": "I have a variable that I want to generate a few times in the same function, each time with the same set of constraints. Can I set the constraints once and the just gen it many times? That is, instead of this:\nvar a:uint;\ngen a keeping {it in [100..120];};\n// some code that ...
I'm doing some coding in JSP/Java (without any framework, or other strange things) and I get stuck trying to find a way to check if a remote image (by URL) meets some specifications, like some defined height and width. Is there a way to do this in JSP/Java? It's quite easy in PHP, but I can't find the way here ... Than...
To check the dimensions of a remote image in JSP/Java, you can use the `ImageIO` class to read the image directly from the URL. You can then obtain the width and height from the image object. Below is a step-by-step guide on how to achieve this. ### Step 1: Import Required Classes You need to import the necessary cla...
43,073
[ { "from": "human", "value": "I'm doing some coding in JSP/Java (without any framework, or other strange things) and I get stuck trying to find a way to check if a remote image (by URL) meets some specifications, like some defined height and width.\nIs there a way to do this in JSP/Java? It's quite easy in P...
Is there a way to read the properties inside an MSI file? For example, given a MSI file named Testpackage.msi, I need to find productName PackageCode version This I am going to use it with WMI uninstall string objPath = string.Format("Win32_Product.IdentifyingNumber='{0}', Name='{1}', Version='{2}'", "{AC9C1263-2BA8-4...
Yes, you can read the properties inside an MSI file programmatically using various methods. Below are a few options to achieve this, including using Windows Installer APIs and third-party libraries. ### Option 1: Using Windows Installer APIs in C# You can use `Windows Installer` COM interface to access the properties...
42,328
[ { "from": "human", "value": "Is there a way to read the properties inside an MSI file?\nFor example, given a MSI file named Testpackage.msi, I need to find\nproductName\nPackageCode\nversion\n\nThis I am going to use it with WMI uninstall\nstring objPath = string.Format(\"Win32_Product.IdentifyingNumber='{0...
Rails' ActiveSupport module extends the builtin ruby Time class with a number of methods. Notably, there is the to_formatted_s method, which lets you write Time.now.to_formatted_s(:db) to get a string in Database format, rather than having to write ugly strftime format-strings everywhere. My question is, is there a way...
Rails does not provide a built-in `parse_formatted_s` method for parsing date strings back into `Time` objects directly using the format symbols like `:db`. However, you can easily implement this functionality yourself. The format used by `:db` in Rails corresponds to the ISO 8601 format, which looks like `YYYY-MM-DD ...
43,444
[ { "from": "human", "value": "Rails' ActiveSupport module extends the builtin ruby Time class with a number of methods.\nNotably, there is the to_formatted_s method, which lets you write Time.now.to_formatted_s(:db) to get a string in Database format, rather than having to write ugly strftime format-strings ...
I'm looking for a method that can round a number up to the nearest multiple of another. This is similar Quantization. Eg. If I want to round 81 up to the nearest multiple of 20, it should return 100. Is there a method built-in method in the .NET framework I can use for this? The reason I'm asking for a built-in metho...
In .NET, there isn't a built-in method specifically designed to round a number up to the nearest multiple of another number. However, you can easily implement this functionality using a simple calculation. Here’s how you can do it: ```csharp public static int RoundUpToNearestMultiple(int number, int multiple) { ...
47,393
[ { "from": "human", "value": "I'm looking for a method that can round a number up to the nearest multiple of another. This is similar Quantization.\nEg. If I want to round 81 up to the nearest multiple of 20, it should return 100.\nIs there a method built-in method in the .NET framework I can use for this?...
Many products/services we are interact with (including our own) uses XML-over-HTTP or derivatives (like OMA IMPS IM/presence protocol). I am looking for some tool that will "listen" to a traffic and produce client/server stubs for simulation/testing. Thanks.
For your needs regarding XML-over-HTTP traffic analysis and generating client/server stubs for simulation and testing, you have a few tools at your disposal. Here are some popular options: 1. **Wireshark**: - **Description**: A powerful network protocol analyzer that can capture and analyze the traffic going over y...
42,209
[ { "from": "human", "value": "Many products/services we are interact with (including our own) uses XML-over-HTTP or derivatives (like OMA IMPS IM/presence protocol).\nI am looking for some tool that will \"listen\" to a traffic and produce client/server stubs for simulation/testing.\nThanks. \n" }, { ...
I've been reading through the details of the System libraries set and get methods yet the parameters are usually Strings. Would you consider the use of String as parameters bad practise since the inclusion of enum? A better alternative at minimum might be public final String, No?
The use of `String` parameters in methods is a common practice in Java and many other programming languages, but there are situations where using `String` can be less ideal, particularly when it comes to representing a fixed set of possible values. Here are a few considerations regarding the use of `String` versus `enu...
45,948
[ { "from": "human", "value": "I've been reading through the details of the System libraries set and get methods yet the parameters are usually Strings.\nWould you consider the use of String as parameters bad practise since the inclusion of enum?\nA better alternative at minimum might be public final String, ...
I am using the as3 DataGrid component in a flash project and I want to change the color from black on white to white on black but can't find how to change the colors of the DataGrid control. Can anyone help? This is the flash component, I'm not using flex.
To change the colors of the `DataGrid` component in ActionScript 3 (AS3), you'll need to manipulate its style properties. Since you want to change the background to black and the text color to white, you can do this using the `setStyle` method. Here's how you can do it: 1. Set the background color of the `DataGrid` t...
43,908
[ { "from": "human", "value": "I am using the as3 DataGrid component in a flash project and I want to change the color from black on white to white on black but can't find how to change the colors of the DataGrid control. Can anyone help?\nThis is the flash component, I'm not using flex.\n" }, { "from...
I'm connecting to DBF files using Delphi 2009 ADO components and this connection string: Driver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\mypath; If c:\mypath doesn't exist, and I run the application inside the debugger, my app hangs. No exception is raised. If I run the application without debugging, an ex...
The behavior you're experiencing is not uncommon when working with ADO and DBF files, especially when the directory specified in your connection string does not exist. The difference in behavior between running in the debugger and running the application without debugging can often be attributed to differences in how e...
44,705
[ { "from": "human", "value": "I'm connecting to DBF files using Delphi 2009 ADO components and this connection string:\nDriver={Microsoft dBASE Driver (*.dbf)};DriverID=277;Dbq=c:\\mypath;\n\nIf c:\\mypath doesn't exist, and I run the application inside the debugger, my app hangs. No exception is raised.\nIf...
I have a database that is stuck in single-user mode. I kill the process that obtains the "lock" on the db but when I kill it another one spawns automatically, (using the sa account). This happens even with SQL Server agent disabled. Any ideas?
If your SQL Server database is stuck in single-user mode, and every time you kill the process, it spawns another one, this is likely due to the way SQL Server manages its connections. When a database is in single-user mode, only one user can access it at a time. Here are some steps you can take to resolve this issue: ...
42,089
[ { "from": "human", "value": "I have a database that is stuck in single-user mode. I kill the process that obtains the \"lock\" on the db but when I kill it another one spawns automatically, (using the sa account). This happens even with SQL Server agent disabled. Any ideas? \n" }, { "from": "gpt", ...
back story: I am designing a portfolio website for myself. on its home page, the logo is front and center but on the sub pages the logo is top & right. I thought it would be a nice visual cue (upon clicking a link to a sub page) to use jQuery to animate the movement of the logo from the middle to the corner of the pag...
Yes, you can achieve this by preventing the default action of the link and manually redirecting after the animation completes. Here's how you can do it using jQuery: 1. **Prevent Default Link Behavior**: When a user clicks a link, prevent the default action from occurring immediately. 2. **Animate the Logo**: Start t...
44,523
[ { "from": "human", "value": "back story: I am designing a portfolio website for myself. on its home page, the logo is front and center but on the sub pages the logo is top & right. \nI thought it would be a nice visual cue (upon clicking a link to a sub page) to use jQuery to animate the movement of the log...
What is the origin of the term reflection? It seems more like introspection. Why isn't it called that? Introspection: A looking inward; specifically, the act or process of self-examination. Reflection: the act of reflecting or the state of being reflected. an image; representation; counterpart a fixing of the though...
The term "reflection" has its roots in the Latin word "reflectere," which means "to bend back." This etymology suggests a process of turning back or looking back, which aligns with the idea of careful consideration or contemplation. Over time, "reflection" has evolved in its usage, encompassing both the literal and met...
45,670
[ { "from": "human", "value": "What is the origin of the term reflection? It seems more like introspection. Why isn't it called that?\nIntrospection: A looking inward; specifically, the act or process of self-examination.\nReflection:\n\nthe act of reflecting or the state of being reflected.\nan image; repr...
I've been trying to find a good video that I can show at a "Lunch and Learn" on Agile Development / Scrum. Our organization is primarily Waterfall and most people have never even heard of Agile development let alone have any concrete knowledge of the topic. There are plenty of great resources out there that talk about ...
Finding an engaging and straightforward video that introduces Agile Development and Scrum to a Waterfall-centric audience can indeed be a challenge. However, there are a few resources that cater to beginners without assuming prior knowledge. Here are some video recommendations that might fit your needs: 1. **"What is ...
44,634
[ { "from": "human", "value": "I've been trying to find a good video that I can show at a \"Lunch and Learn\" on Agile Development / Scrum. Our organization is primarily Waterfall and most people have never even heard of Agile development let alone have any concrete knowledge of the topic. There are plenty of...
I'm trying to update something in AS400 from sql server 2000 through openquery like following. UPDATE OPENQUERY(odbcname, 'SELECT * FROM "libname"."filename" WITH NC') SET NBFLAG01=1 WHERE NBFLAG01 <> 1 Here's the error I'm getting. "OLE DB provider 'MSDASQL' reported an error. [OLE/DB provider returned message: In...
The error message you're encountering typically indicates that the OLE DB provider is unable to update the table via the `OPENQUERY` due to the way the query is structured or because of limitations with the data source. Unfortunately, the SQL Server's `OPENQUERY` does not support updates directly in the way you're tryi...
42,488
[ { "from": "human", "value": "I'm trying to update something in AS400 from sql server 2000 through openquery like following. \nUPDATE\nOPENQUERY(odbcname, 'SELECT * FROM \"libname\".\"filename\" WITH NC')\nSET NBFLAG01=1\nWHERE NBFLAG01 <> 1\n\nHere's the error I'm getting.\n\"OLE DB provider 'MSDASQL' repor...
Does SQL Server's (2000) Soundex function work on Asian character sets? I used it in a query and it appears to have not worked properly but I realize that it could be because I don't know how to read Chinese... Furthermore, are there any other languages where the function might have trouble working on? (Russian for exa...
The `SOUNDEX` function in SQL Server, including version 2000, is primarily designed to work with the English alphabet and is based on the way English words are pronounced. This function encodes a string into a four-character code that represents the phonetic pronunciation of the string. Because it is specifically tuned...
46,580
[ { "from": "human", "value": "Does SQL Server's (2000) Soundex function work on Asian character sets? I used it in a query and it appears to have not worked properly but I realize that it could be because I don't know how to read Chinese...\nFurthermore, are there any other languages where the function might...
What's the regex to match a square bracket? I'm using \\] in a pattern in eregi_replace, but it doesn't seem to be able to find a ]...
When using regular expressions, the square brackets `[` and `]` have special meanings. To match them literally, you need to escape them correctly. In many programming languages and contexts, including PHP, if you want to match a closing square bracket `]`, you typically do not need to escape it, unless it is part of a...
45,537
[ { "from": "human", "value": "What's the regex to match a square bracket? I'm using \\\\] in a pattern in eregi_replace, but it doesn't seem to be able to find a ]...\n" }, { "from": "gpt", "value": "When using regular expressions, the square brackets `[` and `]` have special meanings. To match t...
How do I define an Extension Method for IEnumerable<T> which returns IEnumerable<T>? The goal is to make the Extension Method available for all IEnumerable and IEnumerable<T> where T can be an anonymous type.
To define an extension method for `IEnumerable<T>` that returns `IEnumerable<T>`, you can create a static class that contains a static method. Extension methods are defined in static classes and use the `this` keyword to specify which type they extend. Here is a simple example of how to create an extension method for ...
43,912
[ { "from": "human", "value": "How do I define an Extension Method for IEnumerable<T> which returns IEnumerable<T>?\nThe goal is to make the Extension Method available for all IEnumerable and IEnumerable<T> where T can be an anonymous type.\n" }, { "from": "gpt", "value": "To define an extension m...
One of the cool things about the .NET Compact Framework is that you can run .NETCF executables on the desktop version of Windows. However, there are minor incompatibilities between the platforms that have to be dealt with at run-time. My question is, how do I tell which platform I'm on right now?
In the .NET Compact Framework (CF), you can determine the platform you're running on by checking the `Environment` class properties. Specifically, you can check the `Environment.OSVersion` and/or `Environment.Version` properties to identify whether you are running on a Compact Framework environment or a full .NET Frame...
45,735
[ { "from": "human", "value": "One of the cool things about the .NET Compact Framework is that you can run .NETCF executables on the desktop version of Windows. However, there are minor incompatibilities between the platforms that have to be dealt with at run-time. My question is, how do I tell which platform...
In Python, is there a portable and simple way to test if an executable program exists? By simple I mean something like the which command which would be just perfect. I don't want to search PATH manually or something involving trying to execute it with Popen & al and see if it fails (that's what I'm doing now, but imagi...
Yes, you can check if an executable program exists in a portable and straightforward way in Python using the `shutil` module, which provides a function specifically for this purpose. The `shutil` module has a function called `shutil.which()`, which is similar to the Unix `which` command. It returns the path to the exe...
48,265
[ { "from": "human", "value": "In Python, is there a portable and simple way to test if an executable program exists?\nBy simple I mean something like the which command which would be just perfect. I don't want to search PATH manually or something involving trying to execute it with Popen & al and see if it f...
I am fetching an array of floats from my database but the array I get has converted the values to strings. How can I convert them into floats again without looping through the array? Alternatively, how can I fetch the values from the database without converting them to strings? EDIT: I am using the Zend Framework and...
If you're retrieving an array of floats from a database, but the values are coming back as strings, there are a couple of approaches you can take to handle this situation. ### 1. Fetching Data without Converting to Strings You can potentially resolve the issue at the point of fetching data from the database by specif...
47,000
[ { "from": "human", "value": "I am fetching an array of floats from my database but the array I get has converted the values to strings.\nHow can I convert them into floats again without looping through the array?\nAlternatively, how can I fetch the values from the database without converting them to strings...
I have a form in Axapta/Dynamics Ax (EmplTable) which has two data sources (EmplTable and HRMVirtualNetworkTable) where the second data source (HRMVirtualNetworkTable) is linked to the first on with "Delayed" link type. Is there a way to set an filter on the records, based on the second data source, without having to c...
Yes, you can filter records in a Dynamics AX form that uses a delayed link type without changing it to an inner join. When you use a delayed link, you can still apply filters on the second data source (HRMVirtualNetworkTable) based on conditions related to the first data source (EmplTable). Here’s a basic approach to ...
45,271
[ { "from": "human", "value": "I have a form in Axapta/Dynamics Ax (EmplTable) which has two data sources (EmplTable and HRMVirtualNetworkTable) where the second data source (HRMVirtualNetworkTable) is linked to the first on with \"Delayed\" link type.\nIs there a way to set an filter on the records, based on...
I'm trying to search using the windows search one of my web directories for any uses of scriptlets. However, the search seems to be ignoring all files ending in .jsp. I searched for plain words, and that didn't work either. Is there a reason Windows ignores these files when searching?
Windows Search may not index or search `.jsp` (JavaServer Pages) files by default, which could be why your searches are not returning the expected results. Here are a few potential reasons and solutions: 1. **File Type Not Indexed**: Windows Search may not include certain file types in its indexing options. To check i...
46,163
[ { "from": "human", "value": "I'm trying to search using the windows search one of my web directories for any uses of scriptlets. However, the search seems to be ignoring all files ending in .jsp. I searched for plain words, and that didn't work either. Is there a reason Windows ignores these files when sear...
.NET 1.1 lacks ParameterizedThreadStart (I have to use 1.1 because it's the last one supporting NT 4.0) In .NET 2.0, I would simply write: Thread clientThread = new Thread(new ParameterizedThreadStart(SomeThreadProc)); clientThread.Start(someThreadParams); How can I create equivalent .NET 1.1 code?
In .NET 1.1, you don't have `ParameterizedThreadStart`, but you can achieve similar functionality using the `ThreadStart` delegate along with a shared state or context, such as a class variable or using an object array to hold your parameters. Here’s an example of how you could implement a parameterized thread in .NET...
44,695
[ { "from": "human", "value": ".NET 1.1 lacks ParameterizedThreadStart (I have to use 1.1 because it's the last one supporting NT 4.0)\nIn .NET 2.0, I would simply write:\nThread clientThread = new Thread(new ParameterizedThreadStart(SomeThreadProc));\nclientThread.Start(someThreadParams);\n\nHow can I create...
Why 4? I know its in the documentation as 4, but that just seems strange.
It sounds like you’re referring to a specific value or parameter that’s set to 4 in a particular context, perhaps in software documentation or an API reference. Without more details about what "4" refers to, it's challenging to provide a precise answer. In many cases, specific values like this could be determined by ...
48,934
[ { "from": "human", "value": "Why 4? I know its in the documentation as 4, but that just seems strange.\n" }, { "from": "gpt", "value": "It sounds like you’re referring to a specific value or parameter that’s set to 4 in a particular context, perhaps in software documentation or an API reference...
If I have an mssql varchar[1024] that is always empty in a table, how much actual bytes will be wasted in the db file on disk per row? Please let me know the size for both: NULLs allowed storing '' NULLs not allowed storing '' NULLs allowed storing NULL Since the max varchar size is > 2^1 and < 2^3 I would assume ...
In Microsoft SQL Server, the `VARCHAR` data type is a variable-length string type. Let's analyze the storage requirements based on the scenarios you provided. ### 1. **NULLs allowed storing '' (empty string)** - **Storage Requirement**: An empty string `''` is stored as `0` bytes of data. - **Overhead**: SQL Server st...
44,697
[ { "from": "human", "value": "If I have an mssql varchar[1024] that is always empty in a table, how much actual bytes will be wasted in the db file on disk per row?\nPlease let me know the size for both:\n\nNULLs allowed storing ''\n\n\nNULLs not allowed storing ''\nNULLs allowed storing NULL\n\n\nSince the ...
I'm trying to replace the programs that run from my startup directory with a batch script. The batch script will simply warn me that the programs are going to run and I can either continue running the script or stop it. Here's the script as I have written so far: @echo off echo You are about to run startup programs!...
To run multiple programs simultaneously in a batch script without them blocking each other, you can use the `start` command, which indeed allows you to start a new command window for each program you want to run. However, it looks like you encountered an issue with the command treating your string as a window title. ...
42,847
[ { "from": "human", "value": "I'm trying to replace the programs that run from my startup directory with a batch script. The batch script will simply warn me that the programs are going to run and I can either continue running the script or stop it. \nHere's the script as I have written so far:\n@echo off\...
Is there any code coverage tool available for PHP? I wish to check the code coverage of my code and API's written in PHP, but have not been able to lay my hands on any code coverage tool for PHP, as it is more of a server side language and dynamic in nature. Does anyone know of a method by which code coverage for PHP c...
Yes, there are several code coverage tools available for PHP that you can use to analyze your code and APIs. The most popular tools include: ### 1. **PHPUnit** PHPUnit is a widely-used testing framework for PHP that includes built-in support for code coverage. You can easily integrate PHPUnit into your testing workflo...
44,062
[ { "from": "human", "value": "Is there any code coverage tool available for PHP?\nI wish to check the code coverage of my code and API's written in PHP, but have not been able to lay my hands on any code coverage tool for PHP, as it is more of a server side language and dynamic in nature.\nDoes anyone know o...
I'm having trouble with this code: NSRect itemFrame; id item; // code to assign item goes here. itemFrame.origin.y -= [item respondsToSelector:@selector(selectedHeight)] ? [item selectedHeight] : [self defaultSelectedHeight]; This is the problematic bit: [item selectedHeight] The compiler is assuming that the retur...
The issue you're encountering with the line `[item selectedHeight]` is indeed related to how Objective-C handles the return type of methods called on objects of type `id`. Since `item` is declared as `id`, the compiler cannot infer the return type of `selectedHeight`—it assumes that it could return any object type. If...
44,623
[ { "from": "human", "value": "I'm having trouble with this code:\nNSRect itemFrame;\nid item;\n// code to assign item goes here.\nitemFrame.origin.y -= [item respondsToSelector:@selector(selectedHeight)] ? [item selectedHeight] : [self defaultSelectedHeight];\n\nThis is the problematic bit:\n[item selected...
If I open a connection to the server from firefox browser, and then I open a new tab within the same instance of browser to make a connection to the server, is it considered one session to server or considered as two diff sessions?
When you open a new tab within the same instance of a browser like Firefox, it generally uses the same session for connections to the same server. This means that cookies, local storage, and session storage are shared across tabs within the same browser window. As a result, if both tabs are connected to the same server...
47,056
[ { "from": "human", "value": "If I open a connection to the server from firefox browser, and then I open a new tab within the same instance of browser to make a connection to the server, is it considered one session to server or considered as two diff sessions?\n" }, { "from": "gpt", "value": "Wh...
I want to skip to the first line that contains "include". <> until /include/; Why does this not work?
The syntax you are using appears to be an attempt to create a command that searches for the first occurrence of the word "include". However, the exact format you've shown (`<> until /include/;`) is not a recognized command in most programming or scripting languages. Here are a few possibilities based on common contexts...
44,674
[ { "from": "human", "value": "I want to skip to the first line that contains \"include\".\n<> until /include/;\n\nWhy does this not work?\n" }, { "from": "gpt", "value": "The syntax you are using appears to be an attempt to create a command that searches for the first occurrence of the word \"inc...
I have uploaded some files to a directory under public and I try to access them using Dir.glob. But I get no results back. The Dir.glob works fine on dev server (mongrel) and also works fine when using script/console on the site installed on site5 is there a way to get this working or a different way to get the list o...
If `Dir.glob` is returning no results in your production environment while working fine in development, there are a few things you can check: 1. **File Permissions**: Ensure that the files in the directory are readable by the user under which your web server is running. If the web server cannot read the files, `Dir.gl...
46,194
[ { "from": "human", "value": "I have uploaded some files to a directory under public and I try to access them using Dir.glob. But I get no results back. \nThe Dir.glob works fine on dev server (mongrel) and also works fine when using script/console on the site installed on site5\nis there a way to get this w...
I am looking for a Windows based library which can be used for parsing a bunch of C files to list global and local variables. The global and local variables may be declared using typedef. The output (i.e. list of global and local variables) can then be used for post processing (e.g. replacing the variable names with a ...
Yes, there are several libraries and tools that can help you parse C files to list global and local variables, including those declared with `typedef`. Here are some options you might consider: 1. **Clang LibTooling**: - Clang provides a powerful library (LibTooling) that you can use to parse C/C++ code. It is part...
43,020
[ { "from": "human", "value": "I am looking for a Windows based library which can be used for parsing a bunch of C files to list global and local variables. The global and local variables may be declared using typedef. The output (i.e. list of global and local variables) can then be used for post processing (...
If I do something like this: using (SqlCommand cmd = new SqlCommand("SELECT * FROM TBL")) { using (SqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { string s = reader.GetString(7); } } } does the Read() call read the entire row into memory, or does th...
The `SqlDataReader` operates in a way that it reads data in a forward-only manner from the database. When you call `reader.Read()`, it advances to the next row in the result set. However, the way it fetches data from the database depends on the specific implementation of the `SqlDataReader`. When you call `reader.Read...
47,781
[ { "from": "human", "value": "If I do something like this:\nusing (SqlCommand cmd = new SqlCommand(\"SELECT * FROM TBL\"))\n{\n using (SqlDataReader reader = cmd.ExecuteReader())\n {\n while (reader.Read())\n {\n string s = reader.GetString(7);\n }\n }\n}\n\ndoes the ...
If I have records: Row Date, LocationID, Account 1 Jan 1, 2008 1 1000 2 Jan 2, 2008 1 1000 3 Jan 3, 2008 2 1001 4 Jan 3, 2008 1 1001 5 Jan 3, 2008 3 1001 6 Jan 4, 2008 3 1002 I need to get the row (date, locatinid, account) wh...
To retrieve the rows with the most recent date for each distinct `LocationID` from the provided records, you can follow these steps in SQL-like pseudocode or Python with pandas. Here’s how you can do it in both ways: ### SQL Approach If you are working with a SQL database, you can use the following SQL query: ```sql...
45,118
[ { "from": "human", "value": "If I have records:\n\nRow Date, LocationID, Account\n1 Jan 1, 2008 1 1000\n2 Jan 2, 2008 1 1000\n3 Jan 3, 2008 2 1001\n4 Jan 3, 2008 1 1001\n5 Jan 3, 2008 3 1001\n6 Jan 4, 2008 3 1002\n\n...
I was wonder about the proper usage of ManualWorkflowSchedulerService.RunWorkflow(). Do I need to synchronize calls to the same workflowInstanceId across threads when I call ManualWorkflowSchedulerService.RunWorkflow?
When using `ManualWorkflowSchedulerService.RunWorkflow()` in a .NET workflow application, it is important to be aware of the concurrency model of the workflow runtime and how `ManualWorkflowSchedulerService` operates. `ManualWorkflowSchedulerService` allows you to control the execution of workflows manually, which is ...
44,111
[ { "from": "human", "value": "I was wonder about the proper usage of ManualWorkflowSchedulerService.RunWorkflow(). Do I need to synchronize calls to the same workflowInstanceId across threads when I call ManualWorkflowSchedulerService.RunWorkflow?\n" }, { "from": "gpt", "value": "When using `Man...
With the JavaFX 1.0 release I am trying to layout some SwingButton instances in a HBox such that they are aligned to the right. A lot of the tutorials on the net (admittedly pre 1.0 release) talk about layout classes (FlowPanel et. al) which dont seem to be in this release. Whats the simplest way to achieve this seemin...
In JavaFX 1.0, if you're looking to align Swing components (like `JButton`) within a `HBox`, you'll want to make use of the `HBox` layout itself. While JavaFX 1.0 does not have all the layout managers that Swing provides, you can still align your components using properties of the `HBox`. Here’s a simple way to achiev...
44,403
[ { "from": "human", "value": "With the JavaFX 1.0 release I am trying to layout some SwingButton instances in a HBox such that they are aligned to the right. A lot of the tutorials on the net (admittedly pre 1.0 release) talk about layout classes (FlowPanel et. al) which dont seem to be in this release. What...
I have an array of objects which populate a UITableView. When a user removes the last object from the array, I automatically create a new "default" object. However, in the TableView, when the user gets there, the list is still in "Edit" mode. Is there a way for me to programatically set the TableView back to "normal" m...
Yes, you can programmatically set the `UITableView` back to normal mode (i.e., non-edit mode) by calling the `setEditing:animated:` method on your `UITableView`. You should call this method in the appropriate place in your code after you've added the new default object to your array. Here's how you can implement it: ...
44,956
[ { "from": "human", "value": "I have an array of objects which populate a UITableView. When a user removes the last object from the array, I automatically create a new \"default\" object. However, in the TableView, when the user gets there, the list is still in \"Edit\" mode. Is there a way for me to program...
Has anybody made a german version of the GhostDoc template textes?
As of my last knowledge update in October 2023, GhostDoc, a documentation tool for .NET developers, typically comes with default templates in English. However, the community around development tools often creates localized versions of templates, including German ones. To find a German version of GhostDoc templates, yo...
48,507
[ { "from": "human", "value": "Has anybody made a german version of the GhostDoc template textes?\n" }, { "from": "gpt", "value": "As of my last knowledge update in October 2023, GhostDoc, a documentation tool for .NET developers, typically comes with default templates in English. However, the com...
Sometimes it seems natural to have a default parameter which is an empty list. However, Python produces unexpected behavior in these situations. For example, consider this function: def my_func(working_list=[]): working_list.append("a") print(working_list) The first time it is called, the default will work, bu...
The behavior you're observing is due to how default mutable arguments, like lists, work in Python. When you use a mutable object as a default argument, such as an empty list, that object is created once when the function is defined, not each time the function is called. As a result, all calls to the function that do no...
48,090
[ { "from": "human", "value": "Sometimes it seems natural to have a default parameter which is an empty list. However, Python produces unexpected behavior in these situations.\nFor example, consider this function:\ndef my_func(working_list=[]):\n working_list.append(\"a\")\n print(working_list)\n\nThe f...
For example, if you type something in upper-right google/yahoo search box in firefox there will be some kind 'suggested auto complete' sort of thing. Another example is in youtube search box and Stackoverflow tags edit box just below this question preview. How do they work? What technology behind 'em?
The autocomplete and suggestion features you see in search boxes, like those on Google, YouTube, or Stack Overflow, are typically powered by a combination of technologies, including: 1. **JavaScript**: Most of these features are implemented on the client side using JavaScript. When a user types into a search box, Java...
45,536
[ { "from": "human", "value": "For example, if you type something in upper-right google/yahoo search box in firefox there will be some kind 'suggested auto complete' sort of thing. \nAnother example is in youtube search box and Stackoverflow tags edit box just below this question preview. How do they work? Wh...
function a () { return "foo"; } a.b = function () { return "bar"; } function c () { }; c.prototype = a; var d = new c(); d.b(); // returns "bar" d(); // throws exception, d is not a function Is there some way for d to be a function, and yet still inherit properties from a?
In JavaScript, you can make an object both callable (like a function) and have properties (like an object) by using the `Function` constructor or by setting up a function prototype chain correctly. Here's a way to achieve that by creating a function that inherits properties from another function: ```javascript functio...
46,603
[ { "from": "human", "value": "function a () {\n return \"foo\";\n}\n\na.b = function () {\n return \"bar\";\n}\n\nfunction c () { };\nc.prototype = a;\n\nvar d = new c();\nd.b(); // returns \"bar\"\nd(); // throws exception, d is not a function\n\nIs there some way for d to be a function, and yet still...
I'm not seeing any real advantages, other than the fact that you have a C++ syntax, and with it, things like pointers and destructors.
It sounds like you're comparing C++ to another programming language, possibly C or a higher-level language. C++ does bring several advantages beyond just its syntax and features like pointers and destructors. Here are some key advantages of C++: 1. **Object-Oriented Programming (OOP)**: C++ supports OOP principles suc...
41,624
[ { "from": "human", "value": "I'm not seeing any real advantages, other than the fact that you have a C++ syntax, and with it, things like pointers and destructors.\n" }, { "from": "gpt", "value": "It sounds like you're comparing C++ to another programming language, possibly C or a higher-level l...
Is there a Firefox plugin for manipulating and deleting saved form data? In the browser there is only the option to delete all data.
As of my last update in October 2023, Firefox does not have a built-in feature that allows you to selectively manipulate or delete individual saved form data entries. However, there are a few approaches you can take: 1. **Using the Built-in Firefox Options**: - You can manage saved form data by going to **Options (...
44,064
[ { "from": "human", "value": "Is there a Firefox plugin for manipulating and deleting saved form data?\nIn the browser there is only the option to delete all data.\n" }, { "from": "gpt", "value": "As of my last update in October 2023, Firefox does not have a built-in feature that allows you to se...
I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el: (defvar program-dir (substring data-directory 0 -4)) (setq inhibit-startup-message t) (setenv "HOME" program-dir) I changed the HOME variable so that not only my .emacs init files (and other init files) are read, but...
When you set the `HOME` environment variable to a different directory in Emacs, it can affect the behavior of the Emacs server, especially if your Emacs configuration is trying to use certain files (like the server socket or the authentication file) located in the original `HOME` directory. To resolve the issue with t...
44,170
[ { "from": "human", "value": "I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el:\n(defvar program-dir (substring data-directory 0 -4))\n\n(setq inhibit-startup-message t)\n(setenv \"HOME\" program-dir)\n\nI changed the HOME variable so that not only my .emac...
I have some SQL that does an order by case statement. It works fine. I can't replicate it as Linq2Sql. Here's a quick hacked up version of the SQL i made, simplified and really dumbed down. Please ignore what the sql is trying to do (business logic wise) as i made this up, for the question. SELECT u.Id, u...
In LINQ to SQL, you can indeed achieve similar functionality to a SQL `ORDER BY CASE` statement using a combination of conditional operators. However, the way you're currently trying to use an anonymous type in the `orderby` clause is causing the issue. Instead of creating an anonymous type, you should directly use the...
49,109
[ { "from": "human", "value": "I have some SQL that does an order by case statement. It works fine. I can't replicate it as Linq2Sql.\nHere's a quick hacked up version of the SQL i made, simplified and really dumbed down. Please ignore what the sql is trying to do (business logic wise) as i made this up, for ...